• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/classifier/classifier-addr.h

00001 /*
00002  * Copyright (c) Sun Microsystems, Inc. 1998 All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  *
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  *
00015  * 3. All advertising materials mentioning features or use of this software
00016  *    must display the following acknowledgement:
00017  *      This product includes software developed by Sun Microsystems, Inc.
00018  *
00019  * 4. The name of the Sun Microsystems, Inc nor may not be used to endorse or
00020  *      promote products derived from this software without specific prior
00021  *      written permission.
00022  *
00023  * SUN MICROSYSTEMS MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS
00024  * SOFTWARE FOR ANY PARTICULAR PURPOSE.  The software is provided "as is"
00025  * without express or implied warranty of any kind.
00026  *
00027  * These notices must be retained in any copies of any part of this software.
00028  */
00029 
00030 #ifndef ns_classifier_addr_h
00031 #define ns_classifier_addr_h
00032 
00033 #include "config.h"
00034 #include "packet.h"
00035 #include "ip.h"
00036 #include "classifier.h"
00037 
00038 #define BCAST_ADDR_MASK mask_
00039 
00040 class AddressClassifier : public Classifier {
00041 protected:
00042         virtual int classify(Packet * p);
00043 };
00044 
00045 /* addr. classifier that enforces reserved ports */
00046 class ReserveAddressClassifier : public AddressClassifier {
00047 public:
00048         ReserveAddressClassifier() : AddressClassifier(), reserved_(0) {}
00049 protected:
00050         virtual int classify(Packet *p);
00051         virtual void clear(int slot);
00052         virtual int getnxt(NsObject *);
00053         virtual int command(int argc, const char*const* argv);
00054         int reserved_;
00055 };
00056 
00057 /* addr. classifier that supports limited broadcast */
00058 class BcastAddressClassifier : public AddressClassifier {
00059 public:
00060         BcastAddressClassifier() : AddressClassifier(), bcast_recver_(0) {}
00061         NsObject *find(Packet *);
00062 protected:
00063         virtual int command(int argc, const char*const* argv);
00064         NsObject *bcast_recver_;
00065 };
00066 
00067 #endif

Generated on Tue Aug 10 2010 16:16:06 for ns-2.33 by  doxygen 1.7.1