diff options
Diffstat (limited to 'userland/libc/include/socket.h')
-rw-r--r-- | userland/libc/include/socket.h | 16 |
1 files changed, 15 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 |