Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

SRC/pcarp.h File Reference


Detailed Description

ARP handler module.

Definition in file pcarp.h.

Go to the source code of this file.

Data Structures

struct  gate_entry
struct  arp_entry

Functions

W32_FUNC int _arp_list_gateways (struct gate_entry *gw, int max)
 Gateway functions.
int _arp_check_gateways (void)
 Return number of default gateways.
BOOL _arp_add_gateway (const char *config_string, DWORD ip)
 Add a gateway to the routing table.
BOOL _arp_have_default_gw (void)
 Check if we have at least one default gateway.
void _arp_kill_gateways (void)
 Delete all gateways.
W32_FUNC BOOL _arp_resolve (DWORD ina, eth_address *eth)
 Blocking ARP resolve functions.
W32_FUNC BOOL _arp_check_own_ip (eth_address *eth)
 Used by DHCP initialisation.
BOOL arp_start_lookup (DWORD ip)
 New non-blocking functions, GvB 2002-09.
BOOL arp_lookup (DWORD ip, eth_address *eth)
 Lookup MAC-address of 'ip'.
BOOL arp_lookup_fixed (DWORD ip, eth_address *eth)
 Lookup fixed MAC-address of 'ip'.
BOOL arp_lookup_pending (DWORD ip)
 An ARP-lookup timeout check.
BOOL _arp_add_cache (DWORD ip, const void *eth, BOOL expire)
 ARP cache functions.
BOOL _arp_delete_cache (DWORD ip)
 Delete given 'ip' address from ARP-cache (dynamic or fixed).
W32_FUNC int _arp_list_cache (struct arp_entry *arp, int max)
 Return contents of ARP cache.
void _arp_init (void)
 'Internal' interface to pctcp.c & others.
BOOL _arp_reply (const void *mac_dst, DWORD src_ip, DWORD dst_ip)
 Send unicast/broadcast ARP reply.
BOOL _arp_handler (const arp_Header *arp, BOOL brdcast)
 Receive ARP handler.
BOOL _arp_register (DWORD use_this_gateway_ip, DWORD for_this_host_ip)
 ICMP redirection.
W32_FUNC void _arp_debug_dump (void)
 Debug-dump of configured gateways, route table and ARP cache.


Function Documentation

BOOL _arp_add_cache DWORD  ip,
const void *  eth,
BOOL  expires
 

ARP cache functions.

Note:
'ip' is on host order.
Definition at line 1197 of file pcarp.c.

References _arp_delete_cache(), arp_move_entry(), DWORD, arp_entry::ip, is_on_LAN(), my_ip_addr, and set_timeout().

BOOL _arp_add_gateway const char *  config_string,
DWORD  ip
 

Add a gateway to the routing table.

The format of 'config_string' is: IP-address [, subnet] , mask]]

If 'config_string' is NULL, simply add 'ip' with zero mask and subnet. Definition at line 185 of file pcarp.c.

References aton(), DWORD, and gate_entry::gate_ip.

W32_FUNC BOOL _arp_check_own_ip eth_address other_guy  ) 
 

Used by DHCP initialisation.

Do an ARP resolve on our own IP address to check if someone else is replying. Return non-zero if someone replied.

Note:
Blocks waiting for reply or timeout.
Definition at line 1550 of file pcarp.c.

References _arp_resolve(), DWORD, eth_address, and my_ip_addr.

W32_FUNC void _arp_debug_dump void   ) 
 

Debug-dump of configured gateways, route table and ARP cache.

Redone + moved here from pcdbug.c for encapsulation reasons GvB 2002-09 Definition at line 1625 of file pcarp.c.

References _inet_ntoa(), DWORD, MAC_address(), gate_entry::mask, set_timeout(), and sin_mask.

BOOL _arp_delete_cache DWORD  ip  ) 
 

Delete given 'ip' address from ARP-cache (dynamic or fixed).

Note:
'ip' is on host order.
Definition at line 1261 of file pcarp.c.

References arp_move_entry(), DWORD, arp_entry::flags, and arp_entry::ip.

BOOL _arp_handler const arp_Header ah,
BOOL  brdcast
 

Receive ARP handler.

This processes incoming 'raw' ARP packets supplied by tcp_tick(). Definition at line 1412 of file pcarp.c.

References _arp_add_cache(), _arp_reply(), _eth_addr, _eth_brdcast, _eth_get_hwtype(), _eth_mac_len, _inet_ntoa(), _pkt_rxmode, arp_move_entry(), arp_Header::dstIPAddr, DWORD, eth_address, arp_entry::expiry, arp_entry::flags, arp_Header::hwAddrLen, arp_Header::hwType, arp_entry::ip, MAC_address(), my_ip_addr, arp_Header::opcode, arp_Header::protoAddrLen, arp_Header::protType, RXMODE_BROADCAST, set_timeout(), arp_Header::srcEthAddr, arp_Header::srcIPAddr, and WORD.

W32_FUNC int _arp_list_cache struct arp_entry arp,
int  max
 

Return contents of ARP cache.

'max' entries are returned in 'arp[]' buffers. Only entries in-use are returned. Definition at line 1576 of file pcarp.c.

References eth_address, arp_entry::expiry, arp_entry::flags, arp_entry::hardware, and arp_entry::ip.

W32_FUNC int _arp_list_gateways struct gate_entry gw,
int  max
 

Gateway functions.

Note:
Max 'num' gateways is returned in 'gw[]' buffer.
Definition at line 71 of file pcarp.c.

References gate_entry::echo_pending, gate_entry::gate_ip, gate_entry::is_dead, gate_entry::mask, and gate_entry::subnet.

BOOL _arp_register DWORD  use_this_gateway_ip,
DWORD  for_this_host_ip
 

ICMP redirection.

Called on ICMP-redirects.

Redirects are sent from a gateway/router, telling us that a different gateway is better suited to connect to the specified host than the one we were using. Definition at line 718 of file pcarp.c.

BOOL _arp_reply const void *  mac_dst,
DWORD  src_ip,
DWORD  dst_ip
 

Send unicast/broadcast ARP reply.

'src_ip' and 'dst_ip' on network order. Definition at line 409 of file pcarp.c.

References _eth_addr, _eth_brdcast, _eth_formatpacket(), _eth_get_hwtype(), arp_send(), arp_Header::dstEthAddr, arp_Header::dstIPAddr, DWORD, arp_Header::hwAddrLen, arp_Header::hwType, arp_Header::opcode, arp_Header::protoAddrLen, arp_Header::protType, arp_Header::srcEthAddr, and arp_Header::srcIPAddr.

W32_FUNC BOOL _arp_resolve DWORD  ina,
eth_address eth
 

Blocking ARP resolve functions.

Doesn't return until success or time-out. Definition at line 1108 of file pcarp.c.

BOOL arp_lookup DWORD  ip,
eth_address eth
 

Lookup MAC-address of 'ip'.

Return values:
TRUE MAC for 'ip' is known.
Definition at line 1029 of file pcarp.c.

References _eth_addr, _pktserial, DWORD, eth_address, is_on_LAN(), LAN_lookup(), and route_lookup().

BOOL arp_lookup_fixed DWORD  ip,
eth_address eth
 

Lookup fixed MAC-address of 'ip'.

Return values:
TRUE Supplied 'ip' has a fixed MAC entry.
Definition at line 1074 of file pcarp.c.

References _pktserial, DWORD, eth_address, arp_entry::ip, and is_on_LAN().

BOOL arp_lookup_pending DWORD  ip  ) 
 

An ARP-lookup timeout check.

Return values:
TRUE The lookup is currently underway ("pending").
FALSE The IP has either been resolved (arp_lookup() == TRUE), or the lookup has timed out, i.e. the host is unreachable.
Definition at line 1061 of file pcarp.c.

References DWORD, is_on_LAN(), LAN_lookup_pending(), and route_lookup_pending().

BOOL arp_start_lookup DWORD  ip  ) 
 

New non-blocking functions, GvB 2002-09.

This is called by 'higher' routines to start an ARP request. This function is non-blocking, i.e. returns 'immediately'. Definition at line 1012 of file pcarp.c.

References _pktserial, DWORD, is_on_LAN(), LAN_start_lookup(), and route_start_lookup().


Generated on Wed Aug 4 08:55:57 2010 for Watt-32 tcp/ip by doxygen 1.3.8