448 lines
13 KiB
Plaintext
448 lines
13 KiB
Plaintext
; $Header: /usr/cvsroot/target/h/wrn/wm/util/layout/ip.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $
|
|
; Layout information for IP protocols
|
|
|
|
;****************************************************************************
|
|
;
|
|
; *** Restricted Rights Legend ***
|
|
;
|
|
; The programs and information contained herein are licensed only
|
|
; pursuant to a license agreement that contains use, reverse
|
|
; engineering, disclosure, and other restrictions; accordingly, it
|
|
; is "Unpublished--all rights reserved under the applicable
|
|
; copyright laws".
|
|
;
|
|
; Use duplication, or disclosure by the Government is subject to
|
|
; restrictions as set forth in subparagraph (c)(1)(ii) of the Rights
|
|
; in Technical Data and Computer Licensed Programs clause of DFARS
|
|
; 52.227 7013.
|
|
;
|
|
; Copyright 2000-2001 Wind River Systems, Inc.
|
|
; Copyright 1995-1997 Epilogue Technology Corporation.
|
|
; Copyright 1998 Integrated Systems, Inc.
|
|
; All rights reserved.
|
|
;
|
|
; *** Government Use ***
|
|
;
|
|
; The Licensed Programs and their documentation were developed at
|
|
; private expense and no part of them is in the public domain.
|
|
;
|
|
; The Licensed Programs are "Restricted Computer Software" as that
|
|
; term is defined in Clause 52.227-19 of the Federal Acquisition
|
|
; Regulations (FAR) and are "Commercial Computer Software" as that
|
|
; term is defined in Subpart 227.401 of the Department of Defense
|
|
; Federal Acquisition Regulation Supplement (DFARS).
|
|
;
|
|
; (i) If the licensed Programs are supplied to the Department of
|
|
; Defense (DoD), the Licensed Programs are classified as
|
|
; "Commercial Computer Software" and the Government is acquiring
|
|
; only "restricted rights" in the Licensed Programs and their
|
|
; documentation as that term is defined in Clause 52.227
|
|
; 7013(c)(1) of the DFARS, and
|
|
;
|
|
; (ii) If the Licensed Programs are supplied to any unit or agency
|
|
; of the United States Government other than DoD, the
|
|
; Government's rights in the Licensed Programs and their
|
|
; documentation will be as defined in Clause 52.227-19(c)(2) of
|
|
; the FAR.
|
|
;****************************************************************************
|
|
|
|
; $Log: ip.ldb,v $
|
|
; Revision 1.1.1.1 2001/11/05 17:47:20 tneale
|
|
; Tornado shuffle
|
|
;
|
|
; Revision 1.19 2001/01/19 22:22:33 paul
|
|
; Update copyright.
|
|
;
|
|
; Revision 1.18 1999/10/19 20:12:43 sar
|
|
; Update ip and ip6 files with ip6 information
|
|
;
|
|
; Revision 1.17 1998/02/25 15:21:40 sra
|
|
; Finish moving types.h, bug.h, and bugdef.h to common/h/.
|
|
;
|
|
; Revision 1.16 1998/02/25 04:53:59 sra
|
|
; Update copyrights.
|
|
;
|
|
; Revision 1.15 1998/02/20 04:02:37 sra
|
|
; Fix too-long layout macro names.
|
|
;
|
|
; Revision 1.14 1998/01/20 23:03:23 mrf
|
|
; Added IP_PROTOCOL_is_IPV4 definition for tunnels
|
|
;
|
|
; Revision 1.13 1997/09/26 20:21:15 alan
|
|
; Use features of new layout compiler: `use-layouts' and `C-include'.
|
|
;
|
|
; Revision 1.12 1997/09/13 03:11:58 alan
|
|
; Add IGMP_MESSAGE, and ICMP messages of type Router Solicitation and
|
|
; Router Advertisement.
|
|
;
|
|
; Revision 1.11 1997/06/04 05:46:25 alan
|
|
; Fix RCS keywords.
|
|
;
|
|
; Revision 1.10 1997/06/03 22:59:34 alan
|
|
; Use `define-rcs-info'.
|
|
;
|
|
; Revision 1.9 1997/05/28 05:13:51 alan
|
|
; Fix ICMP layouts so that they no longer use internal unions. This makes
|
|
; the size of the variants be what people expect.
|
|
;
|
|
; Revision 1.8 1997/05/21 07:15:30 alan
|
|
; Split out IP4_TYPE_OF_SERVICE.
|
|
;
|
|
; Revision 1.7 1997/05/17 06:43:54 alan
|
|
; Add some more values to IP_PROTOCOL.
|
|
;
|
|
; Revision 1.6 1997/05/15 00:39:23 alan
|
|
; Generate: SIZEOF_ICMP_MESSAGE_MINIMUM_HEADER.
|
|
;
|
|
; Revision 1.5 1997/05/12 23:39:57 alan
|
|
; Add definitions: TCP_OPTION_HEADER and TCP_OPTION_MSS.
|
|
;
|
|
; Revision 1.4 1997/05/12 21:14:14 alan
|
|
; Add definition for `IP_PSEUDO_HEADER'.
|
|
;
|
|
; Revision 1.3 1997/04/22 21:06:02 alan
|
|
; Add BGP to IP_PORT enumeration.
|
|
;
|
|
; Revision 1.2 1997/04/22 00:08:57 alan
|
|
; Fix copyright.
|
|
; Update IP port numbers.
|
|
;
|
|
; Revision 1.1 1997/04/19 04:12:15 alan
|
|
; Move all .ldb files into the `layout' directory.
|
|
;
|
|
; Revision 1.6 1996/12/03 07:52:12 alan
|
|
; Some changes for IPv6.
|
|
;
|
|
; Revision 1.5 1995/08/19 06:22:50 alan
|
|
; Allow getting IP address as a number.
|
|
;
|
|
; Revision 1.4 1995/06/28 23:57:03 alan
|
|
; Add some more port numbers
|
|
;
|
|
; Revision 1.3 1995/06/04 18:35:38 alan
|
|
; Fix typo
|
|
;
|
|
; Revision 1.2 1995/05/25 23:53:33 alan
|
|
; Some enums have a `base' attribute -- some other tweaking.
|
|
;
|
|
; Revision 1.1 1995/05/23 07:17:19 alan
|
|
; Basic network layouts.
|
|
|
|
(define-rcs-info "$Id: ip.ldb,v 1.1.1.1 2001/11/05 17:47:20 tneale Exp $")
|
|
|
|
(C-include EPILOGUE_INSTALL_H <install.h>)
|
|
(C-include EPILOGUE_TYPES_H <common/h/types.h>)
|
|
(C-include EPILOGUE_LAYOUT_LDBGLUE_H <layout/ldbglue.h>)
|
|
|
|
(define-layout IP_PROTOCOL
|
|
(enum (type (unsigned 8))
|
|
(value HOP_BY_HOP_OPTIONS 0) ; v6
|
|
(value ICMP 1)
|
|
(value IGMP 2)
|
|
(value IPV4 4)
|
|
(value TCP 6)
|
|
(value UDP 17)
|
|
(value IPV6 41)
|
|
(value ROUTING 43) ; v6
|
|
(value FRAGMENT 44) ; v6
|
|
(value ESP 50) ; "Encapsulating Secure Payload"
|
|
(value AUTHENTICATION 51)
|
|
(value ICMPV6 58) ; v6
|
|
(value NO_NEXT 59) ; v6
|
|
(value DESTINATION_OPTIONS 60) ; v6
|
|
(value OSPF 89)
|
|
))
|
|
|
|
(define-layout IP_ADDRESS
|
|
(union (size (* 4 8))
|
|
(field BYTES (array (count 4) (type (unsigned 8))))
|
|
(field NUMBER (unsigned (* 4 8)))
|
|
(field OPAQUE (opaque (* 4 8)))))
|
|
|
|
(define-layout IP_PORT
|
|
(union (size 16)
|
|
(field NUMBER (unsigned 16))
|
|
(field OPAQUE (enum (type (opaque 16))
|
|
(value ECHO 7)
|
|
(value DISCARD 9)
|
|
(value USERS 11)
|
|
(value DAYTIME 13)
|
|
(value QUOTE 17)
|
|
(value FTP 21)
|
|
(value SSH 22)
|
|
(value TELNET 23)
|
|
(value SMTP 25)
|
|
(value TIME 37)
|
|
(value DOMAIN 53)
|
|
(value TFTP 69)
|
|
(value GOPHER 70)
|
|
(value FINGER 79)
|
|
(value WWW 80)
|
|
(value SUPDUP 95)
|
|
(value SUNRPC 111)
|
|
(value NNTP 119)
|
|
(value NTP 123)
|
|
(value IMAP2 143)
|
|
(value PCMAIL 158)
|
|
(value SNMP 161)
|
|
(value SNMP_TRAP 162)
|
|
(value BGP 179)
|
|
(value SMUX 199)
|
|
(value IMAP3 220)
|
|
(value BSD_TCP_EXEC 512)
|
|
(value BSD_UDP_BIFF 512)
|
|
(value BSD_TCP_LOGIN 513)
|
|
(value BSD_UDP_WHO 513)
|
|
(value BSD_TCP_SHELL 514)
|
|
(value BSD_UDP_SYSLOG 514)
|
|
(value BSD_PRINTER 515)
|
|
(value BSD_TALK 517)
|
|
(value BSD_NTALK 518)
|
|
(value RIP 520)
|
|
(value BSD_TIMED 525)
|
|
(value BSD_TEMPO 526)
|
|
(value BSD_COURIER 530)
|
|
(value BSD_CONFERENCE 531)
|
|
(value BSD_NETNEWS 532)
|
|
(value BSD_NETWALL 533)
|
|
(value BSD_UUCP 540)
|
|
(value BSD_REMOTEFS 556)
|
|
(value KLOGIN 543)
|
|
(value KSHELL 544)
|
|
(value KERBEROS_ADM 749)
|
|
(value WEBSTER 765)))))
|
|
|
|
(define-layout IP4_TYPE_OF_SERVICE
|
|
(struct (size 8)
|
|
(align 1)
|
|
(field PRECEDENCE (unsigned 3))
|
|
(field LOW_DELAY (boolean 1))
|
|
(field HIGH_THROUGHPUT (boolean 1))
|
|
(field HIGH_RELIABILITY (boolean 1))
|
|
(fill 2) ; MBZ
|
|
))
|
|
|
|
(define-layout IP_HEADER
|
|
(struct (size (* 5 32)) ; error check
|
|
(struct (align 4)
|
|
(field VERSION
|
|
(enum (type (unsigned 4))
|
|
(value IPV4 4)
|
|
(value IPV6 6)))
|
|
(field HEADER_LENGTH (unsigned 4)))
|
|
(field TYPE_OF_SERVICE (unsigned (sizeof IP4_TYPE_OF_SERVICE)))
|
|
(field TOTAL_LENGTH (unsigned 16))
|
|
(field IDENTIFICATION (opaque 16))
|
|
(field FRAGMENT
|
|
(struct (size 16) ; error check
|
|
(align 1)
|
|
(fill 1) ; MBZ
|
|
(field DONT (boolean 1))
|
|
(field MORE (boolean 1))
|
|
(field OFFSET (unsigned 13))))
|
|
(field TIME_TO_LIVE (unsigned 8))
|
|
(field PROTOCOL IP_PROTOCOL)
|
|
(field HEADER_CHECKSUM (unsigned 16))
|
|
(field SOURCE_ADDRESS IP_ADDRESS)
|
|
(field DESTINATION_ADDRESS IP_ADDRESS)
|
|
(field OPTIONS
|
|
(array (count 0)
|
|
(type (enum (type (unsigned 8)) ; <Length>
|
|
(value END 0) ; 1
|
|
(value NOOP 1) ; 1
|
|
(value SECURITY 130) ; 11
|
|
(value LSRR 131)
|
|
(value SSRR 137)
|
|
(value RECORD_ROUTE 7)
|
|
(value STREAM_ID 136) ; 4
|
|
(value TIMESTAMP 68)
|
|
))))
|
|
))
|
|
|
|
(define-layout IP_PSEUDO_HEADER
|
|
;; for computing UDP or TCP checksums
|
|
(struct (size (* 3 32))
|
|
(field SOURCE_ADDRESS IP_ADDRESS)
|
|
(field DESTINATION_ADDRESS IP_ADDRESS)
|
|
(fill 8) ; MBZ
|
|
(field PROTOCOL IP_PROTOCOL)
|
|
(field PAYLOAD_LENGTH (unsigned 16))))
|
|
|
|
(define-layout IGMP_MESSAGE
|
|
(struct (size (* 2 32)) ; error check
|
|
(struct (align 4)
|
|
(field VERSION (unsigned 4))
|
|
(field TYPE (enum (type (unsigned 4))
|
|
(value QUERY 1)
|
|
(value REPORT 2))))
|
|
(fill 8) ; MBZ
|
|
(field CHECKSUM (unsigned 16))
|
|
(field GROUP_ADDRESS IP_ADDRESS)
|
|
))
|
|
|
|
(define-layout ICMP_MESSAGE
|
|
(union (struct ;; Many ICMP messages share these fields:
|
|
(field TYPE (enum (type (unsigned 8))
|
|
(value ECHO_REPLY 0)
|
|
(value DESTINATION_UNREACHABLE 3)
|
|
(value SOURCE_QUENCH 4)
|
|
(value REDIRECT 5)
|
|
(value ECHO 8)
|
|
(value ROUTER_ADVERTISEMENT 9)
|
|
(value ROUTER_SOLICITATION 10)
|
|
(value TIME_EXCEEDED 11)
|
|
(value PARAMETER_PROBLEM 12)
|
|
(value TIMESTAMP 13)
|
|
(value TIMESTAMP_REPLY 14)
|
|
(value INFO_REQUEST 15)
|
|
(value INFO_REPLY 16)
|
|
))
|
|
(fill 8) ; the CODE
|
|
(field CHECKSUM (unsigned 16)) ; always
|
|
(field IDENTIFICATION (opaque 16)) ; sometimes
|
|
(field SEQUENCE_NUMBER (unsigned 16)) ; sometimes
|
|
(field HEADER IP_HEADER) ; sometimes
|
|
)
|
|
|
|
;; Usefull size to know
|
|
(field MINIMUM_HEADER (struct (size (* 8 8)) ; error check
|
|
(fill 8) ; TYPE
|
|
(fill 8) ; CODE
|
|
(fill 16) ; CHECKSUM
|
|
(fill 16) ; IDENTIFICATION
|
|
(fill 16) ; SEQUENCE_NUMBER
|
|
))
|
|
|
|
;; Destination Unreachable Message
|
|
(field DU (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value NET 0)
|
|
(value HOST 1)
|
|
(value PROTOCOL 2)
|
|
(value PORT 3)
|
|
(value CANT_FRAGMENT 4)
|
|
(value ROUTE_FAILED 5)))
|
|
;; contains a datagram
|
|
))
|
|
;; Source Quench Message:
|
|
(field SQ (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value ZERO 0)))
|
|
;; contains a datagram
|
|
))
|
|
;; Redirect Message:
|
|
(field RD (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value NET 0)
|
|
(value HOST 1)
|
|
(value TOS_NET 2)
|
|
(value TOS_HOST 3)))
|
|
(fill 16) ; checksum
|
|
(field GATEWAY IP_ADDRESS)
|
|
;; contains a datagram
|
|
))
|
|
;; Time Exceeded Message:
|
|
(field TE (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value TTL 0)
|
|
(value REASSEMBLY 1)))
|
|
;; contains a datagram
|
|
))
|
|
;; Parameter Problem Message:
|
|
(field PP (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value ZERO 0)))
|
|
(fill 16) ; checksum
|
|
(field POINTER (unsigned 8))
|
|
;; contains a datagram
|
|
))
|
|
;; Echo or Echo Reply Message:
|
|
(field ECHO (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value ZERO 0)))
|
|
(fill 48) ; checksum+ident+sequence
|
|
(field DATA (array (count 0)
|
|
(type (unsigned 8))))))
|
|
;; Timestamp or Timestamp Reply Message:
|
|
(field TIMESTAMP (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value ZERO 0)))
|
|
(fill 48) ; checksum+ident+sequence
|
|
(field ORIGINATE (unsigned 32))
|
|
(field RECEIVE (unsigned 32))
|
|
(field TRANSMIT (unsigned 32))))
|
|
;; Information Request or Information Reply Message:
|
|
(field INFO (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value ZERO 0)))
|
|
(fill 48) ; checksum+ident+sequence
|
|
))
|
|
;; Router Solicitation Message:
|
|
(field RS (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value ZERO 0)))
|
|
(fill 16) ; checksum
|
|
(field RESERVED (unsigned 32))))
|
|
;; Router Advertisement Message:
|
|
(field RA (struct (fill 8) ; the TYPE
|
|
(field CODE (enum (type (unsigned 8))
|
|
(value ZERO 0)))
|
|
(fill 16) ; checksum
|
|
(field NUM_ADDRS (unsigned 8))
|
|
(field ADDR_ENTRY_SIZE (unsigned 8))
|
|
(field LIFETIME (unsigned 16))
|
|
(field ENTRY
|
|
(array (count 0)
|
|
(type (struct (field ADDRESS
|
|
IP_ADDRESS)
|
|
(field PREFERENCE
|
|
(unsigned 32))
|
|
))))
|
|
))
|
|
))
|
|
|
|
(define-layout UDP_HEADER
|
|
(struct (size (* 2 32)) ; error check
|
|
(field SOURCE_PORT IP_PORT)
|
|
(field DESTINATION_PORT IP_PORT)
|
|
(field LENGTH (unsigned 16))
|
|
(field CHECKSUM (unsigned 16))))
|
|
|
|
(define-layout TCP_HEADER
|
|
(struct (size (* 5 32)) ; error check
|
|
(field SOURCE_PORT IP_PORT)
|
|
(field DESTINATION_PORT IP_PORT)
|
|
(field SEQUENCE_NUMBER (unsigned 32))
|
|
(field ACKNOWLEDGE_NUMBER (unsigned 32))
|
|
(struct (size 16) ; error check
|
|
(align 1)
|
|
(field DATA_OFFSET (unsigned 4))
|
|
(fill 6)
|
|
(field URG (boolean 1))
|
|
(field ACK (boolean 1))
|
|
(field PSH (boolean 1))
|
|
(field RST (boolean 1))
|
|
(field SYN (boolean 1))
|
|
(field FIN (boolean 1)))
|
|
(field WINDOW (unsigned 16))
|
|
(field CHECKSUM (unsigned 16))
|
|
(field URGENT_POINTER (unsigned 16))
|
|
(field OPTIONS (struct (size 0)))
|
|
))
|
|
|
|
(define-layout TCP_OPTION_HEADER
|
|
(struct (field KIND (enum (type (unsigned 8)) ; <Length>
|
|
(value END 0) ; 1
|
|
(value NOOP 1) ; 1
|
|
(value MSS 2) ; 4
|
|
))
|
|
(field LENGTH (unsigned 8))))
|
|
|
|
(define-layout TCP_OPTION_MSS
|
|
(struct (fill (sizeof TCP_OPTION_HEADER))
|
|
(field SIZE (unsigned 16))))
|
|
|
|
; Local Variables:
|
|
; mode: Scheme
|
|
; End:
|