LwIP with PPP & Ethernet integration

Dependents:   NetworkingCoreLib

This is the mbed port of the LwIP stack: http://savannah.nongnu.org/projects/lwip/

It includes contributed content from NXP's port for LPCxxxx devices: http://www.lpcware.com/content/project/lightweight-ip-lwip-networking-stack

Licence

LwIP is licenced under the BSD licence:

Copyright (c) 2001-2004 Swedish Institute of Computer Science. 
All rights reserved. 
Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met: 
1. Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer. 
2. Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation 
and/or other materials provided with the distribution. 
3. The name of the author may not be used to endorse or promote products 
derived from this software without specific prior written permission. 
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.
Committer:
donatien
Date:
Thu May 24 15:53:48 2012 +0000
Revision:
0:8e01dca41002
Merge with Emilio's LwIp

Who changed what in which revision?

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