- 论坛徽章:
- 0
|
想从pppd source中单独编译vjcompress.c
[root@dwang tcpcommpress]# cc -c vjcompress.c -o vjcompress.o
vjcompress.c: In function 'vj_compress_init':
vjcompress.c:76: warning: incompatible implicit declaration of built-in function 'bzero'
vjcompress.c: In function 'vj_compress_tcp':
vjcompress.c:173: error: 'struct tcphdr' has no member named 'th_flags'
vjcompress.c:173: error: 'TH_SYN' undeclared (first use in this function)
vjcompress.c:173: error: (Each undeclared identifier is reported only once
vjcompress.c:173: error: for each function it appears in.)
vjcompress.c:173: error: 'TH_FIN' undeclared (first use in this function)
vjcompress.c:173: error: 'TH_RST' undeclared (first use in this function)
vjcompress.c:173: error: 'TH_ACK' undeclared (first use in this function)
vjcompress.c:220: error: 'struct tcphdr' has no member named 'th_off'
vjcompress.c:252: error: 'struct tcphdr' has no member named 'th_off'
vjcompress.c:260: error: 'struct tcphdr' has no member named 'th_off'
.....
这个文件中使用了
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
这些文件都存在的,且PATH环境变量也设置了/usr/include:
[root@dwang tcpcommpress]# cd /usr/include/netinet/
ether.h if_ether.h if_tr.h in.h ip6.h ip_icmp.h udp.h
icmp6.h if_fddi.h igmp.h in_systm.h ip.h tcp.h
tcp.h中tcphdr定义如下:
56 # ifdef __FAVOR_BSD
57 typedef u_int32_t tcp_seq;
58 /*
59 * TCP header.
60 * Per RFC 793, September, 1981.
61 */
62 struct tcphdr
63 {
64 u_int16_t th_sport; /* source port */
65 u_int16_t th_dport; /* destination port */
66 tcp_seq th_seq; /* sequence number */
67 tcp_seq th_ack; /* acknowledgement number */
68 # if __BYTE_ORDER == __LITTLE_ENDIAN
69 u_int8_t th_x2:4; /* (unused) */
70 u_int8_t th_off:4; /* data offset */
71 # endif
72 # if __BYTE_ORDER == __BIG_ENDIAN
73 u_int8_t th_off:4; /* data offset */
74 u_int8_t th_x2:4; /* (unused) */
75 # endif
76 u_int8_t th_flags;
77 # define TH_FIN 0x01
78 # define TH_SYN 0x02
79 # define TH_RST 0x04
80 # define TH_PUSH 0x08
81 # define TH_ACK 0x10
82 # define TH_URG 0x20
83 u_int16_t th_win; /* window */
84 u_int16_t th_sum; /* checksum */
85 u_int16_t th_urp; /* urgent pointer */
86 };
87
88 # else /* !__FAVOR_BSD */
89 struct tcphdr
90 {
91 u_int16_t source;
92 u_int16_t dest;
93 u_int32_t seq;
94 u_int32_t ack_seq;
95 # if __BYTE_ORDER == __LITTLE_ENDIAN
96 u_int16_t res1:4;
97 u_int16_t doff:4;
98 u_int16_t fin:1;
99 u_int16_t syn:1;
100 u_int16_t rst:1;
101 u_int16_t psh:1;
102 u_int16_t ack:1;
103 u_int16_t urg:1;
104 u_int16_t res2:2;
105 # elif __BYTE_ORDER == __BIG_ENDIAN
106 u_int16_t doff:4;
107 u_int16_t res1:4;
108 u_int16_t res2:2;
109 u_int16_t urg:1;
110 u_int16_t ack:1;
111 u_int16_t psh:1;
112 u_int16_t rst:1;
113 u_int16_t syn:1;
114 u_int16_t fin:1;
115 # else
116 # error "Adjust your <bits/endian.h> defines"
117 # endif
118 u_int16_t window;
119 u_int16_t check;
120 u_int16_t urg_ptr;
121 };
122 # endif /* __FAVOR_BSD */
|
可能与__FAVOR_BSD变量有关,我怎么才可以知道__FAVOR_BSD变量有没有定义? |
|