Subversion Repositories Kolibri OS

Rev

Rev 10051 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10051 Rev 10058
Line 203... Line 203...
203
        popa
203
        popa
Line 204... Line 204...
204
 
204
 
Line 205... Line 205...
205
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_input: socket ptr=%x state=%u flags=%x\n", ebx, [ebx + TCP_SOCKET.t_state], [edx + TCP_header.Flags]:2
205
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_input: socket ptr=%x state=%u flags=%x\n", ebx, [ebx + TCP_SOCKET.t_state], [edx + TCP_header.Flags]:2
206
 
206
 
Line 207... Line 207...
207
;----------------------------
207
;----------------------------
208
; Check if socket isnt closed
208
; Check if socket is not closed
Line 209... Line 209...
209
 
209
 
Line 230... Line 230...
230
 
230
 
231
        movzx   eax, [edx + TCP_header.Window]
231
        movzx   eax, [edx + TCP_header.Window]
232
        push    ecx
232
        push    ecx
233
        mov     cl, [ebx + TCP_SOCKET.SND_SCALE]
233
        mov     cl, [ebx + TCP_SOCKET.SND_SCALE]
234
        shl     eax, cl
234
        shl     eax, cl
235
        mov     dword[edx + TCP_header.Window], eax     ; word after window is checksum, we dont need checksum anymore
235
        mov     dword[edx + TCP_header.Window], eax     ; word after window is checksum, we don't need checksum anymore
Line 236... Line 236...
236
        pop     ecx
236
        pop     ecx
237
 
237
 
238
;-----------------------------------------------------------------------------------
238
;-----------------------------------------------------------------------------------
Line 395... Line 395...
395
        mov     [ebx + TCP_SOCKET.ts_val], eax
395
        mov     [ebx + TCP_SOCKET.ts_val], eax
396
        lodsd                                   ; timestamp echo reply
396
        lodsd                                   ; timestamp echo reply
397
        mov     [ebx + TCP_SOCKET.ts_ecr], eax
397
        mov     [ebx + TCP_SOCKET.ts_ecr], eax
398
        or      [temp_bits], TCP_BIT_TIMESTAMP
398
        or      [temp_bits], TCP_BIT_TIMESTAMP
Line 399... Line 399...
399
 
399
 
Line 400... Line 400...
400
        ; Since we have a timestamp, lets do the paws test right away!
400
        ; Since we have a timestamp, let's do the paws test right away!
401
 
401
 
Line 402... Line 402...
402
        test    [edx + TCP_header.Flags], TH_RST
402
        test    [edx + TCP_header.Flags], TH_RST
Line 1268... Line 1268...
1268
 
1268
 
1269
        test    [temp_bits], TCP_BIT_FIN_IS_ACKED
1269
        test    [temp_bits], TCP_BIT_FIN_IS_ACKED
Line 1270... Line 1270...
1270
        jz      .ack_processed
1270
        jz      .ack_processed
1271
 
1271
 
1272
; If we can't receive any more data, then closing user can proceed.
1272
; If we can't receive any more data, then closing user can proceed.
Line 1273... Line 1273...
1273
; Starting the timer is contrary to the specification, but if we dont get a FIN,
1273
; Starting the timer is contrary to the specification, but if we don't get a FIN,
1274
; we'll hang forever.
1274
; we'll hang forever.
1275
 
1275
 
Line 1512... Line 1512...
1512
; Advance sequence number to correspond to first data byte.
1512
; Advance sequence number to correspond to first data byte.
1513
; If data, trim to stay within window, dropping FIN if necessary
1513
; If data, trim to stay within window, dropping FIN if necessary
Line 1514... Line 1514...
1514
 
1514
 
Line 1515... Line 1515...
1515
        inc     [edx + TCP_header.SequenceNumber]
1515
        inc     [edx + TCP_header.SequenceNumber]
Line 1516... Line 1516...
1516
 
1516
 
1517
; Drop any received data that doesnt fit in the receive window.
1517
; Drop any received data that doesn't fit in the receive window.
Line 1518... Line 1518...
1518
 
1518
 
Line 1540... Line 1540...
1540
;-----------------------------------------------------------------------------------
1540
;-----------------------------------------------------------------------------------
Line 1541... Line 1541...
1541
 
1541
 
1542
  .ack_processed:
1542
  .ack_processed:
Line 1543... Line 1543...
1543
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_input: ACK processed\n"
1543
        DEBUGF  DEBUG_NETWORK_VERBOSE, "TCP_input: ACK processed\n"
Line 1544... Line 1544...
1544
 
1544
 
1545
; dont look at window if no ACK
1545
; don't look at window if no ACK
Line 1546... Line 1546...
1546
 
1546
 
Line 1666... Line 1666...
1666
; The connection is established?
1666
; The connection is established?
Line 1667... Line 1667...
1667
 
1667
 
1668
        cmp     [ebx + TCP_SOCKET.t_state], TCPS_ESTABLISHED
1668
        cmp     [ebx + TCP_SOCKET.t_state], TCPS_ESTABLISHED
Line 1669... Line 1669...
1669
        jne     .out_of_order
1669
        jne     .out_of_order
Line 1670... Line 1670...
1670
 
1670
 
Line 1671... Line 1671...
1671
; Ok, lets do this..  Set delayed ACK flag and copy data into socket buffer
1671
; Ok, let's do this..  Set delayed ACK flag and copy data into socket buffer
1672
 
1672
 
Line 1689... Line 1689...
1689
 
1689
 
1690
  .out_of_order:
1690
  .out_of_order:
1691
        DEBUGF  DEBUG_NETWORK_VERBOSE,  "TCP data is out of order!\nSequencenumber is %u, we expected %u.\n", \
1691
        DEBUGF  DEBUG_NETWORK_VERBOSE,  "TCP data is out of order!\nSequencenumber is %u, we expected %u.\n", \
Line 1692... Line 1692...
1692
        [edx + TCP_header.SequenceNumber], [ebx + TCP_SOCKET.RCV_NXT]
1692
        [edx + TCP_header.SequenceNumber], [ebx + TCP_SOCKET.RCV_NXT]
Line 1693... Line 1693...
1693
 
1693
 
Line 1694... Line 1694...
1694
; Uh-oh, some data is out of order, lets call TCP reassemble for help
1694
; Uh-oh, some data is out of order, let's call TCP reassemble for help
1695
 
1695
 
Line 1833... Line 1833...
1833
        pop     edx ebx
1833
        pop     edx ebx
Line 1834... Line 1834...
1834
 
1834
 
1835
        test    [edx + TCP_header.Flags], TH_RST
1835
        test    [edx + TCP_header.Flags], TH_RST
Line 1836... Line 1836...
1836
        jnz     .done
1836
        jnz     .done
Line 1837... Line 1837...
1837
 
1837
 
1838
; TODO: if its a multicast/broadcast, also drop
1838
; TODO: if it's a multicast/broadcast, also drop
Line 1839... Line 1839...
1839
 
1839
 
Line 1869... Line 1869...
1869
 
1869
 
1870
  .respond_seg_reset:
1870
  .respond_seg_reset:
1871
        test    [edx + TCP_header.Flags], TH_RST
1871
        test    [edx + TCP_header.Flags], TH_RST
Line 1872... Line 1872...
1872
        jnz     .drop_no_socket
1872
        jnz     .drop_no_socket
Line 1873... Line 1873...
1873
 
1873
 
1874
; TODO: if its a multicast/broadcast, also drop
1874
; TODO: if it's a multicast/broadcast, also drop
Line 1875... Line 1875...
1875
 
1875