dev

Dependents:   EthernetInterface

Fork of lwip by mbed official

Committer:
yihui
Date:
Mon Mar 02 08:19:15 2015 +0000
Revision:
19:6c91d95ef874
Parent:
0:51ac1d130fd4
minor changes

Who changed what in which revision?

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