3 * Ethernet output function - handles OUTGOING ethernet level traffic, implements
5 * To be used in most low-level netif implementations
9 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
10 * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg@axon.tv>
11 * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands.
12 * All rights reserved.
14 * Redistribution and use in source and binary forms, with or without modification,
15 * are permitted provided that the following conditions are met:
17 * 1. Redistributions of source code must retain the above copyright notice,
18 * this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright notice,
20 * this list of conditions and the following disclaimer in the documentation
21 * and/or other materials provided with the distribution.
22 * 3. The name of the author may not be used to endorse or promote products
23 * derived from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
28 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
36 * This file is part of the lwIP TCP/IP stack.
38 * Author: Adam Dunkels <adam@sics.se>
42 #ifndef LWIP_HDR_NETIF_ETHARP_H
43 #define LWIP_HDR_NETIF_ETHARP_H
47 #if LWIP_ARP || LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */
49 #include "lwip/pbuf.h"
50 #include "lwip/ip4_addr.h"
51 #include "lwip/netif.h"
53 #include "lwip/prot/ethernet.h"
59 #if LWIP_IPV4 && LWIP_ARP /* don't build if not configured for use in lwipopts.h */
61 #include "lwip/prot/etharp.h"
63 /** 1 seconds period */
64 #define ARP_TMR_INTERVAL 1000
67 /** struct for queueing outgoing packets for unknown address
68 * defined here to be accessed by memp.h
70 struct etharp_q_entry
{
71 struct etharp_q_entry
*next
;
74 #endif /* ARP_QUEUEING */
76 #define etharp_init() /* Compatibility define, no init needed. */
77 void etharp_tmr(void);
78 s8_t
etharp_find_addr(struct netif
*netif
, const ip4_addr_t
*ipaddr
,
79 struct eth_addr
**eth_ret
, const ip4_addr_t
**ip_ret
);
80 u8_t
etharp_get_entry(u8_t i
, ip4_addr_t
**ipaddr
, struct netif
**netif
, struct eth_addr
**eth_ret
);
81 err_t
etharp_output(struct netif
*netif
, struct pbuf
*q
, const ip4_addr_t
*ipaddr
);
82 err_t
etharp_query(struct netif
*netif
, const ip4_addr_t
*ipaddr
, struct pbuf
*q
);
83 err_t
etharp_request(struct netif
*netif
, const ip4_addr_t
*ipaddr
);
84 /** For Ethernet network interfaces, we might want to send "gratuitous ARP";
85 * this is an ARP packet sent by a node in order to spontaneously cause other
86 * nodes to update an entry in their ARP cache.
87 * From RFC 3220 "IP Mobility Support for IPv4" section 4.6. */
88 #define etharp_gratuitous(netif) etharp_request((netif), netif_ip4_addr(netif))
89 void etharp_cleanup_netif(struct netif
*netif
);
91 #if ETHARP_SUPPORT_STATIC_ENTRIES
92 err_t
etharp_add_static_entry(const ip4_addr_t
*ipaddr
, struct eth_addr
*ethaddr
);
93 err_t
etharp_remove_static_entry(const ip4_addr_t
*ipaddr
);
94 #endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
96 #endif /* LWIP_IPV4 && LWIP_ARP */
98 void etharp_input(struct pbuf
*p
, struct netif
*netif
);
104 #endif /* LWIP_ARP || LWIP_ETHERNET */
106 #endif /* LWIP_HDR_NETIF_ETHARP_H */