Closed Wojtek242 closed 1 year ago
It's not a bad idea, Capture is more an interface to pcap API. Thus I think I will work to add an iterator.
next_packet
and send_packet
make more sense to me.
You think an iterator still makes sense? The issue I see with an iterator is that there is no underlying collection and unless copied the packets do not remain so calling next
on libpcap does not really do the same thing as next
on a list/vec/map.
You think an iterator still makes sense? The issue I see with an iterator is that there is no underlying collection and unless copied the packets do not remain so calling
next
on libpcap does not really do the same thing asnext
on a list/vec/map.
Actually stream iterators make sense. I don't know why I forgot about them.
Capture::next
suggests thatCapture
implements an iterator. It does not. Suggest renaming it tonextpacket
which then mirrorssendpacket
even though it breaks away from libpcap naming (which it already was not holding that well).