Fwd: ieee80211_radiotap_iterator_next return values

Lee Hambley <[email protected]> Fri, 10 May 2013 14:55:54 +0200
Newsgroups org.netbsd.radiotap
Message-ID <CAN_+VLVY9OY5OdAHs6mdzKLXcubAbHPXprsQis58+_ze939hQw@mail.gmail.com>
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