in.h

Go to the documentation of this file.
00001 /*
00002 ** in.h for  in /home/anoman/work/lse/lseos/lseos-net/libinet
00003 ** 
00004 ** Copyright (c)2004 Arthur Kopatsy
00005 ** Login   <kopats_a@epita.fr>
00006 ** 
00007 ** Started on  Wed Nov  3 16:33:14 2004 Arthur Kopatsy
00008 ** Last update Wed Nov  3 16:33:15 2004 Arthur Kopatsy
00009 */
00010 
00011 #ifndef INET_IN_H_
00012 #define INET_IN_H_
00013 
00014 /*
00015  * Protocols
00016  */
00017 #define IPPROTO_IP              0               /* dummy for IP */
00018 #define IPPROTO_HOPOPTS         0               /* IP6 hop-by-hop options */
00019 #define IPPROTO_ICMP            1               /* control message protocol */
00020 #define IPPROTO_IGMP            2               /* group mgmt protocol */
00021 #define IPPROTO_GGP             3               /* gateway^2 (deprecated) */
00022 #define IPPROTO_IPV4            4               /* IP header */
00023 #define IPPROTO_IPIP            4               /* IP inside IP */
00024 #define IPPROTO_TCP             6               /* tcp */
00025 #define IPPROTO_EGP             8               /* exterior gateway protocol */
00026 #define IPPROTO_PUP             12              /* pup */
00027 #define IPPROTO_UDP             17              /* user datagram protocol */
00028 #define IPPROTO_IDP             22              /* xns idp */
00029 #define IPPROTO_TP              29              /* tp-4 w/ class negotiation */
00030 #define IPPROTO_IPV6            41              /* IP6 header */
00031 #define IPPROTO_ROUTING         43              /* IP6 routing header */
00032 #define IPPROTO_FRAGMENT        44              /* IP6 fragmentation header */
00033 #define IPPROTO_RSVP            46              /* resource reservation */
00034 #define IPPROTO_GRE             47              /* GRE encaps RFC 1701 */
00035 #define IPPROTO_ESP             50              /* encap. security payload */
00036 #define IPPROTO_AH              51              /* authentication header */
00037 #define IPPROTO_MOBILE          55              /* IP Mobility RFC 2004 */
00038 #define IPPROTO_IPV6_ICMP       58              /* IPv6 ICMP */
00039 #define IPPROTO_ICMPV6          58              /* ICMP6 */
00040 #define IPPROTO_NONE            59              /* IP6 no next header */
00041 #define IPPROTO_DSTOPTS         60              /* IP6 destination option */
00042 #define IPPROTO_EON             80              /* ISO cnlp */
00043 #define IPPROTO_ENCAP           98              /* encapsulation header */
00044 #define IPPROTO_PIM             103             /* Protocol indep. multicast */
00045 #define IPPROTO_IPCOMP          108             /* IP Payload Comp. Protocol */
00046 #define IPPROTO_VRRP            112             /* VRRP RFC 2338 */
00047 
00048 #define IPPROTO_RAW             255             /* raw IP packet */
00049 #define IPPROTO_MAX             256
00050 
00051 /* Standard well-known ports.  */
00052 enum {
00053   IPPORT_ECHO = 7,              /* Echo service.  */
00054   IPPORT_DISCARD = 9,           /* Discard transmissions service.  */
00055   IPPORT_SYSTAT = 11,           /* System status service.  */
00056   IPPORT_DAYTIME = 13,  /* Time of day service.  */
00057   IPPORT_NETSTAT = 15,  /* Network status service.  */
00058   IPPORT_FTP = 21,              /* File Transfer Protocol.  */
00059   IPPORT_TELNET = 23,           /* Telnet protocol.  */
00060   IPPORT_SMTP = 25,             /* Simple Mail Transfer Protocol.  */
00061   IPPORT_TIMESERVER = 37,       /* Timeserver service.  */
00062   IPPORT_NAMESERVER = 42,       /* Domain Name Service.  */
00063   IPPORT_WHOIS = 43,            /* Internet Whois service.  */
00064   IPPORT_MTP = 57,
00065   
00066   IPPORT_TFTP = 69,             /* Trivial File Transfer Protocol.  */
00067   IPPORT_RJE = 77,
00068   IPPORT_FINGER = 79,           /* Finger service.  */
00069   IPPORT_TTYLINK = 87,
00070   IPPORT_SUPDUP = 95,           /* SUPDUP protocol.  */
00071   
00072   
00073   IPPORT_EXECSERVER = 512,      /* execd service.  */
00074   IPPORT_LOGINSERVER = 513,     /* rlogind service.  */
00075   IPPORT_CMDSERVER = 514,
00076   IPPORT_EFSSERVER = 520,
00077   
00078   /* UDP ports.  */
00079   IPPORT_BIFFUDP = 512,
00080   IPPORT_WHOSERVER = 513,
00081   IPPORT_ROUTESERVER = 520,
00082   
00083   /* Ports less than this value are reserved for privileged processes.  */
00084   IPPORT_RESERVED = 1024,
00085   
00086   /* Ports greater this value are reserved for (non-privileged) servers.  */
00087   IPPORT_USERRESERVED = 5000
00088 };
00089 
00090 /* 
00091 ** sockaddr_in
00092 */
00093 
00094 #define INET_ADDRSTRLEN         16
00095 
00096 #define IP_ADDR_SIZE            4
00097 
00098 /* Internet address.  */
00099 struct in_addr {
00100   in_addr_t     s_addr;
00101 };
00102 
00103 struct sockaddr_in {
00104   u_int8_t              sin_len;
00105   u_int8_t              sin_family;
00106   u_int16_t             sin_port;
00107   struct in_addr        sin_addr;
00108   u_int8_t              sin_zero[8];
00109 };
00110 
00111 /* Definitions of the bits in an Internet address integer.
00112 
00113    On subnets, host and network parts are found according to
00114    the subnet mask, not these masks.  */
00115 
00116 #define IN_CLASSA(a)            ((((in_addr_t)(a)) & 0x80000000) == 0)
00117 #define IN_CLASSA_NET           0xff000000
00118 #define IN_CLASSA_NSHIFT        24
00119 #define IN_CLASSA_HOST          (0xffffffff & ~IN_CLASSA_NET)
00120 #define IN_CLASSA_MAX           128
00121 
00122 #define IN_CLASSB(a)            ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
00123 #define IN_CLASSB_NET           0xffff0000
00124 #define IN_CLASSB_NSHIFT        16
00125 #define IN_CLASSB_HOST          (0xffffffff & ~IN_CLASSB_NET)
00126 #define IN_CLASSB_MAX           65536
00127 
00128 #define IN_CLASSC(a)            ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
00129 #define IN_CLASSC_NET           0xffffff00
00130 #define IN_CLASSC_NSHIFT        8
00131 #define IN_CLASSC_HOST          (0xffffffff & ~IN_CLASSC_NET)
00132 
00133 #define IN_CLASSD(a)            ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
00134 #define IN_MULTICAST(a)         IN_CLASSD(a)
00135 
00136 #define IN_EXPERIMENTAL(a)      ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
00137 #define IN_BADCLASS(a)          ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
00138 
00139 /* Address to accept any incoming messages.  */
00140 #define INADDR_ANY              ((in_addr_t) 0x00000000)
00141 /* Address to send to all hosts.  */
00142 #define INADDR_BROADCAST        ((in_addr_t) 0xffffffff)
00143 /* Address indicating an error return.  */
00144 #define INADDR_NONE             ((in_addr_t) 0xffffffff)
00145 
00146 /* Network number for local host loopback.  */
00147 #define IN_LOOPBACKNET          127
00148 /* Address to loopback in software to local host.  */
00149 #ifndef INADDR_LOOPBACK
00150 # define INADDR_LOOPBACK        ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1.  */
00151 #endif
00152 
00153 /* Defines for Multicast INADDR.  */
00154 #define INADDR_UNSPEC_GROUP     ((in_addr_t) 0xe0000000) /* 224.0.0.0 */
00155 #define INADDR_ALLHOSTS_GROUP   ((in_addr_t) 0xe0000001) /* 224.0.0.1 */
00156 #define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
00157 #define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
00158 
00159 #endif

Generated on Wed May 24 23:05:52 2006 for LSE/OS by  doxygen 1.4.6