lpc1768

Committer:
jh1cdv00
Date:
Tue Jan 27 01:38:19 2015 +0000
Revision:
0:f35dada1dac1
lpc1768

Who changed what in which revision?

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