tcpdump mailing list archives
packets contents
From: stephen () stephengarrett net
Date: Wed, 29 Oct 2008 11:49:31 -0400 (EDT)
I'm working with some C code using pcap.h and I have an infinite loop running pcap_dispatch. The packet handler
function then takes the packet header it received from pcap_dispatch and sends a message to a synthesizer currently
based on the packet length which is stored in the packet header it receives. I'd rather base my synthesizer decisions
on IP addresses. Is there a pcap function that will allow me to view the ip addresses (sending and receiving) of a
packet that will also use the callback functionality that pcap_dispatch uses? Thanks!
My code is below:
while (1) {
pcap_dispatch(hdl_pcap, 1, packet_handler, 0);
}
/** packet handler called by pcap_dispatch in main() */
void packet_handler(u_char * args, const struct pcap_pkthdr *pcap_hdr, const u_char * p)/*{{{*/
{
float factor2 = (float)(rand()%5 + 1);
float factor = pow(2,(float)(pcap_hdr->len / 256.0f)*3.0f / 12.0f) * factor2;
lo_send(target, "/s_new", "siiisf",
"hearnet", -1, 1, 0,
"freq", 55.0f * factor + ((float)(rand()%5) * factor));
}/*}}}*/
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.
Current thread:
- packets contents stephen (Oct 29)
- Re: packets contents Guy Harris (Oct 29)
