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