X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=blobdiff_plain;f=wiretap%2Flibpcap.c;h=822b2faaed963256c2c36e6eda0bdd60862503e4;hp=c9c8efba0ae15123aaa84e27cc7c1683564be68a;hb=12f22966cb2cdec99f1cfe67cf43661c6e730dcb;hpb=3d4a00750d651fb7280a436f44d713ec92b2d0a3 diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index c9c8efba0a..822b2faaed 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -1,9 +1,9 @@ /* libpcap.c * - * $Id: libpcap.c,v 1.29 2000/01/09 07:55:48 guy Exp $ + * $Id: libpcap.c,v 1.33 2000/03/22 07:06:58 guy Exp $ * * Wiretap Library - * Copyright (c) 1998 by Gilbert Ramirez + * Copyright (c) 1998 by Gilbert Ramirez * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,7 +26,7 @@ #include #include #include "wtap.h" -#include "file.h" +#include "file_wrappers.h" #include "buffer.h" #include "libpcap.h" @@ -88,6 +88,7 @@ struct pcaprec_modified_hdr { static int libpcap_read(wtap *wth, int *err); static void adjust_header(wtap *wth, struct pcaprec_hdr *hdr); +static void libpcap_close(wtap *wth); static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const u_char *pd, int *err); @@ -247,7 +248,7 @@ int libpcap_open(wtap *wth, int *err) || pcap_encap[hdr.network] == WTAP_ENCAP_UNKNOWN) { g_message("pcap: network type %u unknown or unsupported", hdr.network); - *err = WTAP_ERR_UNSUPPORTED; + *err = WTAP_ERR_UNSUPPORTED_ENCAP; return -1; } @@ -259,6 +260,7 @@ int libpcap_open(wtap *wth, int *err) wth->capture.pcap->version_major = hdr.version_major; wth->capture.pcap->version_minor = hdr.version_minor; wth->subtype_read = libpcap_read; + wth->subtype_close = libpcap_close; wth->file_encap = pcap_encap[hdr.network]; wth->snapshot_length = hdr.snaplen; @@ -454,6 +456,12 @@ adjust_header(wtap *wth, struct pcaprec_hdr *hdr) } } +static void +libpcap_close(wtap *wth) +{ + g_free(wth->capture.pcap); +} + int wtap_pcap_encap_to_wtap_encap(int encap) { if (encap < 0 || encap >= NUM_PCAP_ENCAPS)