我已經得到了使用功能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