什么是pcap_pkthdr那里? [英] What's pcap_pkthdr there for?
本文介绍了什么是pcap_pkthdr那里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
code段从这里:
void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
....
/* retireve the position of the ip header */
ih = (ip_header *) (pkt_data +
14); //length of ethernet header
....
什么是 const的结构pcap_pkthdr *标题
为(的定义),我们什么时候需要它,它是如何填充(因为在包本身如下)?没有这样的信息
What's const struct pcap_pkthdr *header
for(definition), when do we need it, how is it populated (since there is no such info in the packet itself as below)?
推荐答案
如果你会不停的评论,这本来是一点点更容易。它说:
If you would have kept the comment, it would have been a tad easier. It says:
/* Callback function invoked by libpcap for every incoming packet */
这里该说,关于无效的typedef (*)pcap_handler(u_char *用户,常量结构pcap_pkthdr * pkt_header,常量u_char * pkt_data)
:
pkt_header
的标题关联
由捕获驱动到分组。
这不是一个协议头。
pkt_header
is the header associated by the capture driver to the packet. It is NOT a protocol header.
这篇关于什么是pcap_pkthdr那里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文