Subversion Repositories Kolibri OS

Rev

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

Rev 1257 Rev 1258
Line 15... Line 15...
15
;;             Version 2, June 1991                                ;;
15
;;             Version 2, June 1991                                ;;
16
;;                                                                 ;;
16
;;                                                                 ;;
17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 18... Line 18...
18
 
18
 
Line 19... Line 19...
19
 
19
 
20
$Revision: 1257 $
20
$Revision: 1258 $
21
 
21
 
Line 69... Line 69...
69
 
69
 
70
align 4
70
align 4
Line 71... Line 71...
71
uglobal
71
uglobal
-
 
72
 
72
 
73
	NumARP		dd ?
Line 73... Line 74...
73
	NumARP		dd ?
74
 
74
	ARPTable	rb ARP_ENTRY.size * ARP_TABLE_SIZE
75
	ARPTable	rb ARP_ENTRY.size * ARP_TABLE_SIZE
Line 160... Line 161...
160
 
161
 
Line 161... Line 162...
161
   ; if not, reserve an entry in list and send an ARP request packet
162
   ; if not, reserve an entry in list and send an ARP request packet
Line 162... Line 163...
162
 
163
 
163
	push	eax
164
	push	eax
164
 
165
 
165
	push	word ARP_REQUEST_TTL
166
	pushw	ARP_REQUEST_TTL
166
	push	word ARP_AWAITING_RESPONSE
167
	pushw	ARP_AWAITING_RESPONSE
167
	push	dword 0
168
	pushd	0
168
	push	word 0
-
 
169
	push	eax
169
	pushw	0
170
	call	ARP_add_entry
170
	pushd	eax
Line -... Line 171...
-
 
171
	call	ARP_add_entry
-
 
172
	cmp	eax, -1
-
 
173
	je	.full
-
 
174
 
-
 
175
	; 
171
 
176
 
-
 
177
	; This piece of code waits for an ARP reply
172
	cmp	eax, -1
178
 
Line -... Line 179...
-
 
179
	mov	ebx, eax
-
 
180
	pop	eax
-
 
181
	push	ebx
-
 
182
	call	ARP_create_request
-
 
183
 
-
 
184
	push	[timer_ticks]
-
 
185
	add	dword[esp], 100*ARP_REQUEST_TTL
-
 
186
	DEBUGF 1,"Waiting for ARP reply, time: %x, entry:%u\n",[timer_ticks], [esp + 4]
-
 
187
   .dirty_loop:
-
 
188
 
-
 
189
	call	change_task	; The ARP reply hasnt been received yet, tell the processor to do some other stuff first
-
 
190
 
-
 
191
	mov	eax, [esp + 4]
-
 
192
	imul	eax, ARP_ENTRY.size
-
 
193
	add	eax, ARPTable
-
 
194
	cmp	[eax + ARP_ENTRY.Status], ARP_VALID_MAPPING
-
 
195
	je	.gogogo
-
 
196
 
-
 
197
	mov	eax, [esp]	; Check if the reply hasnt timed-out yet
-
 
198
	cmp	[timer_ticks], eax
173
	je	.full
199
	jl	.dirty_loop
Line 174... Line 200...
174
 
200
 
175
	pop	eax
201
	; 
176
	call	ARP_create_request
-
 
177
 
202
	or	eax, -1
178
	ret
203
	add	esp, 8
179
 
-
 
180
  .found_it:
204
	ret
Line 181... Line 205...
181
	add    esi, ARP_ENTRY.MAC
205
 
182
	DEBUGF 1,"Found MAC! (%x-%x-%x-%x-%x-%x)\n",[esi+0]:2,[esi+1]:2,[esi+2]:2,[esi+3]:2,[esi+4]:2,[esi+5]:2
206
  .found_it:
183
	movzx  eax, word [esi]
207
	DEBUGF 1,"found MAC in ARPTable\n"
184
	mov    ebx, [esi+2]
208
	movzx  eax, word [esi+ARP_ENTRY.MAC]
Line -... Line 209...
-
 
209
	mov    ebx, dword[esi+ARP_ENTRY.MAC+2]
-
 
210
	ret
-
 
211
 
-
 
212
  .full:
-
 
213
	add	esp, 4
-
 
214
	mov	eax, -1
-
 
215
	ret
Line 185... Line 216...
185
 
216
 
186
	ret
217
  .gogogo:
187
 
218
	DEBUGF 1,"got ARP reply, time: %x\n",[timer_ticks]
188
  .full:
219
	mov    ebx, dword[eax+ARP_ENTRY.MAC+2]
189
	add	esp, 4
220
	movzx  eax, word [eax+ARP_ENTRY.MAC]
190
	mov	eax, -1
221
	add    esp, 8
191
	ret
222
	ret
192
 
223
 
Line 374... Line 405...
374
	mov	ecx, ARP_ENTRY.size/2
405
	mov	ecx, ARP_ENTRY.size/2
375
	repz	movsw
406
	repz	movsw
Line 376... Line 407...
376
 
407
 
377
	inc	[NumARP]
408
	inc	[NumARP]
378
	pop	eax
-
 
-
 
409
	pop	eax
379
 
410
	DEBUGF 1,"New entry created: %u\n", eax
380
.exit:
411
.exit:
381
	DEBUGF 1,"Exiting\n"
412
	DEBUGF 1,"Exiting\n"
Line 382... Line 413...
382
	ret	ARP_ENTRY.size
413
	ret	ARP_ENTRY.size