diff options
author | Guy Harris <guy@alum.mit.edu> | 2005-03-23 01:25:01 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2005-03-23 01:25:01 +0000 |
commit | 46e1907f136cd62ff768a9c509a0bf368024e141 (patch) | |
tree | f219510fe2e4d6014ba976062506b55f857f3bcb /capture-wpcap.c | |
parent | 79daa1e80ee9ee42a25fdf1119feedc423709b36 (diff) | |
download | wireshark-46e1907f136cd62ff768a9c509a0bf368024e141.tar.gz wireshark-46e1907f136cd62ff768a9c509a0bf368024e141.tar.bz2 wireshark-46e1907f136cd62ff768a9c509a0bf368024e141.zip |
If we have "pcap_freecode()", use it to free the instructions for a BPF
filter after installing the filter.
Set HAVE_PCAP_LIB_VERSION if we're building with WinPcap 3.1; it's not
present in earlier versions, but is present in current 3.1 betas.
Check HAVE_PCAP_LIB_VERSION when building capture-wpcap.c.
svn path=/trunk/; revision=13872
Diffstat (limited to 'capture-wpcap.c')
-rw-r--r-- | capture-wpcap.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/capture-wpcap.c b/capture-wpcap.c index 7d88073e69..9163b2997d 100644 --- a/capture-wpcap.c +++ b/capture-wpcap.c @@ -65,6 +65,7 @@ static int (*p_pcap_lookupnet) (char *, bpf_u_int32 *, bpf_u_int32 *, static pcap_t* (*p_pcap_open_live) (char *, int, int, int, char *); #endif static int (*p_pcap_loop) (pcap_t *, int, pcap_handler, guchar *); +static void (*p_pcap_freecode) (struct bpf_program *); #ifdef HAVE_PCAP_FINDALLDEVS static int (*p_pcap_findalldevs) (pcap_if_t **, char *); static void (*p_pcap_freealldevs) (pcap_if_t *); @@ -75,7 +76,9 @@ static int (*p_pcap_datalink_name_to_val) (const char *); #ifdef HAVE_PCAP_DATALINK_VAL_TO_NAME static const char *(*p_pcap_datalink_val_to_name) (int); #endif +#ifdef HAVE_PCAP_LIB_VERSION static const char *(*p_pcap_lib_version) (void); +#endif static int (*p_pcap_setbuff) (pcap_t *, int dim); typedef struct { @@ -104,6 +107,7 @@ load_wpcap(void) SYM(pcap_lookupnet, FALSE), SYM(pcap_open_live, FALSE), SYM(pcap_loop, FALSE), + SYM(pcap_freecode, FALSE), #ifdef HAVE_PCAP_FINDALLDEVS SYM(pcap_findalldevs, TRUE), SYM(pcap_freealldevs, TRUE), @@ -114,7 +118,9 @@ load_wpcap(void) #ifdef HAVE_PCAP_DATALINK_VAL_TO_NAME SYM(pcap_datalink_val_to_name, TRUE), #endif +#ifdef HAVE_PCAP_LIB_VERSION SYM(pcap_lib_version, TRUE), +#endif SYM(pcap_setbuff, TRUE), { NULL, NULL, FALSE } }; @@ -179,7 +185,6 @@ pcap_dispatch(pcap_t *a, int b, pcap_handler c, guchar *d) return p_pcap_dispatch(a, b, c, d); } - int pcap_snapshot(pcap_t *a) { @@ -187,7 +192,6 @@ pcap_snapshot(pcap_t *a) return p_pcap_snapshot(a); } - int pcap_datalink(pcap_t *a) { @@ -246,6 +250,13 @@ pcap_loop(pcap_t *a, int b, pcap_handler c, guchar *d) return p_pcap_loop(a, b, c, d); } +void +pcap_freecode(struct bpf_program *a) +{ + g_assert(has_wpcap); + p_pcap_freecode(a); +} + #ifdef HAVE_PCAP_FINDALLDEVS int pcap_findalldevs(pcap_if_t **a, char *b) @@ -621,9 +632,12 @@ get_runtime_pcap_version(GString *str) } g_string_sprintfa(str, "with "); +#ifdef HAVE_PCAP_LIB_VERSION if (p_pcap_lib_version != NULL) g_string_sprintfa(str, p_pcap_lib_version()); - else if (packetVer != NULL) + else +#endif + if (packetVer != NULL) g_string_sprintfa(str, "WinPcap (%s)", packetVer); else g_string_append(str, "WinPcap (version unknown)"); |