Subversion Repositories Kolibri OS

Rev

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

Rev 1171 Rev 1185
Line -... Line 565...
-
 
565
 
-
 
566
 
-
 
567
 
-
 
568
 
-
 
569
 
-
 
570
;---------------------------------------------------------------------------
-
 
571
;
-
 
572
; ARP_decrease_entry_ttls
-
 
573
;
-
 
574
; IN: /
-
 
575
; OUT: /
-
 
576
;
-
 
577
;---------------------------------------------------------------------------
-
 
578
 
-
 
579
align 4
-
 
580
ARP_decrease_entry_ttls:
-
 
581
 
-
 
582
	mov	ecx, [NumARP]
-
 
583
	test	ecx, ecx
-
 
584
	jz	.exit
-
 
585
 
-
 
586
	mov	ebx, ARPTable
-
 
587
 
-
 
588
.timer_loop:
-
 
589
 
-
 
590
	movsx	esi, word [ebx + ARP_ENTRY.TTL]
-
 
591
	cmp	esi, 0xFFFFFFFF
-
 
592
	je	.timer_loop_end  ;if TTL==0xFFFF then it's static entry
-
 
593
 
-
 
594
	test	esi, esi
-
 
595
	jnz	.timer_loop_end_with_dec  ;if TTL!=0
-
 
596
 
-
 
597
	; Ok, TTL is 0
-
 
598
	;if Status==AWAITING_RESPONSE and TTL==0
-
 
599
	;then we have to change it to ARP_RESPONSE_TIMEOUT
-
 
600
	cmp	word [ebx + ARP_ENTRY.Status], ARP_AWAITING_RESPONSE
-
 
601
	jne	@f
-
 
602
 
-
 
603
	mov	word [ebx + ARP_ENTRY.Status], ARP_RESPONSE_TIMEOUT
-
 
604
	mov	word [ebx + ARP_ENTRY.TTL], word 0x000A   ;10 sec
-
 
605
	jmp	.timer_loop_end
-
 
606
 
-
 
607
  @@:
-
 
608
	;if TTL==0 and Status==VALID_MAPPING, we have to delete it
-
 
609
	;if TTL==0 and Status==RESPONSE_TIMEOUT, delete too
-
 
610
	mov	esi, dword[NumARP]
-
 
611
	sub	esi, ecx	  ;esi=index of entry, will be deleted
-
 
612
 
-
 
613
	call	ARP_del_entry
-
 
614
 
-
 
615
	jmp	.timer_loop_end
-
 
616
 
-
 
617
 
-
 
618
.timer_loop_end_with_dec:
-
 
619
 
-
 
620
	dec	word [ebx + ARP_ENTRY.TTL]  ;decrease TTL
-
 
621
 
-
 
622
.timer_loop_end:
-
 
623
 
-
 
624
	add	ebx, ARP_ENTRY.size
-
 
625
	loop	.timer_loop
-
 
626
 
-
 
627
.exit:
-
 
628
 
-
 
629
	ret
-
 
630
 
-
 
631
 
-
 
632
;---------------------------------------------------------------------------
-
 
633
;
-
 
634
; ARP_del_entry
-
 
635
;
-
 
636
; IN: entry # in esi
-
 
637
; OUT: /
-
 
638
;
-
 
639
;---------------------------------------------------------------------------
-
 
640
 
-
 
641
align 4
-
 
642
ARP_del_entry:
-
 
643
 
-
 
644
	imul	esi, ARP_ENTRY.size
-
 
645
 
-
 
646
	mov	ecx, (ARP_TABLE_SIZE - 1) * ARP_ENTRY.size
-
 
647
	sub	ecx, esi
-
 
648
 
-
 
649
	lea	edi, [ebx + esi]	    ;edi=ptr to entry that should be deleted
-
 
650
	lea	esi, [edi + ARP_ENTRY.size] ;esi=ptr to next entry
-
 
651
 
-
 
652
	shr	ecx,1	   ;ecx/2 => ARP_ENTRY_SIZE MUST BE EVEN NUMBER!
-
 
653
	cld
-
 
654
	rep	movsw
-
 
655
 
-
 
656
	dec	dword[NumARP] ;decrease arp-entries counter
-
 
657
	ret
565
 
658
 
566
 
659
 
567
 
660
 
568
 
661
 
569
 
662