more stack for boot
[minix.git] / include / netinet / in.h
blob973088fbddb73fbba5566636873edd1f78710bb7
1 /*
2 netinet/in.h
3 */
5 #ifndef _NETINET__IN_H
6 #define _NETINET__IN_H
8 /* Can we include <stdint.h> here or do we need an additional header that is
9 * safe to include?
11 #include <stdint.h>
13 /* Open Group Base Specifications Issue 6 (not complete) */
14 #define INADDR_ANY (uint32_t)0x00000000
15 #define INADDR_BROADCAST (uint32_t)0xFFFFFFFF
16 #define INADDR_LOOPBACK (uint32_t)0x7F000001
18 #define IN_LOOPBACKNET 127
20 #define IPPORT_RESERVED 1024
22 typedef uint16_t in_port_t;
24 #ifndef _IN_ADDR_T
25 #define _IN_ADDR_T
26 typedef uint32_t in_addr_t;
27 #endif /* _IN_ADDR_T */
29 #ifndef _SA_FAMILY_T
30 #define _SA_FAMILY_T
31 /* Should match corresponding typedef in <sys/socket.h> */
32 typedef uint8_t sa_family_t;
33 #endif /* _SA_FAMILY_T */
35 /* Protocols */
36 #define IPPROTO_IP 0 /* Dummy protocol */
37 #define IPPROTO_ICMP 1 /* ICMP */
38 #define IPPROTO_TCP 6 /* TCP */
39 #define IPPROTO_EGP 8 /* exterior gateway protocol */
40 #define IPPROTO_UDP 17 /* UDP */
42 /* setsockopt options at IP level */
43 #define IP_ADD_MEMBERSHIP 12
44 #define IP_DROP_MEMBERSHIP 13
46 #ifndef _STRUCT_IN_ADDR
47 #define _STRUCT_IN_ADDR
48 struct in_addr
50 in_addr_t s_addr;
52 #endif
54 struct sockaddr_in
56 sa_family_t sin_family;
57 in_port_t sin_port;
58 struct in_addr sin_addr;
61 struct ip_mreq
63 struct in_addr imr_multiaddr;
64 struct in_addr imr_interface;
67 /*
68 * IPv6 is not supported, but some programs need these declarations
69 * nevertheless; these declarations are based on
70 * http://www.opengroup.org/onlinepubs/000095399/basedefs/netinet/in.h.html
72 struct in6_addr
74 uint8_t s6_addr[16];
77 struct sockaddr_in6
79 sa_family_t sin6_family;
80 in_port_t sin6_port;
81 uint32_t sin6_flowinfo;
82 struct in6_addr sin6_addr;
83 uint32_t sin6_scope_id;
86 #define INET6_ADDRSTRLEN 46
88 /* Definitions that are not part of the Open Group Base Specifications */
89 #define IN_CLASSA(i) (((uint32_t)(i) & 0x80000000) == 0)
90 #define IN_CLASSA_NET 0xff000000
91 #define IN_CLASSA_NSHIFT 24
93 #define IN_CLASSB(i) (((uint32_t)(i) & 0xc0000000) == 0x80000000)
94 #define IN_CLASSB_NET 0xffff0000
95 #define IN_CLASSB_NSHIFT 16
97 #define IN_CLASSC(i) (((uint32_t)(i) & 0xe0000000) == 0xc0000000)
98 #define IN_CLASSC_NET 0xffffff00
99 #define IN_CLASSC_NSHIFT 8
101 #define IN_CLASSD(i) (((uint32_t)(i) & 0xf0000000) == 0xe0000000)
102 #define IN_CLASSD_NET 0xf0000000
103 #define IN_CLASSD_NSHIFT 28
105 #endif /* _NETINET__IN_H */