#ifndef __IN_LOADED #define __IN_LOADED 1 /**************************************************************************** ** ** - Internet protocol family ** ***************************************************************************** ** Header introduced by the X/Open CAE Specification, Issue 4, Version 2 ***************************************************************************** ** ** Copyright 2005 Hewlett-Packard Development Company, L.P. ** ** Confidential computer software. Valid license from HP and/or ** its subsidiaries required for possession, use, or copying. ** ** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ** Computer Software Documentation, and Technical Data for Commercial ** Items are licensed to the U.S. Government under vendor's standard ** commercial license. ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** or editorial errors or omissions contained herein. The information ** in this document is provided "as is" without warranty of any kind and ** is subject to change without notice. The warranties for HP products ** are set forth in the express limited warranty statements accompanying ** such products. Nothing herein should be construed as constituting an ** additional warranty. ** ***************************************************************************** ** ** Copyright (c) 1982 Regents of the University of California. ** All rights reserved. The Berkeley software License Agreement ** specifies the terms and conditions for redistribution. ** ** in.h 6.5 (Berkeley) 6/8/85 ** ****************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif /* ** The OpenVMS V7.0 release added a second implementation of the socket ** functions which is compatible with BSD 4.4. Define a local to be ** used throughout the remaining header file which reflects which ** implementation is being used. ** ** An application program enables this support by defining _SOCKADDR_LEN ** prior to including this header file. */ #ifdef _SOCKADDR_LEN # if (__CRTL_VER < 70000000) # error " BSD 4.4 Socket package not available before OpenVMS V7.0" # undef _SOCKADDR_LEN # endif #endif /* ** All includes of other header files must be done prior to altering ** the pointer size mode. We include socket.h because we need the ** sa_family_t typedef for Spec1170. */ #include #if !defined (_XOPEN_SOURCE_EXTENDED) # include #endif /* ** Start processing in 32-bit addressing mode */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** Set __nomember_alignment to avoid internal and tail ** padding in structures; default base alignment. ** Required for consistency across programming languages. */ #pragma __member_alignment __save #pragma __nomember_alignment /* ** Define XPG4 IP typedefs */ #if !defined __IN_PORT_T && !defined _DECC_V4_SOURCE # define __IN_PORT_T 1 typedef __in_port_t in_port_t; #endif #if !defined __IN_ADDR_T && !defined _DECC_V4_SOURCE # define __IN_ADDR_T 1 typedef __in_addr_t in_addr_t; #endif #if !defined __SA_FAMILY_T && !defined _DECC_V4_SOURCE # define __SA_FAMILY_T 1 typedef __sa_family_t sa_family_t; #endif /* ** Internet address (a structure for historical reasons). ** The address format can be any of the supported Internet ** address notations. See the DEC TCP/IP Services for OpenVMS ** System Management manual for more information on ** Internet address notations. */ #ifndef __IN_ADDR # define __IN_ADDR 1 struct in_addr { union { struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b; struct { unsigned short s_w1,s_w2; } S_un_w; unsigned long S_addr; #ifdef _XOPEN_SOURCE_EXTENDED __in_addr_t S_addr_xopen; #endif } S_un; }; #ifdef _XOPEN_SOURCE_EXTENDED # define s_addr S_un.S_addr_xopen /* X/Open version of s_addr */ #else # define s_addr S_un.S_addr /* can be used for most tcp & ip code */ #endif # define s_host S_un.S_un_b.s_b2 /* host on imp */ # define s_net S_un.S_un_b.s_b1 /* network */ # define s_imp S_un.S_un_w.s_w2 /* imp */ # define s_impno S_un.S_un_b.s_b4 /* imp # */ # define s_lh S_un.S_un_b.s_b3 /* logical host */ #endif /* * Buffer size to hold IPv4 address as text string */ #define INET_ADDRSTRLEN 16 /* * Constants and structures defined by the internet system, * Per RFC 790, September 1981. */ /* * Protocols */ #define IPPROTO_IP 0 /* dummy for IP */ #define IPPROTO_HOPOPTS 0 /* IPv6 Hop-by-Hop options */ #define IPPROTO_ICMP 1 /* control message protocol */ #define IPPROTO_IGMP 2 /* group mgmt protocol */ #define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ #define IPPROTO_IPIP 4 /* IP inside IP */ #define IPPROTO_IPV4 IPPROTO_IPIP /* IPv4 (tunneled) */ #define IPPROTO_TCP 6 /* tcp */ #define IPPROTO_EGP 8 /* exterior gateway protocol */ #define IPPROTO_PUP 12 /* pup */ #define IPPROTO_UDP 17 /* user datagram protocol */ #define IPPROTO_IDP 22 /* xns idp */ #define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ #define IPPROTO_IPV6 41 /* IPv6 header */ #define IPPROTO_ROUTING 43 /* IPv6 Routing header */ #define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ #define IPPROTO_RSVP 46 /* resource reservation proto */ #define IPPROTO_ESP 50 /* encap. security payload */ #define IPPROTO_AH 51 /* authentication header */ #define IPPROTO_ICMPV6 58 /* ICMPv6 */ #define IPPROTO_NONE 59 /* IPv6 no next header */ #define IPPROTO_DSTOPTS 60 /* IPv6 Destination options */ #define IPPROTO_EON 80 /* ISO cnlp */ #define IPPROTO_IFMP 101 /* Ipsilon Flow Mgmt Protocol*/ #define IPPROTO_IPCOMP 108 /* IP Payload Compression */ #define IPPROTO_SCTP 132 /* SCTP */ #define IPPROTO_MH 135 /* IPv6 Mobility header */ #define IPPROTO_MOBILITY IPPROTO_MH /* IPv6 Mobility header */ #define IPPROTO_RAW 255 /* raw IP packet */ #define IPPROTO_MAX 256 /* * Local port number conventions: * Ports < IPPORT_RESERVED are reserved for * privileged processes (e.g. root). * Ports > IPPORT_USERRESERVED are reserved * for servers, not necessarily privileged. */ #define IPPORT_RESERVED 1024 #define IPPORT_USERRESERVED 5000 /* From Sun 4.1 sources, needed for SUN rpc */ #define IPPORT_TIMESERVER 37 /* ** Link numbers */ #define IMPLINK_IP 155 #define IMPLINK_LOWEXPER 156 #define IMPLINK_HIGHEXPER 158 /* ** Macros for subnetworks. A subnet is distinguished by ** ** (1) the network number is a `local' network number, and ** (2) the most significant bit of the host part is set. ** ** Such addresses include one additional byte in the network number, and ** use one less byte in the host part (i.e., a subnet of a Class A network ** uses the rules for Class B net/host number extraction, a Class B subnet ** is dealt with as if it were a Class C net). Subnets of Class C nets ** are not supported. */ #define SUBNETSHIFT 8 /* used to get main net number from subnet */ #define IN_SUBNETA(i) ((((long)(i))&0x80800000)==0x00800000) #define IN_CLASSA_SUBNET 0xffff0000 #define IN_CLASSA_SUBNSHIFT (IN_CLASSA_NSHIFT - SUBNETSHIFT) #define IN_CLASSA_SUBHOST 0x0000ffff #define IN_SUBNETB(i) ((((long)(i))&0xc0008000)==0x80008000) #define IN_CLASSB_SUBNET 0xffffff00 #define IN_CLASSB_SUBNSHIFT (IN_CLASSB_NSHIFT - SUBNETSHIFT) #define IN_CLASSA_SUBHOST 0x0000ffff #define IN_CLASSB_SUBHOST 0x000000ff /* * Definitions of bits in internet address integers. * On subnets, the decomposition of addresses to host and net parts * is done according to subnet mask, not the masks here. */ #define IN_CLASSA(i) (((int)(i) & 0x80000000) == 0) #define IN_CLASSA_NET 0xff000000 #define IN_CLASSA_NSHIFT 24 #define IN_CLASSA_HOST 0x00ffffff #define IN_CLASSA_MAX 128 #define IN_CLASSB(i) (((int)(i) & 0xc0000000) == 0x80000000) #define IN_CLASSB_NET 0xffff0000 #define IN_CLASSB_NSHIFT 16 #define IN_CLASSB_HOST 0x0000ffff #define IN_CLASSB_MAX 65536 #define IN_CLASSC(i) (((int)(i) & 0xe0000000) == 0xc0000000) #define IN_CLASSC_NET 0xffffff00 #define IN_CLASSC_NSHIFT 8 #define IN_CLASSC_HOST 0x000000ff #define IN_CLASSD(i) (((int)(i) & 0xf0000000) == 0xe0000000) #define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ #define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ #define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ #define IN_MULTICAST(i) IN_CLASSD(i) #define IN_EXPERIMENTAL(i) (((int)(i) & 0xe0000000) == 0xe0000000) #define IN_BADCLASS(i) (((int)(i) & 0xf0000000) == 0xf0000000) #define INADDR_ANY (unsigned int)0x00000000 #define INADDR_BROADCAST (unsigned int)0xffffffff /* must be masked */ #define INADDR_LOOPBACK (unsigned int)0x7F000001 #define INADDR_UNSPEC_GROUP (unsigned int)0xe0000000 /* 224.0.0.0 */ #define INADDR_ALLHOSTS_GROUP (unsigned int)0xe0000001 /* 224.0.0.1 */ #define INADDR_MAX_LOCAL_GROUP (unsigned int)0xe00000ff /* 224.0.0.255 */ #define INADDR_NONE 0xffffffff /* -1 return */ #define IN_LOOPBACKNET 127 /* official! */ /* * Socket address, internet style. */ #if defined(_SOCKADDR_LEN) || \ defined(_XOPEN_SOURCE_EXTENDED) struct sockaddr_in { unsigned char sin_len; __sa_family_t sin_family; /* New typedef for Spec 1170 */ __in_port_t sin_port; /* New typedef for Spec 1170 */ struct in_addr sin_addr; #ifdef _XOPEN_SOURCE_EXTENDED unsigned char sin_zero[8]; /* Changed type from char to */ /* unsigned char for Spec 1170 */ #else char sin_zero[8]; #endif }; #else struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; #endif /* ** DEC C extensions ** ** caddr_t was here in previous versions and so is retained for compatibility */ #if !defined __CADDR_T && !defined CADDR_T && !defined _XOPEN_SOURCE_EXTENDED # define __CADDR_T 1 # ifndef __HIDE_FORBIDDEN_NAMES # define CADDR_T 1 # endif typedef __caddr_t caddr_t; # endif /* * Structure used to describe IP options. * Used to store options internally, to pass them to a process, * or to restore options retrieved earlier. * The ip_dst is used for the first-hop gateway when using a source route * (this gets put into the header proper). */ struct ip_opts { struct in_addr ip_dst; /* first hop, 0 w/o src rt */ #if defined(__cplusplus) char Ip_opts[40]; /* cannot have same name as class */ #else char ip_opts[40]; /* actually variable in size */ #endif }; /* * Options for use with [gs]etsockopt at the IP level. * First word of comment is data type; bool is stored in int. */ #define IP_OPTIONS 1 /* buf/ip_opts; set/get IP per-packet options */ #define IP_HDRINCL 2 /* int; header is included with data (raw) */ #define IP_TOS 3 /* int; IP type of service and precedence */ #define IP_TTL 4 /* int; IP time to live */ #define IP_RECVOPTS 5 /* bool; receive all IP options w/datagram */ #define IP_RECVRETOPTS 6 /* bool; receive IP options for response */ #define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/datagram */ #define IP_RETOPTS 8 /* ip_opts; set/get IP per-packet options */ #define IP_MULTICAST_IF 9 /* in_addr; IP multicast interface */ #define IP_MULTICAST_TTL 10 /* u_char; IP multicast timetolive */ #define IP_MULTICAST_LOOP 11 /* u_char; IP multicast loopback */ #define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ #define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ #define IP_MULTICAST_VIF 14 /* set/get IP mcast vir. interface */ #define OIP_MULTICAST_IF 16 /* in_addr; IP multicast interface */ #define OIP_MULTICAST_TTL 17 /* u_char; IP multicast timetolive */ #define OIP_MULTICAST_LOOP 18 /* u_char; IP multicast loopback */ #define OIP_ADD_MEMBERSHIP 19 /* ip_mreq; add an IP group membership */ #define OIP_DROP_MEMBERSHIP 20 /* ip_mreq; drop an IP group membership */ #define OIP_MULTICAST_VIF 21 /* set/get IP mcast vir. interface */ #define IP_RSVP_ON 25 /* set rsvp var. in kernel */ #define IP_RSVP_OFF 26 /* unset rsvp var in kernel */ #define IP_RSVP_VIF_ON 27 /* set rsvp per-vif socket */ #define IP_RSVP_VIF_OFF 28 /* unset rsvp per-vif socket */ #define IP_PROXY 29 /* bool; allow proxy packet reception */ /* IP_FLOWLABEL 20 defined in in6.h */ /* IP_RXHDR 21 defined in in6.h */ #define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ #define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ #define IP_DEFAULT_MEMBERSHIPS 20 /* default multicasts per socket */ #define IP_MAX_MEMBERSHIPS 65535 /* max per socket */ /* * IP protocol specific route flags */ #define IP_RTF_PMTU RTF_PROTO3 /* rmx_mtu set by pmtu discovery */ /* * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */ struct ip_mreq { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_interface; /* local IP address of interface */ }; /* * Protocol specific route flags */ #define RTF_PMTU RTF_PROTO4 /* rmx_mtu set by pmtu discovery */ #define RTF_NOPMTUDISC RTF_PROTO5 /* pmtu discovery disabled */ #define RTF_NOFRAGTOPMTU RTF_PROTO6 /* fragment to pmtu size disabled */ #define RTF_LOOPBACK RTF_PROTO7 /* send packets over loopback device */ /* included to get decls for ntohs, htons, ntohl, htonl */ /* ** Macros for number representation conversion. */ __in_addr_t htonl (__in_addr_t); __in_port_t htons (__in_port_t); __in_addr_t ntohl (__in_addr_t); __in_port_t ntohs (__in_port_t); #include /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __member_alignment __restore #pragma __standard #endif /* __IN_LOADED */