Onenet

Dependents:   K64F_eCompass_OneNET_JW

Committer:
robert_jw
Date:
Mon Jun 20 01:40:20 2016 +0000
Revision:
0:b2805b6888dc
ADS

Who changed what in which revision?

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