feat: ports - git port
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* <netinet/in.h> for the MontaukOS git port.
|
||||
*
|
||||
* Address types only. See compat/sys/socket.h for why nothing here connects
|
||||
* to anything yet. The byte-order helpers are real (x86-64 is little-endian,
|
||||
* so they are byte swaps).
|
||||
*/
|
||||
#ifndef _MONTAUK_GIT_NETINET_IN_H_
|
||||
#define _MONTAUK_GIT_NETINET_IN_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
typedef uint16_t in_port_t;
|
||||
typedef uint32_t in_addr_t;
|
||||
|
||||
struct in_addr {
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
|
||||
struct in6_addr {
|
||||
union {
|
||||
uint8_t __u6_addr8[16];
|
||||
uint16_t __u6_addr16[8];
|
||||
uint32_t __u6_addr32[4];
|
||||
} __in6_u;
|
||||
};
|
||||
|
||||
#define s6_addr __in6_u.__u6_addr8
|
||||
#define s6_addr16 __in6_u.__u6_addr16
|
||||
#define s6_addr32 __in6_u.__u6_addr32
|
||||
|
||||
struct sockaddr_in {
|
||||
sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
unsigned 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;
|
||||
};
|
||||
|
||||
#define INADDR_ANY ((in_addr_t)0x00000000)
|
||||
#define INADDR_LOOPBACK ((in_addr_t)0x7f000001)
|
||||
#define INADDR_NONE ((in_addr_t)0xffffffff)
|
||||
|
||||
#define INET_ADDRSTRLEN 16
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
|
||||
#define IPPROTO_IP 0
|
||||
#define IPPROTO_TCP 6
|
||||
#define IPPROTO_UDP 17
|
||||
|
||||
static inline uint16_t htons(uint16_t x) { return __builtin_bswap16(x); }
|
||||
static inline uint16_t ntohs(uint16_t x) { return __builtin_bswap16(x); }
|
||||
static inline uint32_t htonl(uint32_t x) { return __builtin_bswap32(x); }
|
||||
static inline uint32_t ntohl(uint32_t x) { return __builtin_bswap32(x); }
|
||||
|
||||
#endif /* _MONTAUK_GIT_NETINET_IN_H_ */
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* <netinet/tcp.h> for the MontaukOS git port.
|
||||
*
|
||||
* Socket option names only; setsockopt() itself fails here. See
|
||||
* compat/sys/socket.h.
|
||||
*/
|
||||
#ifndef _MONTAUK_GIT_NETINET_TCP_H_
|
||||
#define _MONTAUK_GIT_NETINET_TCP_H_
|
||||
|
||||
#define TCP_NODELAY 1
|
||||
#define TCP_KEEPIDLE 4
|
||||
#define TCP_KEEPINTVL 5
|
||||
#define TCP_KEEPCNT 6
|
||||
|
||||
#endif /* _MONTAUK_GIT_NETINET_TCP_H_ */
|
||||
Reference in New Issue
Block a user