Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2620 → Rev 2621

/kernel/branches/net/network/IPv4.inc
200,8 → 200,7
;
;-----------------------------------------------------------------
align 4
IPv4_input: ; TODO: implement handler for IP options
; TODO2: add code for raw sockets
IPv4_input: ; TODO: add code for raw sockets
 
DEBUGF 1,"IPv4_input, packet from: %u.%u.%u.%u ",\
[edx + IPv4_header.SourceAddress]:1,[edx + IPv4_header.SourceAddress + 1]:1,[edx + IPv4_header.SourceAddress + 2]:1,[edx + IPv4_header.SourceAddress + 3]:1
214,14 → 213,6
cmp byte [edx + IPv4_header.TimeToLive], 0
je .dump
 
;--------------------------------------
; First, check if IP packet has options
 
movzx eax, [edx + IPv4_header.VersionAndIHL]
and al , 0x0f ; get IHL(header length)
cmp al , 0x05 ; IHL!= 5*4(20 bytes)
jnz .has_options
 
;-------------------------------
; Now, re-calculate the checksum
 
530,14 → 521,7
 
 
 
;-----------------------------------
; The IP packet has some options
 
.has_options:
jmp .dump
 
 
 
;-----------------------------------------------------------------
;
; find fragment slot
949,7 → 933,7
movzx eax, bh
shl eax, 2
 
and ebx, 0xff
and ebx, 0x000000ff
cmp ebx, .number
ja .error
jmp dword [.table + 4*ebx]
957,6 → 941,7
.table:
dd .packets_tx ; 0
dd .packets_rx ; 1
dd .read_ip ; 2
dd .write_ip ; 3
dd .read_dns ; 4
dd .write_dns ; 5
/kernel/branches/net/network/socket.inc
814,12 → 814,13
push eax
add eax, STREAM_SOCKET.snd
call SOCKET_ring_write
mov [esp+32], ecx
pop eax
 
test ecx, ecx
jz s_error
 
mov [esp+32], ecx
 
call TCP_output
ret
 
/kernel/branches/net/network/stack.inc
589,82 → 589,73
cmp dword [esi + NET_DRV_LIST], 0 ; check if driver is running
je .doesnt_exist
 
mov eax, [esi + NET_DRV_LIST]
 
and ebx, 0x000000ff
cmp ebx, .number
ja .doesnt_exist
jmp dword [.table + 4*ebx]
 
test bl, bl ; 0 = Get device type (ethernet/token ring/...)
jnz @f
.table:
dd .get_type ; 0
dd .get_dev_name ; 1
dd .reset ; 2
dd .stop ; 3
dd .get_ptr ; 4
dd .get_drv_name ; 5
dd .set_default ; 6
.number = ($ - .table) / 4 - 1
 
xor eax, eax
.get_type: ; 0 = Get device type (ethernet/token ring/...)
 
mov eax, [eax + NET_DEVICE.type]
jmp .return
 
 
@@:
dec bl ; 1 = Get device name
jnz @f
.get_dev_name: ; 1 = Get device name
 
mov esi, [esi + NET_DRV_LIST]
mov esi, [esi + NET_DEVICE.name]
mov esi, [eax + NET_DEVICE.name]
mov edi, ecx
 
mov ecx, 64 ; max length
repnz movsb
mov ecx, 64/4 ; max length
rep movsd
 
xor eax, eax
jmp .return
 
@@:
.reset: ; 2 = Reset the device
 
dec bl ; 2 = Reset the device
jnz @f
 
mov esi, [esi + NET_DRV_LIST]
call [esi + NET_DEVICE.reset]
call [eax + NET_DEVICE.reset]
jmp .return
 
@@:
.stop: ; 3 = Stop driver for this device
 
dec bl ; 3 = Stop driver for this device
jnz @f
 
mov esi, [esi + NET_DRV_LIST]
call [esi + NET_DEVICE.unload]
call [eax + NET_DEVICE.unload]
jmp .return
 
@@:
dec bl ; 4 = Get driver pointer
jnz @f
 
; ..;
xor eax, eax
.get_ptr: ; 4 = Get driver pointer
 
jmp .return
 
 
@@:
dec bl ; 5 = Get driver name
jnz @f
.get_drv_name: ; 5 = Get driver name
 
; ..;
xor eax, eax
jmp .return
 
 
@@:
dec bl ; 6 = Set default device
jnz @f
.set_default: ; 6 = Set default device
 
mov eax, esi
call NET_set_default
jmp .return
 
 
@@:
 
.doesnt_exist:
DEBUGF 1,"sys_network: invalid device/function specified!\n"
mov eax, -1
 
.return:
mov [esp+28+4], eax
mov [esp+32], eax
ret
 
 
/kernel/branches/net/network/tcp_input.inc
589,9 → 589,7
;;; TODO: update stats
 
; set socket state to connected
 
mov [ebx + SOCKET.state],1 ;;;; FIXME
 
mov [ebx + SOCKET.state], SS_ISCONNECTED
mov [ebx + TCP_SOCKET.t_state], TCPS_ESTABLISHED
 
;;; TODO: check if we should scale the connection (567-572)