Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1166 → Rev 1171

/kernel/branches/net/network/ARP.inc
531,6 → 531,8
xor edx, edx
shl edx, 2
 
inc [ARP_PACKETS_TX+edx]
 
push dword .returnaddr
push dword 60
push ebx
598,7 → 600,8
jne .exit
 
call ETH_struc2dev
DEBUGF 1,"Packet came from device: %u\n", edi
DEBUGF 1,"ARP Packet came from device: %u\n", edi
inc [ARP_PACKETS_RX+4*edi]
cmp edi, -1
jz .exit
 
/kernel/branches/net/network/IPv4.inc
149,7 → 149,8
jmp .dump
 
.ip_ok:
 
call ETH_struc2dev ; TODO: make this work on other protocols too!
inc [IP_PACKETS_RX+4*edi]
DEBUGF 1,"IP_Handler - packet from %u.%u.%u.%u\n",\
[edx + IPv4_Packet.SourceAddress]:1,[edx + IPv4_Packet.SourceAddress + 1]:1,[edx + IPv4_Packet.SourceAddress + 2]:1,[edx + IPv4_Packet.SourceAddress + 3]:1
 
390,10 → 391,10
mov al , [edx + IPv4_Packet.Protocol]
pop edx ; Offset to data (tcp/udp/icmp/.. Packet)
 
; cmp al , PROTOCOL_TCP
; cmp al , IP_PROTO_TCP
; je TCP_Handler
 
cmp al , PROTOCOL_UDP
cmp al , IP_PROTO_UDP
je UDP_Handler
 
cmp al , IP_PROTO_ICMP
535,6 → 536,7
.send:
push ecx eax ebx dx di
call IPv4_dest_to_dev
inc [IP_PACKETS_TX+4*edi]
mov edi, [ETH_DRV_LIST + 4*edi]
lea eax, [edi + ETH_DEVICE.mac]
mov ebx, temp_dstmac
581,7 → 583,7
 
 
uglobal
temp_dstmac dp ?
temp_dstmac dp ? ; TODO: place this in stack instead!
endg
 
 
/kernel/branches/net/network/ethernet.inc
449,7 → 449,6
dec bl
jz .out_queue ; 7
 
 
.error:
mov eax, -1
ret
456,25 → 455,26
 
.packets_tx:
add eax, ETH_DRV_LIST
mov eax, [eax]
mov eax, [eax + ETH_DEVICE.packets_tx]
mov eax, dword [eax]
mov eax, dword [eax + ETH_DEVICE.packets_tx]
 
ret
 
.packets_rx:
add eax, ETH_DRV_LIST
mov eax, [eax]
mov eax, [eax + ETH_DEVICE.packets_rx]
mov eax, dword [eax]
mov eax, dword [eax + ETH_DEVICE.packets_rx]
ret
 
.bytes_tx:
add eax, ETH_DRV_LIST
mov eax, [eax]
mov eax, dword [eax]
mov eax, dword [eax + ETH_DEVICE.bytes_tx + 4]
ret
 
.bytes_rx:
add eax, ETH_DRV_LIST
mov eax, [eax]
mov eax, dword [eax]
mov eax, dword [eax + ETH_DEVICE.bytes_rx + 4]
ret
 
/kernel/branches/net/network/icmp.inc
125,6 → 125,14
ret
 
 
 
 
 
 
 
;--------------------------------
;
; ICMP_Handler:
151,6 → 159,11
mov byte [edx + ICMP_Packet.Type], ICMP_ECHOREPLY ; Change Packet type to reply
mov word [edx + ICMP_Packet.Checksum], 0 ; Set checksum to 0, needed to calculate new checksum
 
call ETH_struc2dev
cmp edi,-1
je .dump
inc [ICMP_PACKETS_RX+4*edi]
 
; exchange dest and source address in IP header
; exchange dest and source MAC in ETH header
mov esi, [esp]
197,8 → 210,12
xchg al, ah ; Convert to intel byte order
mov word [edx + ICMP_Packet.Checksum], ax
 
jmp ETH_Sender
jmp ETH_Sender ; Send the reply
 
 
 
 
 
.check_sockets:
; TODO: validate the header & checksum. Discard buffer if error
 
222,6 → 239,11
cmp ecx, SOCKETBUFFSIZE - SOCKETHEADERSIZE; TODO: fix this problem !
jg .dump
 
call IPv4_dest_to_dev
cmp edi,-1
je .dump
inc [ICMP_PACKETS_RX+4*edi]
 
DEBUGF 1,"Found valid ICMP packet for socket %x\n", esi
 
lea ebx, [esi + SOCKET.lock]
/kernel/branches/net/network/stack.inc
1,23 → 1,21
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; STACK.INC ;;
;; ;;
;; TCP/IP stack for Menuet OS ;;
;; BASIC TCP/IP stack for KolibriOS ;;
;; ;;
;; Copyright 2002 Mike Hibbett, mikeh@oceanfree.net ;;
;; Written by hidnplayr@kolibrios.org ;;
;; ;;
;; See file COPYING for details ;;
;; based on the work of Mike Hibbett, mikeh@oceanfree.net ;;
;; but also Paolo Franchetti ;;
;; ;;
;; Version 0.7 ;;
;; Added a timer per socket to allow delays when rx window ;;
;; gets below 1KB ;;
;; GNU GENERAL PUBLIC LICENSE ;;
;; Version 2, June 1991 ;;
;; ;;
;;10.01.2007 Bugfix for checksum function from Paolo Franchetti ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision: 983 $
 
192,8 → 190,8
 
;----------------------------------------------------------------
;
; System function to work with network devices (73)
;
;
;----------------------------------------------------------------
 
align 4
242,13 → 240,12
 
;----------------------------------------------------------------
;
; System Function To work with Protocols (75)
;
;
;----------------------------------------------------------------
 
align 4
sys_protocols:
 
cmp bh, MAX_NET_DEVICES ; Check if device number exists
jge .doesnt_exist
 
255,8 → 252,7
mov esi, ebx
and esi, 0x0000ff00
shr esi, 6
 
cmp dword [esi + ETH_DRV_LIST], 0 ; check if driver is running TODO: check otehr lists too
cmp dword [esi + ETH_DRV_LIST], 0 ; check if driver is running TODO: check other lists too
je .doesnt_exist
 
push .return ; return address (we will be using jumps instead of calls)
273,7 → 269,7
cmp ax , IP_PROTO_UDP
je UDP_API
 
; cmp ax , IP_PROTO_TCP
cmp ax , IP_PROTO_TCP
; je TCP_API
 
cmp ax, ETHER_ARP
285,9 → 281,9
add esp,4 ; if we reached here, no function was called, so we need to balance stack
 
.doesnt_exist:
DEBUGF 1,"sys_protocols: invalid device specified!\n"
DEBUGF 1,"sys_protocols: protocol %u doesnt exist on device %u!\n",ax, bh
mov eax, -1
 
.return:
mov [esp+32], eax
mov [esp+28+4], eax
ret