Subversion Repositories Kolibri OS

Rev

Rev 3589 | Rev 5201 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3589 Rev 3626
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved.    ;;
3
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved.    ;;
4
;; Distributed under terms of the GNU General Public License       ;;
4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
5
;;                                                                 ;;
6
;;  Part of the TCP/IP network stack for KolibriOS                 ;;
6
;;  Part of the TCP/IP network stack for KolibriOS                 ;;
7
;;                                                                 ;;
7
;;                                                                 ;;
8
;;   Written by hidnplayr@kolibrios.org                            ;;
8
;;   Written by hidnplayr@kolibrios.org                            ;;
Line 14... Line 14...
14
;;                                                                 ;;
14
;;                                                                 ;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 16... Line 16...
16
 
16
 
Line -... Line 17...
-
 
17
$Revision: 3143 $
-
 
18
 
-
 
19
timer_flag_retransmission       = 1 shl 0
-
 
20
timer_flag_keepalive            = 1 shl 1
-
 
21
timer_flag_2msl                 = 1 shl 2
-
 
22
timer_flag_persist              = 1 shl 3
-
 
23
timer_flag_wait                 = 1 shl 4
17
$Revision: 3143 $
24
 
18
 
25
 
19
;----------------------
26
;----------------------
20
; 160 ms timer
27
; 160 ms timer
Line 25... Line 32...
25
local   .exit
32
local   .exit
Line 26... Line 33...
26
 
33
 
27
        mov     ebx, net_sockets
34
        mov     ebx, net_sockets
28
  .loop:
35
  .loop:
29
        mov     ebx, [ebx + SOCKET.NextPtr]
36
        mov     ebx, [ebx + SOCKET.NextPtr]
30
        or      ebx, ebx
37
        test    ebx, ebx
Line 31... Line 38...
31
        jz      .exit
38
        jz      .exit
32
 
39
 
33
        cmp     [ebx + SOCKET.Domain], AF_INET4
-
 
34
        jne     .loop
40
        cmp     [ebx + SOCKET.Domain], AF_INET4
35
 
41
        jne     .loop
36
        cmp     [ebx + SOCKET.Protocol], IP_PROTO_TCP
-
 
37
        jne     .loop
42
        cmp     [ebx + SOCKET.Protocol], IP_PROTO_TCP
38
 
43
        jne     .loop
-
 
44
        test    [ebx + TCP_SOCKET.t_flags], TF_DELACK
39
        test    [ebx + TCP_SOCKET.t_flags], TF_DELACK
45
        jz      .loop
Line 40... Line 46...
40
        jz      .loop
46
 
41
        and     [ebx + TCP_SOCKET.t_flags], not (TF_DELACK)
47
        and     [ebx + TCP_SOCKET.t_flags], not (TF_DELACK)
42
 
48
 
Line 56... Line 62...
56
 
62
 
57
 
63
 
58
;----------------------
64
;----------------------
59
; 640 ms timer
65
; 640 ms timer
Line 60... Line 66...
60
;----------------------
66
;----------------------
61
macro   TCP_timer_640ms {
67
macro   TCP_timer_640ms {                       ; TODO: implement timed wait timer!
Line 62... Line 68...
62
 
68
 
Line 63... Line 69...
63
local   .loop
69
local   .loop
Line 64... Line 70...
64
local   .exit
70
local   .exit
65
 
71
 
Line 66... Line 72...
66
; Update TCP sequence number
72
; Update TCP sequence number
67
 
73
 
68
        add     [TCP_sequence_num], 64000
74
        add     [TCP_sequence_num], 64000
69
 
75
 
Line 82... Line 88...
82
 
88
 
83
        cmp     [eax + SOCKET.Protocol], IP_PROTO_TCP
89
        cmp     [eax + SOCKET.Protocol], IP_PROTO_TCP
Line 84... Line 90...
84
        jne     .loop
90
        jne     .loop
-
 
91
 
85
 
92
        inc     [eax + TCP_SOCKET.t_idle]
86
        inc     [eax + TCP_SOCKET.t_idle]
93
 
-
 
94
        dec     [eax + TCP_SOCKET.timer_retransmission]
-
 
95
        jnz     .check_more2
Line 87... Line 96...
87
        dec     [eax + TCP_SOCKET.timer_retransmission]
96
        test    [eax + TCP_SOCKET.timer_flags], timer_flag_retransmission
Line 88... Line 97...
88
        jnz     .check_more2
97
        jz      .check_more2
89
 
98
 
90
        DEBUGF  DEBUG_NETWORK_VERBOSE, "socket %x: Retransmission timer expired\n", eax
99
        DEBUGF  DEBUG_NETWORK_VERBOSE, "socket %x: Retransmission timer expired\n", eax
Line 91... Line 100...
91
 
100
 
92
        push    eax
101
        push    eax
93
        call    TCP_output
102
        call    TCP_output
-
 
103
        pop     eax
-
 
104
 
Line 94... Line 105...
94
        pop     eax
105
  .check_more2:
Line 95... Line 106...
95
 
106
        dec     [eax + TCP_SOCKET.timer_keepalive]
96
  .check_more2:
107
        jnz     .check_more3
Line 123... Line 134...
123
        mov     [eax + TCP_SOCKET.timer_keepalive], TCP_time_keep_idle
134
        mov     [eax + TCP_SOCKET.timer_keepalive], TCP_time_keep_idle
Line 124... Line 135...
124
 
135
 
125
  .check_more3:
136
  .check_more3:
126
        dec     [eax + TCP_SOCKET.timer_timed_wait]
137
        dec     [eax + TCP_SOCKET.timer_timed_wait]
-
 
138
        jnz     .check_more5
-
 
139
        test    [eax + TCP_SOCKET.timer_flags], timer_flag_2msl
Line 127... Line 140...
127
        jnz     .check_more5
140
        jz      .check_more5
Line 128... Line 141...
128
 
141
 
129
        DEBUGF  DEBUG_NETWORK_VERBOSE, "socket %x: 2MSL timer expired\n", eax
142
        DEBUGF  DEBUG_NETWORK_VERBOSE, "socket %x: 2MSL timer expired\n", eax
130
 
143
 
-
 
144
  .check_more5:
-
 
145
        dec     [eax + TCP_SOCKET.timer_persist]
Line 131... Line 146...
131
  .check_more5:
146
        jnz     .loop
Line 132... Line 147...
132
        dec     [eax + TCP_SOCKET.timer_persist]
147
        test    [eax + TCP_SOCKET.timer_flags], timer_flag_persist
133
        jnz     .loop
148
        jz      .loop
Line 150... Line 165...
150
 
165
 
Line 151... Line 166...
151
; eax = socket
166
; eax = socket
Line 152... Line -...
152
 
-
 
153
TCP_cancel_timers:
-
 
154
 
167
 
155
        push    eax edi
-
 
156
 
-
 
157
        lea     edi, [eax + TCP_SOCKET.timer_retransmission]
-
 
158
        xor     eax, eax
-
 
159
        stosd
-
 
160
        stosd
-
 
161
        stosd
-
 
162
        stosd
-
 
163
        stosd
-
 
Line 164... Line 168...
164
 
168
TCP_cancel_timers:
165
        pop     edi eax
169