[Click] Accessing port values from header

Jason Haas jjhaas at gmail.com
Thu Apr 6 13:36:37 EDT 2006


Hi Daniel,

s_addr is a uint32_t, not a string, so that should be what you're looking
for.  The source and destination ports are accessable through the transport
header.  Assuming you're using tcp or udp, check out click_tcp or click_udp
in include/clicknet/{tcp.h, udp.h}.  The ports will be, as in the header
files uint16_t's.

Jason Haas

On 4/6/06, Daniel Braund <D.Braund-01 at student.lboro.ac.uk> wrote:
>
> Hi. I am running in circles trying to figure out how to extract the port
> value
> for a packet in a similar manner to the way I extract a packets source and
> destination addresses:
>
> packet_src=iph->ip_src.s_addr;
> packet_dst=iph->ip_dst.s_addr;
>
> essentially I want to know if I can do something like
>
> packet_port=iph->ip_dst.port;
>
> I have looked, but cannot find a list or description of what values I can
> plug
> into here to gain the data I want. Does one exist somewhere? Also, s_addr
> I
> assume implies string, is there a binary/hex variant?
>
> Thanks in advance for any insight you can offer me.
>
> Daniel
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>


More information about the click mailing list