欢迎来到天天文库
浏览记录
ID:53865877
大小:81.50 KB
页数:10页
时间:2020-04-10
《WinPcap下的主要结构体和主要函数.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、WinPCap中的主要结构体:1.structpcap_if_t(称为网络设备结构,表示一个网络接口设备(如网卡)) 结构体包含以下5个域(其结构体与pcap_if相同,可以用pcap_if_t代替pcap_if):structpcap_if{structpcap_if*next;char*name;/*nametohandto"pcap_open_live()"*/char*description;/*textualdescriptionofinterface,orNULL*/structpcap_addr*addresses;bpf
2、_u_int32flags;/*PCAP_IF_interfaceflags*/};Structpcap_addr:Representationofaninterfaceaddress (表示接口地址)Structpcap_addr{structpcap_addr* next:ifnotNULL,apointertothenextelementinthelist; NULLforthelastelementofthelist(指向下一个元素的指针)structsockaddr* addr apointertoastructsockadd
3、rcontaininganaddressstructsockaddr* netmask ifnotNULL,apointertoastructsockaddrthatcontainsthenetmaskcorrespondingtotheaddresspointedtobyaddr.structsockaddr* broadaddr ifnotNULL,apointertoastructsockaddrthatcontainsthebroadcastaddresscorre�spondingtotheaddresspointedtoby
4、addr;maybenulliftheinterfacedoesn'tsupportbroadcastsstructsockaddr* dstaddr ifnotNULL,apointertoastructsockaddrthatcontainsthedestinationaddresscorre�spondingtotheaddresspointedtobyaddr;maybenulliftheinterfaceisn'tapoint-to-pointinterface}2.pcap_ifIteminalistofinterfaces
5、,usedbypcap_findalldevs().(接口设备列表的一项(一个设备,比如一个网卡))Definitionatline148offileincs/pcap.h. Structpcap_if{structpcap_if*nextifnotNULL,apointertothenextelementinthelist;NULLforthelastelementofthelistchar*nameapointertoastringgivinganameforthedevicetopasstopcap_open_live()char
6、*descriptionifnotNULL,apointertoastringgivingahuman-readabledescriptionofthedevicestructpcap_addr*addressesapointertothefirstelementofalistofaddressesfortheinterfaceu_intflagsPCAP_IF_interfaceflags.CurrentlytheonlypossibleflagisPCAP_IF_LOOPBACK,thatissetiftheinterfaceisa
7、loopbackinterface.}2.结构体pcap_tDescriptorofanopencaptureinstance.Thisstructureisopaquetotheuser,thathandlesitscontentthroughthefunctionsprovidedbywpcap.dll.(该结构体描述一个捕获的实例(例如指向一个发现的网卡,称为网卡描述符),其结构体在.h文件中看不到)3.结构体pcap_pkthdr //Headerofapacketinthedumpfile.Eachpacketinthedum
8、pfileisprependedwiththisgenericheader.(每一个分组都有不同的头部,分组的头部用该结构体表示)structpcap_pkthdr{ structtimevalts
此文档下载收益归作者所有