8 /* Can we include <stdint.h> here or do we need an additional header that is
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
;
26 typedef uint32_t in_addr_t
;
27 #endif /* _IN_ADDR_T */
31 /* Should match corresponding typedef in <sys/socket.h> */
32 typedef uint8_t sa_family_t
;
33 #endif /* _SA_FAMILY_T */
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
56 sa_family_t sin_family
;
58 struct in_addr sin_addr
;
63 struct in_addr imr_multiaddr
;
64 struct in_addr imr_interface
;
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
79 sa_family_t sin6_family
;
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 */