Linux CÍøÂç±à³ÌÓö´í:¡®struct tcphdr¡¯ ûÓÐÃûΪ ¡®th_sport¡¯ µÄ³ÉÔ±
µ÷ÓÃtcpheader->th_sport = htons (9877)ʱ²»ÖªµÀΪºÎ³öÏÖÒÔÏ´íÎó?'Al$ZySs1? ]Bg0Z8fX
syn.c:106: ´íÎ󣺡®struct tcphdr¡¯ ûÓÐÃûΪ ¡®th_sport¡¯ µÄ³ÉÔ±R[@#F@Jv#l%z
syn.c:108: ´íÎ󣺡®struct tcphdr¡¯ ûÓÐÃûΪ ¡®th_dport¡¯ µÄ³ÉÔ±
......Xi h-X_+K+}.T
¾²é¿´Îļþ/usr/include/netinet/tcp.h,
µÃÖª:1`1l9fUJ7t
#ifdef __FAVOR_BSD [color=Red]<------¾ÍÊDz»ÖªµÀÕâÐÐÊÇÔõô»ØÊÂ?[/color]
struct tcphdrd*CM}5E _
{
u_int16_t th_sport; *dp"Iq @ PAD7|
u_int16_t th_dport;
......
};
#else /* !__FAVOR_BSD */
struct tcphdr
{
u_int16_t source;
u_int16_t dest;
u_int32_t seq;Me!Sm#Q.Hn)b8g,J
u_int32_t ack_seq;9sY[jK@9O6{(G
......
}; ºÜ¶àtcp/ipÐÒéÕ»¶¼ÊǼ̳Ð×Ôfreebsd£¬ÎÒûÓÐÓùýfreebsd£¬²Â²âÖ»ÊÇΪÁ˺ÍfreebsdµÄÍ·Îļþ¶¨ÒåµÄstruct tcphdrÒ»ÖÁ£¬Äã¿ÉÒÔÔÚ#include <netinet/in.h>Ç°Ãæ¼ÓÉÏ #define __FAVOR_BSD¡£ Ã÷Ã÷ÊÇLinuxΪʲôҪŪBSDµÄ£¿ ´¦ÀíÕâÑùµÄÎÊÌâµÄʱºò£¬×îºÃµÄ°ì·¨¾ÍÊÇ×Ô¼º¶¨ÒåÒ»¸ötcp header£¬¾Í±ÜÃâµÄÕâÑùÄÇÑùµÄÎÊÌâ¡£
typedef struct TCP_Hdr {
U16 th_sport; // Source port
U16 th_dport; // Destionation port
U32 th_seq; // Sequence numberpe u$G[i
U32 th_ack; // Acknowledgement number
U8 th_off; // Data dffset: (thoff & 0xf0) >> 4.C\Z%K;F7kI
U8 th_flags; // ACK, FIN, PUSH, RST, SYN, URGKJ?VY z,O:u,?M$bs
U16 th_win; // Advertised window6R8dJKc*L0y.R
U16 th_sum; // Checksum"vV A` ff6||
U16 th_urp; // Urgent offset