From 4e09bca9e34c226b6d7e34b4fa11248405fd988e Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Sun, 22 Oct 2023 19:50:38 +0200 Subject: Move everything into a new repo. --- userland/libc/include/socket.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 userland/libc/include/socket.h (limited to 'userland/libc/include/socket.h') diff --git a/userland/libc/include/socket.h b/userland/libc/include/socket.h new file mode 100644 index 0000000..5e86b45 --- /dev/null +++ b/userland/libc/include/socket.h @@ -0,0 +1,41 @@ +#include +#include + +#define AF_UNIX 0 +#define AF_LOCAL AF_UNIX + +#define INADDR_ANY 0 + +typedef struct { + int domain; + int type; + int protocol; + + // UNIX socket + char *path; + int incoming_fd; +} SOCKET; + +typedef struct { + char *path; + SOCKET *s; +} OPEN_UNIX_SOCKET; + +typedef uint32_t in_addr_t; +typedef uint16_t in_port_t; +typedef unsigned int sa_family_t; +typedef uint32_t socklen_t; + +struct sockaddr { + sa_family_t sa_family; /* Address family */ + char *sa_data; /* Socket address */ +}; + +struct sockaddr_un { + sa_family_t sun_family; /* Address family */ + char *sun_path; /* Socket pathname */ +}; + +int socket(int domain, int type, int protocol); +int accept(int socket, struct sockaddr *address, socklen_t *address_len); +int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); -- cgit v1.2.3