root/include/linux/in.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * INET         An implementation of the TCP/IP protocol suite for the LINUX
   3  *              operating system.  INET is implemented using the  BSD Socket
   4  *              interface as the means of communication with the user level.
   5  *
   6  *              Definitions of the Internet Protocol.
   7  *
   8  * Version:     @(#)in.h        1.0.1   04/21/93
   9  *
  10  * Authors:     Original taken from the GNU Project <netinet/in.h> file.
  11  *              Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  12  *
  13  *              This program is free software; you can redistribute it and/or
  14  *              modify it under the terms of the GNU General Public License
  15  *              as published by the Free Software Foundation; either version
  16  *              2 of the License, or (at your option) any later version.
  17  */
  18 #ifndef _LINUX_IN_H
  19 #define _LINUX_IN_H
  20 
  21 
  22 /* Standard well-defined IP protocols.  */
  23 enum {
  24   IPPROTO_IP = 0,               /* Dummy protocol for TCP               */
  25   IPPROTO_ICMP = 1,             /* Internet Control Message Protocol    */
  26   IPPROTO_IGMP = 2,             /* Internet Gateway Management Protocol */
  27   IPPROTO_IPIP = 4,             /* IPIP tunnels (older KA9Q tunnels use 94) */
  28   IPPROTO_TCP = 6,              /* Transmission Control Protocol        */
  29   IPPROTO_EGP = 8,              /* Exterior Gateway Protocol            */
  30   IPPROTO_PUP = 12,             /* PUP protocol                         */
  31   IPPROTO_UDP = 17,             /* User Datagram Protocol               */
  32   IPPROTO_IDP = 22,             /* XNS IDP protocol                     */
  33 
  34   IPPROTO_RAW = 255,            /* Raw IP packets                       */
  35   IPPROTO_MAX
  36 };
  37 
  38 
  39 /* Internet address. */
  40 struct in_addr {
  41         unsigned long int       s_addr;
  42 };
  43 
  44 /* Request struct for multicast socket ops */
  45 
  46 struct ip_mreq 
  47 {
  48         struct in_addr imr_multiaddr;   /* IP multicast address of group */
  49         struct in_addr imr_interface;   /* local IP address of interface */
  50 };
  51 
  52 
  53 /* Structure describing an Internet (IP) socket address. */
  54 #define __SOCK_SIZE__   16              /* sizeof(struct sockaddr)      */
  55 struct sockaddr_in {
  56   short int             sin_family;     /* Address family               */
  57   unsigned short int    sin_port;       /* Port number                  */
  58   struct in_addr        sin_addr;       /* Internet address             */
  59 
  60   /* Pad to size of `struct sockaddr'. */
  61   unsigned char         __pad[__SOCK_SIZE__ - sizeof(short int) -
  62                         sizeof(unsigned short int) - sizeof(struct in_addr)];
  63 };
  64 #define sin_zero        __pad           /* for BSD UNIX comp. -FvK      */
  65 
  66 
  67 /*
  68  * Definitions of the bits in an Internet address integer.
  69  * On subnets, host and network parts are found according
  70  * to the subnet mask, not these masks.
  71  */
  72 #define IN_CLASSA(a)            ((((long int) (a)) & 0x80000000) == 0)
  73 #define IN_CLASSA_NET           0xff000000
  74 #define IN_CLASSA_NSHIFT        24
  75 #define IN_CLASSA_HOST          (0xffffffff & ~IN_CLASSA_NET)
  76 #define IN_CLASSA_MAX           128
  77 
  78 #define IN_CLASSB(a)            ((((long int) (a)) & 0xc0000000) == 0x80000000)
  79 #define IN_CLASSB_NET           0xffff0000
  80 #define IN_CLASSB_NSHIFT        16
  81 #define IN_CLASSB_HOST          (0xffffffff & ~IN_CLASSB_NET)
  82 #define IN_CLASSB_MAX           65536
  83 
  84 #define IN_CLASSC(a)            ((((long int) (a)) & 0xe0000000) == 0xc0000000)
  85 #define IN_CLASSC_NET           0xffffff00
  86 #define IN_CLASSC_NSHIFT        8
  87 #define IN_CLASSC_HOST          (0xffffffff & ~IN_CLASSC_NET)
  88 
  89 #define IN_CLASSD(a)            ((((long int) (a)) & 0xf0000000) == 0xe0000000)
  90 #define IN_MULTICAST(a)         IN_CLASSD(a)
  91 #define IN_MULTICAST_NET        0xF0000000
  92 
  93 #define IN_EXPERIMENTAL(a)      ((((long int) (a)) & 0xe0000000) == 0xe0000000)
  94 #define IN_BADCLASS(a)          ((((long int) (a)) & 0xf0000000) == 0xf0000000)
  95 
  96 /* Address to accept any incoming messages. */
  97 #define INADDR_ANY              ((unsigned long int) 0x00000000)
  98 
  99 /* Address to send to all hosts. */
 100 #define INADDR_BROADCAST        ((unsigned long int) 0xffffffff)
 101 
 102 /* Address indicating an error return. */
 103 #define INADDR_NONE             0xffffffff
 104 
 105 /* Network number for local host loopback. */
 106 #define IN_LOOPBACKNET          127
 107 
 108 /* Address to loopback in software to local host.  */
 109 #define INADDR_LOOPBACK         0x7f000001      /* 127.0.0.1   */
 110 
 111 /* Defines for Multicast INADDR */
 112 #define INADDR_UNSPEC_GROUP     0xe0000000      /* 224.0.0.0   */
 113 #define INADDR_ALLHOSTS_GROUP   0xe0000001      /* 224.0.0.1   */
 114 #define INADDR_MAX_LOCAL_GROUP  0xe00000ff      /* 224.0.0.255 */
 115 
 116 /* <asm/byteorder.h> contains the htonl type stuff.. */
 117 
 118 #include <asm/byteorder.h> 
 119 
 120 #endif  /* _LINUX_IN_H */

/* [previous][next][first][last][top][bottom][index][help] */