Subversion Repositories Kolibri OS

Rev

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

Rev 4423 Rev 5201
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved.    ;;
3
;; Copyright (C) KolibriOS team 2004-2014. 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 12... Line 12...
12
;;          GNU GENERAL PUBLIC LICENSE                             ;;
12
;;          GNU GENERAL PUBLIC LICENSE                             ;;
13
;;             Version 2, June 1991                                ;;
13
;;             Version 2, June 1991                                ;;
14
;;                                                                 ;;
14
;;                                                                 ;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 16... Line 16...
16
 
16
 
Line 17... Line 17...
17
$Revision: 4423 $
17
$Revision: 5201 $
18
 
18
 
19
; Socket states
19
; Socket states
20
TCPS_CLOSED             = 0
20
TCPS_CLOSED             = 0
Line 94... Line 94...
94
 
94
 
95
; bits used by tcp_input and tcp_output
95
; bits used by tcp_input and tcp_output
96
TCP_BIT_NEEDOUTPUT      = 1 shl 0
96
TCP_BIT_NEEDOUTPUT      = 1 shl 0
97
TCP_BIT_TIMESTAMP       = 1 shl 1
97
TCP_BIT_TIMESTAMP       = 1 shl 1
-
 
98
TCP_BIT_DROPSOCKET      = 1 shl 2
Line 98... Line 99...
98
TCP_BIT_DROPSOCKET      = 1 shl 2
99
TCP_BIT_FIN_IS_ACKED    = 1 shl 3
Line 99... Line 100...
99
 
100
 
Line 139... Line 140...
139
;        TCP_bytes_rx            rq NET_DEVICES_MAX
140
;        TCP_bytes_rx            rq NET_DEVICES_MAX
140
;        TCP_bytes_tx            rq NET_DEVICES_MAX
141
;        TCP_bytes_tx            rq NET_DEVICES_MAX
141
        TCP_sequence_num        dd ?
142
        TCP_sequence_num        dd ?
142
        TCP_queue               rd (TCP_QUEUE_SIZE*sizeof.TCP_queue_entry + sizeof.queue)/4
143
        TCP_queue               rd (TCP_QUEUE_SIZE*sizeof.TCP_queue_entry + sizeof.queue)/4
143
        TCP_input_event         dd ?
144
        TCP_input_event         dd ?
-
 
145
        TCP_timer1_event        dd ?
144
endg
146
endg
Line 145... Line 147...
145
 
147
 
146
uglobal
148
uglobal
Line 222... Line 224...
222
        movi    ebx, 1
224
        movi    ebx, 1
223
        mov     ecx, TCP_process_input
225
        mov     ecx, TCP_process_input
224
        call    new_sys_threads
226
        call    new_sys_threads
225
        test    eax, eax
227
        test    eax, eax
226
        jns     @f
228
        jns     @f
227
        DEBUGF  DEBUG_NETWORK_ERROR,'K : cannot create kernel thread for TCP, error %d\n', eax
229
        DEBUGF  DEBUG_NETWORK_ERROR,'K : cannot create kernel thread for TCP input, error %d\n', eax
-
 
230
  @@:
-
 
231
 
-
 
232
        movi    ebx, 1
-
 
233
        mov     ecx, TCP_timer_640ms
-
 
234
        call    new_sys_threads
-
 
235
        test    eax, eax
-
 
236
        jns     @f
-
 
237
        DEBUGF  DEBUG_NETWORK_ERROR,'K : cannot create kernel thread for TCP timer, error %d\n', eax
228
  @@:
238
  @@:
Line 229... Line 239...
229
 
239
 
Line 262... Line 272...
262
        jz      .packets_rx     ; 1
272
        jz      .packets_rx     ; 1
263
        dec     bl
273
        dec     bl
264
        jz      .packets_missed ; 2
274
        jz      .packets_missed ; 2
265
        dec     bl
275
        dec     bl
266
        jz      .packets_dumped ; 3
276
        jz      .packets_dumped ; 3
-
 
277
        dec     bl
-
 
278
        jz      .packets_queued ; 4
Line 267... Line 279...
267
 
279
 
268
  .error:
280
  .error:
269
        mov     eax, -1
281
        mov     eax, -1
Line 282... Line 294...
282
        ret
294
        ret
Line 283... Line 295...
283
 
295
 
284
  .packets_dumped:
296
  .packets_dumped:
285
        mov     eax, [TCP_segments_dumped + eax]
297
        mov     eax, [TCP_segments_dumped + eax]
-
 
298
        ret
-
 
299
 
-
 
300
  .packets_queued:
-
 
301
        mov     eax, [TCP_queue + queue.size]