From d9a3ea763bb366a5d60301cd35452843d680a75b Mon Sep 17 00:00:00 2001 From: turbocat Date: Sun, 13 Mar 2022 14:45:55 +0000 Subject: [PATCH] kernel: added struct sockaddr git-svn-id: svn://kolibrios.org@9739 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/network/socket.inc | 9 +++++++++ kernel/trunk/network/udp.inc | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/kernel/trunk/network/socket.inc b/kernel/trunk/network/socket.inc index 29002197b3..d5f09dd698 100644 --- a/kernel/trunk/network/socket.inc +++ b/kernel/trunk/network/socket.inc @@ -169,6 +169,15 @@ struct STREAM_SOCKET TCP_SOCKET ends +struct sockaddr + + family dw ? ; Address family + port dw ? ; 16 bit TCP/UDP port number + ip dd ? ; 32 bit IP address + _zero rb 8 ; Not use, for align + +ends + struct socket_queue_entry data_ptr dd ? diff --git a/kernel/trunk/network/udp.inc b/kernel/trunk/network/udp.inc index 8741e2d40d..e64a9db566 100644 --- a/kernel/trunk/network/udp.inc +++ b/kernel/trunk/network/udp.inc @@ -305,6 +305,7 @@ udp_output: ; udp_connect ; ; ; ; IN: eax = socket pointer ; +; edx = pointer to sockaddr struct ; ; ; ; OUT: eax = 0 on success ; ; eax = -1 on error ; @@ -325,10 +326,10 @@ udp_connect: pop edx eax ; Fill in remote port and IP - pushw [edx + 2] - pop [eax + UDP_SOCKET.RemotePort] + pushw [edx + sockaddr.port] + popw [eax + UDP_SOCKET.RemotePort] - pushd [edx + 4] + pushd [edx + sockaddr.ip] pop [eax + UDP_SOCKET.RemoteIP] ; Find route to host