File: classifier-addr.h

package info (click to toggle)
ns2 2.35%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,796 kB
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 816; awk: 525; csh: 355
file content (67 lines) | stat: -rw-r--r-- 2,231 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright (c) Sun Microsystems, Inc. 1998 All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed by Sun Microsystems, Inc.
 *
 * 4. The name of the Sun Microsystems, Inc nor may not be used to endorse or
 *      promote products derived from this software without specific prior
 *      written permission.
 *
 * SUN MICROSYSTEMS MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS
 * SOFTWARE FOR ANY PARTICULAR PURPOSE.  The software is provided "as is"
 * without express or implied warranty of any kind.
 *
 * These notices must be retained in any copies of any part of this software.
 */

#ifndef ns_classifier_addr_h
#define ns_classifier_addr_h

#include "config.h"
#include "packet.h"
#include "ip.h"
#include "classifier.h"

#define BCAST_ADDR_MASK	mask_

class AddressClassifier : public Classifier {
protected:
	virtual int classify(Packet * p);
};

/* addr. classifier that enforces reserved ports */
class ReserveAddressClassifier : public AddressClassifier {
public:
	ReserveAddressClassifier() : AddressClassifier(), reserved_(0) {}
protected:
	virtual int classify(Packet *p);
	virtual void clear(int slot);
	virtual int getnxt(NsObject *);
	virtual int command(int argc, const char*const* argv);
	int reserved_;
};

/* addr. classifier that supports limited broadcast */
class BcastAddressClassifier : public AddressClassifier {
public:
	BcastAddressClassifier() : AddressClassifier(), bcast_recver_(0) {}
	NsObject *find(Packet *);
protected:
	virtual int command(int argc, const char*const* argv);
	NsObject *bcast_recver_;
};

#endif