LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-25-2014, 03:57 AM   #1
rose24
LQ Newbie
 
Registered: Oct 2012
Posts: 14

Rep: Reputation: Disabled
what are the un utilized fields of ns2 packet header


Dear all,

I would like to ask if there is any optional fields or un utilized fields in the packet header of ns2 software. I want to attach my data in any untilized fields of ns2 packet header in order to make it accessible by the whole classes in ns2.XX folder. So is there any such optional fields that the ns2 developer consider it for future use or fields are utilized but not fully utilized or fields that if they have been overwritten, it will not cause any problems with ns2? I have a deeper look at ns2 documentation but I don't find what I need. Any suggestions??

Below is part dedicated for ns2 packet fields:

class Packet : public Event {
private:
unsigned char* bits_; // header bits
// unsigned char* data_; // variable size buffer for 'data'
// unsigned int datalen_; // length of variable size buffer
AppData* data_; // variable size buffer for 'data'
static void init(Packet*); // initialize pkt hdr
bool fflag_;
protected:
static Packet* free_; // packet free list
int ref_count_; // free the pkt until count to 0
public:
Packet* next_; // for queues and the free list
static int hdrlen_;

Packet() : bits_(0), data_(0), ref_count_(0), next_(0) { }
inline unsigned char* const bits() { return (bits_); }
inline Packet* copy() const;
inline Packet* refcopy() { ++ref_count_; return this; }
inline int& ref_count() { return (ref_count_); }
static inline Packet* alloc();
static inline Packet* alloc(int);
inline void allocdata(int);
// dirty hack for diffusion data
inline void initdata() { data_ = 0;}
static inline void free(Packet*);
inline unsigned char* access(int off) const {
if (off < 0)
abort();
return (&bits_[off]);
}
// This is used for backward compatibility, i.e., assuming user data
// is PacketData and return its pointer.
inline unsigned char* accessdata() const {
if (data_ == 0)
return 0;
assert(data_->type() == PACKET_DATA);
return (((PacketData*)data_)->data());
}
// This is used to access application-specific data, not limited
// to PacketData.
inline AppData* userdata() const {
return data_;
}
inline void setdata(AppData* d) {
if (data_ != NULL)
delete data_;
data_ = d;
}
inline int datalen() const { return data_ ? data_->size() : 0; }

// Monarch extn

static void dump_header(Packet *p, int offset, int length);

// the pkt stamp carries all info about how/where the pkt
// was sent needed for a receiver to determine if it correctly
// receives the pkt
PacketStamp txinfo_;

/*
* According to cmu code:
* This flag is set by the MAC layer on an incoming packet
* and is cleared by the link layer. It is an ugly hack, but
* there's really no other way because NS always calls
* the recv() function of an object.
*
*/
u_int8_t incoming;

//monarch extns end;
};
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_); }

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
};



Thanks for your help in advance.
 
  


Reply

Tags
ns2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to block unwanted mail using Postfix setup (maybe filtering From and To header fields)? ddaas Linux - Server 7 06-17-2013 08:05 AM
adding fields to DSR in ns2.34 khubalkar Programming 0 05-22-2012 06:40 PM
kate header footer special fields josephj Linux - General 1 05-18-2009 08:26 PM
dump packet data to file, but no packet header Nathanael Linux - Networking 3 02-08-2006 11:27 AM
does each header fields in packet sent on network uses htons? b123coder Programming 3 04-06-2005 09:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration