radiotap_iter.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef __RADIOTAP_ITER_H
  2. #define __RADIOTAP_ITER_H
  3. #include <stdint.h>
  4. #include "radiotap.h"
  5. /* Radiotap header iteration
  6. * implemented in radiotap.c
  7. */
  8. struct radiotap_override {
  9. uint8_t field;
  10. uint8_t align:4, size:4;
  11. };
  12. struct radiotap_align_size {
  13. uint8_t align:4, size:4;
  14. };
  15. struct ieee80211_radiotap_namespace {
  16. const struct radiotap_align_size *align_size;
  17. int n_bits;
  18. uint32_t oui;
  19. uint8_t subns;
  20. };
  21. struct ieee80211_radiotap_vendor_namespaces {
  22. const struct ieee80211_radiotap_namespace *ns;
  23. int n_ns;
  24. };
  25. /**
  26. * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
  27. * @this_arg_index: index of current arg, valid after each successful call
  28. * to ieee80211_radiotap_iterator_next()
  29. * @this_arg: pointer to current radiotap arg; it is valid after each
  30. * call to ieee80211_radiotap_iterator_next() but also after
  31. * ieee80211_radiotap_iterator_init() where it will point to
  32. * the beginning of the actual data portion
  33. * @this_arg_size: length of the current arg, for convenience
  34. * @current_namespace: pointer to the current namespace definition
  35. * (or internally %NULL if the current namespace is unknown)
  36. * @is_radiotap_ns: indicates whether the current namespace is the default
  37. * radiotap namespace or not
  38. *
  39. * @overrides: override standard radiotap fields
  40. * @n_overrides: number of overrides
  41. *
  42. * @_rtheader: pointer to the radiotap header we are walking through
  43. * @_max_length: length of radiotap header in cpu byte ordering
  44. * @_arg_index: next argument index
  45. * @_arg: next argument pointer
  46. * @_next_bitmap: internal pointer to next present u32
  47. * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
  48. * @_vns: vendor namespace definitions
  49. * @_next_ns_data: beginning of the next namespace's data
  50. * @_reset_on_ext: internal; reset the arg index to 0 when going to the
  51. * next bitmap word
  52. *
  53. * Describes the radiotap parser state. Fields prefixed with an underscore
  54. * must not be used by users of the parser, only by the parser internally.
  55. */
  56. struct ieee80211_radiotap_iterator {
  57. struct ieee80211_radiotap_header *_rtheader;
  58. const struct ieee80211_radiotap_vendor_namespaces *_vns;
  59. const struct ieee80211_radiotap_namespace *current_namespace;
  60. unsigned char *_arg, *_next_ns_data;
  61. le32 *_next_bitmap;
  62. unsigned char *this_arg;
  63. #ifdef RADIOTAP_SUPPORT_OVERRIDES
  64. const struct radiotap_override *overrides;
  65. int n_overrides;
  66. #endif
  67. int this_arg_index;
  68. int this_arg_size;
  69. int is_radiotap_ns;
  70. int _max_length;
  71. int _arg_index;
  72. uint32_t _bitmap_shifter;
  73. int _reset_on_ext;
  74. };
  75. extern int ieee80211_radiotap_iterator_init(
  76. struct ieee80211_radiotap_iterator *iterator,
  77. struct ieee80211_radiotap_header *radiotap_header,
  78. int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
  79. extern int ieee80211_radiotap_iterator_next(
  80. struct ieee80211_radiotap_iterator *iterator);
  81. #endif /* __RADIOTAP_ITER_H */