Ethernetwebsoc

Dependencies:   C12832_lcd LM75B WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
GordonSin
Date:
Fri May 31 04:09:54 2013 +0000
Revision:
0:0ed2a7c7190c
31/5/2013;

Who changed what in which revision?

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