Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Sep 2008
Directly access received packets in buffer
I would like to be able to directly access the buffer where packets are stored when they're received. After some googling, I think perhaps libpcap with mmap would be the solution. Does libpcap 1.0 and above support mmap?
From my understanding, mmap would allow me to directly access the buffer without having to explicitly copy the packet to another buffer for me to do processing. I would also appreciate it if someone can let me know where I can find examples of such applications, as many examples of mmap I've found involves mapping a buffer for file operations, rather than integrating it with pcap functions like pcap_loop, pcap_next_ex etc.
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
You have a lot of studying to do before you go down this path... Network packets are kept (usually) in a circular buffer (linked list). Just using mmap() to map a physical address is not a lot of use here. This is where the pcap functions come in, as they let you navigate that list without much bother.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!