Subversion Repositories Kolibri OS

Rev

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

Rev 5363 Rev 5442
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: 5363 $
17
$Revision: 5442 $
18
 
18
 
19
;-----------------------------------------------------------------
19
;-----------------------------------------------------------------
20
;
20
;
Line 88... Line 88...
88
        test    ecx, ecx
88
        test    ecx, ecx
89
        jnz     .no_zero_window
89
        jnz     .no_zero_window
Line 90... Line 90...
90
 
90
 
91
        cmp     ebx, [eax + STREAM_SOCKET.snd.size]
91
        cmp     ebx, [eax + STREAM_SOCKET.snd.size]
92
        jae     @f
-
 
93
 
92
        jae     @f
94
        and     dl, not (TH_FIN)
-
 
95
 
93
        and     dl, not (TH_FIN)
-
 
94
       @@:
96
       @@:
95
 
97
        inc     ecx
96
        inc     ecx
Line 98... Line 97...
98
        jmp     .no_force
97
        jmp     .no_force
99
 
98
 
Line 111... Line 110...
111
        jb      @f
110
        jb      @f
112
        mov     esi, ecx
111
        mov     esi, ecx
113
       @@:
112
       @@:
114
        sub     esi, ebx
113
        sub     esi, ebx
Line 115... Line -...
115
 
-
 
116
 
114
 
117
;------------------------
115
;------------------------
Line 118... Line 116...
118
; check for window shrink (107)
116
; check for window shrink (107)
119
 
117
 
Line 144... Line 142...
144
;---------------------------
142
;---------------------------
145
; Send one segment at a time (124)
143
; Send one segment at a time (124)
Line 146... Line 144...
146
 
144
 
147
        cmp     esi, [eax + TCP_SOCKET.t_maxseg]
145
        cmp     esi, [eax + TCP_SOCKET.t_maxseg]
148
        jbe     @f
-
 
149
 
146
        jbe     @f
150
        mov     esi, [eax + TCP_SOCKET.t_maxseg]
147
        mov     esi, [eax + TCP_SOCKET.t_maxseg]
151
        or      [temp_bits], TCP_BIT_SENDALOT
148
        or      [temp_bits], TCP_BIT_SENDALOT
Line 152... Line 149...
152
       @@:
149
       @@:
Line 158... Line 155...
158
        add     edi, esi
155
        add     edi, esi
159
        sub     edi, [eax + TCP_SOCKET.SND_UNA]
156
        sub     edi, [eax + TCP_SOCKET.SND_UNA]
160
        cmp     edi, [eax + STREAM_SOCKET.snd.size]
157
        cmp     edi, [eax + STREAM_SOCKET.snd.size]
161
        jae     @f
158
        jae     @f
162
        and     dl, not (TH_FIN)
159
        and     dl, not (TH_FIN)
163
 
-
 
164
       @@:
160
       @@:
Line 165... Line 161...
165
 
161
 
166
;-------------------------------
162
;-------------------------------
Line 401... Line 397...
401
 
397
 
402
        mov     esi, [eax + TCP_SOCKET.t_maxseg]
398
        mov     esi, [eax + TCP_SOCKET.t_maxseg]
403
        or      [temp_bits], TCP_BIT_SENDALOT
399
        or      [temp_bits], TCP_BIT_SENDALOT
Line -... Line 400...
-
 
400
  .no_overflow:
-
 
401
 
-
 
402
; Update stats
-
 
403
        test    esi, esi
-
 
404
        jz      .zero_data
-
 
405
 
-
 
406
        cmp     [eax + TCP_SOCKET.t_force], 1
-
 
407
        jne     @f
-
 
408
        cmp     esi, 1
-
 
409
        jne     @f
-
 
410
        inc     [TCPS_sndprobe]
-
 
411
        jmp     .eos
-
 
412
  @@:
-
 
413
 
-
 
414
        mov     ebx, [eax + TCP_SOCKET.SND_NXT]
-
 
415
        cmp     ebx, [eax + TCP_SOCKET.SND_MAX]
-
 
416
        jae     @f
-
 
417
        inc     [TCPS_sndrexmitpack]
-
 
418
        add     [TCPS_sndrexmitbyte], esi
-
 
419
        jmp     .eos
-
 
420
  @@:
-
 
421
        inc     [TCPS_sndpack]
-
 
422
        add     [TCPS_sndbyte], esi
-
 
423
        jmp     .eos
-
 
424
 
-
 
425
  .zero_data:
-
 
426
        test    [eax + TCP_SOCKET.t_flags], TF_ACKNOW
-
 
427
        jz      @f
-
 
428
        inc     [TCPS_sndacks]
-
 
429
        jmp     .eos
-
 
430
  @@:
-
 
431
        test    dl, TH_SYN + TH_FIN + TH_RST
-
 
432
        jz      @f
-
 
433
        inc     [TCPS_sndctrl]
-
 
434
        jmp     .eos
-
 
435
  @@:
-
 
436
        mov     ebx, [eax + TCP_SOCKET.SND_UP]
-
 
437
        cmp     ebx, [eax + TCP_SOCKET.SND_UNA]
-
 
438
        jb      @f
-
 
439
        inc     [TCPS_sndurg]
-
 
440
        jmp     .eos
-
 
441
  @@:
-
 
442
        inc     [TCPS_sndwinup]
-
 
443
 
404
  .no_overflow:
444
  .eos:
405
 
445
 
406
;----------------------------------------------------
446
;----------------------------------------------------
Line 407... Line 447...
407
; Calculate the receive window.
447
; Calculate the receive window.
Line 467... Line 507...
467
        mov     eax, [eax + IP_SOCKET.RemoteIP] ; dest ip
507
        mov     eax, [eax + IP_SOCKET.RemoteIP] ; dest ip
468
        mov     di, IP_PROTO_TCP shl 8 + 128
508
        mov     di, IP_PROTO_TCP shl 8 + 128
469
        call    IPv4_output
509
        call    IPv4_output
470
        jz      .ip_error
510
        jz      .ip_error
Line 471... Line 511...
471
 
511
 
472
;-----------------------------------------
512
;------------------------------------------
Line 473... Line 513...
473
; Move TCP header from stack to TCP packet
513
; Move TCP header from stack to TCP segment
474
 
514
 
475
        push    ecx
515
        push    ecx
476
        mov     ecx, [esp + 4]
516
        mov     ecx, [esp + 4]
Line 502... Line 542...
502
        push    edx
542
        push    edx
503
        push    [eax + TCP_SOCKET.SND_NXT]      ; we'll need this for timing the transmission
543
        push    [eax + TCP_SOCKET.SND_NXT]      ; we'll need this for timing the transmission
504
        test    ecx, ecx
544
        test    ecx, ecx
505
        jz      .nodata
545
        jz      .nodata
506
        mov     edx, [eax + TCP_SOCKET.SND_NXT]
546
        mov     edx, [eax + TCP_SOCKET.SND_NXT]
507
        add     [eax + TCP_SOCKET.SND_NXT], ecx ; update sequence number <<< CHECKME
547
        add     [eax + TCP_SOCKET.SND_NXT], ecx ; update sequence number
508
        sub     edx, [eax + TCP_SOCKET.SND_UNA] ; offset
548
        sub     edx, [eax + TCP_SOCKET.SND_UNA] ; offset
509
        add     eax, STREAM_SOCKET.snd
549
        add     eax, STREAM_SOCKET.snd
510
        call    SOCKET_ring_read
550
        call    SOCKET_ring_read
511
  .nodata:
551
  .nodata:
512
        pop     edi
552
        pop     edi
Line 534... Line 574...
534
 
574
 
535
        cmp     [eax + TCP_SOCKET.t_rtt], 0                     ; are we currently timing anything?
575
        cmp     [eax + TCP_SOCKET.t_rtt], 0                     ; are we currently timing anything?
536
        je      @f
576
        je      @f
537
        mov     [eax + TCP_SOCKET.t_rtt], 1                     ; nope, start transmission timer
577
        mov     [eax + TCP_SOCKET.t_rtt], 1                     ; nope, start transmission timer
538
        mov     [eax + TCP_SOCKET.t_rtseq], edi
578
        mov     [eax + TCP_SOCKET.t_rtseq], edi
539
;TODO: update stats
579
        inc     [TCPS_segstimed]
Line 540... Line 580...
540
       @@:
580
       @@:
541
 
581
 
542
; set retransmission timer if not already set, and not doing an ACK or keepalive probe
582
; set retransmission timer if not already set, and not doing an ACK or keepalive probe
Line 582... Line 622...
582
        pop     ecx
622
        pop     ecx
583
        pop     eax
623
        pop     eax
Line 584... Line 624...
584
 
624
 
585
        call    NET_ptr_to_num4
625
        call    NET_ptr_to_num4
-
 
626
        inc     [TCP_segments_tx + edi]
Line 586... Line 627...
586
        inc     [TCP_segments_tx + edi]
627
        inc     [TCPS_sndtotal]
587
 
628
 
588
; update advertised receive window
629
; update advertised receive window
589
        test    ecx, ecx
630
        test    ecx, ecx