The Pedigree Project  0.1
lwip/etharp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
27 /*
28  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
29  * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg@axon.tv>
30  * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands.
31  * All rights reserved.
32  *
33  * Redistribution and use in source and binary forms, with or without modification,
34  * are permitted provided that the following conditions are met:
35  *
36  * 1. Redistributions of source code must retain the above copyright notice,
37  * this list of conditions and the following disclaimer.
38  * 2. Redistributions in binary form must reproduce the above copyright notice,
39  * this list of conditions and the following disclaimer in the documentation
40  * and/or other materials provided with the distribution.
41  * 3. The name of the author may not be used to endorse or promote products
42  * derived from this software without specific prior written permission.
43  *
44  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
45  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
46  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
47  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
48  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
49  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
50  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
51  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
52  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
53  * OF SUCH DAMAGE.
54  *
55  * This file is part of the lwIP TCP/IP stack.
56  *
57  * Author: Adam Dunkels <adam@sics.se>
58  *
59  */
60 
61 #ifndef LWIP_HDR_NETIF_ETHARP_H
62 #define LWIP_HDR_NETIF_ETHARP_H
63 
64 #include "lwip/opt.h"
65 
66 #if LWIP_ARP || LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */
67 
68 #include "lwip/pbuf.h"
69 #include "lwip/ip4_addr.h"
70 #include "lwip/netif.h"
71 #include "lwip/ip4.h"
72 #include "lwip/prot/ethernet.h"
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
78 #if LWIP_IPV4 && LWIP_ARP /* don't build if not configured for use in lwipopts.h */
79 
80 #include "lwip/prot/etharp.h"
81 
83 #define ARP_TMR_INTERVAL 1000
84 
85 #if ARP_QUEUEING
86 
89 struct etharp_q_entry {
90  struct etharp_q_entry *next;
91  struct pbuf *p;
92 };
93 #endif /* ARP_QUEUEING */
94 
95 #define etharp_init() /* Compatibility define, no init needed. */
96 void etharp_tmr(void);
97 s8_t etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr,
98  struct eth_addr **eth_ret, const ip4_addr_t **ip_ret);
99 u8_t etharp_get_entry(u8_t i, ip4_addr_t **ipaddr, struct netif **netif, struct eth_addr **eth_ret);
100 err_t etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr);
101 err_t etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q);
102 err_t etharp_request(struct netif *netif, const ip4_addr_t *ipaddr);
107 #define etharp_gratuitous(netif) etharp_request((netif), netif_ip4_addr(netif))
108 void etharp_cleanup_netif(struct netif *netif);
109 
110 #if ETHARP_SUPPORT_STATIC_ENTRIES
111 err_t etharp_add_static_entry(const ip4_addr_t *ipaddr, struct eth_addr *ethaddr);
112 err_t etharp_remove_static_entry(const ip4_addr_t *ipaddr);
113 #endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
114 
115 #endif /* LWIP_IPV4 && LWIP_ARP */
116 
117 void etharp_input(struct pbuf *p, struct netif *netif);
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* LWIP_ARP || LWIP_ETHERNET */
124 
125 #endif /* LWIP_HDR_NETIF_ETHARP_H */
Definition: pbuf.h:161
Definition: netif.h:244
s8_t err_t
Definition: err.h:76