Small update in TCP code, stub for TCP_close

git-svn-id: svn://kolibrios.org@1716 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2010-12-10 18:37:02 +00:00
parent b0017d06ea
commit d93ba1183b
3 changed files with 47 additions and 8 deletions

View File

@ -30,7 +30,7 @@ virtual at 0
.Domain dd ? ; INET/UNIX/..
.Type dd ? ; RAW/STREAM/DGRAP
.Protocol dd ? ; ICMP/IPv4/ARP/TCP/UDP
; .errorcode dd ?
.errorcode dd ?
.options dd ?
.state dd ?

View File

@ -76,6 +76,14 @@ NET_TYPE_SLIP equ 2
MAX_backlog equ 20 ; maximum backlog for stream sockets
; Error Codes
ENOBUFS equ 55
ECONNREFUSED equ 61
ECONNRESET equ 52
ETIMEDOUT equ 60
ECONNABORTED equ 53
virtual at 0

View File

@ -779,7 +779,8 @@ align 4
test [edx + TCP_segment.Flags], TH_ACK
jz .drop
;tp = tcp_drop(tp, ECONNREFUSED)
mov ebx, ECONNREFUSED
call TCP_drop
jmp .drop
@@:
@ -1063,7 +1064,9 @@ align 4
test [edx + TCP_segment.Flags], TH_SYN
jz @f
;;; tcp_drop ( ECONNRESET)
mov ebx, ECONNRESET
call TCP_drop
jmp .drop_with_reset
test [edx + TCP_segment.Flags], TH_ACK
@ -1964,8 +1967,9 @@ TCP_outflags:
; TCP_drop
;
; IN: eax = socket ptr
; ebx = error number
;
; OUT: /
; OUT: eax = socket ptr
;
;-------------------------
align 4
@ -1973,21 +1977,48 @@ TCP_drop:
DEBUGF 1,"TCP_drop\n"
; cmp [eax + TCP_SOCKET.t_state], TCB_SYN_RECEIVED
; jl .no_syn_received
cmp [eax + TCP_SOCKET.t_state], TCB_SYN_RECEIVED
jl .no_syn_received
mov [eax + TCP_SOCKET.t_state], TCB_CLOSED
call TCP_output
; .no_syn_received:
;;; TODO: update stats
jmp TCP_close
.no_syn_received:
;;; TODO: update stats
;;; TODO: check if error code is "Connection timed out' and handle accordingly
mov [eax + SOCKET.errorcode], ebx
jmp TCP_close
;-------------------------
;
; TCP_close
;
; IN: eax = socket ptr
; OUT: eax = socket ptr
;
;-------------------------
align 4
TCP_close:
;;; TODO: update RTT and mean deviation
;;; TODO: update slow start threshold
;;; TODO: release connection resources
ret
;---------------------------------------
;
; The easy way to send an ACK/RST/keepalive segment