tcpdump mailing list archives

Making pcap_loop call different callback functions dependent on packet ..


From: MMatos <razielukain () gmail com>
Date: Thu, 02 Dec 2004 02:54:39 +0000


Hi there!

How can i implement a filter that based on the kind of traffic it recieves it calls different "callback functions" ? As an example if a packet arrives from 1.1.1.1 it will call the function callback1 and if it arrives from 1.1.2.1 it should call function callback2 so i can process different traffic in different ways ... I have think of using a filter that covers both situations and to implement a callback function that handles the different packets an processes it properly perhaps using an hash table to find what should i do for each "class" of packet but in an high traffic situation that should not be reliable as it will slowdown things a lot even if the hashing function is well written. The ideal thing should be a function of the library handling this and delivering the packet to the proper callback function but i am unable to see a correct way to do this. I've also think of doing a fork in each child will handle different filters (using different pcap_loop functions)but i think that will not work because only one filter can be attached to the kernel at any given time correct??

What is the best way to achieve this?

Thanks in advance.

MMatos

--
www.NoSoftwarePatents.com.

Question: Do you use Linux exclusively, or do you use other operating systems as well?

Alan Cox: I run Linux on pretty much everything except the microwave and washing machine. Those are tempting targets but would probably make Telsa extremely cross.
--  Behind the scenes --
http://www.opensource.org/halloween/

-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.


Current thread: