当前位置: 动力学知识库 > 问答 > 编程问答 >

c - Size of 802.11 packet

问题描述:

Given the below declaration for pcap callback:

void my_callback(u_char *args, const struct pcap_pkthdr *header, const u_char *packet)

How to ascertain the total number of bytes present in the packet? I need that value so that I can pass it to crc32() function.

网友答案:

according to this reference the information about the size of the packet is in the pcap_pkthdr's structure

网友答案:

The information is in the pcap_pkthdr variable.

Given your callback, the full packet size is given by

header->len

and the captured packet size (which might be smaller if you've set a snaplen that happens to be smaller than actual packet size) is given by

header->caplen
分享给朋友:
您可能感兴趣的文章:
随机阅读: