Subversion Repositories Kolibri OS

Rev

Rev 1481 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1481 Rev 1514
Line 129... Line 129...
129
 
129
 
Line 130... Line 130...
130
START:					    ; start of execution
130
START:					    ; start of execution
Line 131... Line -...
131
 
-
 
132
    mcall 40, 1 shl 7 ; network event
-
 
133
 
131
 
Line 134... Line -...
134
;    eth.set_network_drv 0x00000383
-
 
135
 
-
 
136
    DEBUGF  1,">Zero-config service:\n"
-
 
137
 
-
 
138
;    eth.status eax                          ; Read the Stack status
-
 
139
;    test    eax,eax                         ; if eax is zero, no driver was found
-
 
140
;    jnz     @f
-
 
141
;    DEBUGF  1,"No Card found!\n"
-
 
142
;    jmp     close
-
 
143
 
-
 
144
;   @@:
-
 
145
;    DEBUGF  1,"Detected card: %x\n",eax
-
 
146
;   @@:
-
 
147
;    eth.check_cable eax
-
 
148
;    test    al,al
-
 
149
;    jnz     @f
-
 
150
;    DEBUGF  1,"Cable disconnected!\n"
-
 
151
;    mcall   5, 500                          ; loop until cable is connected (check every 5 sec)
-
 
152
;    jmp     @r
-
 
153
 
132
	mcall	40, 1 shl 7 ; network event
Line 154... Line 133...
154
;   @@:
133
 
155
;    eth.read_mac MAC
134
	DEBUGF	1,">Zero-config service:\n"
Line 252... Line 231...
252
    stdcall mem.Alloc, BUFFER
231
	stdcall mem.Alloc, BUFFER
253
    mov     [dhcpMsg], eax
232
	mov	[dhcpMsg], eax
254
    test    eax,eax
233
	test	eax,eax
255
    jz	    apipa
234
	jz	apipa
Line -... Line 235...
-
 
235
 
Line 256... Line 236...
256
 
236
	    ;;; todo: skip this bullcrap
257
 
237
 
258
    mov     edi, eax
238
	mov	edi, eax
259
    mov     ecx,BUFFER
239
	mov	ecx, BUFFER
260
    xor     eax,eax
240
	xor	eax, eax
Line -... Line 241...
-
 
241
	cld
-
 
242
	rep	stosb
261
    cld
243
 
Line 262... Line 244...
262
    rep     stosb
244
	    ;; todo: put this in a buffer instead of writing bytes and words!
263
 
245
 
264
    mov     edx,[dhcpMsg]
246
	mov	edx,[dhcpMsg]
265
 
247
 
266
    mov     [edx], byte 0x01		    ; Boot request
248
	mov	[edx], byte 0x01		; Boot request
267
    mov     [edx+1], byte 0x01		    ; Ethernet
249
	mov	[edx+1], byte 0x01		; Ethernet
268
    mov     [edx+2], byte 0x06		    ; Ethernet h/w len
250
	mov	[edx+2], byte 0x06		; Ethernet h/w len
269
    mov     [edx+4], dword 0x11223344	    ; xid
251
	mov	[edx+4], dword 0x11223344	; xid                 ;;;;;;;
270
    mov     eax,[currTime]
252
	mov	eax,[currTime]
271
    mov     [edx+8], eax		    ; secs, our uptime
253
	mov	[edx+8], eax			; secs, our uptime
272
    mov     [edx+10], byte 0x80 	    ; broadcast flag set
254
	mov	[edx+10], byte 0x80		; broadcast flag set
273
    mov     eax, dword [MAC]		    ; first 4 bytes of MAC
255
	mov	eax, dword [MAC]		; first 4 bytes of MAC
274
    mov     [edx+28],dword eax
256
	mov	[edx+28],dword eax
275
    mov     ax, word [MAC+4]		    ; last 2 bytes of MAC
257
	mov	ax, word [MAC+4]		; last 2 bytes of MAC
276
    mov     [edx+32],word ax
258
	mov	[edx+32],word ax
277
    mov     [edx+236], dword 0x63538263     ; magic number
259
	mov	[edx+236], dword 0x63538263	; magic cookie
278
    mov     [edx+240], word 0x0135	    ; option DHCP msg type
260
	mov	[edx+240], word 0x0135		; option DHCP msg type
Line 311... Line 293...
311
    mov     [dhcpMsgLen], eax		    ; Used as a pointer to the data
293
	mov	[dhcpMsgLen], eax			; Used as a pointer to the data
Line 312... Line 294...
312
 
294
 
Line 313... Line 295...
313
    mcall 23, TIMEOUT*10		    ; wait for data
295
	mcall	23, TIMEOUT*10				; wait for data
314
 
-
 
315
read_data:				    ; we have data - this will be the response
296
 
Line 316... Line 297...
316
 
297
read_data:						; we have data - this will be the response
Line 317... Line 298...
317
    mcall 74, 7, [socketNum], [dhcpMsg], BUFFER   ; read data from socket
298
	mcall	74, 7, [socketNum], [dhcpMsg], BUFFER	; read data from socket
Line 462... Line 443...
462
    jmp     next_option
443
    jmp     next_option
Line 463... Line 444...
463
 
444
 
Line 464... Line 445...
464
pr_exit:
445
pr_exit:
465
 
-
 
-
 
446
 
Line 466... Line 447...
466
;    DEBUGF  1,"Sending ARP announce\n"
447
;    DEBUGF  1,"Sending ARP announce\n"
Line 467... Line 448...
467
;    eth.ARP_ANNOUNCE [dhcpClientIP]         ; send an ARP announce packet
448
;;;
468
 
449
 
Line 570... Line 551...
570
 
551
 
Line 571... Line 552...
571
 
552
 
572
sockaddr1:
553
sockaddr1:
573
 
554
 
Line 574... Line 555...
574
	dw AF_INET4
555
	dw AF_INET4
Line 575... Line 556...
575
	dw 68 shl 8	; local port
556
	dw 68		; local port
Line 576... Line 557...
576
	dd 0		; local IP
557
	dd 0		; local IP
577
 
558
 
578
	rb 10
559
	rb 10
Line 579... Line 560...
579
 
560