Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2629 → Rev 2627

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