fixed some bugs, cleaned a lot of code,

re-added support for PPP
automatic detection of link-layer protocol
This commit is contained in:
Arnout Engelen
2004-09-14 11:23:59 +00:00
parent 23a56f95a6
commit a695b7db2a
8 changed files with 279 additions and 354 deletions

View File

@@ -14,11 +14,11 @@ enum dp_packet_type {
dp_n_packet_types
};
enum dp_link_type {
/*enum dp_link_type {
dp_link_ethernet,
dp_link_ppp,
dp_n_link_types
};
};*/
/*struct dp_header {
};*/
@@ -29,14 +29,14 @@ typedef int (*dp_callback)(u_char *, const dp_header *, const u_char *);
struct dp_handle {
pcap_t * pcap_handle;
dp_callback callback [dp_n_packet_types];
enum dp_link_type linktype;
int linktype;
u_char * userdata;
int userdata_size;
};
/* functions to set up a handle (which is basically just a pcap handle) */
struct dp_handle * dp_open_live(char * device, enum dp_link_type link, int snaplen, int promisc, int to_ms, char * ebuf);
struct dp_handle * dp_open_live(char * device, int snaplen, int promisc, int to_ms, char * ebuf);
/* functions to add callbacks */
@@ -49,3 +49,7 @@ void dp_parse (enum dp_packet_type type, void * packet);
/* functions to start monitoring */
int dp_dispatch (struct dp_handle * handler, int count, u_char *user, int size);
/* functions that simply call libpcap */
int dp_datalink(struct dp_handle * handle);