Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3724 → Rev 3725

/kernel/branches/Kolibri-acpi/network/udp.inc
27,10 → 27,12
ends
 
 
uglobal
align 4
uglobal
 
UDP_PACKETS_TX rd NET_DEVICES_MAX
UDP_PACKETS_RX rd NET_DEVICES_MAX
 
endg
 
 
114,6 → 116,7
;
;-----------------------------------------------------------------
align 4
diff16 "UDP packetgfgfgfgfs", 0, $
UDP_input:
 
DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: size=%u\n", ecx
139,6 → 142,11
; IP Packet UDP Destination Port = local Port
; IP Packet SA = Remote IP
 
pusha
mov ecx, socket_mutex
call mutex_lock
popa
 
mov cx, [esi + UDP_header.SourcePort]
mov dx, [esi + UDP_header.DestinationPort]
mov edi, [edi + 4] ; ipv4 source address
147,7 → 155,7
.next_socket:
mov eax, [eax + SOCKET.NextPtr]
or eax, eax
jz .dump
jz .dump_
 
cmp [eax + SOCKET.Domain], AF_INET4
jne .next_socket
160,6 → 168,11
 
DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: socket=%x\n", eax
 
pusha
mov ecx, socket_mutex
call mutex_unlock
popa
 
;;; TODO: when packet is processed, check more sockets!
 
; cmp [eax + IP_SOCKET.RemoteIP], 0xffffffff
182,7 → 195,8
popa
 
.updatesock:
inc [UDP_PACKETS_RX] ; Fixme: correct interface?
call NET_ptr_to_num4
inc [UDP_PACKETS_RX + edi]
 
movzx ecx, [esi + UDP_header.Length]
sub ecx, sizeof.UDP_header
202,7 → 216,17
 
jmp .updatesock
 
.dump_:
 
pusha
mov ecx, socket_mutex
call mutex_unlock
popa
 
DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: no socket found\n"
 
jmp .dump
 
.checksum_mismatch:
DEBUGF DEBUG_NETWORK_VERBOSE, "UDP_input: checksum mismatch\n"
 
274,7 → 298,8
call [ebx + NET_DEVICE.transmit]
test eax, eax
jnz @f
inc [UDP_PACKETS_TX] ; FIXME: correct device?
call NET_ptr_to_num4
inc [UDP_PACKETS_TX + edi]
@@:
 
ret