Hello, Thanks for the clue. I have one more question. This is the explanation given for set_network_header function. _________________________________
void set_network_header (const unsigned char *header, Method on Packet unsigned len) Sets the network header annotation to header, which must lie between buffer_data() and buffer_data() + buffer_length(). The network header is len bytes long, so network_header_length() will equal len and transport_header() will equal header + len. ______________________________________ Does this statement mean that transport header annotation's place is taken immediately after network header annotation.? If this is the case I have a problem. My packet format is --------------------------------------- {IP Header} {QoS Header} {UDP Header} ----------------------------------------- How should I use the set_ip_header()/set_network_header() for my case.? One way I could think is to give the 'len' parameter as 'sizeof(click_ip)+sizeof(qos_header) '. Do I have to change iph->ip_hl in this case.(I mean to ask does this 'len' parameter indicates the length of the IP header OR placement of transport header relative to iph) The Other way is to bring in only the IP and UDP headers first, after calling the Packe::make and then call 'set_ip_header to set both IP and UDP header annotations and then insert QoS header between the headers so that annotations will not change. Can you suggest which is a better way among these two and if possible any other better way? Regards, Pradeep. _______________________ Previous From: Beyers Cronje <[EMAIL PROTECTED]> Subject: Re: [Click] [click]SetIPChecksum To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Date: Friday, 8 August, 2008, 6:47 PM Hi Pradeep, p->ip_header() returns a pointer to the ip header of a packet, which is stored in the ip header annotation of Packet. The ip header annotation is set by elements such as MarkIPHeader and CheckIPHeader. Packet::make() does not set this annotatio by itself, so you either have to set it yourself by calling 'packet->set_ip_header(iph, iph->ip_hl << 2)' or let a downstream element such as MarkIPHeader set it for you. Beyers On Fri, Aug 8, 2008 at 11:05 PM, Pradeep Pradeep <[EMAIL PROTECTED] > wrote: > Hello, > > In the code for the element SetIPChecksum element there is part which > tests if a packet is IP packet or not. > > It uses > --------------------- > ip=p->ip_header(); > if(!ip) > > When can a situation arise which satisfies !ip? > ------------------------- > > I am genarating packets which have the following format > {IP Header} > {QoS Data} > {UDP Header} > > > The code I used is > _______________________________ > > void push(Packet* p) > { > > > WritablePacket *packet = Packet::make(0, 0, data_len+header_room, 0); > > if (packet == 0) { > click_chatter( "cannot make packet!"); > packet = NULL; > return; > } > > // fill IP header > > click_ip *iph = (click_ip*) packet->data(); > memcpy(iph, p->ip_header(), sizeof(click_ip)); > iph->ip_tos |= 0x0c; // 12 for QoS > iph->ip_tos |= 0x01; // Set ECN capability > > // fill QoS fields > QoSSignalFormat* format = > (QoSSignalFormat*)(packet->data()+sizeof(click_ip)); > > > // fill UDP header > click_udp *udph = > (click_udp*)(packet->data()+sizeof(click_ip)+sizeof(struct > QoSSignalFormat)); > memcpy(udph, p->udp_header(), sizeof(click_udp)); > > p->kill(); // destroy data packet > output(0).push((Packet *)packet); > } > _______________________________ > > As you can see I am making some changes to IP header. So I want to recompue > the checksum by passing the packets through SetIPChecksum element. When I > forward the these packets SetIPChecksum (which is slightly modified that it > detects the condtion !ip ) the packets are being struck at this !ip > condtion. Please help me with this. > > Regards, > Pradeep. Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/ _______________________________________________ click mailing list click@amsterdam.lcs.mit.edu https://amsterdam.lcs.mit.edu/mailman/listinfo/click