diff options
Diffstat (limited to 'userland/libc/include')
-rw-r--r-- | userland/libc/include/socket.h | 16 | ||||
-rw-r--r-- | userland/libc/include/sys/socket.h | 7 | ||||
-rw-r--r-- | userland/libc/include/syscall.h | 1 |
3 files changed, 23 insertions, 1 deletions
diff --git a/userland/libc/include/socket.h b/userland/libc/include/socket.h index 5e86b45..c4a3e73 100644 --- a/userland/libc/include/socket.h +++ b/userland/libc/include/socket.h @@ -1,9 +1,14 @@ +#ifndef SOCKET_H +#define SOCKET_H #include <stddef.h> #include <stdint.h> #define AF_UNIX 0 +#define AF_INET 1 #define AF_LOCAL AF_UNIX +#define SOCK_DGRAM 0 + #define INADDR_ANY 0 typedef struct { @@ -24,13 +29,21 @@ typedef struct { typedef uint32_t in_addr_t; typedef uint16_t in_port_t; typedef unsigned int sa_family_t; -typedef uint32_t socklen_t; +typedef int socklen_t; struct sockaddr { sa_family_t sa_family; /* Address family */ char *sa_data; /* Socket address */ }; +struct sockaddr_in { + sa_family_t sin_family; + union { + uint32_t s_addr; + } sin_addr; + uint16_t sin_port; +}; + struct sockaddr_un { sa_family_t sun_family; /* Address family */ char *sun_path; /* Socket pathname */ @@ -39,3 +52,4 @@ struct sockaddr_un { 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); +#endif // SOCKET_H diff --git a/userland/libc/include/sys/socket.h b/userland/libc/include/sys/socket.h index e69de29..18402d0 100644 --- a/userland/libc/include/sys/socket.h +++ b/userland/libc/include/sys/socket.h @@ -0,0 +1,7 @@ +#include <socket.h> +#include <stddef.h> + +#define MSG_WAITALL 1 + +size_t recvfrom(int socket, void *buffer, size_t length, int flags, + struct sockaddr *address, socklen_t *address_len); diff --git a/userland/libc/include/syscall.h b/userland/libc/include/syscall.h index b3863d2..7d84b8f 100644 --- a/userland/libc/include/syscall.h +++ b/userland/libc/include/syscall.h @@ -32,6 +32,7 @@ #define SYS_MSLEEP 24 #define SYS_UPTIME 25 #define SYS_MKDIR 26 +#define SYS_RECVFROM 27 int syscall(uint32_t eax, uint32_t ebx, uint32_t ecx, uint32_t edx, uint32_t esi, uint32_t edi); |