diff --git a/kernel/branches/net/network/socket.inc b/kernel/branches/net/network/socket.inc index c2b8e56aae..a9d617c204 100644 --- a/kernel/branches/net/network/socket.inc +++ b/kernel/branches/net/network/socket.inc @@ -57,9 +57,6 @@ virtual at IP_SOCKET.end .LocalPort dw ? .RemotePort dw ? - .OrigRemoteIP dd ? ; original remote IP address (used to reset to LISTEN state) - .OrigRemotePort dw ? ; original remote port (used to reset to LISTEN state) - .t_state dd ? ; TCB state .t_rxtshift dd ? .t_rxtcur dd ? @@ -1491,8 +1488,6 @@ SOCKET_fork: rep movsd and [eax + SOCKET.options], not SO_ACCEPTCON - - ;;;;; call SOCKET_notify_owner pop edi ecx esi ret @@ -1625,7 +1620,7 @@ SOCKET_check_owner: -;--------------------------------------------------- +;------------------------------------------------------ ; ; SOCKET_process_end ; @@ -1675,6 +1670,8 @@ SOCKET_process_end: .tcp: + ;;; TODO + jmp .next_socket .done: @@ -1685,6 +1682,43 @@ SOCKET_process_end: +;----------------------------------------------------------------- +; +; SOCKET_is_connecting +; +; IN: eax = socket ptr +; OUT: / +; +;----------------------------------------------------------------- + +align 4 +SOCKET_is_connecting: + + + and [eax + SOCKET.options], not (SS_ISCONNECTED + SS_ISDISCONNECTING + SS_ISCONFIRMING) + or [eax + SOCKET.options], SS_ISCONNECTING + + jmp SOCKET_notify_owner + + + +;----------------------------------------------------------------- +; +; SOCKET_is_connected +; +; IN: eax = socket ptr +; OUT: / +; +;----------------------------------------------------------------- + +align 4 +SOCKET_is_connected: + + + and [eax + SOCKET.options], not (SS_ISCONNECTING + SS_ISDISCONNECTING + SS_ISCONFIRMING) + or [eax + SOCKET.options], SS_ISCONNECTED + + jmp SOCKET_notify_owner @@ -1738,13 +1772,15 @@ SOCKET_is_disconnected: align 4 SOCKET_cant_recv_more: + or [eax + SOCKET.options], SS_CANTRCVMORE + ret ;----------------------------------------------------------------- ; -; SOCKET_is_connected +; SOCKET_cant_send_more ; ; IN: eax = socket ptr ; OUT: / @@ -1752,10 +1788,8 @@ SOCKET_cant_recv_more: ;----------------------------------------------------------------- align 4 -SOCKET_is_connected: +SOCKET_cant_send_more: + or [eax + SOCKET.options], SS_CANTSENDMORE - and [eax + SOCKET.options], not (SS_ISCONNECTING + SS_ISDISCONNECTING + SS_ISCONFIRMING) - or [eax + SOCKET.options], SS_ISCONNECTED - - jmp SOCKET_notify_owner \ No newline at end of file + ret \ No newline at end of file diff --git a/kernel/branches/net/network/stack.inc b/kernel/branches/net/network/stack.inc index 4b528bdc05..d0aa844945 100644 --- a/kernel/branches/net/network/stack.inc +++ b/kernel/branches/net/network/stack.inc @@ -60,7 +60,16 @@ SOCK_DGRAM equ 2 SOCK_RAW equ 3 ; Socket options -SO_ACCEPTCON equ 1 +SO_ACCEPTCON equ 1 shl 0 +SO_BROADCAST equ 1 shl 1 +SO_DEBUG equ 1 shl 2 +SO_DONTROUTE equ 1 shl 3 +SO_KEEPALIVE equ 1 shl 4 +SO_OOBINLINE equ 1 shl 5 +SO_REUSEADDR equ 1 shl 6 +SO_REUSEPORT equ 1 shl 7 +SO_USELOOPBACK equ 1 shl 8 + ; Socket States SS_NOFDREF equ 0x001 ; no file table ref any more diff --git a/kernel/branches/net/network/tcp_subr.inc b/kernel/branches/net/network/tcp_subr.inc index 2294cfdcef..9ac0f345bc 100644 --- a/kernel/branches/net/network/tcp_subr.inc +++ b/kernel/branches/net/network/tcp_subr.inc @@ -173,9 +173,7 @@ TCP_close: ;;; TODO: update slow start threshold ;;; TODO: release connection resources -; Now, mark the socket as being disconnected - - mov [eax + SOCKET.state], 0 ;;; FIXME + call SOCKET_is_disconnected ret diff --git a/kernel/branches/net/network/tcp_timer.inc b/kernel/branches/net/network/tcp_timer.inc index e7f7b9661c..8c27efb33d 100644 --- a/kernel/branches/net/network/tcp_timer.inc +++ b/kernel/branches/net/network/tcp_timer.inc @@ -33,7 +33,7 @@ local .exit cmp [ebx + SOCKET.Domain], AF_INET4 jne .loop - cmp [ebx + SOCKET.Protocol], IP_PROTO_TCP ;;; We should also check if family is AF_INET + cmp [ebx + SOCKET.Protocol], IP_PROTO_TCP jne .loop test [ebx + TCP_SOCKET.t_flags], TF_DELACK