[Click] Please help. TCP and UDP Headers problems.
Josh Butler
tuna_armadillo at hotmail.com
Wed Nov 21 19:57:08 EST 2007
Hi all,
Hoping I'll get a response to this one, not got anything back on my last
two questions... My element contains the following code which I thought
was ok, but "sudo make install" tells me isn't.
//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*’
./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’
./elements/local/mytee.cc:86: error: invalid conversion from ‘const
click_udp*’ to ‘click_udp*’
./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’
Any idea what the problem is, because I can't get my head round it.
Thanks,
Josh
More information about the click
mailing list