Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5841 → Rev 5842

/kernel/trunk/network/tcp_input.inc
24,9 → 24,10
;
; IN: [esp] = ptr to buffer
; ebx = ptr to device struct
; ecx = segment size
; ecx = TCP segment size
; edx = ptr to IPv4 header
; esi = ptr to TCP segment
; edi = ptr to ipv4 source address, followed by ipv4 dest address
; edi = interface number*4
;
; OUT: /
;
37,13 → 38,14
 
; record the current time
push [timer_ticks] ; in 1/100 seconds
push ebx ecx esi edi ; mind the order (see TCP_queue_entry struct)
push ebx ecx esi edx ; mind the order (see TCP_queue_entry struct)
mov esi, esp
 
push edi
add_to_queue TCP_queue, TCP_QUEUE_SIZE, sizeof.TCP_queue_entry, .fail
pop edi
add esp, sizeof.TCP_queue_entry
 
call NET_ptr_to_num4
inc [TCP_segments_rx + edi]
 
xor edx, edx
55,6 → 57,7
ret
 
.fail:
pop edi
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP incoming queue is full, discarding packet!\n"
 
call NET_ptr_to_num4
94,7 → 97,7
 
mov ebx, [esi + TCP_queue_entry.device_ptr]
mov ecx, [esi + TCP_queue_entry.segment_size]
mov edi, [esi + TCP_queue_entry.ip_ptr] ; ptr to ipv4 source address, followed by ipv4 destination address
mov edi, [esi + TCP_queue_entry.ip_ptr] ; ptr to ipv4 header
mov esi, [esi + TCP_queue_entry.segment_ptr] ; change esi last
 
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: size=%u time=%d\n", ecx, [timer_ticks]
111,7 → 114,7
push ecx esi
pushw [esi + TCP_header.Checksum]
mov [esi + TCP_header.Checksum], 0
TCP_checksum (edi), (edi+4)
TCP_checksum (edi+IPv4_header.SourceAddress), (edi+IPv4_header.DestinationAddress)
pop cx ; previous checksum
cmp cx, dx
pop edx ecx
170,7 → 173,7
jne .socket_loop
 
mov eax, [ebx + IP_SOCKET.RemoteIP]
cmp eax, [edi] ; Ipv4 source address
cmp eax, [edi + IPv4_header.SourceAddress]
je @f
test eax, eax
jnz .socket_loop
233,7 → 236,7
call mutex_unlock
popa
 
push ecx edx esi edi ;;;
push ecx edx esi edi
call SOCKET_fork
pop edi esi edx ecx
 
244,7 → 247,7
 
mov [temp_bits], TCP_BIT_DROPSOCKET
 
push dword [edi + 4] ; Ipv4 destination addres
push [edi + IPv4_header.DestinationAddress]
pop [ebx + IP_SOCKET.LocalIP]
 
push [edx + TCP_header.DestinationPort]
1211,7 → 1214,7
 
;;; TODO: check if it's a broadcast or multicast, and drop if so
 
push dword [edi] ; Ipv4 source addres
push [edi + IPv4_header.SourceAddress]
pop [ebx + IP_SOCKET.RemoteIP]
 
push [edx + TCP_header.SourcePort]
1673,11 → 1676,13
 
.respond_seg_ack:
mov cl, TH_RST
xor ebx, ebx ; FIXME: find a way to get the receiving device ptr
call TCP_respond_segment
jmp .drop_no_socket
 
.respond_seg_syn:
mov cl, TH_RST + TH_ACK
xor ebx, ebx ; FIXME: find a way to get the receiving device ptr
call TCP_respond_segment
jmp .drop_no_socket