User | Revision | Line number | New contents of line |
donatien |
0:0f5a52711275
|
1
|
/*
|
donatien |
0:0f5a52711275
|
2
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
donatien |
0:0f5a52711275
|
3
|
* All rights reserved.
|
donatien |
0:0f5a52711275
|
4
|
*
|
donatien |
0:0f5a52711275
|
5
|
* Redistribution and use in source and binary forms, with or without modification,
|
donatien |
0:0f5a52711275
|
6
|
* are permitted provided that the following conditions are met:
|
donatien |
0:0f5a52711275
|
7
|
*
|
donatien |
0:0f5a52711275
|
8
|
* 1. Redistributions of source code must retain the above copyright notice,
|
donatien |
0:0f5a52711275
|
9
|
* this list of conditions and the following disclaimer.
|
donatien |
0:0f5a52711275
|
10
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
donatien |
0:0f5a52711275
|
11
|
* this list of conditions and the following disclaimer in the documentation
|
donatien |
0:0f5a52711275
|
12
|
* and/or other materials provided with the distribution.
|
donatien |
0:0f5a52711275
|
13
|
* 3. The name of the author may not be used to endorse or promote products
|
donatien |
0:0f5a52711275
|
14
|
* derived from this software without specific prior written permission.
|
donatien |
0:0f5a52711275
|
15
|
*
|
donatien |
0:0f5a52711275
|
16
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
donatien |
0:0f5a52711275
|
17
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
donatien |
0:0f5a52711275
|
18
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
donatien |
0:0f5a52711275
|
19
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
donatien |
0:0f5a52711275
|
20
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
donatien |
0:0f5a52711275
|
21
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
donatien |
0:0f5a52711275
|
22
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
donatien |
0:0f5a52711275
|
23
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
donatien |
0:0f5a52711275
|
24
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
donatien |
0:0f5a52711275
|
25
|
* OF SUCH DAMAGE.
|
donatien |
0:0f5a52711275
|
26
|
*
|
donatien |
0:0f5a52711275
|
27
|
* This file is part of the lwIP TCP/IP stack.
|
donatien |
0:0f5a52711275
|
28
|
*
|
donatien |
0:0f5a52711275
|
29
|
* Author: Adam Dunkels <adam@sics.se>
|
donatien |
0:0f5a52711275
|
30
|
*
|
donatien |
0:0f5a52711275
|
31
|
*/
|
donatien |
0:0f5a52711275
|
32
|
#ifndef __LWIP_NETIF_H__
|
donatien |
0:0f5a52711275
|
33
|
#define __LWIP_NETIF_H__
|
donatien |
0:0f5a52711275
|
34
|
|
donatien |
0:0f5a52711275
|
35
|
#include "lwip/opt.h"
|
donatien |
0:0f5a52711275
|
36
|
|
donatien |
0:0f5a52711275
|
37
|
#define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF)
|
donatien |
0:0f5a52711275
|
38
|
|
donatien |
0:0f5a52711275
|
39
|
#include "lwip/err.h"
|
donatien |
0:0f5a52711275
|
40
|
|
donatien |
0:0f5a52711275
|
41
|
#include "lwip/ip_addr.h"
|
donatien |
0:0f5a52711275
|
42
|
|
donatien |
0:0f5a52711275
|
43
|
#include "lwip/def.h"
|
donatien |
0:0f5a52711275
|
44
|
#include "lwip/pbuf.h"
|
donatien |
0:0f5a52711275
|
45
|
#if LWIP_DHCP
|
donatien |
0:0f5a52711275
|
46
|
struct dhcp;
|
donatien |
0:0f5a52711275
|
47
|
#endif
|
donatien |
0:0f5a52711275
|
48
|
#if LWIP_AUTOIP
|
donatien |
0:0f5a52711275
|
49
|
struct autoip;
|
donatien |
0:0f5a52711275
|
50
|
#endif
|
donatien |
0:0f5a52711275
|
51
|
|
donatien |
0:0f5a52711275
|
52
|
#ifdef __cplusplus
|
donatien |
0:0f5a52711275
|
53
|
extern "C" {
|
donatien |
0:0f5a52711275
|
54
|
#endif
|
donatien |
0:0f5a52711275
|
55
|
|
donatien |
0:0f5a52711275
|
56
|
/* Throughout this file, IP addresses are expected to be in
|
donatien |
0:0f5a52711275
|
57
|
* the same byte order as in IP_PCB. */
|
donatien |
0:0f5a52711275
|
58
|
|
donatien |
3:e02ec42cf9c8
|
59
|
/* must be the maximum of all used hardware address lengths
|
donatien |
0:0f5a52711275
|
60
|
across all types of interfaces in use */
|
donatien |
0:0f5a52711275
|
61
|
#define NETIF_MAX_HWADDR_LEN 6U
|
donatien |
0:0f5a52711275
|
62
|
|
donatien |
3:e02ec42cf9c8
|
63
|
/* Whether the network interface is 'up'. This is
|
donatien |
0:0f5a52711275
|
64
|
* a software flag used to control whether this network
|
donatien |
0:0f5a52711275
|
65
|
* interface is enabled and processes traffic.
|
donatien |
0:0f5a52711275
|
66
|
* It is set by the startup code (for static IP configuration) or
|
donatien |
0:0f5a52711275
|
67
|
* by dhcp/autoip when an address has been assigned.
|
donatien |
0:0f5a52711275
|
68
|
*/
|
donatien |
0:0f5a52711275
|
69
|
#define NETIF_FLAG_UP 0x01U
|
donatien |
3:e02ec42cf9c8
|
70
|
/* If set, the netif has broadcast capability.
|
donatien |
0:0f5a52711275
|
71
|
* Set by the netif driver in its init function. */
|
donatien |
0:0f5a52711275
|
72
|
#define NETIF_FLAG_BROADCAST 0x02U
|
donatien |
3:e02ec42cf9c8
|
73
|
/* If set, the netif is one end of a point-to-point connection.
|
donatien |
0:0f5a52711275
|
74
|
* Set by the netif driver in its init function. */
|
donatien |
0:0f5a52711275
|
75
|
#define NETIF_FLAG_POINTTOPOINT 0x04U
|
donatien |
3:e02ec42cf9c8
|
76
|
/* If set, the interface is configured using DHCP.
|
donatien |
0:0f5a52711275
|
77
|
* Set by the DHCP code when starting or stopping DHCP. */
|
donatien |
0:0f5a52711275
|
78
|
#define NETIF_FLAG_DHCP 0x08U
|
donatien |
3:e02ec42cf9c8
|
79
|
/* If set, the interface has an active link
|
donatien |
0:0f5a52711275
|
80
|
* (set by the network interface driver).
|
donatien |
0:0f5a52711275
|
81
|
* Either set by the netif driver in its init function (if the link
|
donatien |
0:0f5a52711275
|
82
|
* is up at that time) or at a later point once the link comes up
|
donatien |
0:0f5a52711275
|
83
|
* (if link detection is supported by the hardware). */
|
donatien |
0:0f5a52711275
|
84
|
#define NETIF_FLAG_LINK_UP 0x10U
|
donatien |
3:e02ec42cf9c8
|
85
|
/* If set, the netif is an ethernet device using ARP.
|
donatien |
0:0f5a52711275
|
86
|
* Set by the netif driver in its init function.
|
donatien |
0:0f5a52711275
|
87
|
* Used to check input packet types and use of DHCP. */
|
donatien |
0:0f5a52711275
|
88
|
#define NETIF_FLAG_ETHARP 0x20U
|
donatien |
3:e02ec42cf9c8
|
89
|
/* If set, the netif is an ethernet device. It might not use
|
donatien |
0:0f5a52711275
|
90
|
* ARP or TCP/IP if it is used for PPPoE only.
|
donatien |
0:0f5a52711275
|
91
|
*/
|
donatien |
0:0f5a52711275
|
92
|
#define NETIF_FLAG_ETHERNET 0x40U
|
donatien |
3:e02ec42cf9c8
|
93
|
/* If set, the netif has IGMP capability.
|
donatien |
0:0f5a52711275
|
94
|
* Set by the netif driver in its init function. */
|
donatien |
0:0f5a52711275
|
95
|
#define NETIF_FLAG_IGMP 0x80U
|
donatien |
0:0f5a52711275
|
96
|
|
donatien |
3:e02ec42cf9c8
|
97
|
/* Function prototype for netif init functions. Set up flags and output/linkoutput
|
donatien |
0:0f5a52711275
|
98
|
* callback functions in this function.
|
donatien |
0:0f5a52711275
|
99
|
*
|
donatien |
0:0f5a52711275
|
100
|
* @param netif The netif to initialize
|
donatien |
0:0f5a52711275
|
101
|
*/
|
donatien |
0:0f5a52711275
|
102
|
typedef err_t (*netif_init_fn)(struct netif *netif);
|
donatien |
3:e02ec42cf9c8
|
103
|
/* Function prototype for netif->input functions. This function is saved as 'input'
|
donatien |
0:0f5a52711275
|
104
|
* callback function in the netif struct. Call it when a packet has been received.
|
donatien |
0:0f5a52711275
|
105
|
*
|
donatien |
0:0f5a52711275
|
106
|
* @param p The received packet, copied into a pbuf
|
donatien |
0:0f5a52711275
|
107
|
* @param inp The netif which received the packet
|
donatien |
0:0f5a52711275
|
108
|
*/
|
donatien |
0:0f5a52711275
|
109
|
typedef err_t (*netif_input_fn)(struct pbuf *p, struct netif *inp);
|
donatien |
3:e02ec42cf9c8
|
110
|
/* Function prototype for netif->output functions. Called by lwIP when a packet
|
donatien |
0:0f5a52711275
|
111
|
* shall be sent. For ethernet netif, set this to 'etharp_output' and set
|
donatien |
0:0f5a52711275
|
112
|
* 'linkoutput'.
|
donatien |
0:0f5a52711275
|
113
|
*
|
donatien |
0:0f5a52711275
|
114
|
* @param netif The netif which shall send a packet
|
donatien |
0:0f5a52711275
|
115
|
* @param p The packet to send (p->payload points to IP header)
|
donatien |
0:0f5a52711275
|
116
|
* @param ipaddr The IP address to which the packet shall be sent
|
donatien |
0:0f5a52711275
|
117
|
*/
|
donatien |
0:0f5a52711275
|
118
|
typedef err_t (*netif_output_fn)(struct netif *netif, struct pbuf *p,
|
donatien |
0:0f5a52711275
|
119
|
ip_addr_t *ipaddr);
|
donatien |
3:e02ec42cf9c8
|
120
|
/* Function prototype for netif->linkoutput functions. Only used for ethernet
|
donatien |
0:0f5a52711275
|
121
|
* netifs. This function is called by ARP when a packet shall be sent.
|
donatien |
0:0f5a52711275
|
122
|
*
|
donatien |
0:0f5a52711275
|
123
|
* @param netif The netif which shall send a packet
|
donatien |
0:0f5a52711275
|
124
|
* @param p The packet to send (raw ethernet packet)
|
donatien |
0:0f5a52711275
|
125
|
*/
|
donatien |
0:0f5a52711275
|
126
|
typedef err_t (*netif_linkoutput_fn)(struct netif *netif, struct pbuf *p);
|
donatien |
3:e02ec42cf9c8
|
127
|
/* Function prototype for netif status- or link-callback functions. */
|
donatien |
0:0f5a52711275
|
128
|
typedef void (*netif_status_callback_fn)(struct netif *netif);
|
donatien |
3:e02ec42cf9c8
|
129
|
/* Function prototype for netif igmp_mac_filter functions */
|
donatien |
0:0f5a52711275
|
130
|
typedef err_t (*netif_igmp_mac_filter_fn)(struct netif *netif,
|
donatien |
0:0f5a52711275
|
131
|
ip_addr_t *group, u8_t action);
|
donatien |
0:0f5a52711275
|
132
|
|
donatien |
3:e02ec42cf9c8
|
133
|
/* Generic data structure used for all lwIP network interfaces.
|
donatien |
0:0f5a52711275
|
134
|
* The following fields should be filled in by the initialization
|
donatien |
0:0f5a52711275
|
135
|
* function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
|
donatien |
0:0f5a52711275
|
136
|
struct netif {
|
donatien |
3:e02ec42cf9c8
|
137
|
/* pointer to next in linked list */
|
donatien |
0:0f5a52711275
|
138
|
struct netif *next;
|
donatien |
0:0f5a52711275
|
139
|
|
donatien |
3:e02ec42cf9c8
|
140
|
/* IP address configuration in network byte order */
|
donatien |
0:0f5a52711275
|
141
|
ip_addr_t ip_addr;
|
donatien |
0:0f5a52711275
|
142
|
ip_addr_t netmask;
|
donatien |
0:0f5a52711275
|
143
|
ip_addr_t gw;
|
donatien |
0:0f5a52711275
|
144
|
|
donatien |
3:e02ec42cf9c8
|
145
|
/* This function is called by the network device driver
|
donatien |
0:0f5a52711275
|
146
|
* to pass a packet up the TCP/IP stack. */
|
donatien |
0:0f5a52711275
|
147
|
netif_input_fn input;
|
donatien |
3:e02ec42cf9c8
|
148
|
/* This function is called by the IP module when it wants
|
donatien |
0:0f5a52711275
|
149
|
* to send a packet on the interface. This function typically
|
donatien |
0:0f5a52711275
|
150
|
* first resolves the hardware address, then sends the packet. */
|
donatien |
0:0f5a52711275
|
151
|
netif_output_fn output;
|
donatien |
3:e02ec42cf9c8
|
152
|
/* This function is called by the ARP module when it wants
|
donatien |
0:0f5a52711275
|
153
|
* to send a packet on the interface. This function outputs
|
donatien |
0:0f5a52711275
|
154
|
* the pbuf as-is on the link medium. */
|
donatien |
0:0f5a52711275
|
155
|
netif_linkoutput_fn linkoutput;
|
donatien |
0:0f5a52711275
|
156
|
#if LWIP_NETIF_STATUS_CALLBACK
|
donatien |
3:e02ec42cf9c8
|
157
|
/* This function is called when the netif state is set to up or down
|
donatien |
0:0f5a52711275
|
158
|
*/
|
donatien |
0:0f5a52711275
|
159
|
netif_status_callback_fn status_callback;
|
donatien |
0:0f5a52711275
|
160
|
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
donatien |
0:0f5a52711275
|
161
|
#if LWIP_NETIF_LINK_CALLBACK
|
donatien |
3:e02ec42cf9c8
|
162
|
/* This function is called when the netif link is set to up or down
|
donatien |
0:0f5a52711275
|
163
|
*/
|
donatien |
0:0f5a52711275
|
164
|
netif_status_callback_fn link_callback;
|
donatien |
0:0f5a52711275
|
165
|
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
donatien |
3:e02ec42cf9c8
|
166
|
/* This field can be set by the device driver and could point
|
donatien |
0:0f5a52711275
|
167
|
* to state information for the device. */
|
donatien |
0:0f5a52711275
|
168
|
void *state;
|
donatien |
0:0f5a52711275
|
169
|
#if LWIP_DHCP
|
donatien |
3:e02ec42cf9c8
|
170
|
/* the DHCP client state information for this netif */
|
donatien |
0:0f5a52711275
|
171
|
struct dhcp *dhcp;
|
donatien |
0:0f5a52711275
|
172
|
#endif /* LWIP_DHCP */
|
donatien |
0:0f5a52711275
|
173
|
#if LWIP_AUTOIP
|
donatien |
3:e02ec42cf9c8
|
174
|
/* the AutoIP client state information for this netif */
|
donatien |
0:0f5a52711275
|
175
|
struct autoip *autoip;
|
donatien |
0:0f5a52711275
|
176
|
#endif
|
donatien |
0:0f5a52711275
|
177
|
#if LWIP_NETIF_HOSTNAME
|
donatien |
0:0f5a52711275
|
178
|
/* the hostname for this netif, NULL is a valid value */
|
donatien |
0:0f5a52711275
|
179
|
char* hostname;
|
donatien |
0:0f5a52711275
|
180
|
#endif /* LWIP_NETIF_HOSTNAME */
|
donatien |
3:e02ec42cf9c8
|
181
|
/* maximum transfer unit (in bytes) */
|
donatien |
0:0f5a52711275
|
182
|
u16_t mtu;
|
donatien |
3:e02ec42cf9c8
|
183
|
/* number of bytes used in hwaddr */
|
donatien |
0:0f5a52711275
|
184
|
u8_t hwaddr_len;
|
donatien |
3:e02ec42cf9c8
|
185
|
/* link level hardware address of this interface */
|
donatien |
0:0f5a52711275
|
186
|
u8_t hwaddr[NETIF_MAX_HWADDR_LEN];
|
donatien |
3:e02ec42cf9c8
|
187
|
/* flags (see NETIF_FLAG_ above) */
|
donatien |
0:0f5a52711275
|
188
|
u8_t flags;
|
donatien |
3:e02ec42cf9c8
|
189
|
/* descriptive abbreviation */
|
donatien |
0:0f5a52711275
|
190
|
char name[2];
|
donatien |
3:e02ec42cf9c8
|
191
|
/* number of this interface */
|
donatien |
0:0f5a52711275
|
192
|
u8_t num;
|
donatien |
0:0f5a52711275
|
193
|
#if LWIP_SNMP
|
donatien |
3:e02ec42cf9c8
|
194
|
/* link type (from "snmp_ifType" enum from snmp.h) */
|
donatien |
0:0f5a52711275
|
195
|
u8_t link_type;
|
donatien |
3:e02ec42cf9c8
|
196
|
/* (estimate) link speed */
|
donatien |
0:0f5a52711275
|
197
|
u32_t link_speed;
|
donatien |
3:e02ec42cf9c8
|
198
|
/* timestamp at last change made (up/down) */
|
donatien |
0:0f5a52711275
|
199
|
u32_t ts;
|
donatien |
3:e02ec42cf9c8
|
200
|
/* counters */
|
donatien |
0:0f5a52711275
|
201
|
u32_t ifinoctets;
|
donatien |
0:0f5a52711275
|
202
|
u32_t ifinucastpkts;
|
donatien |
0:0f5a52711275
|
203
|
u32_t ifinnucastpkts;
|
donatien |
0:0f5a52711275
|
204
|
u32_t ifindiscards;
|
donatien |
0:0f5a52711275
|
205
|
u32_t ifoutoctets;
|
donatien |
0:0f5a52711275
|
206
|
u32_t ifoutucastpkts;
|
donatien |
0:0f5a52711275
|
207
|
u32_t ifoutnucastpkts;
|
donatien |
0:0f5a52711275
|
208
|
u32_t ifoutdiscards;
|
donatien |
0:0f5a52711275
|
209
|
#endif /* LWIP_SNMP */
|
donatien |
0:0f5a52711275
|
210
|
#if LWIP_IGMP
|
donatien |
3:e02ec42cf9c8
|
211
|
/* This function could be called to add or delete a entry in the multicast
|
donatien |
0:0f5a52711275
|
212
|
filter table of the ethernet MAC.*/
|
donatien |
0:0f5a52711275
|
213
|
netif_igmp_mac_filter_fn igmp_mac_filter;
|
donatien |
0:0f5a52711275
|
214
|
#endif /* LWIP_IGMP */
|
donatien |
0:0f5a52711275
|
215
|
#if LWIP_NETIF_HWADDRHINT
|
donatien |
0:0f5a52711275
|
216
|
u8_t *addr_hint;
|
donatien |
0:0f5a52711275
|
217
|
#endif /* LWIP_NETIF_HWADDRHINT */
|
donatien |
0:0f5a52711275
|
218
|
#if ENABLE_LOOPBACK
|
donatien |
0:0f5a52711275
|
219
|
/* List of packets to be queued for ourselves. */
|
donatien |
0:0f5a52711275
|
220
|
struct pbuf *loop_first;
|
donatien |
0:0f5a52711275
|
221
|
struct pbuf *loop_last;
|
donatien |
0:0f5a52711275
|
222
|
#if LWIP_LOOPBACK_MAX_PBUFS
|
donatien |
0:0f5a52711275
|
223
|
u16_t loop_cnt_current;
|
donatien |
0:0f5a52711275
|
224
|
#endif /* LWIP_LOOPBACK_MAX_PBUFS */
|
donatien |
0:0f5a52711275
|
225
|
#endif /* ENABLE_LOOPBACK */
|
donatien |
0:0f5a52711275
|
226
|
};
|
donatien |
0:0f5a52711275
|
227
|
|
donatien |
0:0f5a52711275
|
228
|
#if LWIP_SNMP
|
donatien |
0:0f5a52711275
|
229
|
#define NETIF_INIT_SNMP(netif, type, speed) \
|
donatien |
0:0f5a52711275
|
230
|
/* use "snmp_ifType" enum from snmp.h for "type", snmp_ifType_ethernet_csmacd by example */ \
|
donatien |
0:0f5a52711275
|
231
|
(netif)->link_type = (type); \
|
donatien |
0:0f5a52711275
|
232
|
/* your link speed here (units: bits per second) */ \
|
donatien |
0:0f5a52711275
|
233
|
(netif)->link_speed = (speed); \
|
donatien |
0:0f5a52711275
|
234
|
(netif)->ts = 0; \
|
donatien |
0:0f5a52711275
|
235
|
(netif)->ifinoctets = 0; \
|
donatien |
0:0f5a52711275
|
236
|
(netif)->ifinucastpkts = 0; \
|
donatien |
0:0f5a52711275
|
237
|
(netif)->ifinnucastpkts = 0; \
|
donatien |
0:0f5a52711275
|
238
|
(netif)->ifindiscards = 0; \
|
donatien |
0:0f5a52711275
|
239
|
(netif)->ifoutoctets = 0; \
|
donatien |
0:0f5a52711275
|
240
|
(netif)->ifoutucastpkts = 0; \
|
donatien |
0:0f5a52711275
|
241
|
(netif)->ifoutnucastpkts = 0; \
|
donatien |
0:0f5a52711275
|
242
|
(netif)->ifoutdiscards = 0
|
donatien |
0:0f5a52711275
|
243
|
#else /* LWIP_SNMP */
|
donatien |
0:0f5a52711275
|
244
|
#define NETIF_INIT_SNMP(netif, type, speed)
|
donatien |
0:0f5a52711275
|
245
|
#endif /* LWIP_SNMP */
|
donatien |
0:0f5a52711275
|
246
|
|
donatien |
0:0f5a52711275
|
247
|
|
donatien |
3:e02ec42cf9c8
|
248
|
/* The list of network interfaces. */
|
donatien |
0:0f5a52711275
|
249
|
extern struct netif *netif_list;
|
donatien |
3:e02ec42cf9c8
|
250
|
/* The default network interface. */
|
donatien |
0:0f5a52711275
|
251
|
extern struct netif *netif_default;
|
donatien |
0:0f5a52711275
|
252
|
|
donatien |
0:0f5a52711275
|
253
|
void netif_init(void);
|
donatien |
0:0f5a52711275
|
254
|
|
donatien |
0:0f5a52711275
|
255
|
struct netif *netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
|
donatien |
0:0f5a52711275
|
256
|
ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input);
|
donatien |
0:0f5a52711275
|
257
|
|
donatien |
0:0f5a52711275
|
258
|
void
|
donatien |
0:0f5a52711275
|
259
|
netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
|
donatien |
0:0f5a52711275
|
260
|
ip_addr_t *gw);
|
donatien |
0:0f5a52711275
|
261
|
void netif_remove(struct netif * netif);
|
donatien |
0:0f5a52711275
|
262
|
|
donatien |
0:0f5a52711275
|
263
|
/* Returns a network interface given its name. The name is of the form
|
donatien |
0:0f5a52711275
|
264
|
"et0", where the first two letters are the "name" field in the
|
donatien |
0:0f5a52711275
|
265
|
netif structure, and the digit is in the num field in the same
|
donatien |
0:0f5a52711275
|
266
|
structure. */
|
donatien |
0:0f5a52711275
|
267
|
struct netif *netif_find(char *name);
|
donatien |
0:0f5a52711275
|
268
|
|
donatien |
0:0f5a52711275
|
269
|
void netif_set_default(struct netif *netif);
|
donatien |
0:0f5a52711275
|
270
|
|
donatien |
0:0f5a52711275
|
271
|
void netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr);
|
donatien |
0:0f5a52711275
|
272
|
void netif_set_netmask(struct netif *netif, ip_addr_t *netmask);
|
donatien |
0:0f5a52711275
|
273
|
void netif_set_gw(struct netif *netif, ip_addr_t *gw);
|
donatien |
0:0f5a52711275
|
274
|
|
donatien |
0:0f5a52711275
|
275
|
void netif_set_up(struct netif *netif);
|
donatien |
0:0f5a52711275
|
276
|
void netif_set_down(struct netif *netif);
|
donatien |
3:e02ec42cf9c8
|
277
|
/* Ask if an interface is up */
|
donatien |
0:0f5a52711275
|
278
|
#define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
|
donatien |
0:0f5a52711275
|
279
|
|
donatien |
0:0f5a52711275
|
280
|
#if LWIP_NETIF_STATUS_CALLBACK
|
donatien |
0:0f5a52711275
|
281
|
void netif_set_status_callback(struct netif *netif, netif_status_callback_fn status_callback);
|
donatien |
0:0f5a52711275
|
282
|
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
donatien |
0:0f5a52711275
|
283
|
|
donatien |
0:0f5a52711275
|
284
|
void netif_set_link_up(struct netif *netif);
|
donatien |
0:0f5a52711275
|
285
|
void netif_set_link_down(struct netif *netif);
|
donatien |
3:e02ec42cf9c8
|
286
|
/* Ask if a link is up */
|
donatien |
0:0f5a52711275
|
287
|
#define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
|
donatien |
0:0f5a52711275
|
288
|
|
donatien |
0:0f5a52711275
|
289
|
#if LWIP_NETIF_LINK_CALLBACK
|
donatien |
0:0f5a52711275
|
290
|
void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callback);
|
donatien |
0:0f5a52711275
|
291
|
#endif /* LWIP_NETIF_LINK_CALLBACK */
|
donatien |
0:0f5a52711275
|
292
|
|
donatien |
0:0f5a52711275
|
293
|
#if LWIP_NETIF_HOSTNAME
|
donatien |
0:0f5a52711275
|
294
|
#define netif_set_hostname(netif, name) do { if((netif) != NULL) { (netif)->hostname = name; }}while(0)
|
donatien |
0:0f5a52711275
|
295
|
#define netif_get_hostname(netif) (((netif) != NULL) ? ((netif)->hostname) : NULL)
|
donatien |
0:0f5a52711275
|
296
|
#endif /* LWIP_NETIF_HOSTNAME */
|
donatien |
0:0f5a52711275
|
297
|
|
donatien |
0:0f5a52711275
|
298
|
#if LWIP_IGMP
|
donatien |
0:0f5a52711275
|
299
|
#define netif_set_igmp_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->igmp_mac_filter = function; }}while(0)
|
donatien |
0:0f5a52711275
|
300
|
#define netif_get_igmp_mac_filter(netif) (((netif) != NULL) ? ((netif)->igmp_mac_filter) : NULL)
|
donatien |
0:0f5a52711275
|
301
|
#endif /* LWIP_IGMP */
|
donatien |
0:0f5a52711275
|
302
|
|
donatien |
0:0f5a52711275
|
303
|
#if ENABLE_LOOPBACK
|
donatien |
0:0f5a52711275
|
304
|
err_t netif_loop_output(struct netif *netif, struct pbuf *p, ip_addr_t *dest_ip);
|
donatien |
0:0f5a52711275
|
305
|
void netif_poll(struct netif *netif);
|
donatien |
0:0f5a52711275
|
306
|
#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
|
donatien |
0:0f5a52711275
|
307
|
void netif_poll_all(void);
|
donatien |
0:0f5a52711275
|
308
|
#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
|
donatien |
0:0f5a52711275
|
309
|
#endif /* ENABLE_LOOPBACK */
|
donatien |
0:0f5a52711275
|
310
|
|
donatien |
0:0f5a52711275
|
311
|
#ifdef __cplusplus
|
donatien |
0:0f5a52711275
|
312
|
}
|
donatien |
0:0f5a52711275
|
313
|
#endif
|
donatien |
0:0f5a52711275
|
314
|
|
donatien |
0:0f5a52711275
|
315
|
#endif /* __LWIP_NETIF_H__ */
|