I want to add an extra field in the Hdr_cmn structure (in packet.h). Lets just say the extra field is : MyValue. - At the routing layer, I modified the value of this field. - At the Physical layer (wireless-phy.cc), I take some actions based on the value of MyValue. To my surprise, even though I set this value in the routing layer as 1, at the physical layer, when I read it, its always 0. I can't understand why. Besides adding this field in the cmn_hdr structure, do I need to do anything else ? (I didn't add the inline functions etc.) I attached a part of the packet.h file. The only modification I made is between the ********** lines. Thanks a lot for your help. ============================================ struct hdr_cmn { enum dir_t { DOWN= -1, NONE= 0, UP= 1 }; packet_t ptype_; // packet type (see above) int size_; // simulated packet size int uid_; // unique id int error_; // error flag int errbitcnt_; // # of corrupted bits jahn int fecsize_; double ts_; // timestamp: for q-delay measurement int iface_; // receiving interface (label) dir_t direction_; // direction: 0=none, 1=up, -1=down // source routing char src_rt_valid; double ts_arr_; // Required by Marker of JOBS //Monarch extn begins nsaddr_t prev_hop_; // IP addr of forwarding hop nsaddr_t next_hop_; // next hop for this packet int addr_type_; // type of next_hop_ addr nsaddr_t last_hop_; // for tracing on multi-user channels // called if pkt can't obtain media or isn't ack'd. not called if // droped by a queue FailureCallback xmit_failure_; void *xmit_failure_data_; /* * MONARCH wants to know if the MAC layer is passing this back because * it could not get the RTS through or because it did not receive * an ACK. */ int xmit_reason_; #define XMIT_REASON_RTS 0x01 #define XMIT_REASON_ACK 0x02 // filled in by GOD on first transmission, used for trace analysis int num_forwards_; // how many times this pkt was forwarded int opt_num_forwards_; // optimal #forwards // Monarch extn ends; // tx time for this packet in sec double txtime_; inline double& txtime() { return(txtime_); } // ****************************** MODIFICATION BEGINS HERE *********************** u_int8_t MyValue; // ****************************** MODIFICATION ENDS HERE ************************* static int offset_; // offset for this header inline static int& offset() { return offset_; } inline static hdr_cmn* access(const Packet* p) { return (hdr_cmn*) p->access(offset_); } /* per-field member functions */ inline packet_t& ptype() { return (ptype_); } inline int& size() { return (size_); } inline int& uid() { return (uid_); } inline int& error() { return error_; } inline int& errbitcnt() {return errbitcnt_; } inline int& fecsize() {return fecsize_; } inline double& timestamp() { return (ts_); } inline int& iface() { return (iface_); } inline dir_t& direction() { return (direction_); } // monarch_begin inline nsaddr_t& next_hop() { return (next_hop_); } inline int& addr_type() { return (addr_type_); } inline int& num_forwards() { return (num_forwards_); } inline int& opt_num_forwards() { return (opt_num_forwards_); } //monarch_end };
--------------------------------- Do you Yahoo!? Get on board. You're invited to try the new Yahoo! Mail Beta.