RetroArch
etharp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
3  * Copyright (c) 2003-2004 Leon Woestenberg <[email protected]>
4  * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote products
16  * derived from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
19  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
21  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
23  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
27  * OF SUCH DAMAGE.
28  *
29  * This file is part of the lwIP TCP/IP stack.
30  *
31  * Author: Adam Dunkels <[email protected]>
32  *
33  */
34 
35 #ifndef __NETIF_ETHARP_H__
36 #define __NETIF_ETHARP_H__
37 
38 #ifndef ETH_PAD_SIZE
39 #define ETH_PAD_SIZE 0
40 #endif
41 
42 #include "lwip/pbuf.h"
43 #include "lwip/ip_addr.h"
44 #include "lwip/netif.h"
45 #include "lwip/ip.h"
46 
47 #ifdef PACK_STRUCT_USE_INCLUDES
48 # include "arch/bpstruct.h"
49 #endif
51 struct eth_addr {
55 #ifdef PACK_STRUCT_USE_INCLUDES
56 # include "arch/epstruct.h"
57 #endif
58 
59 #ifdef PACK_STRUCT_USE_INCLUDES
60 # include "arch/bpstruct.h"
61 #endif
63 struct eth_hdr {
64 #if ETH_PAD_SIZE
66 #endif
67  PACK_STRUCT_FIELD(struct eth_addr dest);
72 #ifdef PACK_STRUCT_USE_INCLUDES
73 # include "arch/epstruct.h"
74 #endif
75 
76 #ifdef PACK_STRUCT_USE_INCLUDES
77 # include "arch/bpstruct.h"
78 #endif
81 struct etharp_hdr {
82  PACK_STRUCT_FIELD(struct eth_hdr ethhdr);
83  PACK_STRUCT_FIELD(u16_t hwtype);
85  PACK_STRUCT_FIELD(u16_t _hwlen_protolen);
86  PACK_STRUCT_FIELD(u16_t opcode);
87  PACK_STRUCT_FIELD(struct eth_addr shwaddr);
88  PACK_STRUCT_FIELD(struct ip_addr2 sipaddr);
89  PACK_STRUCT_FIELD(struct eth_addr dhwaddr);
90  PACK_STRUCT_FIELD(struct ip_addr2 dipaddr);
93 #ifdef PACK_STRUCT_USE_INCLUDES
94 # include "arch/epstruct.h"
95 #endif
96 
97 #ifdef PACK_STRUCT_USE_INCLUDES
98 # include "arch/bpstruct.h"
99 #endif
101 struct ethip_hdr {
102  PACK_STRUCT_FIELD(struct eth_hdr eth);
103  PACK_STRUCT_FIELD(struct ip_hdr ip);
106 #ifdef PACK_STRUCT_USE_INCLUDES
107 # include "arch/epstruct.h"
108 #endif
109 
111 #define ARP_TMR_INTERVAL 5000
112 
113 #define ETHTYPE_ARP 0x0806
114 #define ETHTYPE_IP 0x0800
115 
116 void etharp_init(void);
117 void etharp_tmr(void);
118 void etharp_ip_input(struct netif *netif, struct pbuf *p);
119 void etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr,
120  struct pbuf *p);
121 err_t etharp_output(struct netif *netif, struct ip_addr *ipaddr,
122  struct pbuf *q);
123 err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q);
124 err_t etharp_request(struct netif *netif, struct ip_addr *ipaddr);
125 
126 #endif /* __NETIF_ARP_H__ */
void etharp_init(void)
Definition: etharp.c:117
s8_t err_t
Definition: err.h:39
PACK_STRUCT_FIELD(struct eth_addr dest)
Definition: ip_addr.h:41
#define PACK_STRUCT_BEGIN
Definition: arch.h:46
Definition: etharp.h:81
PACK_STRUCT_BEGIN struct eth_addr PACK_STRUCT_STRUCT
err_t etharp_request(struct netif *netif, struct ip_addr *ipaddr)
Definition: etharp.c:784
Definition: netif.h:72
void etharp_ip_input(struct netif *netif, struct pbuf *p)
Definition: etharp.c:431
Definition: etharp.h:63
#define ETH_PAD_SIZE
Definition: etharp.h:39
GLenum type
Definition: glext.h:6233
Definition: etharp.h:101
err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
Definition: etharp.c:690
GLenum const GLvoid * addr
Definition: glext.h:10528
GLenum src
Definition: glext.h:6980
PACK_STRUCT_FIELD(struct eth_hdr ethhdr)
GLdouble GLdouble GLdouble GLdouble q
Definition: glext.h:6414
void etharp_tmr(void)
Definition: etharp.c:137
PACK_STRUCT_FIELD(u8_t addr[6])
GLfloat GLfloat p
Definition: glext.h:9809
#define PACK_STRUCT_END
Definition: arch.h:50
err_t etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
Definition: etharp.c:594
u8 u8_t
Definition: cc.h:43
const char * proto
Definition: civetweb.c:11575
Definition: ip.h:102
PACK_STRUCT_FIELD(struct eth_hdr eth)
Definition: etharp.h:51
void etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
Definition: etharp.c:468
Definition: ip_addr.h:53
u16 u16_t
Definition: cc.h:45
Definition: pbuf.h:66