Remix.run Logo
RossBencina 8 hours ago

Nice.

> int ret = libwifi_get_wifi_frame(&frame, data, data_len, got_radiotap);

> ...

> int ret = libwifi_parse_beacon(&bss, &frame);

I haven't looked into the implementation, but if I understand correctly, the above code (extracted from the example on the home page) implies that the unparsed segment of `data` is either (1) copied into `frame` or (2) a pointer-span in `frame` references the unparsed segment of `data`. I wonder why either of these approaches have been taken. I imagine that the pointer-span could be computed (possibly even statically) inside `libwifi_parse_beacon` and `data` could also be passed:

> libwifi_parse_beacon(&bss, &frame, data);

This would shrink the size of `frame` and achieve zero-copy. Or perhaps I'm missing something.