00001 // Copyright (c) 2000 by the University of Southern California 00002 // All rights reserved. 00003 // 00004 // Permission to use, copy, modify, and distribute this software and its 00005 // documentation in source and binary forms for non-commercial purposes 00006 // and without fee is hereby granted, provided that the above copyright 00007 // notice appear in all copies and that both the copyright notice and 00008 // this permission notice appear in supporting documentation. and that 00009 // any documentation, advertising materials, and other materials related 00010 // to such distribution and use acknowledge that the software was 00011 // developed by the University of Southern California, Information 00012 // Sciences Institute. The name of the University may not be used to 00013 // endorse or promote products derived from this software without 00014 // specific prior written permission. 00015 // 00016 // THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about 00017 // the suitability of this software for any purpose. THIS SOFTWARE IS 00018 // PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, 00019 // INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 00020 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00021 // 00022 // Other copyrights might apply to parts of this software and are so 00023 // noted when applicable. 00024 // 00025 00026 #ifndef ns_hash_table_h 00027 #define ns_hash_table_h 00028 00029 #include "config.h" 00030 #include "tclcl.h" 00031 #include "diff_header.h" 00032 00033 //#include "diffusion.h" 00034 00035 #include "iflist.h" 00036 00037 class InterestTimer; 00038 00039 class Pkt_Hash_Entry { 00040 public: 00041 ns_addr_t forwarder_id; 00042 bool is_forwarded; 00043 bool has_list; 00044 int num_from; 00045 From_List *from_agent; 00046 InterestTimer *timer; 00047 00048 Pkt_Hash_Entry() { 00049 forwarder_id.addr_ = 0; 00050 forwarder_id.port_ = 0; 00051 is_forwarded = false; 00052 has_list = false; 00053 num_from=0; 00054 from_agent=NULL; 00055 timer=NULL; 00056 } 00057 00058 ~Pkt_Hash_Entry(); 00059 void clear_fromagent(From_List *); 00060 }; 00061 00062 00063 class Pkt_Hash_Table { 00064 public: 00065 Tcl_HashTable htable; 00066 00067 Pkt_Hash_Table() { 00068 Tcl_InitHashTable(&htable, 3); 00069 } 00070 00071 void reset(); 00072 void put_in_hash(hdr_cdiff *); 00073 Pkt_Hash_Entry *GetHash(ns_addr_t sender_id, unsigned int pkt_num); 00074 }; 00075 00076 00077 class Data_Hash_Table { 00078 public: 00079 Tcl_HashTable htable; 00080 00081 Data_Hash_Table() { 00082 Tcl_InitHashTable(&htable, MAX_ATTRIBUTE); 00083 } 00084 00085 void reset(); 00086 void PutInHash(int *attr); 00087 Tcl_HashEntry *GetHash(int *attr); 00088 }; 00089 00090 #endif
1.3.3