[Click] header annotations, variable meanings, etc.
Eddie Kohler
kohler at cs.ucla.edu
Sun Dec 10 18:30:09 EST 2006
Hi Nick,
Check out, for example, elements/ip/setipdhcp.cc (the smaction() method).
You need to create a WritablePacket using the uniqueify() method, then you can
simply modify its data.
WritablePacket *wp = p->uniqueify();
if (!wp)
// not enough memory to create a new packet
return 0;
wp->data()[0] = 'W'; // or whatever
Eddie
Nicholas Murphy wrote:
> Eddie-
>
> Thanks for your responses. One quick followup: what is the appropriate
> way to actually make modifications to the packet if modifying the
> annotations doesn't actually change the packet?
>
> Thanks,
> Nick
>
> On Dec 9, 2006, at 7:09 PM, Eddie Kohler wrote:
>
>> Hi Nicholas,
>>
>> Nicholas Murphy wrote:
>>> A few random (probably newbie) questions:
>>> 1) So, you seem to need to run packets through something like
>>> CheckIPHeader in order to fill out the packet header annotations,
>>> correct? Do these annotations persist across elements that use
>>> "uniquify", things like Tee, etc.?
>>
>> Yes.
>>
>>> 2) Are transport-layer annotations only filled out once you run
>>> through something like IPClassifier?
>>
>> The CheckIPHeader annotation sets both the start-network-header
>> annotation and the end-network-header==start-transport-header annotation.
>>
>>> 3) Am I right in thinking that variables like "network_length()"
>>> represent the length from the beginning of the network header to the
>>> end of the packet?
>>
>> Yes!
>>
>>> 4) Am I right in assuming there will never be any layering
>>> information (e.g., ethernet footer) after the data?
>>
>> In practice yes, although this depends on your network layer.
>>
>>
>>> 5) Does changing the annotation variables (e.g.,
>>> ip_header()->ip_len) actually modify the packet itself?
>>
>> Nope!
>>
>> Eddie
>>
>>> Hopefully these are all easy yes/no's. :)
>>> Thanks,
>>> Nick
>>> _______________________________________________
>>> click mailing list
>>> click at amsterdam.lcs.mit.edu
>>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
More information about the click
mailing list