Annotation of embedaddon/pimd/include/linux/netinet/in-glibc-2.0.h, revision 1.1.1.1

1.1       misho       1: /* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc.
                      2:    This file is part of the GNU C Library.
                      3: 
                      4:    The GNU C Library is free software; you can redistribute it and/or modify
                      5:    it under the terms of the GNU General Public License as published by
                      6:    the Free Software Foundation; either version 2, or (at your option)
                      7:    any later version.
                      8: 
                      9:    The GNU C Library is distributed in the hope that it will be useful,
                     10:    but WITHOUT ANY WARRANTY; without even the implied warranty of
                     11:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     12:    GNU General Public License for more details.
                     13: 
                     14:    You should have received a copy of the GNU Library General Public
                     15:    License along with the GNU C Library; see the file COPYING.LIB.  If not,
                     16:    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
                     17:    Boston, MA 02111-1307, USA.  */
                     18: 
                     19: #ifndef        _NETINET_IN_H
                     20: 
                     21: #define        _NETINET_IN_H   1
                     22: #include <features.h>
                     23: 
                     24: #include <sys/socket.h>
                     25: #include <sys/types.h>
                     26: 
                     27: 
                     28: __BEGIN_DECLS
                     29: 
                     30: /* Standard well-defined IP protocols.  */
                     31: enum
                     32:   {
                     33:     IPPROTO_IP = 0,     /* Dummy protocol for TCP.  */
                     34:     IPPROTO_ICMP = 1,   /* Internet Control Message Protocol.  */
                     35:     IPPROTO_IGMP = 2,   /* Internet Group Management Protocol. */
                     36:     IPPROTO_IPIP = 4,   /* IPIP tunnels (older KA9Q tunnels use 94).  */
                     37:     IPPROTO_TCP = 6,    /* Transmission Control Protocol.  */
                     38:     IPPROTO_EGP = 8,    /* Exterior Gateway Protocol.  */
                     39:     IPPROTO_PUP = 12,   /* PUP protocol.  */
                     40:     IPPROTO_UDP = 17,   /* User Datagram Protocol.  */
                     41:     IPPROTO_IDP = 22,   /* XNS IDP protocol.  */
                     42:     IPPROTO_IPV6 = 41,  /* IPv6-in-IPv4 tunnelling.  */
                     43:     IPPROTO_RSVP = 46,  /* RSVP Protocol.  */
                     44:     IPPROTO_GRE = 47,   /* Cisco GRE tunnels (rfc 1701,1702).  */
                     45:     IPPROTO_ICMPV6 = 58, /* ICMPv6.  */
                     46:     IPPROTO_PIM = 103,  /* Protocol Independent Multicast.  */
                     47: 
                     48:     IPPROTO_RAW = 255,  /* Raw IP packets.  */
                     49:     IPPROTO_MAX
                     50:       };
                     51: 
                     52: /* Standard well-known ports.  */
                     53: enum
                     54:   {
                     55:     IPPORT_ECHO = 7,           /* Echo service.  */
                     56:     IPPORT_DISCARD = 9,                /* Discard transmissions service.  */
                     57:     IPPORT_SYSTAT = 11,                /* System status service.  */
                     58:     IPPORT_DAYTIME = 13,       /* Time of day service.  */
                     59:     IPPORT_NETSTAT = 15,       /* Network status service.  */
                     60:     IPPORT_FTP = 21,           /* File Transfer Protocol.  */
                     61:     IPPORT_TELNET = 23,                /* Telnet protocol.  */
                     62:     IPPORT_SMTP = 25,          /* Simple Mail Transfer Protocol.  */
                     63:     IPPORT_TIMESERVER = 37,    /* Timeserver service.  */
                     64:     IPPORT_NAMESERVER = 42,    /* Domain Name Service.  */
                     65:     IPPORT_WHOIS = 43,         /* Internet Whois service.  */
                     66:     IPPORT_MTP = 57,
                     67: 
                     68:     IPPORT_TFTP = 69,          /* Trivial File Transfer Protocol.  */
                     69:     IPPORT_RJE = 77,
                     70:     IPPORT_FINGER = 79,                /* Finger service.  */
                     71:     IPPORT_TTYLINK = 87,
                     72:     IPPORT_SUPDUP = 95,                /* SUPDUP protocol.  */
                     73: 
                     74: 
                     75:     IPPORT_EXECSERVER = 512,   /* execd service.  */
                     76:     IPPORT_LOGINSERVER = 513,  /* rlogind service.  */
                     77:     IPPORT_CMDSERVER = 514,
                     78:     IPPORT_EFSSERVER = 520,
                     79: 
                     80:     /* UDP ports.  */
                     81:     IPPORT_BIFFUDP = 512,
                     82:     IPPORT_WHOSERVER = 513,
                     83:     IPPORT_ROUTESERVER = 520,
                     84: 
                     85:     /* Ports less than this value are reserved for privileged processes.  */
                     86:     IPPORT_RESERVED = 1024,
                     87: 
                     88:     /* Ports greater this value are reserved for (non-privileged) servers.  */
                     89:     IPPORT_USERRESERVED = 5000
                     90:   };
                     91: 
                     92: 
                     93: /* Internet address.  */
                     94: struct in_addr
                     95:   {
                     96:     unsigned int s_addr;
                     97:   };
                     98: 
                     99: 
                    100: /* Definitions of the bits in an Internet address integer.
                    101: 
                    102:    On subnets, host and network parts are found according to
                    103:    the subnet mask, not these masks.  */
                    104: 
                    105: #define        IN_CLASSA(a)            ((((unsigned) (a)) & 0x80000000) == 0)
                    106: #define        IN_CLASSA_NET           0xff000000
                    107: #define        IN_CLASSA_NSHIFT        24
                    108: #define        IN_CLASSA_HOST          (0xffffffff & ~IN_CLASSA_NET)
                    109: #define        IN_CLASSA_MAX           128
                    110: 
                    111: #define        IN_CLASSB(a)            ((((unsigned) (a)) & 0xc0000000) == 0x80000000)
                    112: #define        IN_CLASSB_NET           0xffff0000
                    113: #define        IN_CLASSB_NSHIFT        16
                    114: #define        IN_CLASSB_HOST          (0xffffffff & ~IN_CLASSB_NET)
                    115: #define        IN_CLASSB_MAX           65536
                    116: 
                    117: #define        IN_CLASSC(a)            ((((unsigned) (a)) & 0xc0000000) == 0xc0000000)
                    118: #define        IN_CLASSC_NET           0xffffff00
                    119: #define        IN_CLASSC_NSHIFT        8
                    120: #define        IN_CLASSC_HOST          (0xffffffff & ~IN_CLASSC_NET)
                    121: 
                    122: #define        IN_CLASSD(a)            ((((unsigned) (a)) & 0xf0000000) == 0xe0000000)
                    123: #define        IN_MULTICAST(a)         IN_CLASSD(a)
                    124: 
                    125: #define        IN_EXPERIMENTAL(a)      ((((unsigned) (a)) & 0xe0000000) == 0xe0000000)
                    126: #define        IN_BADCLASS(a)          ((((unsigned) (a)) & 0xf0000000) == 0xf0000000)
                    127: 
                    128: /* Address to accept any incoming messages.  */
                    129: #define        INADDR_ANY              ((unsigned) 0x00000000)
                    130: /* Address to send to all hosts.  */
                    131: #define        INADDR_BROADCAST        ((unsigned) 0xffffffff)
                    132: /* Address indicating an error return.  */
                    133: #define        INADDR_NONE             0xffffffff
                    134: 
                    135: /* Network number for local host loopback.  */
                    136: #define        IN_LOOPBACKNET  127
                    137: /* Address to loopback in software to local host.  */
                    138: #ifndef INADDR_LOOPBACK
                    139: #define        INADDR_LOOPBACK 0x7f000001      /* Internet address 127.0.0.1.  */
                    140: #endif
                    141: 
                    142: /* Defines for Multicast INADDR.  */
                    143: #define INADDR_UNSPEC_GROUP    ((u_int32_t) 0xe0000000U)     /* 224.0.0.0 */
                    144: #define INADDR_ALLHOSTS_GROUP  ((u_int32_t) 0xe0000001U)     /* 224.0.0.1 */
                    145: #define INADDR_ALLRTRS_GROUP    ((u_int32_t) 0xe0000002U)     /* 224.0.0.2 */
                    146: #define INADDR_MAX_LOCAL_GROUP  ((u_int32_t) 0xe00000ffU)     /* 224.0.0.255 */
                    147: 
                    148: 
                    149: /* Get the definition of the macro to define the common sockaddr members.  */
                    150: #include <sockaddrcom.h>
                    151: 
                    152: 
                    153: /* Structure describing an Internet socket address.  */
                    154: struct sockaddr_in
                    155:   {
                    156:     __SOCKADDR_COMMON (sin_);
                    157:     unsigned short int sin_port;       /* Port number.  */
                    158:     struct in_addr sin_addr;           /* Internet address.  */
                    159: 
                    160:     /* Pad to size of `struct sockaddr'.  */
                    161:     unsigned char sin_zero[sizeof(struct sockaddr) -
                    162:                           __SOCKADDR_COMMON_SIZE -
                    163:                           sizeof(unsigned short int) -
                    164:                           sizeof(struct in_addr)];
                    165:   };
                    166: 
                    167: 
                    168: /* Options for use with `getsockopt' and `setsockopt' at the IP level.
                    169:    The first word in the comment at the right is the data type used;
                    170:    "bool" means a boolean value stored in an `int'.  */
                    171: #define        IP_TOS             1    /* int; IP type of service and precedence.  */
                    172: #define        IP_TTL             2    /* int; IP time to live.  */
                    173: #define        IP_HDRINCL         3    /* int; Header is included with data.  */
                    174: #define        IP_OPTIONS         4    /* ip_opts; IP per-packet options.  */
                    175: #define IP_ROUTER_ALERT           5    /* not sure. defined in linux kernel. */
                    176: #define IP_RECVOPTS       6    /* not sure. defined in linux kernel. */
                    177: #define IP_RETOPTS        7    /* not sure. defined in linux kernel. */
                    178: #define IP_PKTINFO        8    /* not sure. defined in linux kernel. */
                    179: #define IP_PKTOPTIONS     9    /* not sure. defined in linux kernel. */
                    180: #define IP_MTU_DISCOVER           10   /* not sure. defined in linux kernel. */
                    181: #define IP_RECVERR        11   /* not sure. defined in linux kernel. */
                    182: #define IP_RECVTTL        12   /* not sure. defined in linux kernel. */
                    183: #define IP_RECVTOS        13   /* not sure. defined in linux kernel. */
                    184: #define IP_MTU            14   /* not sure. defined in linux kernel. */
                    185: #define IP_MULTICAST_IF    32  /* in_addr; set/get IP multicast i/f */
                    186: #define IP_MULTICAST_TTL   33  /* u_char; set/get IP multicast ttl */
                    187: #define IP_MULTICAST_LOOP  34  /* i_char; set/get IP multicast loopback */
                    188: #define IP_ADD_MEMBERSHIP  35  /* ip_mreq; add an IP group membership */
                    189: #define IP_DROP_MEMBERSHIP 36  /* ip_mreq; drop an IP group membership */
                    190: 
                    191: /* BSD compatibility */
                    192: #define IP_RECVRETOPTS IP_RETOPTS
                    193: 
                    194: /* IP_MTU_DISCOVER values */
                    195: #define IP_PMTUDISC_DONT       0       /* Never send DF frames */
                    196: #define IP_PMTUDISC_WANT       1       /* Use per route hints */
                    197: #define IP_PMTUDISC_DO         2       /* Always DF */
                    198: 
                    199: /* To select the IP level.  */
                    200: #define SOL_IP 0
                    201: 
                    202: /* Structure used to describe IP options for IP_OPTIONS. The `ip_dst'
                    203:    field is used for the first-hop gateway when using a source route
                    204:    (this gets put into the header proper).  */
                    205: struct ip_opts
                    206:   {
                    207:     struct in_addr ip_dst;     /* First hop; zero without source route.  */
                    208:     char ip_opts[40];          /* Actually variable in size.  */
                    209:   };
                    210: 
                    211: /* Structure used for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */
                    212: struct ip_mreq
                    213:   {
                    214:     struct in_addr imr_multiaddr;      /* IP multicast address of group */
                    215:     struct in_addr imr_interface;      /* local IP address of interface */
                    216:   };
                    217: 
                    218: /* Functions to convert between host and network byte order.
                    219: 
                    220:    Please note that these functions normally take `unsigned long int' or
                    221:    `unsigned short int' values as arguments and also return them.  But
                    222:    this was a short-sighted decision since on different systems the types
                    223:    may have different representations but the values are always the same.  */
                    224: 
                    225: extern u_int32_t ntohl __P ((u_int32_t __netlong));
                    226: extern u_int16_t ntohs __P ((u_int16_t __netshort));
                    227: extern u_int32_t htonl __P ((u_int32_t __hostlong));
                    228: extern u_int16_t htons __P ((u_int16_t __hostshort));
                    229: 
                    230: #include <endian.h>
                    231: 
                    232: #if __BYTE_ORDER == __BIG_ENDIAN
                    233: /* The host byte order is the same as network byte order,
                    234:    so these functions are all just identity.  */
                    235: #define        ntohl(x)        (x)
                    236: #define        ntohs(x)        (x)
                    237: #define        htonl(x)        (x)
                    238: #define        htons(x)        (x)
                    239: #endif
                    240: 
                    241: 
                    242: /* Bind socket to a priviledged IP port.  */
                    243: extern int bindresvport __P ((int __sockfd, struct sockaddr_in *__sock_in));
                    244: 
                    245: __END_DECLS
                    246: 
                    247: #endif /* netinet/in.h */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>