Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

classifier-mcast.h

Go to the documentation of this file.
00001 /* -*-  Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
00002 /*
00003  * classifier-mcast.h
00004  *
00005  * Copyright (C) 1999 by USC/ISI
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms are permitted
00009  * provided that the above copyright notice and this paragraph are
00010  * duplicated in all such forms and that any documentation, advertising
00011  * materials, and other materials related to such distribution and use
00012  * acknowledge that the software was developed by the University of
00013  * Southern California, Information Sciences Institute.  The name of the
00014  * University may not be used to endorse or promote products derived from
00015  * this software without specific prior written permission.
00016  * 
00017  * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
00018  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00020  * 
00021  */
00022 
00023 #ifndef ns_classifier_mcast_h
00024 #define ns_classifier_mcast_h
00025 
00026 #include <stdlib.h>
00027 #include "config.h"
00028 #include "packet.h"
00029 #include "ip.h"
00030 #include "classifier.h"
00031 
00032 class MCastClassifier : public Classifier {
00033 public:
00034         MCastClassifier();
00035         ~MCastClassifier();
00036         static const char STARSYM[]; //"source" field for shared trees
00037 protected:
00038         virtual int command(int argc, const char*const* argv);
00039         virtual int classify(Packet *p);
00040         int findslot();
00041         enum {HASHSIZE = 256};
00042         struct hashnode {
00043                 int slot;
00044                 nsaddr_t src;
00045                 nsaddr_t dst;
00046                 hashnode* next;
00047                 int iif; // for RPF checking
00048         };
00049         int hash(nsaddr_t src, nsaddr_t dst) const {
00050                 u_int32_t s = src ^ dst;
00051                 s ^= s >> 16;
00052                 s ^= s >> 8;
00053                 return (s & 0xff);
00054         }
00055         hashnode* ht_[HASHSIZE];
00056         hashnode* ht_star_[HASHSIZE]; // for search by group only (not <s,g>)
00057 
00058         void set_hash(hashnode* ht[], nsaddr_t src, nsaddr_t dst,
00059                       int slot, int iface);
00060         void clearAll();
00061         void clearHash(hashnode* h[], int size);
00062         hashnode* lookup(nsaddr_t src, nsaddr_t dst,
00063                          int iface = iface_literal::ANY_IFACE) const;
00064         hashnode* lookup_star(nsaddr_t dst,
00065                               int iface = iface_literal::ANY_IFACE) const;
00066         void change_iface(nsaddr_t src, nsaddr_t dst,
00067                           int oldiface, int newiface);
00068         void change_iface(nsaddr_t dst,
00069                           int oldiface, int newiface);
00070 };
00071 #endif

Generated on Tue Apr 20 12:14:12 2004 for NS2.26SourcesOriginal by doxygen 1.3.3