From 18d56a408733fcc1ece7e845c69336ccbad4f456 Mon Sep 17 00:00:00 2001 From: CleverMouse Date: Mon, 30 Nov 2009 11:19:59 +0000 Subject: [PATCH] allow query of TCP socket state through getsockopt() git-svn-id: svn://kolibrios.org@1299 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/net/network/socket.inc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/branches/net/network/socket.inc b/kernel/branches/net/network/socket.inc index 85a3d5f2c5..b6a41c1c70 100644 --- a/kernel/branches/net/network/socket.inc +++ b/kernel/branches/net/network/socket.inc @@ -741,6 +741,7 @@ socket_send: ; ; At moment, uses only pseudo-optname -2 for get last_ack_number for TCP. ; TODO: find best way to notify that send()'ed data were acknowledged +; Also pseudo-optname -3 is valid and returns socket state, one of TCB_*. ; ;----------------------------------------------------------------- align 4 @@ -749,7 +750,10 @@ socket_get_opt: cmp dword [edx], IP_PROTO_TCP jnz .unknown cmp dword [edx+4], -2 + jz @f + cmp dword [edx+4], -3 jnz .unknown +@@: mov eax, [edx+12] test eax, eax jz .fail @@ -761,6 +765,10 @@ socket_get_opt: jz .fail ; todo: check that eax is really TCP socket mov ecx, [eax + SOCKET_head.end + IPv4_SOCKET.end + TCP_SOCKET.last_ack_number] + cmp dword [edx+4], -2 + jz @f + mov ecx, [eax + SOCKET_head.end + IPv4_SOCKET.end + TCP_SOCKET.state] +@@: mov eax, [edx+8] test eax, eax jz @f