Subversion Repositories Kolibri OS

Rev

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

Rev 2890 Rev 2891
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: 2890 $
17
$Revision: 2891 $
18
 
18
 
19
;-----------------------------------------------------------------
19
;-----------------------------------------------------------------
20
;
20
;
Line 26... Line 26...
26
;
26
;
27
;-----------------------------------------------------------------
27
;-----------------------------------------------------------------
28
align 4
28
align 4
29
TCP_output:
29
TCP_output:
Line 30... Line 30...
30
 
30
 
-
 
31
        DEBUGF 1,"TCP_output: socket=%x\n", eax
-
 
32
 
-
 
33
        pushf
-
 
34
        cli
-
 
35
 
-
 
36
        pusha
-
 
37
        lea     ecx, [eax + SOCKET.mutex]
-
 
38
        call    mutex_lock
Line 31... Line 39...
31
        DEBUGF 1,"TCP_output, socket: %x\n", eax
39
        popa
32
 
40
 
33
; We'll detect the length of the data to be transmitted, and flags to be used
41
; We'll detect the length of the data to be transmitted, and flags to be used
Line 253... Line 261...
253
        cmp     [eax + TCP_SOCKET.timer_retransmission], 0
261
        cmp     [eax + TCP_SOCKET.timer_retransmission], 0
254
        jne     @f
262
        jne     @f
255
        cmp     [eax + TCP_SOCKET.timer_persist], 0     ; Persist timer already expired?
263
        cmp     [eax + TCP_SOCKET.timer_persist], 0     ; Persist timer already expired?
256
        jne     @f
264
        jne     @f
Line 257... Line 265...
257
 
265
 
Line 258... Line 266...
258
        DEBUGF  1,"Entering persist state\n"
266
        DEBUGF  1,"TCP_output: Entering persist state\n"
259
 
267
 
260
        mov     [eax + TCP_SOCKET.t_rxtshift], 0
268
        mov     [eax + TCP_SOCKET.t_rxtshift], 0
Line 261... Line 269...
261
        TCP_set_persist eax
269
        TCP_set_persist eax
262
       @@:
270
       @@:
Line 263... Line 271...
263
 
271
 
Line 264... Line 272...
264
;----------------------------
272
;----------------------------
265
; No reason to send a segment (219)
273
; No reason to send a segment (219)
266
 
274
 
267
        DEBUGF  1,"No reason to send a segment\n"
275
        DEBUGF  1,"TCP_output: No reason to send a segment\n"
-
 
276
 
Line 268... Line 277...
268
 
277
        pusha
Line 291... Line 300...
291
;
300
;
292
;-----------------------------------------------
301
;-----------------------------------------------
293
align 4
302
align 4
294
TCP_send:
303
TCP_send:
Line 295... Line 304...
295
 
304
 
Line 296... Line 305...
296
        DEBUGF  1,"TCP_send socket=%x length=%u flags=%x\n", eax, esi, dl
305
        DEBUGF  1,"TCP_send: socket=%x length=%u flags=%x\n", eax, esi, dl
297
 
306
 
Line 298... Line 307...
298
        push    eax                     ; save socket ptr
307
        push    eax                     ; save socket ptr
Line 499... Line 508...
499
  .retransmit_set:
508
  .retransmit_set:
Line 500... Line 509...
500
 
509
 
501
;--------------------
510
;--------------------
Line 502... Line -...
502
; Create the checksum
-
 
503
 
-
 
504
        DEBUGF  1,"checksum: ptr=%x size=%u\n", esi, ecx
511
; Create the checksum
505
 
512
 
Line 506... Line 513...
506
        TCP_checksum (eax + IP_SOCKET.LocalIP), (eax + IP_SOCKET.RemoteIP)
513
        TCP_checksum (eax + IP_SOCKET.LocalIP), (eax + IP_SOCKET.RemoteIP)
507
        mov     [esi + TCP_header.Checksum], dx
514
        mov     [esi + TCP_header.Checksum], dx
Line 508... Line 515...
508
 
515
 
509
;----------------
516
;----------------
510
; Send the packet
517
; Send the packet
511
 
518
 
Line 512... Line 519...
512
        DEBUGF  1,"Sending TCP Packet to device %x\n", ebx
519
        DEBUGF  1,"TCP_send: Sending with device %x\n", ebx
Line 527... Line 534...
527
        jne     TCP_output.again
534
        jne     TCP_output.again
Line 528... Line 535...
528
 
535
 
529
; unlock socket
536
; unlock socket
530
        lea     ecx, [eax + SOCKET.mutex]
537
        lea     ecx, [eax + SOCKET.mutex]
-
 
538
        call    mutex_unlock
531
        call    mutex_unlock
539
        popf
Line 532... Line 540...
532
        DEBUGF 1,"TCP_output: success!\n"
540
        DEBUGF 1,"TCP_send: success!\n"
533
 
541
 
Line 543... Line 551...
543
        mov     [eax + TCP_SOCKET.timer_retransmission], TCP_time_re_min
551
        mov     [eax + TCP_SOCKET.timer_retransmission], TCP_time_re_min
Line 544... Line 552...
544
 
552
 
545
; unlock socket
553
; unlock socket
546
        lea     ecx, [eax + SOCKET.mutex]
554
        lea     ecx, [eax + SOCKET.mutex]
-
 
555
        call    mutex_unlock
547
        call    mutex_unlock
556
        popf
Line 548... Line 557...
548
        DEBUGF 1,"TCP_output: IP error\n"
557
        DEBUGF 1,"TCP_send: IP error\n"
549
 
558
 
Line 550... Line 559...
550
        or      eax, -1
559
        or      eax, -1
551
        ret
560
        ret
552
 
561
 
553
  .send_error:
562
  .send_error:
554
        pop     eax
563
        pop     eax
-
 
564
; unlock socket
555
; unlock socket
565
        lea     ecx, [eax + SOCKET.mutex]
Line 556... Line 566...
556
        lea     ecx, [eax + SOCKET.mutex]
566
        call    mutex_unlock
557
        call    mutex_unlock
567
        popf