本文主要是介绍ns2中结构体定义,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、hdr_cmn,位于文件:/ns-allinone-2.34/ns-2.34/common/packet.h,570行
struct hdr_cmn {
enum dir_t { DOWN= -1, NONE= 0, UP= 1 };
packet_t ptype_; // 包类型,84行开始
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
// AOMDV patch
int aomdv_salvage_count_;
// 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_;
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_); }
static int offset_; // offset for this header
struct hdr_cmn {
#define XMIT_REASON_RTS 0x01
#define XMIT_REASON_ACK 0x02