包长=IP头长度+14(不是18)
tcpdump的ether.h中是这样定义的:
/*
* Structure of a DEC/Intel/Xerox or 802.3 Ethernet header.
*/
struct ether_header {
u_int8_t ether_dhost[ETHER_ADDR_LEN]; // 6
u_int8_t ether_shost[ETHER_ADDR_LEN]; // 6
u_int16_t ether_type; // 2
};
/*
* Length of a DEC/Intel/Xerox or 802.3 Ethernet header; note that some
* compilers may pad "struct ether_header" to a multiple of 4 bytes,
* for example, so "sizeof (struct ether_header)" may not give the right
* answer.
*/
#define ETHER_HDRLEN 14
开始时不要研究Wireshark,太多界面和分析部分。建议你读一下tcpdump的源码,抓包原理上差不多。
读入.dat格式你还是自己另外先写个程序吧,调试起来也方便。外部可以读入了,再集成到Wireshark中。
[ 本帖最后由 grsgrs 于 2008-6-10 09:10 编辑 ]