我已经得到了使用功能ieee80211_radiotap_iterator_init()
和radiotap-parser.c
ieee80211_radiotap_iterator_next()
一些代码,libpcap的Radiotap头提取
我不知道我在做什么错误,也许有人能教我吗?我使用的示例代码the documentation或多或少不加修饰,它非常适合于什么,我想实现:
/* where packet is `const u_char *packet' */
struct ieee80211_radiotap_iterator rti;
struct ieee80211_radiotap_header *rth = (struct ieee80211_radiotap_header *) packet;
/* 802.11 frame starts here */
struct wi_frame *fr= (struct wi_frame *) (packet + rth->it_len);
/* Set up the iteration */
int ret = ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len);
/* Loop until we've consumed all the fields */
while(!ret) {
printf("Itteration: %d\n", count++);
ret = ieee80211_radiotap_iterator_next(&rti);
if(ret) {
/*
* The problem is here, I'm dropping into this clause with
* a value of `1` consistently, that doesn't match my platform's
* definition of EINVAL or ENOENT.
*/
continue;
}
switch(rti.this_arg_index) {
default:
printf("Constant: %d\n", *rti.this_arg);
break;
}
}
有有限的范围内对代码有拧东西了,我想,我被1
从ieee80211_radiotap_iterator_next()
返回,根据实现似乎并不像the implementation中的错误条件。
我正在筛选类型为"(type mgt) and (not type mgt subtype beacon)"
的数据包,我甚至不确定在数据链接设置为DLT_IEEE802_11_RADIO
时,libpcap是否会包含这些属性?
谢谢Guy,我不确定如何使用'ieee80211_radiotap_iterator_next()'的用户执行的结果。但我会继续挖掘。我甚至没有考虑过这两个函数会有两个并行的实现! – 2013-05-12 08:56:08