• Main Page
  • Classes
  • Files
  • File List

/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/um-olsr-0.8.8/cdswl.h

00001 /*
00002  * cdswl.h
00003  *
00004  *  Created on: Jul 26, 2009
00005  *      Author: yzchen
00006  */
00007 
00008 #ifndef CDSWL_H_
00009 #define CDSWL_H_
00010 
00011 #include <packet.h>
00012 
00013 /********** Message types **********/
00015 #define CDSWL_HELLO_MSG         1
00016 
00017 #define CDSWL_NVEX_MSG          2
00018 
00019 #define CDSWL_INITDECL_MSG      3
00020 
00021 #define CDSWL_RESGDECL_MSG      4
00022 
00023 #define CDSWL_DOMDECL_MSG       5
00024 
00025 /********* Other constants *********/
00026 #define CDSWL_MAX_NBRS          64
00027 
00028 #define HDR_CDSWL_PKT(p) hdr_cdswl_pkt::access(p)
00029 
00030 struct hdr_cdswl_pkt {
00031         /* member variables */
00032         u_int8_t  pkt_type_;    // otc 0:       type
00033         u_int8_t  pkt_subtype_; // otc 1:       subtype
00034         u_int16_t pkt_length_;  // otc 2~3:     total packet length in bytes
00035         nsaddr_t  pkt_src_;             // otc 5~8:     sender IP address (v4)
00036 //      nsaddr_t  pkt_body_[CDSWL_MAX_NBRS];    // maximum number of neighbors in a list
00037         nsaddr_t  *pkt_body_;
00038 
00039         /* accessors */
00040         inline u_int8_t&        pkt_type()              { return pkt_type_; }
00041         inline u_int8_t&        pkt_subtype()   { return pkt_subtype_ ; }
00042         inline u_int16_t&       pkt_length()    { return pkt_length_; }
00043         inline nsaddr_t&        pkt_src()               { return pkt_src_; }
00044 //      inline nsaddr_t*        pkt_body()              { return pkt_body_; }
00045 
00046         /* ns-2 utilities */
00047         static int offset_;
00048         // Q: where is offset_ initlialized?
00049         // A: in "TCL Hooks" of OLSR.cc
00050         inline static int& offset() { return offset_; }
00051         inline static hdr_cdswl_pkt* access(const Packet* p) {
00052                 return (hdr_cdswl_pkt*) p->access(offset_);
00053         }
00054 };
00055 
00056 
00057 #endif /* CDSWL_H_ */

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