From 15003d1b0abccc8bcef84386c4a6da176e41f883 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Sun, 9 Jun 2024 22:05:53 +0200 Subject: Add UDP --- kernel/socket.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'kernel/socket.h') diff --git a/kernel/socket.h b/kernel/socket.h index 3d1025d..ef5863d 100644 --- a/kernel/socket.h +++ b/kernel/socket.h @@ -1,3 +1,5 @@ +struct sockaddr; +typedef int socklen_t; #ifndef SOCKET_H #define SOCKET_H #include @@ -27,6 +29,17 @@ struct TcpListen { struct stack incoming_connections; }; +struct UdpConnection { + u16 incoming_port; + u32 incoming_ip; + u32 outgoing_ip; + u16 outgoing_port; + + int dead; + + struct ringbuffer incoming_buffer; +}; + struct TcpConnection { int dead; u16 incoming_port; @@ -52,6 +65,8 @@ struct TcpConnection *internal_tcp_incoming(u32 src_ip, u16 src_port, struct TcpConnection *tcp_find_connection(ipv4_t src_ip, u16 src_port, u16 dst_port); +struct UdpConnection *udp_find_connection(ipv4_t src_ip, u16 src_port, + u16 dst_port); typedef struct { vfs_fd_t *ptr_socket_fd; @@ -83,7 +98,6 @@ typedef struct { typedef u32 in_addr_t; typedef u16 in_port_t; typedef unsigned int sa_family_t; -typedef int socklen_t; struct sockaddr { sa_family_t sa_family; /* Address family */ -- cgit v1.2.3