41 lines
769 B
C
41 lines
769 B
C
// IPv4 and IPv6 address declarations for the nt-lite POSIX socket layer.
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <sys/socket.h>
|
|
|
|
typedef uint16_t in_port_t;
|
|
typedef uint32_t in_addr_t;
|
|
|
|
#define IPPROTO_ICMP 1
|
|
#define IPPROTO_TCP 6
|
|
#define IPPROTO_UDP 17
|
|
#define IPPROTO_ICMPV6 58
|
|
|
|
#define INADDR_ANY ((in_addr_t)0x00000000u)
|
|
#define INADDR_NONE ((in_addr_t)0xFFFFFFFFu)
|
|
|
|
struct in_addr {
|
|
in_addr_t s_addr;
|
|
};
|
|
|
|
struct in6_addr {
|
|
uint8_t s6_addr[16];
|
|
};
|
|
|
|
struct sockaddr_in {
|
|
sa_family_t sin_family;
|
|
in_port_t sin_port;
|
|
struct in_addr sin_addr;
|
|
char sin_zero[8];
|
|
};
|
|
|
|
struct sockaddr_in6 {
|
|
sa_family_t sin6_family;
|
|
in_port_t sin6_port;
|
|
uint32_t sin6_flowinfo;
|
|
struct in6_addr sin6_addr;
|
|
uint32_t sin6_scope_id;
|
|
};
|