Tcphdr there is not a member named
I am writing an application for a school project to detect attackers from a pcap file. I find some example codes and want to compile them to inspect. When I want to compile them there is some errors
Code:
scandet.c: In function ‘void UpdateMap(map_t&, packetmap_t&, ip*, tcphdr*)’:
scandet.c:82:9: error: ‘TH_SYN’ was not declared in this scope
scandet.c:82:27: error: ‘struct tcphdr’ has no member named ‘th_flags’
scandet.c:82:42: error: ‘TH_ACK’ was not declared in this scope
scandet.c:82:60: error: ‘struct tcphdr’ has no member named ‘th_flags’
scandet.c:84:92: error: ‘struct tcphdr’ has no member named ‘th_sport’
scandet.c:84:118: error: ‘struct tcphdr’ has no member named ‘th_dport’
scandet.c:84:138: error: ‘struct tcphdr’ has no member named ‘th_seq’
scandet.c:91:82: error: ‘struct tcphdr’ has no member named ‘th_sport’
scandet.c:91:108: error: ‘struct tcphdr’ has no member named ‘th_dport’
scandet.c:103:34: error: ‘struct tcphdr’ has no member named ‘th_flags’
scandet.c:103:66: error: ‘struct tcphdr’ has no member named ‘th_flags’
scandet.c:104:91: error: ‘struct tcphdr’ has no member named ‘th_dport’
scandet.c:104:117: error: ‘struct tcphdr’ has no member named ‘th_sport’
scandet.c:104:137: error: ‘struct tcphdr’ has no member named ‘th_ack’
scandet.c:107:82: error: ‘struct tcphdr’ has no member named ‘th_dport’
scandet.c:107:108: error: ‘struct tcphdr’ has no member named ‘th_sport’
make: *** [scandet.o] Error 1
I am trying to compile code at http://github.com/zahanm/sec-project.../pp3/scandet.c . It is a solution to Stanford's CS155 Project 3 Part 2. I am using makefile provided at link. I searched internet and applied some solutions like defining _FAVOR_BSD and __USE_BSD. They don't worked. I am using Xubuntu 11.10. GCC version is 4.6.1, tcpdump version is 4.1.1 and libpcap version is 1.1.1.