hi guys
I am working on admr code and need to add a field '' txpower_ '' in
hdr_cmn ,so I defined it in packet.h as follows:
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
// jeni martin bool txpower_ ; // jeni martin
+
also added inline int& txpower() { return (txpower_); in packet.h:
inline int& num_forwards() { return (num_forwards_); } inline int&
opt_num_forwards() { return (opt_num_forwards_); } //monarch_end //vikas
txpower begin inline int& txpower() { return (txpower_); } //vikas txpower end};
moreover command (HDR_CMN(p))->txpower_ = 0; is added:
inline Packet* Packet::alloc(){ Packet* p = free_; if (p != 0)
{ assert(p->fflag_ == FALSE); free_ = p->next_; assert(p->data_ ==
0); p->uid_ = 0; p->time_ = 0; } else { p = new Packet; p->bits_ = new
unsigned char[hdrlen_]; if (p == 0 || p->bits_ == 0) abort(); } init(p); //
Initialize bits_[] (HDR_CMN(p))->next_hop_ = -2; // -1 reserved for
IP_BROADCAST (HDR_CMN(p))->last_hop_ = -2; // -1 reserved for
IP_BROADCAST //jeni martin begin
(HDR_CMN(p))->txpower_ = 0; //jeni martin p->fflag_ =
TRUE; (HDR_CMN(p))->direction() = hdr_cmn::DOWN; /* setting all direction of
pkts to be downward as default; until channel changes it to +1 (upward)
*/ p->next_ = 0; return (p);}
------------------------------
now when I run the ns command for admr ( ./ns SCRIPTS/run tcl ..... admr ), I
encountered SEGMENTATION FAULT. A: anybody knows why?whats
the solution?B:basically I wanna change in some parts of ADMR protocol,is it
necessary that every time I apply my changes in code,again I install
ns?? //./configure make clean make make install //
thanks