tcpdump mailing list archives

pcap_send_packet vs. pcap_inject functions


From: "Mark Bednarczyk" <voytechs () yahoo com>
Date: Mon, 20 Aug 2007 11:12:47 -0400

Can someone explain to me the difference between these two calls,
pcap_sendpacket vs. pcap_inject, introducted in 0.8.3? 
 

/*

* API compatible with WinPcap's "send a packet" routine - returns -1

* on error, 0 otherwise.

*

* XXX - what if we get a short write?

*/

int

pcap_sendpacket(pcap_t *p, const u_char *buf, int size);

 

/*

* API compatible with OpenBSD's "send a packet" routine - returns -1 on

* error, number of bytes written otherwise.

*/

int

pcap_inject(pcap_t *p, const void *buf, size_t size);

 
From what I could tell one is used on linux and came from winpcap API and
the other on bsd systems? They are both implemented exactly the same way and
accomplish same thing and take the same parameters. So I'm a little confused
what is the purpose of having 2 calls?
 
I'm building an open source java wrapper around libpcap and I need to
understand how to best represent these 2 calls in my java API. I'm trying to
port all of libcap functionality so it looks like I have to peer java with
both functions. Any insight would be very helpful.
 
I have the rest of libpcap API already working nicely under windows and
linux and the only thing left is to figure out how to expose these two
functions.
 
Thanks,
mark....
http://jnetpcap.sf.net
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: