Results 1 to 2 of 2
Hi,
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-29-2011 #1Just Joined!
- Join Date
- Sep 2008
- Posts
- 22
Directly access received packets in buffer
Hi,
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.
Thank you.
Regards,
Rayne
- 04-05-2011 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,160
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!


Reply With Quote
