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