Watt-32 tcp/ip  2.2 dev-rel.10
pcarp.h
Go to the documentation of this file.
1 
4 #ifndef _w32_PCARP_H
5 #define _w32_PCARP_H
6 
11 struct gate_entry {
12  DWORD gate_ip;
13  DWORD subnet;
14  DWORD mask;
15  BOOL is_dead; /* Dead Gate detection: */
16  BOOL echo_pending; /* echo-reply pending */
17  DWORD chk_timer; /* check interval timer */
18  };
19 
23 struct arp_entry {
24  DWORD ip;
25  eth_address hardware;
26  DWORD expiry;
27  DWORD retransmit_to;
28  WORD flags;
29  };
30 
31 
34 #define ARP_FLG_INUSE 0x01
35 #define ARP_FLG_FIXED 0x02
36 #define ARP_FLG_DYNAMIC 0x04
37 #define ARP_FLG_PENDING 0x08
43 struct route_entry {
44  DWORD host_ip; /* when connection to this host ... */
45  DWORD gate_ip; /* ... we use this gateway */
46  DWORD mask; /* mask used to calculate this route */
47  DWORD flags; /* not used yet */
48  };
49 
52 #define ROUTE_FLG_USED 0x01
53 #define ROUTE_FLG_PENDING 0x02
54 #define ROUTE_FLG_DYNAMIC 0x04
55 #define ROUTE_FLG_FIXED 0x08
56 
57 
64 W32_FUNC int W32_CALL _arp_gateways_get (const struct gate_entry **);
65 W32_FUNC int W32_CALL _arp_check_gateways (void);
66 W32_FUNC BOOL W32_CALL _arp_add_gateway (const char* config_string, DWORD ip);
67 W32_FUNC BOOL W32_CALL _arp_have_default_gw (void);
68 W32_FUNC void W32_CALL _arp_kill_gateways (void);
69 
74 W32_FUNC BOOL W32_CALL _arp_resolve (DWORD ina, eth_address *eth);
75 W32_FUNC BOOL W32_CALL _arp_check_own_ip (eth_address *eth);
76 
79 W32_FUNC BOOL W32_CALL _arp_start_lookup (DWORD ip);
80 W32_FUNC BOOL W32_CALL _arp_lookup (DWORD ip, eth_address *eth);
81 W32_FUNC BOOL W32_CALL _arp_lookup_fixed (DWORD ip, eth_address *eth);
82 W32_FUNC BOOL W32_CALL _arp_lookup_pending (DWORD ip);
83 
86 W32_FUNC BOOL W32_CALL _arp_cache_add (DWORD ip, const void *eth, BOOL expire);
87 W32_FUNC BOOL W32_CALL _arp_cache_del (DWORD ip);
88 W32_FUNC int W32_CALL _arp_cache_get (const struct arp_entry **);
89 W32_FUNC void W32_CALL _arp_cache_dump (void);
90 W32_FUNC void W32_CALL _arp_gateways_dump (void);
91 W32_FUNC void W32_CALL _arp_routes_dump (void);
92 W32_FUNC void W32_CALL _arp_debug_dump (void);
93 
96 W32_FUNC void W32_CALL _arp_init (void);
97 W32_FUNC BOOL W32_CALL _arp_reply (const void *mac_dst, DWORD src_ip, DWORD dst_ip);
98 W32_FUNC BOOL W32_CALL _arp_handler (const arp_Header *arp, BOOL brdcast);
99 
102 W32_FUNC BOOL W32_CALL _arp_register (DWORD use_this_gateway_ip, DWORD for_this_host_ip);
103 
104 #endif
WORD flags
ARP flags, see below.
Definition: pcarp.h:28
W32_FUNC BOOL W32_CALL _arp_reply(const void *mac_dst, DWORD src_ip, DWORD dst_ip)
Send unicast/broadcast ARP reply.
Definition: pcarp.c:489
W32_FUNC BOOL W32_CALL _arp_cache_add(DWORD ip, const void *eth, BOOL expire)
ARP cache functions.
Definition: pcarp.c:1352
W32_FUNC BOOL W32_CALL _arp_lookup_pending(DWORD ip)
An ARP-lookup timeout check.
Definition: pcarp.c:1206
W32_FUNC BOOL W32_CALL _arp_add_gateway(const char *config_string, DWORD ip)
Add a gateway to the routing table.
Definition: pcarp.c:247
W32_FUNC BOOL W32_CALL _arp_lookup(DWORD ip, eth_address *eth)
Lookup MAC-address of 'ip'.
Definition: pcarp.c:1186
DWORD retransmit_to
used only for re-requesting MAC while 'pending'
Definition: pcarp.h:27
W32_FUNC BOOL W32_CALL _arp_start_lookup(DWORD ip)
New non-blocking functions, GvB 2002-09.
Definition: pcarp.c:1169
W32_FUNC int W32_CALL _arp_cache_get(const struct arp_entry **)
Return start of arp_list[].
Definition: pcarp.c:527
DWORD expiry
'pending timeout' or 'dynamic expiry'
Definition: pcarp.h:26
W32_FUNC BOOL W32_CALL _arp_have_default_gw(void)
Check if we have at least one default gateway.
Definition: pcarp.c:382
W32_FUNC int W32_CALL _arp_gateways_get(const struct gate_entry **)
Gateway functions.
Definition: pcarp.c:94
W32_FUNC void W32_CALL _arp_kill_gateways(void)
Delete all gateways.
Definition: pcarp.c:373
W32_FUNC void W32_CALL _arp_debug_dump(void)
Debug-dump of configured gateways, route table and ARP cache.
Definition: pcarp.c:1907
W32_FUNC BOOL W32_CALL _arp_cache_del(DWORD ip)
Delete given 'ip' address from ARP-cache (dynamic, fixed or pending).
Definition: pcarp.c:1421
W32_FUNC BOOL W32_CALL _arp_check_own_ip(eth_address *eth)
Used by DHCP initialisation.
Definition: pcarp.c:1729
DWORD gate_ip
The IP address of gateway.
Definition: pcarp.h:12
W32_FUNC BOOL W32_CALL _arp_resolve(DWORD ina, eth_address *eth)
Blocking ARP resolve functions.
Definition: pcarp.c:1279
W32_FUNC void W32_CALL _arp_init(void)
'Internal' interface to pctcp.c & others.
Definition: pcarp.c:1547
Definition: ip.h:67
W32_FUNC int W32_CALL _arp_check_gateways(void)
Return number of default gateways.
Definition: pcarp.c:1752
W32_FUNC BOOL W32_CALL _arp_register(DWORD use_this_gateway_ip, DWORD for_this_host_ip)
ICMP redirection.
Definition: pcarp.c:843
DWORD ip
IP address of ARP entry.
Definition: pcarp.h:24
W32_FUNC BOOL W32_CALL _arp_handler(const arp_Header *arp, BOOL brdcast)
Receive ARP handler.
Definition: pcarp.c:1566
DWORD subnet
The subnet mask of gateway.
Definition: pcarp.h:13
Definition: pcarp.h:23
W32_FUNC BOOL W32_CALL _arp_lookup_fixed(DWORD ip, eth_address *eth)
Lookup fixed MAC-address of 'ip'.
Definition: pcarp.c:1219
Definition: pcarp.h:11
eth_address hardware
MAC address of ARP entry.
Definition: pcarp.h:25
DWORD mask
The netmask fgor the above entry.
Definition: pcarp.h:14