Deleted Added
sdiff udiff text old ( 162012 ) new ( 172677 )
full compact
1/*
2 * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35static const char rcsid[] _U_ =
36 "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.88.2.8 2005/08/13 22:29:46 hannes Exp $ (LBL)";
37#endif
38
39#ifdef HAVE_CONFIG_H
40#include "config.h"
41#endif
42
43#ifdef WIN32
44#include <pcap-stdinc.h>

--- 190 unchanged lines hidden (view full) ---

235 if (*dlt_buffer == NULL) {
236 (void)snprintf(p->errbuf, sizeof(p->errbuf),
237 "malloc: %s", pcap_strerror(errno));
238 return (-1);
239 }
240 **dlt_buffer = p->linktype;
241 return (1);
242 } else {
243 *dlt_buffer = (int*)malloc(sizeof(**dlt_buffer) * p->dlt_count);
244 if (*dlt_buffer == NULL) {
245 (void)snprintf(p->errbuf, sizeof(p->errbuf),
246 "malloc: %s", pcap_strerror(errno));
247 return (-1);
248 }
249 (void)memcpy(*dlt_buffer, p->dlt_list,
250 sizeof(**dlt_buffer) * p->dlt_count);
251 return (p->dlt_count);

--- 97 unchanged lines hidden (view full) ---

349 DLT_CHOICE(DLT_PRISM_HEADER, "802.11 plus Prism header"),
350 DLT_CHOICE(DLT_IP_OVER_FC, "RFC 2625 IP-over-Fibre Channel"),
351 DLT_CHOICE(DLT_SUNATM, "Sun raw ATM"),
352 DLT_CHOICE(DLT_IEEE802_11_RADIO, "802.11 plus BSD radio information header"),
353 DLT_CHOICE(DLT_APPLE_IP_OVER_IEEE1394, "Apple IP-over-IEEE 1394"),
354 DLT_CHOICE(DLT_ARCNET_LINUX, "Linux ARCNET"),
355 DLT_CHOICE(DLT_DOCSIS, "DOCSIS"),
356 DLT_CHOICE(DLT_LINUX_IRDA, "Linux IrDA"),
357 DLT_CHOICE(DLT_IEEE802_11_RADIO_AVS, "802.11 plus AVS radio information header"),
358 DLT_CHOICE(DLT_SYMANTEC_FIREWALL, "Symantec Firewall"),
359 DLT_CHOICE(DLT_JUNIPER_ATM1, "Juniper ATM1 PIC"),
360 DLT_CHOICE(DLT_JUNIPER_ATM2, "Juniper ATM2 PIC"),
361 DLT_CHOICE(DLT_JUNIPER_MLPPP, "Juniper Multi-Link PPP"),
362 DLT_CHOICE(DLT_PPP_PPPD, "PPP for pppd, with direction flag"),
363 DLT_CHOICE(DLT_JUNIPER_PPPOE, "Juniper PPPoE"),
364 DLT_CHOICE(DLT_JUNIPER_PPPOE_ATM, "Juniper PPPoE/ATM"),
365 DLT_CHOICE(DLT_GPRS_LLC, "GPRS LLC"),
366 DLT_CHOICE(DLT_GPF_T, "GPF-T"),
367 DLT_CHOICE(DLT_GPF_F, "GPF-F"),
368 DLT_CHOICE(DLT_JUNIPER_PIC_PEER, "Juniper PIC Peer"),
369 DLT_CHOICE(DLT_JUNIPER_MLFR, "Juniper Multi-Link Frame Relay"),
370 DLT_CHOICE(DLT_ERF_ETH, "Ethernet with Endace ERF header"),
371 DLT_CHOICE(DLT_ERF_POS, "Packet-over-SONET with Endace ERF header"),
372 DLT_CHOICE(DLT_JUNIPER_GGSN, "Juniper GGSN PIC"),
373 DLT_CHOICE(DLT_JUNIPER_ES, "Juniper Encryption Services PIC"),
374 DLT_CHOICE(DLT_JUNIPER_MONITOR, "Juniper Passive Monitor PIC"),
375 DLT_CHOICE(DLT_JUNIPER_SERVICES, "Juniper Advanced Services PIC"),
376 DLT_CHOICE(DLT_JUNIPER_MFR, "Juniper FRF.16 Frame Relay"),
377 DLT_CHOICE(DLT_JUNIPER_ETHER, "Juniper Ethernet"),
378 DLT_CHOICE(DLT_JUNIPER_PPP, "Juniper PPP"),
379 DLT_CHOICE(DLT_JUNIPER_FRELAY, "Juniper Frame Relay"),
380 DLT_CHOICE(DLT_JUNIPER_CHDLC, "Juniper C-HDLC"),
381 DLT_CHOICE_SENTINEL
382};
383
384/*
385 * This array is designed for mapping upper and lower case letter
386 * together for a case independent comparison. The mappings are
387 * based upon ascii character sequences.
388 */

--- 63 unchanged lines hidden (view full) ---

452 (u_char)'\370', (u_char)'\371', (u_char)'\372', (u_char)'\373',
453 (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377',
454};
455
456int
457pcap_strcasecmp(const char *s1, const char *s2)
458{
459 register const u_char *cm = charmap,
460 *us1 = (u_char *)s1,
461 *us2 = (u_char *)s2;
462
463 while (cm[*us1] == cm[*us2++])
464 if (*us1++ == '\0')
465 return(0);
466 return (cm[*us1] - cm[*--us2]);
467}
468
469int

--- 196 unchanged lines hidden (view full) ---

666 snprintf (p, sizeof(errbuf)-(p-errbuf), " (%lu)", error);
667 return (errbuf);
668}
669#endif
670
671/*
672 * Not all systems have strerror().
673 */
674char *
675pcap_strerror(int errnum)
676{
677#ifdef HAVE_STRERROR
678 return (strerror(errnum));
679#else
680 extern int sys_nerr;
681 extern const char *const sys_errlist[];
682 static char ebuf[20];

--- 119 unchanged lines hidden (view full) ---

802 * run, various undesirable things may happen (warnings, the string
803 * being the one from the version of the library with which the program
804 * was linked, or even weirder things, such as the string being the one
805 * from the library but being truncated).
806 */
807#ifdef HAVE_VERSION_H
808#include "version.h"
809#else
810static const char pcap_version_string[] = "libpcap version 0.9[.x]";
811#endif
812
813#ifdef WIN32
814/*
815 * XXX - it'd be nice if we could somehow generate the WinPcap and libpcap
816 * version numbers when building WinPcap. (It'd be nice to do so for
817 * the packet.dll version number as well.)
818 */
819static const char wpcap_version_string[] = "3.1";
820static const char pcap_version_string_fmt[] =
821 "WinPcap version %s, based on %s";
822static const char pcap_version_string_packet_dll_fmt[] =
823 "WinPcap version %s (packet.dll version %s), based on %s";
824static char *full_pcap_version_string;
825
826const char *
827pcap_lib_version(void)

--- 81 unchanged lines hidden ---