Add a new "ipproto.h" header file, with definitions of IP protocol type

values.  Use that rather than private definitions in various files.

Add "gmpls.h" to the list of files in FILES, and add it and "ipfc.h" to
the list of files in INSTALL.
This commit is contained in:
guy 2003-06-07 11:57:51 +00:00
parent dd6c78cdaa
commit c90e936060
11 changed files with 149 additions and 73 deletions

2
FILES
View File

@ -31,6 +31,7 @@ ether.h
ethertype.h
extract.h
fddi.h
gmpls.h
gmt2local.c
gmt2local.h
icmp6.h
@ -41,6 +42,7 @@ interface.h
ip.h
ip6.h
ipfc.h
ipproto.h
ipsec_doi.h
ipx.h
isakmp.h

View File

@ -1,4 +1,4 @@
@(#) $Header: /tcpdump/master/tcpdump/Attic/INSTALL,v 1.53 2003-03-08 08:55:33 guy Exp $ (LBL)
@(#) $Header: /tcpdump/master/tcpdump/Attic/INSTALL,v 1.54 2003-06-07 11:57:52 guy Exp $ (LBL)
If you have not built libpcap, do so first. See the README
file in this directory for the ftp location.
@ -73,6 +73,7 @@ ether.h - Ethernet definitions
ethertype.h - Ethernet type value definitions
extract.h - alignment definitions
fddi.h - Fiber Distributed Data Interface definitions
gmpls.h - GMPLS definitions
gmt2local.c - time conversion routines
gmt2local.h - time conversion prototypes
icmp6.h - ICMPv6 definitiions
@ -82,6 +83,8 @@ install-sh - BSD style install script
interface.h - globals, prototypes and definitions
ip.h - IP definitions
ip6.h - IPv6 definitions
ipfc.h - IP-over-Fibre Channel definitions
ipproto.h - IP protocol type value definitions
ipsec_doi.h - ISAKMP packet definitions - RFC2407
ipx.h - IPX definitions
isakmp.h - ISAKMP packet definitions - RFC2408

123
ipproto.h Normal file
View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 1982, 1986, 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.
*
* @(#) $Header: /tcpdump/master/tcpdump/ipproto.h,v 1.1 2003-06-07 11:57:52 guy Exp $ (LBL)
*
* From:
* @(#)in.h 8.3 (Berkeley) 1/3/94
* $FreeBSD: src/sys/netinet/in.h,v 1.38.2.3 1999/08/29 16:29:34 peter Exp $
*/
#ifndef IPPROTO_IP
#define IPPROTO_IP 0 /* dummy for IP */
#endif
#ifndef IPPROTO_HOPOPTS
#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
#endif
#ifndef IPPROTO_ICMP
#define IPPROTO_ICMP 1 /* control message protocol */
#endif
#ifndef IPPROTO_IGMP
#define IPPROTO_IGMP 2 /* group mgmt protocol */
#endif
#ifndef IPPROTO_IPV4
#define IPPROTO_IPV4 4
#endif
#ifndef IPPROTO_TCP
#define IPPROTO_TCP 6 /* tcp */
#endif
#ifndef IPPROTO_EGP
#define IPPROTO_EGP 8 /* exterior gateway protocol */
#endif
#ifndef IPPROTO_IGRP
#define IPPROTO_IGRP 9
#endif
#ifndef IPPROTO_UDP
#define IPPROTO_UDP 17 /* user datagram protocol */
#endif
#ifndef IPPROTO_IPV6
#define IPPROTO_IPV6 41
#endif
#ifndef IPPROTO_ROUTING
#define IPPROTO_ROUTING 43 /* IPv6 routing header */
#endif
#ifndef IPPROTO_FRAGMENT
#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
#endif
#ifndef IPPROTO_RSVP
#define IPPROTO_RSVP 46 /* resource reservation */
#endif
#ifndef IPPROTO_GRE
#define IPPROTO_GRE 47 /* General Routing Encap. */
#endif
#ifndef IPPROTO_ESP
#define IPPROTO_ESP 50 /* SIPP Encap Sec. Payload */
#endif
#ifndef IPPROTO_AH
#define IPPROTO_AH 51 /* SIPP Auth Header */
#endif
#ifndef IPPROTO_MOBILE
#define IPPROTO_MOBILE 55
#endif
#ifndef IPPROTO_ICMPV6
#define IPPROTO_ICMPV6 58 /* ICMPv6 */
#endif
#ifndef IPPROTO_NONE
#define IPPROTO_NONE 59 /* IPv6 no next header */
#endif
#ifndef IPPROTO_DSTOPTS
#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
#endif
#ifndef IPPROTO_MOBILITY
#define IPPROTO_MOBILITY 62
#endif
#ifndef IPPROTO_ND
#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */
#endif
#ifndef IPPROTO_IGRP
#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */
#endif
#ifndef IPPROTO_OSPF
#define IPPROTO_OSPF 89
#endif
#ifndef IPPROTO_PIM
#define IPPROTO_PIM 103
#endif
#ifndef IPPROTO_IPCOMP
#define IPPROTO_IPCOMP 108
#endif
#ifndef IPPROTO_VRRP
#define IPPROTO_VRRP 112
#endif
#ifndef IPPROTO_SCTP
#define IPPROTO_SCTP 132
#endif

View File

@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.13 2002-12-11 07:13:58 guy Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.14 2003-06-07 11:57:52 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -51,6 +51,7 @@ static const char rcsid[] =
#include "extract.h"
#include "tcp.h"
#include "ipproto.h"
struct nfhdr {
u_int32_t ver_cnt; /* version [15], and # of records */

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.72 2003-05-15 16:58:04 hannes Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.73 2003-06-07 11:57:53 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -39,6 +39,7 @@ static const char rcsid[] =
#include "ip.h"
#include "udp.h"
#include "ipproto.h"
/*
* Interface Control Message Protocol Definitions.

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.70 2003-05-02 08:13:55 itojun Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.71 2003-06-07 11:57:53 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -37,6 +37,7 @@ static const char rcsid[] =
#include "ip6.h"
#include "icmp6.h"
#include "ipproto.h"
#include "interface.h"
#include "addrtoname.h"

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.126 2003-05-25 16:40:48 hannes Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.127 2003-06-07 11:57:53 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -39,11 +39,7 @@ static const char rcsid[] =
#include "extract.h" /* must come after interface.h */
#include "ip.h"
/* Compatibility */
#ifndef IPPROTO_ND
#define IPPROTO_ND 77
#endif
#include "ipproto.h"
/*
* print the recorded route in an IP RR, LSRR or SSRR option.
@ -461,9 +457,6 @@ ip_print(register const u_char *bp, register u_int length)
cp = (const u_char *)ip + hlen;
nh = ip->ip_p;
#ifndef IPPROTO_SCTP
#define IPPROTO_SCTP 132
#endif
if (nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
nh != IPPROTO_SCTP) {
(void)printf("%s > %s: ", ipaddr_string(&ip->ip_src),
@ -472,9 +465,6 @@ ip_print(register const u_char *bp, register u_int length)
again:
switch (nh) {
#ifndef IPPROTO_AH
#define IPPROTO_AH 51
#endif
case IPPROTO_AH:
nh = *cp;
advance = ah_print(cp);
@ -482,9 +472,6 @@ again:
len -= advance;
goto again;
#ifndef IPPROTO_ESP
#define IPPROTO_ESP 50
#endif
case IPPROTO_ESP:
{
int enh, padlen;
@ -497,9 +484,6 @@ again:
goto again;
}
#ifndef IPPROTO_IPCOMP
#define IPPROTO_IPCOMP 108
#endif
case IPPROTO_IPCOMP:
{
int enh;
@ -529,9 +513,6 @@ again:
icmp_print(cp, len, (const u_char *)ip, (off & 0x3fff));
break;
#ifndef IPPROTO_IGRP
#define IPPROTO_IGRP 9
#endif
case IPPROTO_IGRP:
igrp_print(cp, len, (const u_char *)ip);
break;
@ -544,21 +525,15 @@ again:
egp_print(cp);
break;
#ifndef IPPROTO_OSPF
#define IPPROTO_OSPF 89
#endif
case IPPROTO_OSPF:
ospf_print(cp, len, (const u_char *)ip);
break;
#ifndef IPPROTO_IGMP
#define IPPROTO_IGMP 2
#endif
case IPPROTO_IGMP:
igmp_print(cp, len);
break;
case 4:
case IPPROTO_IPV4:
/* DVMRP multicast tunnel (ip-in-ip encapsulation) */
ip_print(cp, len);
if (! vflag) {
@ -568,47 +543,29 @@ again:
break;
#ifdef INET6
#ifndef IP6PROTO_ENCAP
#define IP6PROTO_ENCAP 41
#endif
case IP6PROTO_ENCAP:
case IPPROTO_IPV6:
/* ip6-in-ip encapsulation */
ip6_print(cp, len);
break;
#endif /*INET6*/
#ifndef IPPROTO_RSVP
#define IPPROTO_RSVP 46
#endif
case IPPROTO_RSVP:
rsvp_print(cp, len);
break;
#ifndef IPPROTO_GRE
#define IPPROTO_GRE 47
#endif
case IPPROTO_GRE:
/* do it */
gre_print(cp, len);
break;
#ifndef IPPROTO_MOBILE
#define IPPROTO_MOBILE 55
#endif
case IPPROTO_MOBILE:
mobile_print(cp, len);
break;
#ifndef IPPROTO_PIM
#define IPPROTO_PIM 103
#endif
case IPPROTO_PIM:
pim_print(cp, len);
break;
#ifndef IPPROTO_VRRP
#define IPPROTO_VRRP 112
#endif
case IPPROTO_VRRP:
vrrp_print(cp, len, ip->ip_ttl);
break;

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.30 2003-06-03 23:49:22 guy Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.31 2003-06-07 11:57:54 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -41,6 +41,7 @@ static const char rcsid[] =
#include "extract.h"
#include "ip6.h"
#include "ipproto.h"
/*
* print an IP6 datagram.
@ -75,9 +76,6 @@ ip6_print(register const u_char *bp, register u_int length)
while (cp < snapend) {
cp += advance;
#ifndef IPPROTO_SCTP
#define IPPROTO_SCTP 132
#endif
if (cp == (const u_char *)(ip6 + 1)
&& nh != IPPROTO_TCP && nh != IPPROTO_UDP
&& nh != IPPROTO_SCTP) {
@ -101,9 +99,7 @@ ip6_print(register const u_char *bp, register u_int length)
nh = *cp;
fragmented = 1;
break;
#ifndef IPPROTO_MOBILITY
#define IPPROTO_MOBILITY 62
#endif
case IPPROTO_MOBILITY:
/*
* XXX - we don't use "advance"; is this
@ -145,9 +141,6 @@ ip6_print(register const u_char *bp, register u_int length)
len -= padlen;
break;
}
#ifndef IPPROTO_IPCOMP
#define IPPROTO_IPCOMP 108
#endif
case IPPROTO_IPCOMP:
{
int enh;
@ -158,27 +151,21 @@ ip6_print(register const u_char *bp, register u_int length)
break;
}
#ifndef IPPROTO_PIM
#define IPPROTO_PIM 103
#endif
case IPPROTO_PIM:
pim_print(cp, len);
goto end;
#ifndef IPPROTO_OSPF
#define IPPROTO_OSPF 89
#endif
case IPPROTO_OSPF:
ospf6_print(cp, len);
goto end;
case IPPROTO_IPV6:
ip6_print(cp, len);
goto end;
#ifndef IPPROTO_IPV4
#define IPPROTO_IPV4 4
#endif
case IPPROTO_IPV4:
ip_print(cp, len);
goto end;
case IPPROTO_NONE:
(void)printf("no next header");
goto end;

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.104 2002-12-11 07:14:09 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.105 2003-06-07 11:57:54 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -46,6 +46,7 @@ static const char rcsid[] =
#ifdef INET6
#include "ip6.h"
#endif
#include "ipproto.h"
#include "nameser.h"

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.117 2003-05-11 06:01:17 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.118 2003-06-07 11:57:54 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -51,6 +51,7 @@ static const char rcsid[] =
#ifdef INET6
#include "ip6.h"
#endif
#include "ipproto.h"
#include "nameser.h"
#include "nfs.h"

View File

@ -71,7 +71,6 @@ typedef char* caddr_t;
#define MAXHOSTNAMELEN 64
#define NI_MAXHOST 1025
#define IPPROTO_EGP 8 /* Exterior Gateway Protocol */
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define RETSIGTYPE void