http://mbed.org/users/okini3939/notebook/logger/

Dependencies:   mbed

Committer:
okini3939
Date:
Sat Apr 16 15:15:48 2011 +0000
Revision:
0:a3c892f39cc1

        

Who changed what in which revision?

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