Lines Matching refs:iterator
91 struct ieee80211_radiotap_iterator *iterator, in ieee80211_radiotap_iterator_init() argument
107 iterator->_rtheader = radiotap_header; in ieee80211_radiotap_iterator_init()
108 iterator->_max_length = get_unaligned_le16(&radiotap_header->it_len); in ieee80211_radiotap_iterator_init()
109 iterator->_arg_index = 0; in ieee80211_radiotap_iterator_init()
110 iterator->_bitmap_shifter = get_unaligned_le32(&radiotap_header->it_present); in ieee80211_radiotap_iterator_init()
111 iterator->_arg = (uint8_t *)radiotap_header + sizeof(*radiotap_header); in ieee80211_radiotap_iterator_init()
112 iterator->_next_ns_data = NULL; in ieee80211_radiotap_iterator_init()
113 iterator->_reset_on_ext = 0; in ieee80211_radiotap_iterator_init()
114 iterator->_next_bitmap = &radiotap_header->it_present; in ieee80211_radiotap_iterator_init()
115 iterator->_next_bitmap++; in ieee80211_radiotap_iterator_init()
116 iterator->_vns = vns; in ieee80211_radiotap_iterator_init()
117 iterator->current_namespace = &radiotap_ns; in ieee80211_radiotap_iterator_init()
118 iterator->is_radiotap_ns = 1; in ieee80211_radiotap_iterator_init()
120 iterator->n_overrides = 0; in ieee80211_radiotap_iterator_init()
121 iterator->overrides = NULL; in ieee80211_radiotap_iterator_init()
126 if (iterator->_bitmap_shifter & BIT(IEEE80211_RADIOTAP_EXT)) { in ieee80211_radiotap_iterator_init()
127 if ((unsigned long)iterator->_arg - in ieee80211_radiotap_iterator_init()
128 (unsigned long)iterator->_rtheader + sizeof(uint32_t) > in ieee80211_radiotap_iterator_init()
129 (unsigned long)iterator->_max_length) in ieee80211_radiotap_iterator_init()
131 while (get_unaligned_le32(iterator->_arg) & in ieee80211_radiotap_iterator_init()
133 iterator->_arg += sizeof(uint32_t); in ieee80211_radiotap_iterator_init()
141 if ((unsigned long)iterator->_arg - in ieee80211_radiotap_iterator_init()
142 (unsigned long)iterator->_rtheader + in ieee80211_radiotap_iterator_init()
144 (unsigned long)iterator->_max_length) in ieee80211_radiotap_iterator_init()
148 iterator->_arg += sizeof(uint32_t); in ieee80211_radiotap_iterator_init()
157 iterator->this_arg = iterator->_arg; in ieee80211_radiotap_iterator_init()
158 iterator->this_arg_index = 0; in ieee80211_radiotap_iterator_init()
159 iterator->this_arg_size = 0; in ieee80211_radiotap_iterator_init()
166 static void find_ns(struct ieee80211_radiotap_iterator *iterator, in find_ns() argument
171 iterator->current_namespace = NULL; in find_ns()
173 if (!iterator->_vns) in find_ns()
176 for (i = 0; i < iterator->_vns->n_ns; i++) { in find_ns()
177 if (iterator->_vns->ns[i].oui != oui) in find_ns()
179 if (iterator->_vns->ns[i].subns != subns) in find_ns()
182 iterator->current_namespace = &iterator->_vns->ns[i]; in find_ns()
188 static int find_override(struct ieee80211_radiotap_iterator *iterator, in find_override() argument
193 if (!iterator->overrides) in find_override()
196 for (i = 0; i < iterator->n_overrides; i++) { in find_override()
197 if (iterator->_arg_index == iterator->overrides[i].field) { in find_override()
198 *align = iterator->overrides[i].align; in find_override()
199 *size = iterator->overrides[i].size; in find_override()
235 struct ieee80211_radiotap_iterator *iterator) in ieee80211_radiotap_iterator_next() argument
243 if ((iterator->_arg_index % 32) == IEEE80211_RADIOTAP_EXT && in ieee80211_radiotap_iterator_next()
244 !(iterator->_bitmap_shifter & 1)) in ieee80211_radiotap_iterator_next()
247 if (!(iterator->_bitmap_shifter & 1)) in ieee80211_radiotap_iterator_next()
251 switch (iterator->_arg_index % 32) { in ieee80211_radiotap_iterator_next()
263 if (find_override(iterator, &align, &size)) { in ieee80211_radiotap_iterator_next()
267 if (!iterator->current_namespace || in ieee80211_radiotap_iterator_next()
268 iterator->_arg_index >= iterator->current_namespace->n_bits) { in ieee80211_radiotap_iterator_next()
269 if (iterator->current_namespace == &radiotap_ns) in ieee80211_radiotap_iterator_next()
273 align = iterator->current_namespace->align_size[iterator->_arg_index].align; in ieee80211_radiotap_iterator_next()
274 size = iterator->current_namespace->align_size[iterator->_arg_index].size; in ieee80211_radiotap_iterator_next()
278 iterator->_arg = iterator->_next_ns_data; in ieee80211_radiotap_iterator_next()
280 iterator->current_namespace = NULL; in ieee80211_radiotap_iterator_next()
298 pad = ((unsigned long)iterator->_arg - in ieee80211_radiotap_iterator_next()
299 (unsigned long)iterator->_rtheader) & (align - 1); in ieee80211_radiotap_iterator_next()
302 iterator->_arg += align - pad; in ieee80211_radiotap_iterator_next()
304 if (iterator->_arg_index % 32 == IEEE80211_RADIOTAP_VENDOR_NAMESPACE) { in ieee80211_radiotap_iterator_next()
307 if ((unsigned long)iterator->_arg + size - in ieee80211_radiotap_iterator_next()
308 (unsigned long)iterator->_rtheader > in ieee80211_radiotap_iterator_next()
309 (unsigned long)iterator->_max_length) in ieee80211_radiotap_iterator_next()
312 oui = (*iterator->_arg << 16) | in ieee80211_radiotap_iterator_next()
313 (*(iterator->_arg + 1) << 8) | in ieee80211_radiotap_iterator_next()
314 *(iterator->_arg + 2); in ieee80211_radiotap_iterator_next()
315 subns = *(iterator->_arg + 3); in ieee80211_radiotap_iterator_next()
317 find_ns(iterator, oui, subns); in ieee80211_radiotap_iterator_next()
319 vnslen = get_unaligned_le16(iterator->_arg + 4); in ieee80211_radiotap_iterator_next()
320 iterator->_next_ns_data = iterator->_arg + size + vnslen; in ieee80211_radiotap_iterator_next()
321 if (!iterator->current_namespace) in ieee80211_radiotap_iterator_next()
329 iterator->this_arg_index = iterator->_arg_index; in ieee80211_radiotap_iterator_next()
330 iterator->this_arg = iterator->_arg; in ieee80211_radiotap_iterator_next()
331 iterator->this_arg_size = size; in ieee80211_radiotap_iterator_next()
334 iterator->_arg += size; in ieee80211_radiotap_iterator_next()
343 if ((unsigned long)iterator->_arg - in ieee80211_radiotap_iterator_next()
344 (unsigned long)iterator->_rtheader > in ieee80211_radiotap_iterator_next()
345 (unsigned long)iterator->_max_length) in ieee80211_radiotap_iterator_next()
349 switch (iterator->_arg_index % 32) { in ieee80211_radiotap_iterator_next()
351 iterator->_reset_on_ext = 1; in ieee80211_radiotap_iterator_next()
353 iterator->is_radiotap_ns = 0; in ieee80211_radiotap_iterator_next()
360 iterator->this_arg_index = in ieee80211_radiotap_iterator_next()
362 if (!iterator->current_namespace) in ieee80211_radiotap_iterator_next()
366 iterator->_reset_on_ext = 1; in ieee80211_radiotap_iterator_next()
367 iterator->current_namespace = &radiotap_ns; in ieee80211_radiotap_iterator_next()
368 iterator->is_radiotap_ns = 1; in ieee80211_radiotap_iterator_next()
375 iterator->_bitmap_shifter = in ieee80211_radiotap_iterator_next()
376 get_unaligned_le32(iterator->_next_bitmap); in ieee80211_radiotap_iterator_next()
377 iterator->_next_bitmap++; in ieee80211_radiotap_iterator_next()
378 if (iterator->_reset_on_ext) in ieee80211_radiotap_iterator_next()
379 iterator->_arg_index = 0; in ieee80211_radiotap_iterator_next()
381 iterator->_arg_index++; in ieee80211_radiotap_iterator_next()
382 iterator->_reset_on_ext = 0; in ieee80211_radiotap_iterator_next()
388 iterator->_bitmap_shifter >>= 1; in ieee80211_radiotap_iterator_next()
389 iterator->_arg_index++; in ieee80211_radiotap_iterator_next()