Subversion Repositories Kolibri OS

Rev

Rev 2364 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1164 hidnplayr 1
; Zero-config
2
; v 1.4
3
;
4
; DHCP code is based on that by Mike Hibbet (DHCP client for menuetos)
5
;
6
; Written by HidnPlayr & Derpenguin
7
 
2856 hidnplayr 8
format binary as ""
9
 
1164 hidnplayr 10
use32
2856 hidnplayr 11
               org    0x0
1164 hidnplayr 12
 
2856 hidnplayr 13
               db     'MENUET01'            ; 8 byte id
14
               dd     0x01                  ; header version
15
               dd     START                 ; start of code
16
               dd     IM_END                ; size of image
17
               dd     (I_END+0x100)         ; memory for app
18
               dd     (I_END+0x100)         ; esp
19
               dd     0x0 , path            ; I_Param , I_Icon
1164 hidnplayr 20
 
21
; CONFIGURATION
22
 
23
 
2856 hidnplayr 24
TIMEOUT             equ 60                  ; in seconds
25
BUFFER              equ 1024                ; in bytes
26
__DEBUG__           equ 1                   ; enable/disable
27
__DEBUG_LEVEL__     equ 1                   ; 1 = all, 2 = errors
1164 hidnplayr 28
 
29
; CONFIGURATION FOR LINK-LOCAL
30
 
2856 hidnplayr 31
PROBE_WAIT          equ 1                   ; second  (initial random delay)
32
PROBE_MIN           equ 1                   ; second  (minimum delay till repeated probe)
33
PROBE_MAX           equ 2                   ; seconds (maximum delay till repeated probe)
34
PROBE_NUM           equ 3                   ;         (number of probe packets)
1164 hidnplayr 35
 
2856 hidnplayr 36
ANNOUNCE_NUM        equ 2                   ;         (number of announcement packets)
37
ANNOUNCE_INTERVAL   equ 2                   ; seconds (time between announcement packets)
38
ANNOUNCE_WAIT       equ 2                   ; seconds (delay before announcing)
1164 hidnplayr 39
 
2856 hidnplayr 40
MAX_CONFLICTS       equ 10                  ;         (max conflicts before rate limiting)
1164 hidnplayr 41
 
2856 hidnplayr 42
RATE_LIMIT_INTERVAL equ 60                  ; seconds (delay between successive attempts)
1164 hidnplayr 43
 
2856 hidnplayr 44
DEFEND_INTERVAL     equ 10                  ; seconds (min. wait between defensive ARPs)
1164 hidnplayr 45
 
46
 
1166 hidnplayr 47
include '../proc32.inc'
48
include '../macros.inc'
49
include '../debug-fdo.inc'
1542 hidnplayr 50
include '../network.inc'
1164 hidnplayr 51
include 'dhcp.inc'
2856 hidnplayr 52
include '../dll.inc'
1164 hidnplayr 53
 
54
 
55
Ip2dword:
56
    push    edx
57
 
58
    ; This code validates if the query is an IP containing 4 numbers and 3 dots
59
 
2856 hidnplayr 60
    xor     al, al            ; make al (dot count) zero
1164 hidnplayr 61
 
62
   @@:
63
    cmp     byte[edx],'0'     ; check if this byte is a number, if not jump to no_IP
2856 hidnplayr 64
    jl      no_IP             ;
1164 hidnplayr 65
    cmp     byte[edx],'9'     ;
2856 hidnplayr 66
    jg      no_IP             ;
1164 hidnplayr 67
 
2856 hidnplayr 68
    inc     edx               ; the byte was a number, so lets check the next byte
1164 hidnplayr 69
 
70
    cmp     byte[edx],0       ; is this byte zero? (have we reached end of query?)
2856 hidnplayr 71
    jz      @f                ; jump to next @@ then
1164 hidnplayr 72
    cmp     byte[edx],':'
2856 hidnplayr 73
    jz      @f
1164 hidnplayr 74
 
75
    cmp     byte[edx],'.'     ; is this byte a dot?
2856 hidnplayr 76
    jne     @r                ; if not, jump to previous @@
1164 hidnplayr 77
 
2856 hidnplayr 78
    inc     al                ; the byte was a dot so increment al(dot count)
79
    inc     edx               ; next byte
80
    jmp     @r                ; lets check for numbers again (jump to previous @@)
1164 hidnplayr 81
 
2856 hidnplayr 82
   @@:                        ; we reach this when end of query reached
83
    cmp     al,3              ; check if there where 3 dots
84
    jnz     no_IP             ; if not, jump to no_IP
1164 hidnplayr 85
 
86
    ; The following code will convert this IP into a dword and output it in eax
87
    ; If there is also a port number specified, this will be returned in ebx, otherwise ebx is -1
88
 
2856 hidnplayr 89
    pop     esi               ; edx (query address) was pushed onto stack and is now popped in esi
1164 hidnplayr 90
 
2856 hidnplayr 91
    xor     edx, edx          ; result
92
    xor     eax, eax          ; current character
93
    xor     ebx, ebx          ; current byte
1164 hidnplayr 94
 
95
.outer_loop:
96
    shl     edx, 8
97
    add     edx, ebx
98
    xor     ebx, ebx
99
.inner_loop:
100
    lodsb
101
    test    eax, eax
2856 hidnplayr 102
    jz      .finish
1164 hidnplayr 103
    cmp     al, '.'
2856 hidnplayr 104
    jz      .outer_loop
1164 hidnplayr 105
    sub     eax, '0'
106
    imul    ebx, 10
107
    add     ebx, eax
108
    jmp     .inner_loop
109
.finish:
110
    shl     edx, 8
111
    add     edx, ebx
112
 
2856 hidnplayr 113
    bswap   edx               ; we want little endian order
1164 hidnplayr 114
 
115
    ret
116
 
117
no_IP:
118
    pop     edx
119
    xor     edx, edx
120
 
121
    ret
122
 
123
 
124
 
125
 
126
 
127
 
2856 hidnplayr 128
START:                                      ; start of execution
1164 hidnplayr 129
 
2856 hidnplayr 130
        mcall   40, 1 shl 7 ; network event
1164 hidnplayr 131
 
2856 hidnplayr 132
        DEBUGF  1,">Zero-config service:\n"
1164 hidnplayr 133
 
2856 hidnplayr 134
        mcall   76, API_ETH + 4
1164 hidnplayr 135
 
2856 hidnplayr 136
        cmp     eax, -1
137
        je      exit
1164 hidnplayr 138
 
2856 hidnplayr 139
        mov     word[MAC], bx
140
        mov     dword[MAC+2], eax
1164 hidnplayr 141
 
2856 hidnplayr 142
        DEBUGF  1,"->MAC: %x-%x-%x-%x-%x-%x\n",[MAC]:2,[MAC+1]:2,[MAC+2]:2,[MAC+3]:2,[MAC+4]:2,[MAC+5]:2
1164 hidnplayr 143
 
2856 hidnplayr 144
        cld
145
        mov     edi, path      ; Calculate the length of zero-terminated string
146
        xor     al , al
147
        mov     ecx, 1024
148
        repnz   scas byte[es:edi]
149
        dec     edi
1174 hidnplayr 150
 
2856 hidnplayr 151
        mov     esi, filename
152
        movsd
153
        movsb
1174 hidnplayr 154
 
2856 hidnplayr 155
        DEBUGF  1,"->path to ini: %s\n", path
1164 hidnplayr 156
 
2856 hidnplayr 157
        mcall   68,11
1164 hidnplayr 158
 
2856 hidnplayr 159
        stdcall dll.Load,@IMPORT
160
        or      eax,eax
161
        jnz     skip_ini
1164 hidnplayr 162
 
163
 
2856 hidnplayr 164
        invoke ini.get_str, path, str_ipconfig, str_type, inibuf, 16, 0
1164 hidnplayr 165
 
2856 hidnplayr 166
        mov    eax,dword[inibuf]
1164 hidnplayr 167
 
2856 hidnplayr 168
        cmp    eax,'stat'
169
        jne    skip_ini
1164 hidnplayr 170
 
2856 hidnplayr 171
        invoke ini.get_str, path, str_ipconfig, str_ip, inibuf, 16, 0
172
        mov    edx, inibuf
173
        call   Ip2dword
174
        mcall  76, API_IPv4 + 3, edx
1164 hidnplayr 175
 
2856 hidnplayr 176
        invoke ini.get_str, path, str_ipconfig, str_gateway, inibuf, 16, 0
177
        mov    edx, inibuf
178
        call   Ip2dword
179
        mcall  76, API_IPv4 + 9, edx
1164 hidnplayr 180
 
2856 hidnplayr 181
        invoke ini.get_str, path, str_ipconfig, str_dns, inibuf, 16, 0
182
        mov    edx, inibuf
183
        call   Ip2dword
184
        mcall  76, API_IPv4 + 5, edx
1164 hidnplayr 185
 
2856 hidnplayr 186
        invoke ini.get_str, path, str_ipconfig, str_subnet, inibuf, 16, 0
187
        mov    edx, inibuf
188
        call   Ip2dword
189
        mcall  76, API_IPv4 + 7, edx
1164 hidnplayr 190
 
191
 
2856 hidnplayr 192
        mcall  -1
1164 hidnplayr 193
 
194
 
195
skip_ini:
196
 
2856 hidnplayr 197
        DEBUGF  1,"->Skip ini\n"
1164 hidnplayr 198
 
2856 hidnplayr 199
        mcall 75, 0, AF_INET4, SOCK_DGRAM, 0      ; open socket (parameters: domain, type, reserved)
200
        cmp   eax, -1
201
        je    error
202
        mov   [socketNum], eax
1164 hidnplayr 203
 
2856 hidnplayr 204
        DEBUGF  1,"->socket %x opened\n", eax
1164 hidnplayr 205
 
2856 hidnplayr 206
        mcall 75, 2, [socketNum], sockaddr1, 18     ; bind socket to local port 68
207
        cmp   eax, -1
208
        je    error
1164 hidnplayr 209
 
2856 hidnplayr 210
        DEBUGF  1,"->Socket Bound to local port 68\n"
1164 hidnplayr 211
 
2856 hidnplayr 212
        mcall 75, 4, [socketNum], sockaddr2, 18     ; connect to 255.255.255.255 on port 67
213
        cmp   eax, -1
214
        je    error
1164 hidnplayr 215
 
2856 hidnplayr 216
        DEBUGF  1,"->Connected to 255.255.255.255 on port 67\n"
1164 hidnplayr 217
 
2856 hidnplayr 218
        mov     byte [dhcpMsgType], 0x01        ; DHCP discover
219
        mov     dword [dhcpLease], esi          ; esi is still -1 (-1 = forever)
1164 hidnplayr 220
 
2856 hidnplayr 221
        mcall   26, 9
222
        imul    eax,100
223
        mov     [currTime],eax
1164 hidnplayr 224
 
2856 hidnplayr 225
buildRequest:                               ; Creates a DHCP request packet.
1164 hidnplayr 226
 
2856 hidnplayr 227
        DEBUGF  1,"->Building request\n"
1164 hidnplayr 228
 
2856 hidnplayr 229
        stdcall mem.Alloc, BUFFER
230
        mov     [dhcpMsg], eax
231
        test    eax,eax
232
        jz      apipa
1164 hidnplayr 233
 
2856 hidnplayr 234
            ;;; todo: skip this bullcrap
1164 hidnplayr 235
 
2856 hidnplayr 236
        mov     edi, eax
237
        mov     ecx, BUFFER
238
        xor     eax, eax
239
        cld
240
        rep     stosb
1164 hidnplayr 241
 
2856 hidnplayr 242
            ;; todo: put this in a buffer instead of writing bytes and words!
1164 hidnplayr 243
 
2856 hidnplayr 244
        mov     edx,[dhcpMsg]
1164 hidnplayr 245
 
2856 hidnplayr 246
        mov     [edx], byte 0x01                ; Boot request
247
        mov     [edx+1], byte 0x01              ; Ethernet
248
        mov     [edx+2], byte 0x06              ; Ethernet h/w len
249
        mov     [edx+4], dword 0x11223344       ; xid                 ;;;;;;;
250
        mov     eax,[currTime]
251
        mov     [edx+8], eax                    ; secs, our uptime
252
        mov     [edx+10], byte 0x80             ; broadcast flag set
253
        mov     eax, dword [MAC]                ; first 4 bytes of MAC
254
        mov     [edx+28],dword eax
255
        mov     ax, word [MAC+4]                ; last 2 bytes of MAC
256
        mov     [edx+32],word ax
257
        mov     [edx+236], dword 0x63538263     ; magic cookie
258
        mov     [edx+240], word 0x0135          ; option DHCP msg type
259
        mov     al, [dhcpMsgType]
260
        mov     [edx+240+2], al
261
        mov     [edx+240+3], word 0x0433        ; option Lease time = infinity
262
        mov     eax, [dhcpLease]
263
        mov     [edx+240+5], eax
264
        mov     [edx+240+9], word 0x0432        ; option requested IP address
265
        mov     eax, [dhcpClientIP]
266
        mov     [edx+240+11], eax
267
        mov     [edx+240+15], word 0x0437       ; option request list
268
        mov     [edx+240+17], dword 0x0f060301
1164 hidnplayr 269
 
2856 hidnplayr 270
        cmp     [dhcpMsgType], byte 0x01        ; Check which msg we are sending
271
        jne     request_options
1164 hidnplayr 272
 
2856 hidnplayr 273
        mov     [edx+240+21], byte 0xff         ; "Discover" options
1164 hidnplayr 274
 
2856 hidnplayr 275
        mov     [dhcpMsgLen], dword 262         ; end of options marker
276
        jmp     send_request
1514 hidnplayr 277
 
1164 hidnplayr 278
request_options:
2856 hidnplayr 279
        mov     [edx+240+21], word 0x0436       ; server IP
280
        mov     eax, [dhcpServerIP]
281
        mov     [edx+240+23], eax
1164 hidnplayr 282
 
2856 hidnplayr 283
        mov     [edx+240+27], byte 0xff         ; end of options marker
1164 hidnplayr 284
 
2856 hidnplayr 285
        mov     [dhcpMsgLen], dword 268
1164 hidnplayr 286
 
287
send_request:
2856 hidnplayr 288
        mcall   75, 6, [socketNum], [dhcpMsg], [dhcpMsgLen]     ; write to socket ( send broadcast request )
1164 hidnplayr 289
 
2856 hidnplayr 290
        mov     eax, [dhcpMsg]                          ; Setup the DHCP buffer to receive response
291
        mov     [dhcpMsgLen], eax                       ; Used as a pointer to the data
1164 hidnplayr 292
 
2856 hidnplayr 293
        mcall   23, TIMEOUT*10                          ; wait for data
1164 hidnplayr 294
 
2856 hidnplayr 295
read_data:                                              ; we have data - this will be the response
296
        mcall   75, 7, [socketNum], [dhcpMsg], BUFFER   ; read data from socket
1164 hidnplayr 297
 
2856 hidnplayr 298
        DEBUGF  1,"->%d bytes received\n", eax
1164 hidnplayr 299
 
2856 hidnplayr 300
        push    eax
301
        mcall   75, 1, [socketNum]                     ; exit the socket
302
        pop     eax
1164 hidnplayr 303
 
2856 hidnplayr 304
        cmp     eax, -1
305
        je      error
1164 hidnplayr 306
 
2856 hidnplayr 307
        mov     [dhcpMsgLen], eax
1164 hidnplayr 308
 
309
    ; depending on which msg we sent, handle the response
310
    ; accordingly.
311
    ; If the response is to a dhcp discover, then:
312
    ;  1) If response is DHCP OFFER then
313
    ;  1.1) record server IP, lease time & IP address.
314
    ;  1.2) send a request packet
315
    ; If the response is to a dhcp request, then:
316
    ;  1) If the response is DHCP ACK then
317
    ;  1.1) extract the DNS & subnet fields. Set them in the stack
318
 
2856 hidnplayr 319
    cmp     [dhcpMsgType], byte 0x01        ; did we send a discover?
320
    je      discover
321
    cmp     [dhcpMsgType], byte 0x03        ; did we send a request?
322
    je      request
1164 hidnplayr 323
 
2856 hidnplayr 324
        jmp     exit                           ; really unknown, what we did
1164 hidnplayr 325
 
326
discover:
2856 hidnplayr 327
        call    parseResponse
1164 hidnplayr 328
 
2856 hidnplayr 329
        cmp     [dhcpMsgType], byte 0x02        ; Was the response an offer?
330
        jne     apipa                           ; NO - so we do zeroconf
331
        mov     [dhcpMsgType], byte 0x03        ; DHCP request
332
        jmp     buildRequest
1164 hidnplayr 333
 
334
request:
2856 hidnplayr 335
        call    parseResponse
1164 hidnplayr 336
 
2856 hidnplayr 337
        cmp     [dhcpMsgType], byte 0x05        ; Was the response an ACK? It should be
338
        jne     apipa                           ; NO - so we do zeroconf
1164 hidnplayr 339
 
2856 hidnplayr 340
        jmp     exit
1164 hidnplayr 341
 
342
;***************************************************************************
343
;   Function
344
;      parseResponse
345
;
346
;   Description
347
;      extracts the fields ( client IP address and options ) from
348
;      a DHCP response
349
;      The values go into
350
;       dhcpMsgType,dhcpLease,dhcpClientIP,dhcpServerIP,
351
;       dhcpDNSIP, dhcpSubnet
352
;      The message is stored in dhcpMsg
353
;
354
;***************************************************************************
355
parseResponse:
356
    DEBUGF  1,"Data received, parsing response\n"
357
    mov     edx, [dhcpMsg]
358
 
359
    pusha
2856 hidnplayr 360
    mcall 76, API_IPv4 + 3, [edx+16]
1164 hidnplayr 361
    mov     eax,[edx]
362
    mov     [dhcpClientIP],eax
363
    DEBUGF  1,"Client: %u.%u.%u.%u\n",[edx+16]:1,[edx+17]:1,[edx+18]:1,[edx+19]:1
364
    popa
365
 
2856 hidnplayr 366
    add     edx, 240                        ; Point to first option
1164 hidnplayr 367
    xor     ecx, ecx
368
 
369
next_option:
370
    add     edx, ecx
371
pr001:
372
    mov     al, [edx]
2856 hidnplayr 373
    cmp     al, 0xff                        ; End of options?
374
    je      pr_exit
1164 hidnplayr 375
 
2856 hidnplayr 376
    cmp     al, dhcp_msg_type               ; Msg type is a single byte option
1164 hidnplayr 377
    jne     @f
378
 
379
    mov     al, [edx+2]
380
    mov     [dhcpMsgType], al
381
    add     edx, 3
2856 hidnplayr 382
    jmp     pr001                           ; Get next option
1164 hidnplayr 383
 
384
@@:
385
    inc     edx
386
    movzx   ecx, byte [edx]
2856 hidnplayr 387
    inc     edx                             ; point to data
1164 hidnplayr 388
 
2856 hidnplayr 389
    cmp     al, dhcp_dhcp_server_id         ; server ip
1164 hidnplayr 390
    jne     @f
391
    mov     eax, [edx]
392
    mov     [dhcpServerIP], eax
393
    DEBUGF  1,"Server: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
394
    jmp     next_option
395
 
396
@@:
397
    cmp     al, dhcp_address_time
398
    jne     @f
399
 
400
    pusha
401
    mov     eax,[edx]
402
    bswap   eax
403
    mov     [dhcpLease],eax
404
    DEBUGF  1,"lease: %d\n",eax
405
    popa
406
 
407
    jmp     next_option
408
 
409
@@:
410
    cmp     al, dhcp_subnet_mask
411
    jne     @f
412
 
413
    pusha
2856 hidnplayr 414
    mcall 76, API_IPv4 + 7, [edx]
1164 hidnplayr 415
    DEBUGF  1,"Subnet: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
416
    popa
417
 
418
    jmp     next_option
419
 
420
@@:
421
    cmp     al, dhcp_router
422
    jne     @f
423
 
424
    pusha
2856 hidnplayr 425
    mcall 76, API_IPv4 + 9, [edx]
1164 hidnplayr 426
    DEBUGF  1,"Gateway: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
427
    popa
428
 
429
    jmp     next_option
430
 
431
 
432
@@:
433
    cmp     al, dhcp_domain_server
434
    jne     next_option
435
 
436
    pusha
2856 hidnplayr 437
    mcall 76, API_IPv4 + 5, [edx]
1164 hidnplayr 438
    DEBUGF  1,"DNS: %u.%u.%u.%u\n",[edx]:1,[edx+1]:1,[edx+2]:1,[edx+3]:1
439
    popa
440
 
441
    jmp     next_option
442
 
443
pr_exit:
444
 
2856 hidnplayr 445
        ret
446
 
1164 hidnplayr 447
;    DEBUGF  1,"Sending ARP announce\n"
1514 hidnplayr 448
;;;
1164 hidnplayr 449
 
450
 
451
apipa:
452
    stdcall mem.Free, [dhcpMsg]
453
 
454
link_local:
455
    call random
2856 hidnplayr 456
    mov  ecx,0xfea9                         ; IP 169.254.0.0 link local net, see RFC3927
1164 hidnplayr 457
    mov  cx,ax
2856 hidnplayr 458
    mcall 76, API_IPv4 + 3, ecx                          ; mask is 255.255.0.0
1164 hidnplayr 459
    DEBUGF 1,"Link Local IP assinged: 169.254.%u.%u\n",[generator+2]:1,[generator+3]:1
2856 hidnplayr 460
    mcall 76, API_IPv4 + 5, 0xffff
461
    mcall 76, API_IPv4 + 9, 0x0
462
    mcall 76, API_IPv4 + 7, 0x0
1164 hidnplayr 463
 
464
    mcall 5, PROBE_WAIT*100
465
 
466
    xor esi,esi
467
   probe_loop:
2856 hidnplayr 468
    call  random                            ; create a pseudo random number in eax (seeded by MAC)
1164 hidnplayr 469
 
2856 hidnplayr 470
    cmp   al,PROBE_MIN*100                  ; check if al is bigger then PROBE_MIN
471
    jge   @f                                ; all ok
472
    add   al,(PROBE_MAX-PROBE_MIN)*100      ; al is too small
1164 hidnplayr 473
   @@:
474
 
475
    cmp   al,PROBE_MAX*100
476
    jle   @f
477
    sub   al,(PROBE_MAX-PROBE_MIN)*100
478
   @@:
479
 
480
    movzx ebx,al
481
    DEBUGF  1,"Waiting %u0ms\n",ebx
482
    mcall 5
483
 
484
    DEBUGF  1,"Sending Probe\n"
485
;    eth.ARP_PROBE MAC
486
    inc   esi
487
 
488
    cmp   esi,PROBE_NUM
2856 hidnplayr 489
    jl    probe_loop
1164 hidnplayr 490
 
491
; now we wait further ANNOUNCE_WAIT seconds and send ANNOUNCE_NUM ARP announces. If any other host has assingned
492
; IP within this time, we should create another adress, that have to be done later
493
 
494
    DEBUGF  1,"Waiting %us\n",ANNOUNCE_WAIT
495
    mcall 5, ANNOUNCE_WAIT*100
496
    xor   esi,esi
497
   announce_loop:
498
 
499
    DEBUGF  1,"Sending Announce\n"
500
;    eth.ARP_ANNOUNCE MAC
501
 
502
    inc   esi
503
    cmp   esi,ANNOUNCE_NUM
2856 hidnplayr 504
    je    @f
1164 hidnplayr 505
 
506
    DEBUGF  1,"Waiting %us\n",ANNOUNCE_INTERVAL
507
    mcall 5, ANNOUNCE_INTERVAL*100
508
    jmp   announce_loop
509
   @@:
510
    ; we should, instead of closing, detect ARP conflicts and detect if cable keeps connected ;)
511
 
512
error:
1542 hidnplayr 513
exit:
1164 hidnplayr 514
    mcall -1
515
 
516
 
517
random:  ; Pseudo random actually
518
 
519
    mov   eax,[generator]
520
    add   eax,-43ab45b5h
521
    ror   eax,1
522
    bswap eax
523
    xor   eax,dword[MAC]
524
    ror   eax,1
525
    xor   eax,dword[MAC+2]
526
    mov   [generator],eax
527
 
528
ret
529
 
530
; DATA AREA
531
 
532
align 16
533
@IMPORT:
534
 
535
library \
2856 hidnplayr 536
        libini,'libini.obj'
1164 hidnplayr 537
 
2856 hidnplayr 538
import  libini, \
539
        ini.get_str,'ini_get_str'
1164 hidnplayr 540
 
541
include_debug_strings
542
 
543
filename db '.ini',0
544
str_ip db 'ip',0
545
str_subnet db 'subnet',0
546
str_gateway db 'gateway',0
547
str_dns db 'dns',0
548
str_ipconfig db 'ipconfig',0
549
str_type db 'type',0
550
 
551
 
552
sockaddr1:
553
 
2856 hidnplayr 554
        dw AF_INET4
555
        dw 68           ; local port
556
        dd 0            ; local IP
1164 hidnplayr 557
 
2856 hidnplayr 558
        rb 10
1164 hidnplayr 559
 
560
 
561
sockaddr2:
562
 
2856 hidnplayr 563
        dw AF_INET4
564
        dw 67           ; destination port
565
        dd -1           ; destination IP
1164 hidnplayr 566
 
2856 hidnplayr 567
        rb 10
1164 hidnplayr 568
 
569
 
570
IM_END:
571
 
2856 hidnplayr 572
inibuf          rb 16
1164 hidnplayr 573
 
2856 hidnplayr 574
dhcpClientIP    dd  ?
575
dhcpMsgType     db  ?
576
dhcpLease       dd  ?
577
dhcpServerIP    dd  ?
1164 hidnplayr 578
 
2856 hidnplayr 579
dhcpMsgLen      dd  ?
580
socketNum       dd  ?
1164 hidnplayr 581
 
2856 hidnplayr 582
MAC             dp  ?
1164 hidnplayr 583
 
2856 hidnplayr 584
currTime        dd  ?
585
renewTime       dd  ?
586
generator       dd  ?
1164 hidnplayr 587
 
2856 hidnplayr 588
dhcpMsg         dd  ?
1164 hidnplayr 589
 
590
I_END_2:
591
 
2856 hidnplayr 592
path            rb  1024+5
1164 hidnplayr 593
 
2856 hidnplayr 594
                rb  65536
1542 hidnplayr 595
 
1164 hidnplayr 596
I_END: