Bugfixes & cleanup of AUTODHCP.

git-svn-id: svn://kolibrios.org@339 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2007-02-10 19:10:48 +00:00
parent db4ac47e56
commit 5b0eb8ab98
5 changed files with 474 additions and 190 deletions

View File

@ -93,6 +93,13 @@ macro eth.set_DNS DNS {
int 0x40 int 0x40
} }
macro eth.set_network_drv conf {
mov ecx,conf
mov ebx,2
mov eax,52
int 0x40
}
macro eth.open_udp local,remote,ip,socket { macro eth.open_udp local,remote,ip,socket {
mov ecx, local mov ecx, local
mov edx, remote mov edx, remote

View File

@ -5,128 +5,98 @@
; ;
; by HidnPlayr & Derpenguin ; by HidnPlayr & Derpenguin
TIMEOUT equ 60 ; in seconds
BUFFER equ 1024
__DEBUG__ equ 1
__DEBUG_LEVEL__ equ 1; 1 = all, 2 = errors
use32 use32
org 0x0 org 0x0
db 'MENUET01' ; 8 byte id db 'MENUET01' ; 8 byte id
dd 0x01 ; header version dd 0x01 ; header version
dd START ; start of code dd START ; start of code
dd IM_END ; size of image dd IM_END ; size of image
dd I_END ; memory for app dd I_END ; memory for app
dd I_END ; esp dd I_END ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon dd 0x0 , 0x0 ; I_Param , I_Icon
;include 'macros.inc' ; CONFIGURATION
TIMEOUT equ 60 ; in seconds
BUFFER equ 1024 ; in bytes
__DEBUG__ equ 1 ; enable/disable
__DEBUG_LEVEL__ equ 1 ; 1 = all, 2 = errors
; CONFIGURATION FOR LINK-LOCAL
PROBE_WAIT equ 1 ; second (initial random delay)
PROBE_MIN equ 1 ; second (minimum delay till repeated probe)
PROBE_MAX equ 2 ; seconds (maximum delay till repeated probe)
PROBE_NUM equ 3 ; (number of probe packets)
ANNOUNCE_NUM equ 2 ; (number of announcement packets)
ANNOUNCE_INTERVAL equ 2 ; seconds (time between announcement packets)
ANNOUNCE_WAIT equ 2 ; seconds (delay before announcing)
MAX_CONFLICTS equ 10 ; (max conflicts before rate limiting)
RATE_LIMIT_INTERVAL equ 60 ; seconds (delay between successive attempts)
DEFEND_INTERVAL equ 10 ; seconds (min. wait between defensive ARPs)
include 'macros.inc'
include 'eth.inc' include 'eth.inc'
include 'debug-fdo.inc' include 'debug-fdo.inc'
include 'dhcp.inc'
include 'events.inc'
include 'common.inc'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; START: ; start of execution
; CONFIGURATION FOR LINK-LOCAL ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
PROBE_WAIT equ 1 ; second (initial random delay) ;
PROBE_MIN equ 1 ; second (minimum delay till repeated probe) ;
PROBE_MAX equ 2 ; seconds (maximum delay till repeated probe) ;
PROBE_NUM equ 3 ; (number of probe packets) ;
; ;
ANNOUNCE_NUM equ 2 ; (number of announcement packets) ;
ANNOUNCE_INTERVAL equ 2 ; seconds (time between announcement packets) ;
ANNOUNCE_WAIT equ 2 ; seconds (delay before announcing) ;
; ;
MAX_CONFLICTS equ 10 ; (max conflicts before rate limiting) ;
; ;
RATE_LIMIT_INTERVAL equ 60 ; seconds (delay between successive attempts) ;
; ;
DEFEND_INTERVAL equ 10 ; seconds (min. wait between defensive ARPs) ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
set_event_mask event_network
eth.set_network_drv 0x00000383
START: ; start of execution DEBUGF 1,"Stack Initialized.\n"
mov eax,40 ; Report events eth.status eax ; Read the Stack status
mov ebx,10000000b ; Only Stack test eax,eax ; if eax is zero, no driver was found
int 0x40
mov eax,52 ; first, enable the stack (packet driver)
mov ebx,2
mov ecx,0x00000383
int 0x40
DEBUGF 1,"DHCP: Stack Initialized.\n"
eth.status eax ; Read the Stack status
test eax,eax ; if eax is zero, no driver was found
jnz @f jnz @f
DEBUGF 1,"DHCP: No Card detected\n" DEBUGF 1,"No Card detected\n"
jmp close jmp close
@@: @@:
DEBUGF 1,"DHCP: Detected card: %x\n",eax DEBUGF 1,"Detected card: %x\n",eax
@@: @@:
eth.check_cable eax eth.check_cable eax
test al,al test al,al
jnz @f jnz @f
DEBUGF 1,"DHCP: Ethernet Cable not connected\n" DEBUGF 1,"Ethernet Cable not connected\n"
wait 500 ; loop until cable is connected (check every 5 sec)
mov eax,5
mov ebx,500 ; loop until cable is connected (check every 5 sec)
int 0x40
jmp @r jmp @r
@@: @@:
DEBUGF 1,"DHCP: Ethernet Cable status: %d\n",al DEBUGF 1,"Ethernet Cable status: %d\n",al
eth.read_mac MAC eth.read_mac MAC
DEBUGF 1,"DHCP: MAC address: %x-%x-%x-%x-%x-%x\n",[MAC]:2,[MAC+1]:2,[MAC+2]:2,[MAC+3]:2,[MAC+4]:2,[MAC+5]:2 DEBUGF 1,"MAC address: %x-%x-%x-%x-%x-%x\n",[MAC]:2,[MAC+1]:2,[MAC+2]:2,[MAC+3]:2,[MAC+4]:2,[MAC+5]:2
; jmp apipa ; comment this out if you want to skip DHCP and continue with link-local eth.check_port 68,eax ; Check if port 68 is available
;***************************************************************************
;
; DHCP rubish starts here
;
;***************************************************************************
eth.check_port 68,eax ; Check if port 68 is available
cmp eax,1 cmp eax,1
je @f je @f
DEBUGF 1,"DHCP: Port 68 is already in use.\n" DEBUGF 1,"Port 68 is already in use!\n"
jmp close jmp close
@@: @@:
eth.open_udp 68,67,-1,[socketNum] ; open socket (local,remote,ip,socket) eth.open_udp 68,67,-1,[socketNum] ; open socket (local,remote,ip,socket)
DEBUGF 1,"DHCP: Socket opened: %d\n",eax DEBUGF 1,"Socket opened: %d\n",eax
; Setup the first msg we will send ; Setup the first msg we will send
mov byte [dhcpMsgType], 0x01 ; DHCP discover mov byte [dhcpMsgType], 0x01 ; DHCP discover
mov dword [dhcpLease], esi ; esi is still -1 (-1 = forever) mov dword [dhcpLease], esi ; esi is still -1 (-1 = forever)
mov eax,26 get_time_counter eax
mov ebx,9
int 0x40
imul eax,100 imul eax,100
mov [currTime],eax mov [currTime],eax
;*************************************************************************** buildRequest: ; Creates a DHCP request packet.
; Function
; buildRequest
;
; Description
; Creates a DHCP request packet.
;
;***************************************************************************
buildRequest:
xor eax,eax ; Clear dhcpMsg to all zeros xor eax,eax ; Clear dhcpMsg to all zeros
mov edi,dhcpMsg mov edi,dhcpMsg
mov ecx,BUFFER mov ecx,BUFFER
@ -142,39 +112,32 @@ buildRequest:
mov eax,[currTime] mov eax,[currTime]
mov [edx+8], eax ; secs, our uptime mov [edx+8], eax ; secs, our uptime
mov [edx+10], byte 0x80 ; broadcast flag set mov [edx+10], byte 0x80 ; broadcast flag set
mov eax, dword [MAC] ; first 4 bytes of MAC mov eax, dword [MAC] ; first 4 bytes of MAC
mov [edx+28],dword eax mov [edx+28],dword eax
mov ax, word [MAC+4] ; last 2 bytes of MAC mov ax, word [MAC+4] ; last 2 bytes of MAC
mov [edx+32],word ax mov [edx+32],word ax
mov [edx+236], dword 0x63538263 ; magic number mov [edx+236], dword 0x63538263 ; magic number
mov [edx+240], word 0x0135 ; option DHCP msg type mov [edx+240], word 0x0135 ; option DHCP msg type
mov al, [dhcpMsgType] mov al, [dhcpMsgType]
mov [edx+240+2], al mov [edx+240+2], al
mov [edx+240+3], word 0x0433 ; option Lease time = infinity mov [edx+240+3], word 0x0433 ; option Lease time = infinity
mov eax, [dhcpLease] mov eax, [dhcpLease]
mov [edx+240+5], eax mov [edx+240+5], eax
mov [edx+240+9], word 0x0432 ; option requested IP address mov [edx+240+9], word 0x0432 ; option requested IP address
mov eax, [dhcpClientIP] mov eax, [dhcpClientIP]
mov [edx+240+11], eax mov [edx+240+11], eax
mov [edx+240+15], word 0x0437 ; option request list mov [edx+240+15], word 0x0437 ; option request list
mov [edx+240+17], dword 0x0f060301 mov [edx+240+17], dword 0x0f060301
cmp [dhcpMsgType], byte 0x01 ; Check which msg we are sending cmp [dhcpMsgType], byte 0x01 ; Check which msg we are sending
jne br001 jne request_options
mov [edx+240+21], byte 0xff ; "Discover" options mov [edx+240+21], byte 0xff ; "Discover" options
mov [dhcpMsgLen], dword 262 ; end of options marker mov [dhcpMsgLen], dword 262 ; end of options marker
jmp ctr000 jmp send_request
br001: ; "Request" options
request_options:
mov [edx+240+21], word 0x0436 ; server IP mov [edx+240+21], word 0x0436 ; server IP
mov eax, [dhcpServerIP] mov eax, [dhcpServerIP]
mov [edx+240+23], eax mov [edx+240+23], eax
@ -183,9 +146,8 @@ br001: ; "Request" options
mov [dhcpMsgLen], dword 268 mov [dhcpMsgLen], dword 268
ctr000: send_request:
eth.write_udp [socketNum],[dhcpMsgLen],dhcpMsg ; write to socket ( send broadcast request )
eth.write_udp [socketNum],[dhcpMsgLen],dhcpMsg ; write to socket ( send broadcast request )
mov eax, dhcpMsg ; Setup the DHCP buffer to receive response mov eax, dhcpMsg ; Setup the DHCP buffer to receive response
mov [dhcpMsgLen], eax ; Used as a pointer to the data mov [dhcpMsgLen], eax ; Used as a pointer to the data
@ -197,14 +159,14 @@ ctr000:
eth.poll [socketNum] eth.poll [socketNum]
test eax,eax test eax,eax
jnz ctr002 jnz read_data
DEBUGF 2,"DHCP: Timeout!\n" DEBUGF 2,"Timeout!\n"
eth.close_udp [socketNum] eth.close_udp [socketNum]
jmp apipa ; no server found, lets try zeroconf jmp apipa ; no server found, lets try zeroconf
ctr002: ; we have data - this will be the response read_data: ; we have data - this will be the response
eth.read_packet [socketNum], dhcpMsg, BUFFER eth.read_packet [socketNum], dhcpMsg, BUFFER
mov [dhcpMsgLen], eax mov [dhcpMsgLen], eax
eth.close_udp [socketNum] eth.close_udp [socketNum]
@ -235,17 +197,12 @@ discover:
jmp buildRequest jmp buildRequest
request: request:
call parseResponse call parseResponse
cmp [dhcpMsgType], byte 0x05 ; Was the response an ACK? It should be cmp [dhcpMsgType], byte 0x05 ; Was the response an ACK? It should be
jne apipa ; NO - so we do zeroconf jne apipa ; NO - so we do zeroconf
close: jmp close
DEBUGF 1,"DHCP: Exiting\n"
mov eax,-1 ; at last, exit
int 0x40
;*************************************************************************** ;***************************************************************************
; Function ; Function
@ -261,126 +218,119 @@ close:
; ;
;*************************************************************************** ;***************************************************************************
parseResponse: parseResponse:
DEBUGF 1,"DHCP: Data received, parsing response\n" DEBUGF 1,"Data received, parsing response\n"
mov edx, dhcpMsg mov edx, dhcpMsg
pusha pusha
eth.set_IP [edx+16] eth.set_IP [edx+16]
mov eax,[edx] mov eax,[edx]
mov [dhcpClientIP],eax mov [dhcpClientIP],eax
DEBUGF 1,"DHCP: Client: %u.%u.%u.%u\n",[edx+16]:1,[edx+17]:1,[edx+18]:1,[edx+19]:1 DEBUGF 1,"Client: %u.%u.%u.%u\n",[edx+16]:1,[edx+17]:1,[edx+18]:1,[edx+19]:1
popa popa
add edx, 240 ; Point to first option add edx, 240 ; Point to first option
xor ecx, ecx
next_option:
add edx, ecx
pr001: pr001:
mov al, [edx] mov al, [edx]
cmp al, 0xff ; End of options? cmp al, 0xff ; End of options?
je pr_exit je pr_exit
cmp al, 53 ; Msg type is a single byte option cmp al, dhcp_msg_type ; Msg type is a single byte option
jne pr002 jne @f
mov al, [edx+2] mov al, [edx+2]
mov [dhcpMsgType], al mov [dhcpMsgType], al
add edx, 3 add edx, 3
jmp pr001 ; Get next option jmp pr001 ; Get next option
pr002: @@:
inc edx inc edx
movzx ecx, byte [edx] movzx ecx, byte [edx]
inc edx ; point to data inc edx ; point to data
cmp al, 54 ; server id cmp al, dhcp_dhcp_server_id ; server ip
jne pr0021 jne @f
mov eax, [edx] ; All options are 4 bytes, so get it mov eax, [edx]
mov [dhcpServerIP], eax mov [dhcpServerIP], eax
DEBUGF 1,"DHCP: Server: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 DEBUGF 1,"Server: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
jmp pr003 jmp next_option
pr0021: @@:
cmp al, 51 ; lease cmp al, dhcp_address_time
jne pr0022 jne @f
pusha pusha
DEBUGF 1,"DHCP: lease: " mov eax,[edx]
mov eax,[edx] bswap eax
bswap eax mov [dhcpLease],eax
mov [dhcpLease],eax DEBUGF 1,"lease: %d\n",eax
cmp dword[edx],-1 ; i really don't know, how to test it
jne no_lease_forever
DEBUGF 1,"forever\n"
jmp @f
no_lease_forever:
DEBUGF 1,"%d\n",eax
@@:
popa popa
jmp pr003 jmp next_option
pr0022: @@:
cmp al, 1 ; subnet mask cmp al, dhcp_subnet_mask
jne pr0023 jne @f
pusha pusha
eth.set_SUBNET [edx] eth.set_SUBNET [edx]
DEBUGF 1,"DHCP: Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 DEBUGF 1,"Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
popa popa
jmp pr003 jmp next_option
pr0023: @@:
cmp al, 3 ; gateway ip cmp al, dhcp_router
jne pr0024 jne @f
pusha pusha
eth.set_GATEWAY [edx] eth.set_GATEWAY [edx]
DEBUGF 1,"DHCP: Gateway: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 DEBUGF 1,"Gateway: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
popa popa
jmp next_option
pr0024:
cmp al, 6 ; dns ip @@:
jne pr003 cmp al, dhcp_domain_server
jne next_option
pusha pusha
eth.set_DNS [edx] eth.set_DNS [edx]
DEBUGF 1,"DHCP: DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1 DEBUGF 1,"DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
popa popa
jmp next_option
pr003:
add edx, ecx
jmp pr001
pr_exit: pr_exit:
; DEBUGF 1,"DHCP: Sending ARP probe\n" ; DEBUGF 1,"Sending ARP announce\n"
; eth.ARP_ANNOUNCE [dhcpClientIP] ; send an ARP announc packet ; eth.ARP_ANNOUNCE [dhcpClientIP] ; send an ARP announce packet
jmp close jmp close
apipa: apipa:
call random call random
mov ecx,0xfea9 ; IP 169.254.0.0 link local net, see RFC3927 mov ecx,0xfea9 ; IP 169.254.0.0 link local net, see RFC3927
mov cx,ax mov cx,ax
eth.set_IP ecx ; mask is 255.255.0.0 eth.set_IP ecx ; mask is 255.255.0.0
DEBUGF 1,"ZeroConf: Link Local IP assinged: 169.254.%u.%u\n",[generator+2]:1,[generator+3]:1 DEBUGF 1,"Link Local IP assinged: 169.254.%u.%u\n",[generator+2]:1,[generator+3]:1
eth.set_SUBNET 0xffff eth.set_SUBNET 0xffff
eth.set_GATEWAY 0x0 eth.set_GATEWAY 0x0
eth.set_DNS 0x0 eth.set_DNS 0x0
mov eax,5 wait PROBE_WAIT*100
mov ebx,PROBE_WAIT*100
int 0x40
xor esi,esi xor esi,esi
probe_loop: probe_loop:
call random ; create a pseudo random number in eax (seeded by MAC) call random ; create a pseudo random number in eax (seeded by MAC)
cmp al,PROBE_MIN*100 ; check if al is bigger then PROBE_MIN cmp al,PROBE_MIN*100 ; check if al is bigger then PROBE_MIN
jge @f ; all ok jge @f ; all ok
add al,(PROBE_MAX-PROBE_MIN)*100 ; al is too small add al,(PROBE_MAX-PROBE_MIN)*100 ; al is too small
@@: @@:
cmp al,PROBE_MAX*100 cmp al,PROBE_MAX*100
@ -389,45 +339,44 @@ apipa:
@@: @@:
movzx ebx,al movzx ebx,al
DEBUGF 1,"ZeroConf: Waiting %u0ms\n",ebx DEBUGF 1,"Waiting %u0ms\n",ebx
mov eax,5 wait ebx
int 0x40
DEBUGF 1,"ZeroConf: Sending Probe\n" DEBUGF 1,"Sending Probe\n"
; eth.ARP_PROBE MAC2 ; eth.ARP_PROBE MAC
inc esi inc esi
cmp esi,PROBE_NUM cmp esi,PROBE_NUM
jl probe_loop jl probe_loop
; now we wait further ANNOUNCE_WAIT seconds and send ANNOUNCE_NUM ARP announces. If any other host has assingnd ; now we wait further ANNOUNCE_WAIT seconds and send ANNOUNCE_NUM ARP announces. If any other host has assingned
; IP within this time, we should create another adress, that have to be done later ; IP within this time, we should create another adress, that have to be done later
DEBUGF 1,"ZeroConf: Waiting %us\n",ANNOUNCE_WAIT DEBUGF 1,"Waiting %us\n",ANNOUNCE_WAIT
mov eax,5 wait ANNOUNCE_WAIT*100
mov ebx,ANNOUNCE_WAIT*100
int 0x40
xor esi,esi xor esi,esi
announce_loop: announce_loop:
DEBUGF 1,"ZeroConf: Sending Announce\n" DEBUGF 1,"Sending Announce\n"
; eth.ARP_ANNOUNCE MAC2 ; eth.ARP_ANNOUNCE MAC
inc esi inc esi
cmp esi,ANNOUNCE_NUM cmp esi,ANNOUNCE_NUM
je @f je @f
DEBUGF 1,"ZeroConf: Waiting %us\n",ANNOUNCE_INTERVAL DEBUGF 1,"Waiting %us\n",ANNOUNCE_INTERVAL
mov eax,5 wait ANNOUNCE_INTERVAL*100
mov ebx,ANNOUNCE_INTERVAL*100
int 0x40
jmp announce_loop jmp announce_loop
@@: @@:
jmp close ; we should, instead of closing, detect ARP conflicts and detect if cable keeps connected ;) ; we should, instead of closing, detect ARP conflicts and detect if cable keeps connected ;)
close:
DEBUGF 1,"Exiting\n"
exit ; at last, exit
random: random:
mov eax,[generator] mov eax,[generator]
add eax,-43ab45b5h add eax,-43ab45b5h
ror eax,1 ror eax,1
@ -436,13 +385,12 @@ random:
ror eax,1 ror eax,1
xor eax,dword[MAC+2] xor eax,dword[MAC+2]
mov [generator],eax mov [generator],eax
ret ret
; DATA AREA ; DATA AREA
include_debug_strings ; ALWAYS present in data section include_debug_strings
IM_END: IM_END:

View File

@ -0,0 +1,17 @@
macro wait time {
mov ebx,time
mov eax,5
int 0x40
}
macro get_time_counter result {
mov eax,26
mov ebx,9
int 0x40
mov result,eax
}
macro exit {
mov eax,-1
int 0x40
}

View File

@ -0,0 +1,263 @@
;Name Number Length Meaning
dhcp_pad_option equ 0 ; 0 None
dhcp_end_option equ 255 ; 0 None
dhcp_subnet_mask equ 1 ; 4 Subnet Mask Value
dhcp_time_offset equ 2 ; 4 Time Offset in Seconds from UTC
dhcp_router equ 3 ; N×4 Router addresses
dhcp_time_server equ 4 ; N×4 Timeserver addresses
dhcp_name_server equ 5 ; N×4 IEN-116 Server addresses
dhcp_domain_server equ 6 ; N×4 DNS Server addresses
dhcp_log_server equ 7 ; N×4 Logging Server addresses
dhcp_quotes_server equ 8 ; N×4 Quotes Server addresses
dhcp_lpr_server equ 9 ; N×4 Printer Server addresses
dhcp_impress_server equ 10 ; N×4 Impress Server addresses
dhcp_rlp_server equ 11 ; N×4 N RLP Server addresses
dhcp_hostname equ 12 ; N Hostname string
dhcp_boot_file_size equ 13 ; 2 Size of boot file in 512-octet blocks
dhcp_merit_dump_file equ 14 ; N Client to dump and name the file to dump it to
dhcp_domain_name equ 15 ; N The DNS domain name of the client
dhcp_swap_server equ 16 ; 4 Swap Server address
dhcp_root_path equ 17 ; N Path name for root disk
dhcp_extension_file equ 18 ; N Path name for more BOOTP info
;IP Layer Parameters per Host
dhcp_forward equ 19 ; 1 Enable/Disable IP Forwarding
dhcp_srcrte equ 20 ; 1 Enable/Disable Non-Local Source Routing
dhcp_policy equ 21 ; N×8 Non-Local Source Routing Policy Filters
dhcp_mag_dg_assembly equ 22 ; 2 Max Datagram Reassembly Size
dhcp_default_ip_tll equ 23 ; 1 Default IP Time to Live
dhcp_mtu_timeout equ 24 ; 4 Path MTU Aging Timeout
dhcp_mtu_plateau equ 25 ; N×2 Path MTU Plateau Table
;IP Layer Parameters per Interface
dhcp_mtu_interface equ 26 ; 2 Interface MTU Size
dhcp_mtu_subnet equ 27 ; 1 All Subnets are Local
dhcp_broadcast_address equ 28 ; 4 Broadcast Address
dhcp_mask_discovery equ 29 ; 1 Perform Mask Discovery
dhcp_mask_supplier equ 30 ; 1 Provide Mask to Others
dhcp_router_discovery equ 31 ; 1 Perform Router Discovery
dhcp_router_request equ 32 ; 4 Router Solicitation Address
dhcp_static_route equ 33 ; N×8 Static Routing Table
;Link Layer Parameters per Interface
dhcp_trailers equ 34 ; 1 Trailer Encapsulation
dhcp_arp_timeout equ 35 ; 4 ARP Cache Timeout
dhcp_ethernet equ 36 ; 1 Ethernet Encapsulation
;TCP Parameters
dhcp_default_tcp_tll equ 37 ; 1 Default TCP Time to Live
dhcp_keepalive_time equ 38 ; 4 TCP Keepalive Interval
dhcp_keepalive_data equ 39 ; 1 TCP Keepalive Garbage
;Application and Service Parameters
dhcp_nis_domain equ 40 ; N NIS Domain Name
dhcp_nis_servers equ 41 ; N×4 NIS Server Addresses
dhcp_ntp_servers equ 42 ; N×4 NTP Server Addresses
dhcp_vendor_specific equ 43 ; N Vendor Specific Information
dhcp_netbios_name_srv equ 44 ; N×4 NETBIOS Name Servers
dhcp_netbios_dist_srv equ 45 ; N×4 NETBIOS Datagram Distribution
dhcp_netbios_node_type equ 46 ; 1 NETBIOS Node Type
dhcp_netbios_scope equ 47 ; N NETBIOS Scope
dhcp_x_window_font equ 48 ; N×4 X Window Font Server
dhcp_x_window_manager equ 49 ; N×4 X Window Display Manager
dhcp_nis_domain_name equ 64 ; N NIS+ v3 Client Domain Name
dhcp_nis_server_addr equ 65 ; N×4 NIS+ v3 Server Addresses
dhcp_home_agent_addrs equ 68 ; N×4 Mobile IP Home Agent Addresses
dhcp_smtp_server equ 69 ; N×4 Simple Mail Server Addresses
dhcp_pop3_server equ 70 ; N×4 Post Office Server Addresses
dhcp_nntp_server equ 71 ; N×4 Network News Server Addresses
dhcp_www_server equ 72 ; N×4 WWW Server Addresses
dhcp_finger_server equ 73 ; N×4 Finger Server Addresses
dhcp_irc_server equ 74 ; N×4 Chat Server Addresses
dhcp_streettalk_server equ 75 ; N×4 StreetTalk Server Addresses
dhcp_stda_server equ 76 ; N×4 ST Directory Assist. Addresses
;DHCP Extensions
dhcp_address_request equ 50 ; 4 Requested IP Address
dhcp_address_time equ 51 ; 4 IP Address Lease Time
dhcp_option_overload equ 52 ; 1 Overload "sname" or "file"
dhcp_msg_type equ 53 ; 1 DHCP Message Type
dhcp_dhcp_server_id equ 54 ; 4 DHCP Server Identification
dhcp_parameter_list equ 55 ; N Parameter Request List
dhcp_dhcp_message equ 56 ; N DHCP Error Message
dhcp_dhcp_max_msg_size equ 57 ; 2 DHCP Maximum Message Size
dhcp_renewal_time equ 58 ; 4 DHCP Renewal (T1) Time
dhcp_rebinding_time equ 59 ; 4 DHCP Rebinding (T2) Time
dhcp_class_id equ 60 ; N Vendor Class Identifier
dhcp_client_id equ 61 ; N Client Identifier
dhcp_server_name equ 66 ; N TFTP Server Name
dhcp_bootfile_name equ 67 ; N Boot File Name
;Newer extensions
dhcp_netware_ip_domain equ 62 ; N Netware/IP Domain Name
dhcp_netware_ip_option equ 63 ; N Netware/IP sub Options
dhcp_user_class equ 77 ; N User Class Information
dhcp_directory_agent equ 78 ; N directory agent information
dhcp_service_scope equ 79 ; N service location agent scope
dhcp_rapid_commit equ 80 ; 0 Rapid Commit
dhcp_client_fqdn equ 81 ; N Fully Qualified Domain Name
dhcp_relay_agent_info equ 82 ; N Relay Agent Information, RFC 3046
dhcp_isns equ 83 ; N Internet Storage Name Service
; 84 REMOVED/Unassigned
dhcp_nds_servers equ 85 ; N Novell Directory Services
dhcp_nds_tree_name equ 86 ; N Novell Directory Services
dhcp_nds_conext equ 87 ; N Novell Directory Services
dhcp_bcmcs equ 88 ; Controller Domain Name list
dhcp_bcmcs equ 89 ; Controller IPv4 address option
dhcp_authentication equ 90 ; N Authentication
; 91 REMOVED/Unassigned
; 92 REMOVED/Unassigned
dhcp_client_system equ 93 ; N Client System Architecture
dhcp_client_ndi equ 94 ; N Client Network Device Interface
dhcp_ldap equ 95 ; N Lightweight Directory Access Protocol
; 96 REMOVED/Unassigned
dhcp_uuid_guid equ 97 ; N UUID/GUID-based Client Identifier
dchp_user_auth equ 98 ; N Open Group's User Authentication
; 99 REMOVED/Unassigned
; 100 REMOVED/Unassigned
; 101 REMOVED/Unassigned
; 102 REMOVED/Unassigned
; 103 REMOVED/Unassigned
; 104 REMOVED/Unassigned
; 105 REMOVED/Unassigned
; 106 REMOVED/Unassigned
; 107 REMOVED/Unassigned
; 108 REMOVED/Unassigned
; 109 REMOVED/Unassigned
; 110 REMOVED/Unassigned
; 111 REMOVED/Unassigned
dhcp_netinfo_address equ 112 ; N NetInfo Parent Server Address
dhcp_netinfo_tag equ 113 ; N NetInfo Parent Server Tag
dhcp_url equ 114 ; N URL
; 115 REMOVED/Unassigned
dhcp_auto_config equ 116 ; N DHCP Auto-Configuration
dhcp_ns_search equ 117 ; N Name Service Search
dhcp_subnet_selection equ 118 ; 4 Subnet Selection Option
dhcp_domain_search equ 119 ; N DNS domain search list
dhcp_sip_servers equ 120 ; N SIP Servers DHCP Option
dhcp_cl_static_route equ 121 ; N Classless Static Route Option
dhcp_ccc equ 122 ; N CableLabs Client Configuration
dhcp_geoconf equ 123 ; 16 GeoConf Option
dhcp_v_i_vendor_class equ 124 ; Vendor-Identifying Vendor Class
dhcp_v_i_vendor_spec equ 125 ; Vendor-Identifying Vendor-Specific
; 126 REMOVED/Unassigned
; 127 REMOVED/Unassigned
dhcp_pxe equ 128 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
dhcp_etherboot_sign equ 128 ; Etherboot signature. 6 bytes: E4:45:74:68:00:00
dhcp_docsis equ 128 ; DOCSIS "full security" server IP address
dhcp_tftp_server_ip equ 128 ; TFTP Server IP address (for IP Phone software load)
dhcp_pxe equ 129 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
dhcp_kernel_options equ 129 ; Kernel options. Variable length string
dhcp_call_server_ip equ 129 ; Call Server IP address
dhcp_pxe equ 130 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
dhcp_ethernet_interface equ 130 ; Ethernet interface. Variable length string.
dhcp_siscrimination equ 130 ; Discrimination string (to identify vendor)
dhcp_pxe equ 131 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
dhcp_remote_stat_server equ 131 ; Remote statistics server IP address
dhcp_pxe equ 132 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
dhcp_802.1p equ 132 ; 802.1P VLAN ID
dhcp_pxe equ 133 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
dhcp_802.1q equ 133 ; 802.1Q L2 Priority
dhcp_pxe equ 134 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
dhcp_diffserv equ 134 ; Diffserv Code Point
dhcp_pxe equ 135 ; PXE - undefined (vendor specific) (Tentatively Assigned - 23 June 2005)
dhcp_http_proxy_psa equ 135 ; HTTP Proxy for phone-specific applications
; 136 REMOVED/Unassigned
; 137 REMOVED/Unassigned
; 138 REMOVED/Unassigned
; 139 REMOVED/Unassigned
; 140 REMOVED/Unassigned
; 141 REMOVED/Unassigned
; 142 REMOVED/Unassigned
; 143 REMOVED/Unassigned
; 144 REMOVED/Unassigned
; 145 REMOVED/Unassigned
; 146 REMOVED/Unassigned
; 147 REMOVED/Unassigned
; 148 REMOVED/Unassigned
; 149 REMOVED/Unassigned
dhcp_tftp_server_addr equ 150 ; TFTP server address (Tentatively Assigned - 23 June 2005)
dhcp_etherboot equ 150 ; Etherboot
dhcp_grub_conf_path equ 150 ; GRUB configuration path name
; 151 REMOVED/Unassigned
; 152 REMOVED/Unassigned
; 153 REMOVED/Unassigned
; 154 REMOVED/Unassigned
; 155 REMOVED/Unassigned
; 156 REMOVED/Unassigned
; 157 REMOVED/Unassigned
; 158 REMOVED/Unassigned
; 159 REMOVED/Unassigned
; 160 REMOVED/Unassigned
; 161 REMOVED/Unassigned
; 162 REMOVED/Unassigned
; 163 REMOVED/Unassigned
; 164 REMOVED/Unassigned
; 165 REMOVED/Unassigned
; 166 REMOVED/Unassigned
; 167 REMOVED/Unassigned
; 168 REMOVED/Unassigned
; 169 REMOVED/Unassigned
; 170 REMOVED/Unassigned
; 171 REMOVED/Unassigned
; 172 REMOVED/Unassigned
; 173 REMOVED/Unassigned
; 174 REMOVED/Unassigned
dhcp_etherboot equ 175 ; Etherboot (Tentatively Assigned - 23 June 2005)
dhcp_ip_telephone equ 176 ; IP Telephone (Tentatively Assigned - 23 June 2005)
dhcp_etherboot equ 177 ; Etherboot (Tentatively Assigned - 23 June 2005)
dhcp_packetcable equ 177 ; PacketCable and CableHome (replaced by 122)
; 178 REMOVED/Unassigned
; 179 REMOVED/Unassigned
; 180 REMOVED/Unassigned
; 181 REMOVED/Unassigned
; 182 REMOVED/Unassigned
; 183 REMOVED/Unassigned
; 184 REMOVED/Unassigned
; 185 REMOVED/Unassigned
; 186 REMOVED/Unassigned
; 187 REMOVED/Unassigned
; 188 REMOVED/Unassigned
; 189 REMOVED/Unassigned
; 190 REMOVED/Unassigned
; 191 REMOVED/Unassigned
; 192 REMOVED/Unassigned
; 193 REMOVED/Unassigned
; 194 REMOVED/Unassigned
; 195 REMOVED/Unassigned
; 196 REMOVED/Unassigned
; 197 REMOVED/Unassigned
; 198 REMOVED/Unassigned
; 199 REMOVED/Unassigned
; 200 REMOVED/Unassigned
; 201 REMOVED/Unassigned
; 202 REMOVED/Unassigned
; 203 REMOVED/Unassigned
; 204 REMOVED/Unassigned
; 205 REMOVED/Unassigned
; 206 REMOVED/Unassigned
; 207 REMOVED/Unassigned
dhcp_pxelinux.magic equ 208 ; pxelinux.magic (string) = F1:00:74:7E (241.0.116.126) (Tentatively Assigned - 23 June 2005)
dhcp_pxelinux.conffile equ 209 ; pxelinux.configfile (text) (Tentatively Assigned - 23 June 2005)
dhcp_pxelinux.path equ 210 ; pxelinux.pathprefix (text) (Tentatively Assigned - 23 June 2005)
dhcp_pxelinux.reboot equ 211 ; pxelinux.reboottime (unsigned integer 32 bits) (Tentatively Assigned - 23 June 2005)
; 212 REMOVED/Unassigned
; 213 REMOVED/Unassigned
; 214 REMOVED/Unassigned
; 215 REMOVED/Unassigned
; 216 REMOVED/Unassigned
; 217 REMOVED/Unassigned
; 218 REMOVED/Unassigned
; 219 REMOVED/Unassigned
dhcp_subnet_aloc equ 220 ; Subnet Allocation Option (Tentatively Assigned - 23 June 2005)
dhcp_virtual_subnet equ 221 ; Virtual Subnet Selection Option (Tentatively Assigned - 23 June 2005)
; 222 REMOVED/Unassigned
; 223 REMOVED/Unassigned

View File

@ -0,0 +1,49 @@
macro set_event_mask mask {
mov ebx, mask
mov eax, 40
int 0x40
}
macro wait_for_event {
mov eax, 10
int 0x40
}
macro check_for_event {
mov eax, 11
int 0x40
}
macro wait_for_event_timeout timeout {
mov ebx,timeout
mov eax, 23
int 0x40
}
event_redraw equ 1 shl 0
event_keyboard equ 1 shl 1
event_button equ 1 shl 2
event_background equ 1 shl 4
event_mouse equ 1 shl 5
event_ipc equ 1 shl 6
event_network equ 1 shl 7
event_debug equ 1 shl 8
event_irq0 equ 1 shl 15
event_irq1 equ 1 shl 16
event_irq2 equ 1 shl 17
event_irq3 equ 1 shl 18
event_irq4 equ 1 shl 19
event_irq5 equ 1 shl 20
event_irq6 equ 1 shl 21
event_irq7 equ 1 shl 22
event_irq8 equ 1 shl 23
event_irq9 equ 1 shl 24
event_irq10 equ 1 shl 25
event_irq11 equ 1 shl 26
event_irq12 equ 1 shl 27
event_irq13 equ 1 shl 28
event_irq14 equ 1 shl 29
event_irq15 equ 1 shl 30