Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3631 → Rev 3632

/programs/network/zeroconf/zeroconf.asm
20,8 → 20,9
 
; CONFIGURATION
 
TIMEOUT = 60 ; in seconds
TIMEOUT = 3 ; in seconds
BUFFER = 1024 ; in bytes
DHCP_TRIES = 3 ; number of times to try contacting DHCP server
__DEBUG__ = 1 ; enable/disable
__DEBUG_LEVEL__ = 1 ; 1 = all, 2 = errors
 
194,6 → 195,8
 
try_dhcp:
 
mov [tries], DHCP_TRIES
 
DEBUGF 1,"->Trying DHCP\n"
 
mcall 75, 0, AF_INET4, SOCK_DGRAM, 0 ; open socket (parameters: domain, type, reserved)
287,21 → 290,21
mov [dhcpMsgLen], dword 268
 
send_dhcpmsg:
DEBUGF 1,"Sending DHCP request\n"
mcall 75, 6, [socketNum], [dhcpMsg], [dhcpMsgLen] ; write to socket ( send broadcast request )
mcall 23, TIMEOUT*100 ; wait for data
 
mov eax, [dhcpMsg] ; Setup the DHCP buffer to receive response
mov [dhcpMsgLen], eax ; Used as a pointer to the data
 
mcall 23, TIMEOUT*10 ; wait for data
 
read_data: ; we have data - this will be the response
mcall 75, 7, [socketNum], [dhcpMsg], BUFFER, 0 ; read data from socket
cmp eax, -1
jne @f
DEBUGF 1,"No answer from DHCP server\n"
dec [tries]
jnz send_dhcpmsg ; try again
jmp dhcp_error ; fail
 
@@:
DEBUGF 1,"->%d bytes received\n", eax
 
cmp eax, -1
je dhcp_error
 
mov [dhcpMsgLen], eax
 
; depending on which msg we sent, handle the response
612,6 → 615,7
 
device db 1
inibuf rb 16
tries db ?
 
dhcpMsgType db ?
dhcpLease dd ?