Magdy,

I have not worked adding a new field in packet header in IP layer.
Nevertheless, just throwing some thoughts,

1. Have you included int tag_; in your Agent.h?
2. In MAC layer we have to mention the size of new field, one of the
purpose is, it could be factored in for the transmission time over
physical layer considering longer packet size now.Do see if the same
needed to be done for IP packet.

Good Luck.

rgds
Saravanan K

On Sat, Feb 2, 2013 at 9:18 PM, Magdy Fares <mfare...@yahoo.com> wrote:
>
> How are you Sir,
>
> In my project i need the code to do the following:
> While the packet passes through the nodes in the path from the sender to the 
> receiver, each node has a unique id consists of for example 3 or 4 bits, and 
> there is a field of 16 bits in each packet header that holds the node id 
> after XORing it with the old value.
>
> I acctually did the following:
> 1- In the structure hdr_ip in the file ip.h , i added a variable of type int 
> named tag_ to hold the node's id after doing XOR with the old values as i 
> said befor.
> 2- And also in the same place i added an access function lkie this   int& 
> tag() {return tag_;}
> 3- In the file ip.cc, in the function export_offsets() , i added this line   
> field_offset("tag_", OFFSET(hdr_ip, tag_));
> I think, by these above three steps i added a new field in the packet headers 
> that carry the nodes id after doing XOR between old and new values.
>
> In the file agent.cc, and in the function  Agent::initpkt() , i added these 
> two lines:
>         iph->tag() = 3;
>
>         printf("\n This packet has a tag of %d", iph->tag_);
> I think these two lines are used for debugging.
>
> So, if these steps are correcet, is there any one can help me to build on 
> them to finish my task, please "i need your help Urgently"
>
>
> Thank you friends,
> Eng. Magdy Fadel
>
>
> ________________________________
>  From: Magdy Fares <mfare...@yahoo.com>
> To: "ns-users@isi.edu" <ns-users@isi.edu>
> Sent: Saturday, February 2, 2013 12:14 AM
> Subject: Code for editing packet header
>
>
> To NS-Users,
>               I am a Ph.D. student of and part of my project trys to XOR some 
> data in the packet header while it travrses from the source to the 
> destination. So i *urgently* need code to accomplish this point please.
>
> So, Any One have code for this plz forward it **Urgently.**
>
>
> Thanks and regards,
> Magdy
>  Fadel

Reply via email to