pcapを使用してパケットスニファを作成しています。
私はこのtcp構造を持っています:
typedef struct TSP_header{
unsigned short int sport;
unsigned short int dport;
unsigned int seqnum;
unsigned int acknum;
unsigned char reserved:4, offset:4;
unsigned int
tcp_res1:4, //little-endian
tcph_hlen:4, //length of tcp header in 32-bit words
tcph_fin:1, //Finish flag "fin"
tcph_syn:1, //Synchronize sequence numbers to start a connection
tcph_rst:1, //Reset flag
tcph_psh:1, //Push, sends data to the application
tcph_ack:1, //acknowledge
tcph_urg:1, //urgent pointer
tcph_res2:2;
unsigned short int tcph_win;
unsigned short int tcph_chksum;
unsigned short int tcph_urgptr;
}TSP_header;
シーケンス番号を印刷するにはどうすればよいですか?
htons(sequence_number)を使用する必要がありますか?このように機能していないので!
私の他の質問は、変数宣言の後の数は何ですか?
tcph_hlen:4で4はどういう意味ですか