Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3145 → Rev 3146

/kernel/branches/net/network/tcp_subr.inc
195,90 → 195,9
 
 
 
;-------------------------
;
; TCP_disconnect
;
; IN: eax = socket ptr
; OUT: eax = socket ptr
;
;-------------------------
align 4
TCP_disconnect:
 
DEBUGF 1,"TCP_disconnect: %x\n", eax
 
cmp [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED
jb TCP_close
 
 
; TODO: implement LINGER ?
 
call SOCKET_is_disconnecting
call TCP_usrclosed
call TCP_output
 
ret
 
 
 
;-------------------------
;
; TCP_usrclose
;
; IN: eax = socket ptr
;
;-------------------------
align 4
TCP_usrclosed:
 
DEBUGF 1,"TCP_usrclosed: %x\n", eax
 
push ebx
mov ebx, [eax + TCP_SOCKET.t_state]
mov ebx, dword [.switch + ebx*4]
jmp ebx
 
.switch:
 
dd .close ; TCPS_CLOSED
dd .close ; TCPS_LISTEN
dd .close ; TCPS_SYN_SENT
dd .wait1 ; TCPS_SYN_RECEIVED
dd .wait1 ; TCPS_ESTABLISHED
dd .last_ack ; TCPS_CLOSE_WAIT
dd .ret ; TCPS_FIN_WAIT_1
dd .ret ; TCPS_CLOSING
dd .ret ; TCPS_LAST_ACK
dd .disc ; TCPS_FIN_WAIT_2
dd .disc ; TCPS_TIMED_WAIT
 
 
.close:
pop ebx
mov [eax + TCP_SOCKET.t_state], TCPS_CLOSED
call TCP_close
ret
 
.wait1:
pop ebx
mov [eax + TCP_SOCKET.t_state], TCPS_FIN_WAIT_1
ret
 
.last_ack:
pop ebx
mov [eax + TCP_SOCKET.t_state], TCPS_LAST_ACK
ret
 
.disc:
call SOCKET_is_disconnected
.ret:
pop ebx
ret
 
 
;-------------------------
;
; TCP_outflags
;
; IN: eax = socket ptr