diff options
author | bms <bms@FreeBSD.org> | 2004-03-31 09:17:26 +0000 |
---|---|---|
committer | bms <bms@FreeBSD.org> | 2004-03-31 09:17:26 +0000 |
commit | 281e9d71408deb6e8c5046c746c2e97002b0e7fe (patch) | |
tree | eb08e08f0f875c3b16f8e1aec86091f100906f1c /contrib/tcpdump/missing | |
parent | be6faec6d07fc3a2a54836e76d0309c36192dfad (diff) | |
download | FreeBSD-src-281e9d71408deb6e8c5046c746c2e97002b0e7fe.zip FreeBSD-src-281e9d71408deb6e8c5046c746c2e97002b0e7fe.tar.gz |
Import tcpdump 3.8.3, from http://www.tcpdump.org/releases/tcpdump-3.8.3.tar.gz
Diffstat (limited to 'contrib/tcpdump/missing')
-rw-r--r-- | contrib/tcpdump/missing/addrinfo.h | 6 | ||||
-rw-r--r-- | contrib/tcpdump/missing/addrsize.h | 8 | ||||
-rw-r--r-- | contrib/tcpdump/missing/bittypes.h | 6 | ||||
-rw-r--r-- | contrib/tcpdump/missing/datalinks.c | 67 | ||||
-rw-r--r-- | contrib/tcpdump/missing/dlnames.c | 175 | ||||
-rw-r--r-- | contrib/tcpdump/missing/getaddrinfo.c | 24 | ||||
-rw-r--r-- | contrib/tcpdump/missing/getnameinfo.c | 18 | ||||
-rw-r--r-- | contrib/tcpdump/missing/inet_aton.c | 23 | ||||
-rw-r--r-- | contrib/tcpdump/missing/inet_ntop.c | 23 | ||||
-rw-r--r-- | contrib/tcpdump/missing/inet_pton.c | 23 | ||||
-rw-r--r-- | contrib/tcpdump/missing/resolv6.h | 6 | ||||
-rw-r--r-- | contrib/tcpdump/missing/resolv_ext.h | 10 | ||||
-rw-r--r-- | contrib/tcpdump/missing/snprintf.c | 26 | ||||
-rw-r--r-- | contrib/tcpdump/missing/sockstorage.h | 10 | ||||
-rw-r--r-- | contrib/tcpdump/missing/strlcat.c | 16 | ||||
-rw-r--r-- | contrib/tcpdump/missing/strlcpy.c | 16 | ||||
-rw-r--r-- | contrib/tcpdump/missing/strsep.c | 83 |
17 files changed, 428 insertions, 112 deletions
diff --git a/contrib/tcpdump/missing/addrinfo.h b/contrib/tcpdump/missing/addrinfo.h index 7a32937..09f6a42 100644 --- a/contrib/tcpdump/missing/addrinfo.h +++ b/contrib/tcpdump/missing/addrinfo.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ -/* $Id: addrinfo.h,v 1.3 2000/10/24 00:56:52 fenner Exp $ */ +/* $Id: addrinfo.h,v 1.4 2002/06/11 17:13:36 itojun Exp $ */ #ifndef HAVE_ADDRINFO diff --git a/contrib/tcpdump/missing/addrsize.h b/contrib/tcpdump/missing/addrsize.h index 2880956..13db4da 100644 --- a/contrib/tcpdump/missing/addrsize.h +++ b/contrib/tcpdump/missing/addrsize.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -26,11 +26,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#ifndef INADDRSZ +#ifndef INADDRSZ #define INADDRSZ 4 /* IPv4 T_A */ #endif #ifndef IN6ADDRSZ #define IN6ADDRSZ 16 /* IPv6 T_AAAA */ -#endif +#endif diff --git a/contrib/tcpdump/missing/bittypes.h b/contrib/tcpdump/missing/bittypes.h index 500f39f..577da94 100644 --- a/contrib/tcpdump/missing/bittypes.h +++ b/contrib/tcpdump/missing/bittypes.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -38,7 +38,7 @@ typedef unsigned int u_int8_t; #endif /* HAVE_U_INT8_T */ -#ifndef HAVE_U_INT16_T +#ifndef HAVE_U_INT16_T #if SIZEOF_SHORT == 2 typedef unsigned short u_int16_t; diff --git a/contrib/tcpdump/missing/datalinks.c b/contrib/tcpdump/missing/datalinks.c new file mode 100644 index 0000000..9439142 --- /dev/null +++ b/contrib/tcpdump/missing/datalinks.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/datalinks.c,v 1.1.2.3 2003/11/16 09:29:48 guy Exp $ (LBL)"; +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <tcpdump-stdinc.h> + +#include <pcap.h> +#include <stdlib.h> +#include <stdio.h> + +#include "pcap-missing.h" + +/* + * Stub versions for platforms that don't support them. + */ +int +pcap_list_datalinks(pcap_t *p, int **dlt_buffer) +{ + /* + * This platform doesn't support changing the DLT for an + * interface. Return a list of DLTs containing only the + * DLT this device supports. + */ + *dlt_buffer = (int*)malloc(sizeof(**dlt_buffer)); + if (*dlt_buffer == NULL) + return (-1); + **dlt_buffer = pcap_datalink(p); + return (1); +} diff --git a/contrib/tcpdump/missing/dlnames.c b/contrib/tcpdump/missing/dlnames.c new file mode 100644 index 0000000..97f3788 --- /dev/null +++ b/contrib/tcpdump/missing/dlnames.c @@ -0,0 +1,175 @@ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/dlnames.c,v 1.2.2.3 2003/11/18 23:12:12 guy Exp $ (LBL)"; +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <tcpdump-stdinc.h> + +#include <pcap.h> +#include <string.h> + +#include "pcap-missing.h" + +struct dlt_choice { + const char *name; + const char *description; + int dlt; +}; + +#define DLT_CHOICE(code, description) { #code, description, code } +#define DLT_CHOICE_SENTINEL { NULL, NULL, 0 } + +static struct dlt_choice dlt_choices[] = { + DLT_CHOICE(DLT_NULL, "BSD loopback"), + DLT_CHOICE(DLT_EN10MB, "Ethernet"), + DLT_CHOICE(DLT_IEEE802, "Token ring"), + DLT_CHOICE(DLT_ARCNET, "ARCNET"), + DLT_CHOICE(DLT_SLIP, "SLIP"), + DLT_CHOICE(DLT_PPP, "PPP"), + DLT_CHOICE(DLT_FDDI, "FDDI"), + DLT_CHOICE(DLT_ATM_RFC1483, "RFC 1483 IP-over-ATM"), + DLT_CHOICE(DLT_RAW, "Raw IP"), +#ifdef DLT_SLIP_BSDOS + DLT_CHOICE(DLT_SLIP_BSDOS, "BSD/OS SLIP"), +#endif +#ifdef DLT_PPP_BSDOS + DLT_CHOICE(DLT_PPP_BSDOS, "BSD/OS PPP"), +#endif +#ifdef DLT_ATM_CLIP + DLT_CHOICE(DLT_ATM_CLIP, "Linux Classical IP-over-ATM"), +#endif +#ifdef DLT_PPP_SERIAL + DLT_CHOICE(DLT_PPP_SERIAL, "PPP over serial"), +#endif +#ifdef DLT_PPP_ETHER + DLT_CHOICE(DLT_PPP_ETHER, "PPPoE"), +#endif +#ifdef DLT_C_HDLC + DLT_CHOICE(DLT_C_HDLC, "Cisco HDLC"), +#endif +#ifdef DLT_IEEE802_11 + DLT_CHOICE(DLT_IEEE802_11, "802.11"), +#endif +#ifdef DLT_FRELAY + DLT_CHOICE(DLT_FRELAY, "Frame Relay"), +#endif +#ifdef DLT_LOOP + DLT_CHOICE(DLT_LOOP, "OpenBSD loopback"), +#endif +#ifdef DLT_ENC + DLT_CHOICE(DLT_ENC, "OpenBSD encapsulated IP"), +#endif +#ifdef DLT_LINUX_SLL + DLT_CHOICE(DLT_LINUX_SLL, "Linux cooked"), +#endif +#ifdef DLT_LTALK + DLT_CHOICE(DLT_LTALK, "Localtalk"), +#endif +#ifdef DLT_PFLOG + DLT_CHOICE(DLT_PFLOG, "OpenBSD pflog file"), +#endif +#ifdef DLT_PRISM_HEADER + DLT_CHOICE(DLT_PRISM_HEADER, "802.11 plus Prism header"), +#endif +#ifdef DLT_IP_OVER_FC + DLT_CHOICE(DLT_IP_OVER_FC, "RFC 2625 IP-over-Fibre Channel"), +#endif +#ifdef DLT_SUNATM + DLT_CHOICE(DLT_SUNATM, "Sun raw ATM"), +#endif +#ifdef DLT_IEEE802_11_RADIO + DLT_CHOICE(DLT_IEEE802_11_RADIO, "802.11 plus radio information header"), +#endif +#ifdef DLT_ARCNET_LINUX + DLT_CHOICE(DLT_ARCNET_LINUX, "Linux ARCNET"), +#endif +#ifdef DLT_LINUX_IRDA + DLT_CHOICE(DLT_LINUX_IRDA, "Linux IrDA"), +#endif +#ifdef DLT_LANE8023 + DLT_CHOICE(DLT_LANE8023, "Linux 802.3 LANE"), +#endif +#ifdef DLT_CIP + DLT_CHOICE(DLT_CIP, "Linux Classical IP-over-ATM"), +#endif +#ifdef DLT_HDLC + DLT_CHOICE(DLT_HDLC, "Cisco HDLC"), +#endif + DLT_CHOICE_SENTINEL +}; + +#ifndef HAVE_PCAP_DATALINK_NAME_TO_VAL +int +pcap_datalink_name_to_val(const char *name) +{ + int i; + + for (i = 0; dlt_choices[i].name != NULL; i++) { + if (strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1, + name) == 0) + return (dlt_choices[i].dlt); + } + return (-1); +} + +const char * +pcap_datalink_val_to_name(int dlt) +{ + int i; + + for (i = 0; dlt_choices[i].name != NULL; i++) { + if (dlt_choices[i].dlt == dlt) + return (dlt_choices[i].name + sizeof("DLT_") - 1); + } + return (NULL); +} +#endif + +const char * +pcap_datalink_val_to_description(int dlt) +{ + int i; + + for (i = 0; dlt_choices[i].name != NULL; i++) { + if (dlt_choices[i].dlt == dlt) + return (dlt_choices[i].description); + } + return (NULL); +} diff --git a/contrib/tcpdump/missing/getaddrinfo.c b/contrib/tcpdump/missing/getaddrinfo.c index 89b812d..2a9e0e1 100644 --- a/contrib/tcpdump/missing/getaddrinfo.c +++ b/contrib/tcpdump/missing/getaddrinfo.c @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -47,11 +47,11 @@ #ifdef HAVE_CONFIG_H #include <config.h> -#endif +#endif #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/missing/getaddrinfo.c,v 1.10 2000/10/24 00:56:53 fenner Exp $"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/getaddrinfo.c,v 1.11.2.2 2003/11/16 08:52:00 guy Exp $"; #endif #include <sys/types.h> @@ -76,11 +76,11 @@ static const char rcsid[] = #ifndef HAVE_U_INT32_T #include "bittypes.h" -#endif +#endif #ifndef HAVE_SOCKADDR_STORAGE #include "sockstorage.h" -#endif +#endif #ifdef NEED_ADDRINFO_H #include "addrinfo.h" @@ -104,7 +104,7 @@ static const char in_addrany[] = { 0, 0, 0, 0 }; static const char in6_addrany[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static const char in_loopback[] = { 127, 0, 0, 1 }; +static const char in_loopback[] = { 127, 0, 0, 1 }; static const char in6_loopback[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; @@ -122,7 +122,7 @@ static const struct afd { int a_socklen; int a_off; const char *a_addrany; - const char *a_loopback; + const char *a_loopback; int a_scoped; } afdl [] = { #ifdef INET6 @@ -323,7 +323,7 @@ getaddrinfo(hostname, servname, hints, res) pai->ai_canonname = NULL; pai->ai_addr = NULL; pai->ai_next = NULL; - + if (hostname == NULL && servname == NULL) return EAI_NONAME; if (hints) { @@ -813,7 +813,7 @@ explore_numeric(pai, hostname, servname, res) } while (cur && cur->ai_next) cur = cur->ai_next; - } else + } else ERR(EAI_FAMILY); /*xxx*/ } @@ -948,7 +948,7 @@ get_name(addr, afd, res, numaddr, pai, servname) GET_AI(cur, afd, numaddr); GET_PORT(cur, servname); } - + #ifdef USE_GETIPNODEBY if (hp) freehostent(hp); diff --git a/contrib/tcpdump/missing/getnameinfo.c b/contrib/tcpdump/missing/getnameinfo.c index 502ac7f..f39770c 100644 --- a/contrib/tcpdump/missing/getnameinfo.c +++ b/contrib/tcpdump/missing/getnameinfo.c @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -39,11 +39,11 @@ #ifdef HAVE_CONFIG_H #include <config.h> -#endif +#endif #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/missing/getnameinfo.c,v 1.8 2000/10/24 00:56:53 fenner Exp $"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/getnameinfo.c,v 1.9.2.2 2003/11/16 08:52:00 guy Exp $"; #endif #include <sys/types.h> @@ -124,7 +124,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) if (sa->sa_len != salen) return ENI_SALEN; #endif - + family = sa->sa_family; for (i = 0; afdl[i].a_af; i++) if (afdl[i].a_af == family) { @@ -132,11 +132,11 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) goto found; } return ENI_FAMILY; - + found: if (salen != afd->a_socklen) return ENI_SALEN; - + port = ((struct sockinet *)sa)->si_port; /* network byte order */ addr = (char *)sa + afd->a_off; @@ -174,7 +174,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) flags |= NI_NUMERICHOST; v4a >>= IN_CLASSA_NSHIFT; if (v4a == 0) - flags |= NI_NUMERICHOST; + flags |= NI_NUMERICHOST; break; #ifdef INET6 case AF_INET6: diff --git a/contrib/tcpdump/missing/inet_aton.c b/contrib/tcpdump/missing/inet_aton.c index 3d4ebf9..b12c105 100644 --- a/contrib/tcpdump/missing/inet_aton.c +++ b/contrib/tcpdump/missing/inet_aton.c @@ -2,27 +2,27 @@ * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Kungliga Tekniska * Högskolan and its contributors. - * + * * 4. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -36,17 +36,14 @@ * SUCH DAMAGE. */ -/* $Id: inet_aton.c,v 1.2 2000/01/09 21:35:45 fenner Exp $ */ +/* $Id: inet_aton.c,v 1.4.2.2 2003/11/16 08:52:01 guy Exp $ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/missing/inet_aton.c,v 1.2 2000/01/09 21:35:45 fenner Exp $"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/inet_aton.c,v 1.4.2.2 2003/11/16 08:52:01 guy Exp $"; #endif -#include <sys/types.h> -#include <netinet/in.h> -#include <netdb.h> -#include <arpa/inet.h> +#include <tcpdump-stdinc.h> /* Minimal implementation of inet_aton. * Cannot distinguish between failure and a local broadcast address. */ diff --git a/contrib/tcpdump/missing/inet_ntop.c b/contrib/tcpdump/missing/inet_ntop.c index a43c429..175face 100644 --- a/contrib/tcpdump/missing/inet_ntop.c +++ b/contrib/tcpdump/missing/inet_ntop.c @@ -2,27 +2,27 @@ * Copyright (c) 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Kungliga Tekniska * Högskolan and its contributors. - * + * * 4. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -36,18 +36,17 @@ * SUCH DAMAGE. */ -/* $Id: inet_ntop.c,v 1.3 2000/01/09 21:35:45 fenner Exp $ */ +/* $Id: inet_ntop.c,v 1.5.2.2 2003/11/16 08:52:01 guy Exp $ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/missing/inet_ntop.c,v 1.3 2000/01/09 21:35:45 fenner Exp $"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/inet_ntop.c,v 1.5.2.2 2003/11/16 08:52:01 guy Exp $"; #endif +#include <tcpdump-stdinc.h> + #include <stdio.h> #include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> /* * diff --git a/contrib/tcpdump/missing/inet_pton.c b/contrib/tcpdump/missing/inet_pton.c index 34ec0af..f1eecf1 100644 --- a/contrib/tcpdump/missing/inet_pton.c +++ b/contrib/tcpdump/missing/inet_pton.c @@ -2,27 +2,27 @@ * Copyright (c) 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Kungliga Tekniska * Högskolan and its contributors. - * + * * 4. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -36,17 +36,16 @@ * SUCH DAMAGE. */ -/* $Id: inet_pton.c,v 1.2 2000/01/09 21:35:46 fenner Exp $ */ +/* $Id: inet_pton.c,v 1.4.2.2 2003/11/16 08:52:01 guy Exp $ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/missing/inet_pton.c,v 1.2 2000/01/09 21:35:46 fenner Exp $"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/inet_pton.c,v 1.4.2.2 2003/11/16 08:52:01 guy Exp $"; #endif +#include <tcpdump-stdinc.h> + #include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> int inet_pton(int af, const char *src, void *dst) diff --git a/contrib/tcpdump/missing/resolv6.h b/contrib/tcpdump/missing/resolv6.h index b1d45c0..ccee03e 100644 --- a/contrib/tcpdump/missing/resolv6.h +++ b/contrib/tcpdump/missing/resolv6.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -33,4 +33,4 @@ */ #ifndef HAVE_RES_USE_INET6 #define RES_USE_INET6 0x80000000 /* use/map IPv6 in gethostbyname() */ -#endif +#endif diff --git a/contrib/tcpdump/missing/resolv_ext.h b/contrib/tcpdump/missing/resolv_ext.h index c33ed7e..92c531d 100644 --- a/contrib/tcpdump/missing/resolv_ext.h +++ b/contrib/tcpdump/missing/resolv_ext.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -29,7 +29,7 @@ #ifndef MAXRESOLVSORT /* XXX */ #define MAXRESOLVSORT 10 /* number of net to sort on */ -#endif +#endif #ifndef HAVE_RES_STATE_EXT struct __res_state_ext { @@ -40,10 +40,10 @@ struct __res_state_ext { struct in_addr ina; #ifdef INET6 struct in6_addr in6a; -#endif +#endif } addr, mask; } sort_list[MAXRESOLVSORT]; }; -#endif +#endif extern struct __res_state_ext _res_ext; diff --git a/contrib/tcpdump/missing/snprintf.c b/contrib/tcpdump/missing/snprintf.c index 1d4ab71..c569bb8 100644 --- a/contrib/tcpdump/missing/snprintf.c +++ b/contrib/tcpdump/missing/snprintf.c @@ -2,22 +2,22 @@ * Copyright (c) 1995-1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,15 +31,15 @@ * SUCH DAMAGE. */ -/* $Id: snprintf.c,v 1.5 2001/01/12 10:14:40 guy Exp $ */ +/* $Id: snprintf.c,v 1.6.2.2 2003/11/16 08:52:02 guy Exp $ */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/missing/snprintf.c,v 1.5 2001/01/12 10:14:40 guy Exp $"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/snprintf.c,v 1.6.2.2 2003/11/16 08:52:02 guy Exp $"; #endif #include <stdio.h> @@ -214,7 +214,7 @@ append_number(struct state *state, state->s[-i-1] = state->s[-len+i]; state->s[-len+i] = c; } - + return 0; } @@ -258,13 +258,13 @@ append_char(struct state *state, while(!(flags & minus_flag) && --width > 0) if((*state->append_char) (state, ' ')) return 1; - + if((*state->append_char) (state, arg)) return 1; while((flags & minus_flag) && --width > 0) if((*state->append_char) (state, ' ')) return 1; - + return 0; } @@ -313,7 +313,7 @@ xyzprintf (struct state *state, const char *char_format, va_list ap) else break; } - + if((flags & space_flag) && (flags & plus_flag)) flags ^= space_flag; @@ -365,7 +365,7 @@ xyzprintf (struct state *state, const char *char_format, va_list ap) if (append_string(state, va_arg(ap, unsigned char*), width, - prec, + prec, flags)) return -1; break; diff --git a/contrib/tcpdump/missing/sockstorage.h b/contrib/tcpdump/missing/sockstorage.h index 557eb4d..e733328 100644 --- a/contrib/tcpdump/missing/sockstorage.h +++ b/contrib/tcpdump/missing/sockstorage.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -28,11 +28,11 @@ */ struct sockaddr_storage { #ifdef HAVE_SOCKADDR_SA_LEN - u_int8_t __ss_len; - u_int8_t __ss_family; + u_int8_t ss_len; + u_int8_t ss_family; u_int8_t fill[126]; #else - u_int8_t __ss_family; + u_int8_t ss_family; u_int8_t fill[127]; #endif /* HAVE_SOCKADDR_SA_LEN */ }; diff --git a/contrib/tcpdump/missing/strlcat.c b/contrib/tcpdump/missing/strlcat.c index 92f46a9..7e9cdba 100644 --- a/contrib/tcpdump/missing/strlcat.c +++ b/contrib/tcpdump/missing/strlcat.c @@ -29,16 +29,17 @@ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/missing/strlcat.c,v 1.1 2000/01/19 05:34:19 itojun Exp $ (LBL)"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/strlcat.c,v 1.3.2.2 2003/11/16 08:52:03 guy Exp $ (LBL)"; #endif +#ifdef HAVE_CONFIG_H #include <config.h> +#endif -#include <sys/types.h> -#include <string.h> +#include <tcpdump-stdinc.h> -#include "interface.h" +#include <string.h> /* * Appends src to string dst of size siz (unlike strncat, siz is the @@ -47,10 +48,7 @@ static const char rcsid[] = * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t -strlcat(dst, src, siz) - char *dst; - const char *src; - size_t siz; +strlcat(char *dst, const char *src, size_t siz) { register char *d = dst; register const char *s = src; diff --git a/contrib/tcpdump/missing/strlcpy.c b/contrib/tcpdump/missing/strlcpy.c index f55121d..12747dd 100644 --- a/contrib/tcpdump/missing/strlcpy.c +++ b/contrib/tcpdump/missing/strlcpy.c @@ -29,16 +29,17 @@ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/missing/strlcpy.c,v 1.1 2000/01/19 05:34:19 itojun Exp $ (LBL)"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/missing/strlcpy.c,v 1.3.2.2 2003/11/16 08:52:03 guy Exp $ (LBL)"; #endif +#ifdef HAVE_CONFIG_H #include <config.h> +#endif -#include <sys/types.h> -#include <string.h> +#include <tcpdump-stdinc.h> -#include "interface.h" +#include <string.h> /* * Copy src to string dst of size siz. At most siz-1 characters @@ -46,10 +47,7 @@ static const char rcsid[] = * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t -strlcpy(dst, src, siz) - char *dst; - const char *src; - size_t siz; +strlcpy(char *dst, const char *src, size_t siz) { register char *d = dst; register const char *s = src; diff --git a/contrib/tcpdump/missing/strsep.c b/contrib/tcpdump/missing/strsep.c new file mode 100644 index 0000000..19fb6b2 --- /dev/null +++ b/contrib/tcpdump/missing/strsep.c @@ -0,0 +1,83 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char rcsid[] = + "@(#) $Header: /tcpdump/master/tcpdump/missing/strsep.c,v 1.3 2003/03/25 08:33:48 guy Exp $ (LBL)"; +#endif /* LIBC_SCCS and not lint */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <tcpdump-stdinc.h> + +#include <string.h> + +/* + * Get next token from string *stringp, where tokens are possibly-empty + * strings separated by characters from delim. + * + * Writes NULs into the string at *stringp to end tokens. + * delim need not remain constant from call to call. + * On return, *stringp points past the last NUL written (if there might + * be further tokens), or is NULL (if there are definitely no more tokens). + * + * If *stringp is NULL, strsep returns NULL. + */ +char * +strsep(char **stringp, const char *delim) +{ + register char *s; + register const char *spanp; + register int c, sc; + char *tok; + + if ((s = *stringp) == NULL) + return (NULL); + for (tok = s;;) { + c = *s++; + spanp = delim; + do { + if ((sc = *spanp++) == c) { + if (c == 0) + s = NULL; + else + s[-1] = 0; + *stringp = s; + return (tok); + } + } while (sc != 0); + } + /* NOTREACHED */ +} |