Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2627 → Rev 2629

/kernel/branches/net/network/ARP.inc
156,6 → 156,7
; IN: Pointer to buffer in [esp]
; size of buffer in [esp+4]
; packet size (without ethernet header) in ecx
; packet ptr in edx
; OUT: /
;
;-----------------------------------------------------------------
173,7 → 174,8
jne .maybe_request
 
DEBUGF 1,"ARP_input - it's a reply packet from %u.%u.%u.%u\n",\
[edx + ARP_header.SenderIP]:1, [edx + ARP_header.SenderIP+1]:1, [edx + ARP_header.SenderIP+2]:1, [edx + ARP_header.SenderIP+3]:1
[edx + ARP_header.SenderIP]:1, [edx + ARP_header.SenderIP+1]:1,\
[edx + ARP_header.SenderIP+2]:1, [edx + ARP_header.SenderIP+3]:1
 
mov ecx, [NumARP]
test ecx, ecx
204,8 → 206,8
 
mov eax, dword [edx + ARP_header.SenderMAC]
mov dword [esi+ARP_entry.MAC], eax
mov ax , word [edx + ARP_header.SenderMAC + 4]
mov word [esi+ARP_entry.MAC+4], ax
mov cx, word [edx + ARP_header.SenderMAC + 4]
mov word [esi+ARP_entry.MAC+4], cx
 
jmp .exit
 
225,7 → 227,7
 
mov eax, [IP_LIST+4*edi]
cmp eax, [edx + ARP_header.TargetIP] ; Is it looking for my IP address?
jne .exit ; TODO: instead of quitting, update local entrys with matching IP's ?
jne .exit
 
push eax
push edi
259,7 → 261,7
lea esi, [edx + ARP_header.SenderMAC]
movsd
movsw
; mov ax , ETHER_ARP
; mov ax , ETHER_ARP ; It's already there, I'm sure of it!
; stosw
 
DEBUGF 1,"ARP_input - Sending reply \n"
492,13 → 494,14
;--------------------
; Send an ARP request
 
push eax
push eax ; save IP for ARP_output_request
 
pushw ARP_REQUEST_TTL
pushw ARP_AWAITING_RESPONSE
pushd 0
; Now create the ARP entry
pushw ARP_REQUEST_TTL ; TTL
pushw ARP_AWAITING_RESPONSE ; status
pushd 0 ; mac
pushw 0
pushd eax
pushd eax ; ip
mov esi, esp
call ARP_add_entry
add esp, sizeof.ARP_entry
506,36 → 509,19
cmp eax, -1
je .full
 
mov ecx, eax
; And send a request
pop eax
push ecx
call ARP_output_request
 
call ARP_output_request ; IP in eax
;; TODO: check if driver could transmit packet
 
pop esi
imul esi, sizeof.ARP_entry
add esi, ARP_table
 
mov ecx, 25
.wait_loop:
cmp [esi + ARP_entry.Status], 1
je .got_it
push esi
mov esi, 10
call delay_ms
pop esi
loop .wait_loop
 
mov eax, -2 ; request send
ret
 
.found_it:
DEBUGF 1,"found IP in ARPTable\n"
cmp [esi + ARP_entry.Status], 1
cmp [esi + ARP_entry.Status], ARP_VALID_MAPPING
jne .invalid
 
.got_it:
movzx eax, word [esi + ARP_entry.MAC]
mov ebx, dword[esi + ARP_entry.MAC+2]
ret
/kernel/branches/net/network/IPv4.inc
592,8 → 592,6
test eax, 0xffff0000 ; error bits
jnz .arp_error
 
.continue:
 
push ebx ; push the mac
push ax
 
/kernel/branches/net/network/socket.inc
1323,6 → 1323,8
; socket exists, now try to flag an event to the application
 
mov eax, [eax + SOCKET.PID]
test eax, eax
jz .error2
mov ecx, 1
mov esi, TASK_DATA + TASKDATA.pid
 
1719,15 → 1721,11
 
mov [ebx + SOCKET.PID], 0
 
cmp [ebx + SOCKET.Protocol], IP_PROTO_UDP
je .udp
 
cmp [ebx + SOCKET.Protocol], IP_PROTO_TCP
je .tcp
 
jmp .next_socket ; kill all sockets for given PID
; The socket is stateless, just kill it right away!
 
.udp:
mov eax, ebx
mov ebx, [ebx + SOCKET.NextPtr]
call SOCKET_free
1735,10 → 1733,12
 
.tcp:
 
;;; TODO
push [ebx + SOCKET.NextPtr]
mov eax, ebx
call TCP_close
pop ebx
jmp .test_socket
 
jmp .next_socket
 
.done:
pop ebx
 
/kernel/branches/net/network/tcp_output.inc
534,6 → 534,8
pop eax
add esp, 8
 
mov [eax + TCP_SOCKET.timer_retransmission], TCP_time_re_min
 
pusha
lea ecx, [eax + SOCKET.mutex]
call mutex_unlock