[Click] Please help. TCP and UDP Headers problems.
Bart Braem
bart.braem at ua.ac.be
Thu Nov 22 03:12:55 EST 2007
On Thursday 22 November 2007 01:57:08 Josh Butler wrote:
> //CODE\\
>
> 66 const click_ip *iph = p->ip_header(); // Get pointer to IP Header
> 67
> 68 if (!iph) // Make sure it's a valid header
> 69 {
> 70 p->kill(); // Kill if invalid to avoid memory leaks
> 71 return;
> 72 }
> 73
> 74 SrcIP = iph->ip_src;
> 75 DstIP = iph->ip_dst;
> 76
> 77 if (iph->ip_p == 6) //Is packet tcp?
> 78 {
> 79 click_tcp *tcph = p->tcp_header(); //get pointer to tcp header.
> 80 SrcPort = tcph->th_sport;
> 81 DstPort = tcph->th_dport;
> 82 }
> 83
> 84 else if (iph->ip_p == 17){ //Is packet udp?
> 85 click_udp *udph = p->udp_header(); //get pointer to udp header.
> 86 SrcPort = udph->uh_sport;
> 87 DstPort = udph->uh_dport;
> 88 }
>
> //END CODE\\
>
> Terminal shows the following errors:
>
> ./elements/local/mytee.cc: In member function ‘virtual void
> MyTee::push(int, Packet*)’:
>
> ./elements/local/mytee.cc:80: error: invalid conversion from ‘const
> click_tcp*’ to ‘click_tcp*’
>
Read the header file packet.hh in the include/click directory: in Packet the
function tcp_header(); returns a const pointer. So either use a
WriteablePacket or change the type of the tcp header.
> ./elements/local/mytee.cc:81: error: invalid use of undefined type
> ‘struct click_tcp’
>
> ./include/click/packet.hh:17: error: forward declaration of ‘struct
> click_tcp’
>
> ./elements/local/mytee.cc:82: error: invalid use of undefined type
> ‘struct click_tcp’
>
> ./include/click/packet.hh:17: error: forward declaration of ‘struct
> click_tcp’
>
All these errors result from the previous one.
> ./elements/local/mytee.cc:86: error: invalid conversion from ‘const
> click_udp*’ to ‘click_udp*’
>
This is the same problem of the return type of that function.
> ./elements/local/mytee.cc:87: error: invalid use of undefined type
> ‘struct click_udp’
>
> ./include/click/packet.hh:18: error: forward declaration of ‘struct
> click_udp’
>
> ./elements/local/mytee.cc:88: error: invalid use of undefined type
> ‘struct click_udp’
>
> ./include/click/packet.hh:18: error: forward declaration of ‘struct
> click_udp’
These errors also result from the previous ones.
Regards,
Bart
--
Bart Braem
PATS research group
Dept. of Mathematics and Computer Sciences
University of Antwerp
Campus Middelheim, G3.30
Middelheimlaan 1
B-2020 Antwerpen, Belgium
Phone: +32 (0)3 265.32.91
Fax: +32 (0)3 265.37.77
Web: www.pats.ua.ac.be/bart.braem
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part.
Url : https://pdos.csail.mit.edu/pipermail/click/attachments/20071122/6f743367/attachment.pgp
More information about the click
mailing list