Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(ARM).Porting TCP-IP programmer's guide.Ver 1.6.pdf
Скачиваний:
43
Добавлен:
23.08.2013
Размер:
2.64 Mб
Скачать

Internal Functions

10.1ARP routines

The ARP routines are located in et_arp.c and are as follows:

etainit() on page 10-2

make_arp_entry()

arprcv() on page 10-3.

10.1.1etainit()

The etainit() routine must be called once at initialization time to initialize the ARP layer. It registers the ARP types with the hardware drivers and sets up an ARP timer.

Syntax

int etainit (void);

Return values

0If successful.

1If the ARP type could not be registered with the network driver.

10.1.2make_arp_entry()

The make_arp_entry() routine finds the first unused (or the oldest) ARP table entry and makes a new entry to prepare it for an ARP reply.

Syntax

struct arptabent *make_arp_entry(ip_addr dest_ip, NET net);

where:

dest_ip Is the IP address to make the entry for.

net

Is the associated network interface.

Usage

If the IP address already has an ARP entry, the entry is returned with only the time stamp modified. The MAC address of the created entry is not resolved, but is left as zeros. The eventual ARP reply fills in the MAC address.

Return value

pointer a pointer to the selected ARP table entry.

10-2

Copyright © 1998-2001 ARM Limited. All rights reserved.

ARM DUI 0144B

Internal Functions

10.1.3arprcv()

The arprcv() routine is the upcall for received ARP packets. It is called by the interface layer.

Syntax

int arprcv(PACKET pkt); where:

pkt

Is the PACKET containing the incoming ARP packet.

Return values

0

If the received ARP packet was processed successfully.

ENP_ code

If not successful (see ENP_ error codes on page A-2).

ARM DUI 0144B

Copyright © 1998-2001 ARM Limited. All rights reserved.

10-3