# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.90 2003-02-11 01:46:05 guy Exp $ (LBL)
+# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.91 2003-02-11 07:40:09 guy Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
ethertype.h gencode.h gnuc.h
GENHDR = \
- tokdefs.h
+ tokdefs.h version.h
TAGHDR = \
pcap-bpf.h
@rm -f $@
sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
+version.h: $(srcdir)/VERSION
+ @rm -f $@
+ sed -e 's/\([0-9]*\)\.[0-9]*/#define VERSION_MAJOR \1/' $(srcdir)/VERSION > $@
+ sed -e 's/[0-9]*\.\([0-9]*\)/#define VERSION_MINOR \1/' $(srcdir)/VERSION >> $@
+
bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
rm -f bpf_filter.c
ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
-.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.45 2003-01-16 07:29:15 guy Exp $
+.\" @(#) $Header: /tcpdump/master/libpcap/Attic/pcap.3,v 1.46 2003-02-11 07:40:09 guy Exp $
.\"
.\" Copyright (c) 1994, 1996, 1997
.\" The Regents of the University of California. All rights reserved.
void pcap_perror(pcap_t *p, char *prefix)
char *pcap_geterr(pcap_t *p)
char *pcap_strerror(int error)
+const char *pcap_lib_version(void)
.ft
.LP
.ft B
than the current system.
.PP
.B pcap_major_version()
-returns the major number of the version of the pcap used to write the
-savefile.
-.PP
+returns the major number of the file format of the savefile;
.B pcap_minor_version()
-returns the minor number of the version of the pcap used to write the
-savefile.
+returns the minor number of the file format of the savefile. The
+version number is stored in the header of the savefile.
.PP
.B pcap_file()
returns the standard I/O stream of the ``savefile,'' if a ``savefile''
.BR strerror (1)
isn't available.
.PP
+.B pcap_lib_version()
+returns a pointer to a string giving the version number of the libpcap
+library being used.
+.PP
.B pcap_close()
closes the files associated with
.I p
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.45 2003-01-23 07:24:52 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.46 2003-02-11 07:40:09 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#include "pcap-int.h"
+#include "version.h"
int
pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
pcap_freecode(&p->fcode);
free(p);
}
+
+/*
+ * Generate the version string at run time, so that if libpcap is a
+ * shared library, it reflects the version of the library with
+ * which the program calling "pcap_lib_version()" is running, not
+ * the version with which it was built (on at least some UNIXes,
+ * constant data is linked in at build time).
+ */
+const char *
+pcap_lib_version(void)
+{
+ static char version_string[10+1+10+1];
+
+ if (version_string[0] == '\0') {
+ /*
+ * We haven't built the string yet.
+ */
+ snprintf(version_string, sizeof (version_string), "%u.%u",
+ VERSION_MAJOR, VERSION_MINOR);
+ }
+ return (version_string);
+}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.42 2003-02-11 01:46:06 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.43 2003-02-11 07:40:09 guy Exp $ (LBL)
*/
#ifndef lib_pcap_h
int pcap_findalldevs(pcap_if_t **, char *);
void pcap_freealldevs(pcap_if_t *);
+const char *pcap_lib_version(void);
+
/* XXX this guy lives in the bpf tree */
u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);
int bpf_validate(struct bpf_insn *f, int len);