Fwd: ieee80211_radiotap_iterator_next return values

Lee Hambley <[email protected]> Fri, 10 May 2013 15:16:31 +0200
Newsgroups org.netbsd.radiotap
Message-ID <CAN_+VLVATb9v+yfX4Cen6uOaR9=cTRVd0f3EPX10G97-8tr6_A@mail.gmail.com>
I've cross-posted to StackOverflow because I wasn't sure whether my message
had made it to the list or not thus far. The SO post includes more details,
better explanation and more code in my example. My apologies for the spam.

 •
http://stackoverflow.com/questions/16483010/libpcap-radiotap-header-extraction

Lee Hambley
--
http://lee.hambley.name/
+49 (0) 170 298 5667


---------- Forwarded message ----------
From: Lee Hambley <[email protected]>
Date: 10 May 2013 14:55
Subject: Fwd: ieee80211_radiotap_iterator_next return values
To: [email protected]


Hi Guys,

I'm new on the list, playing around trying to extract the radiotap headers
from IEEE802.11 traffic, specifically relating to signal strength/etc.

I've got some code that is using the functions
ieee80211_radiotap_iterator_init() and ieee80211_radiotap_iterator_next()
 from radiotap-parser.c,

I'm not sure what I'm doing incorrectly, perhaps someone can educate me?
I'm using the sample code from
http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/Documentation/networking/radiotap-headers.txt?v=2.6.25more
or less without modification, it fits very well to what I was trying
to achieve:

 /* where packet is `const u_char *packet' */

struct ieee80211_radiotap_iterator rti;
struct ieee80211_radiotap_header *rth = ( struct ieee80211_radiotap_header
* ) packet;
int ret = ieee80211_radiotap_iterator_init(&rti, rth, rth->it_len);
while(!ret) {
  printf("Itteration: %d\n", count++);
  ret = ieee80211_radiotap_iterator_next(&rti);
  if(ret) {
    continue;
  }
  switch(rti.this_arg_index) {
  default:
    printf("Constant: %d\n", *rti.this_arg);
    break;
  }
}

There's limited scope for having screwed something up in that code, I
think, I'm confused by the `1' being returned from `
ieee80211_radiotap_iterator_init' which according to the implenentation
doesn't seem like an error condition in the implementation
http://lxr.free-electrons.com/source/net/wireless/radiotap.c#L95

Thanks for anything anyone on the list can suggest, I'm out of my element
working at such a low level in C, but needs must!

- Lee Hambley