2020-12-01 23:40:03 +00:00
|
|
|
#ifndef _NETINET_IN_H
|
|
|
|
#define _NETINET_IN_H
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
#ifndef __have_in_port_t
|
|
|
|
#define __have_in_port_t
|
|
|
|
typedef uint16_t in_port_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __have_in_addr_t
|
|
|
|
#define __have_in_addr_t
|
|
|
|
typedef uint32_t in_addr_t;
|
|
|
|
#endif
|
|
|
|
|
2020-12-09 00:08:45 +00:00
|
|
|
struct in_addr {
|
2020-12-01 23:40:03 +00:00
|
|
|
in_addr_t s_addr;
|
2020-12-09 00:08:45 +00:00
|
|
|
};
|
2020-12-01 23:40:03 +00:00
|
|
|
|
2020-12-09 00:08:45 +00:00
|
|
|
struct sockaddr_in{
|
2020-12-01 23:40:03 +00:00
|
|
|
sa_family_t sin_family;
|
|
|
|
in_port_t sin_port;
|
2020-12-09 00:08:45 +00:00
|
|
|
struct in_addr sin_addr;
|
|
|
|
};
|
2020-12-01 23:40:03 +00:00
|
|
|
|
2020-12-09 00:08:45 +00:00
|
|
|
struct in6_addr {
|
2020-12-01 23:40:03 +00:00
|
|
|
uint8_t s6_addr[16];
|
2020-12-09 00:08:45 +00:00
|
|
|
};
|
2020-12-01 23:40:03 +00:00
|
|
|
|
|
|
|
typedef struct _ipv6_sockaddr_in {
|
|
|
|
sa_family_t sin6_family;
|
|
|
|
in_port_t sin6_port;
|
|
|
|
uint32_t sin6_flowinfo;
|
2020-12-09 00:08:45 +00:00
|
|
|
struct in6_addr sin6_addr;
|
2020-12-01 23:40:03 +00:00
|
|
|
uint32_t sin6_scope_id;
|
|
|
|
} sockaddr_in6;
|
|
|
|
|
2020-12-09 00:08:45 +00:00
|
|
|
extern const struct in6_addr in6addr_any;
|
|
|
|
extern const struct in6_addr in6addr_loopback;
|
2020-12-01 23:40:03 +00:00
|
|
|
/* Need INIT macros for the above */
|
|
|
|
|
2020-12-09 00:08:45 +00:00
|
|
|
struct ipv6_mreq {
|
|
|
|
struct int6_addr ipv6mr_multiaddr;
|
2020-12-01 23:40:03 +00:00
|
|
|
unsigned ipv6mr_interface;
|
2020-12-09 00:08:45 +00:00
|
|
|
};
|
2020-12-01 23:40:03 +00:00
|
|
|
|
|
|
|
#define IPPROTO_IP 4
|
|
|
|
#define IPPROTO_IPV6 6
|
|
|
|
#define IPPROTO_ICMP 1
|
|
|
|
#define IPPROTO_RAW 2
|
|
|
|
#define IPPROTO_TCP 5
|
|
|
|
#define IPPROTO_UDP 7
|
|
|
|
|
|
|
|
#endif
|