hattori&ide

Dependencies:   mbed

Committer:
hattori_atsushi
Date:
Sun Dec 18 08:16:01 2022 +0000
Revision:
0:f77369cabd75
hattori

Who changed what in which revision?

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