A version of LWIP, provided for backwards compatibility.
Dependents: AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more
trunk/Core/lwIP/include/lwip/netifapi.h@0:5e1631496985, 2012-05-08 (annotated)
- Committer:
- root@mbed.org
- Date:
- Tue May 08 15:32:10 2012 +0100
- Revision:
- 0:5e1631496985
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
root@mbed.org | 0:5e1631496985 | 1 | /* |
root@mbed.org | 0:5e1631496985 | 2 | * Redistribution and use in source and binary forms, with or without modification, |
root@mbed.org | 0:5e1631496985 | 3 | * are permitted provided that the following conditions are met: |
root@mbed.org | 0:5e1631496985 | 4 | * |
root@mbed.org | 0:5e1631496985 | 5 | * 1. Redistributions of source code must retain the above copyright notice, |
root@mbed.org | 0:5e1631496985 | 6 | * this list of conditions and the following disclaimer. |
root@mbed.org | 0:5e1631496985 | 7 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
root@mbed.org | 0:5e1631496985 | 8 | * this list of conditions and the following disclaimer in the documentation |
root@mbed.org | 0:5e1631496985 | 9 | * and/or other materials provided with the distribution. |
root@mbed.org | 0:5e1631496985 | 10 | * 3. The name of the author may not be used to endorse or promote products |
root@mbed.org | 0:5e1631496985 | 11 | * derived from this software without specific prior written permission. |
root@mbed.org | 0:5e1631496985 | 12 | * |
root@mbed.org | 0:5e1631496985 | 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
root@mbed.org | 0:5e1631496985 | 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
root@mbed.org | 0:5e1631496985 | 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
root@mbed.org | 0:5e1631496985 | 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
root@mbed.org | 0:5e1631496985 | 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
root@mbed.org | 0:5e1631496985 | 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
root@mbed.org | 0:5e1631496985 | 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
root@mbed.org | 0:5e1631496985 | 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
root@mbed.org | 0:5e1631496985 | 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
root@mbed.org | 0:5e1631496985 | 22 | * OF SUCH DAMAGE. |
root@mbed.org | 0:5e1631496985 | 23 | * |
root@mbed.org | 0:5e1631496985 | 24 | * This file is part of the lwIP TCP/IP stack. |
root@mbed.org | 0:5e1631496985 | 25 | * |
root@mbed.org | 0:5e1631496985 | 26 | */ |
root@mbed.org | 0:5e1631496985 | 27 | |
root@mbed.org | 0:5e1631496985 | 28 | #ifndef __LWIP_NETIFAPI_H__ |
root@mbed.org | 0:5e1631496985 | 29 | #define __LWIP_NETIFAPI_H__ |
root@mbed.org | 0:5e1631496985 | 30 | |
root@mbed.org | 0:5e1631496985 | 31 | #include "lwip/opt.h" |
root@mbed.org | 0:5e1631496985 | 32 | |
root@mbed.org | 0:5e1631496985 | 33 | #if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */ |
root@mbed.org | 0:5e1631496985 | 34 | |
root@mbed.org | 0:5e1631496985 | 35 | #include "lwip/sys.h" |
root@mbed.org | 0:5e1631496985 | 36 | #include "lwip/netif.h" |
root@mbed.org | 0:5e1631496985 | 37 | #include "lwip/dhcp.h" |
root@mbed.org | 0:5e1631496985 | 38 | #include "lwip/autoip.h" |
root@mbed.org | 0:5e1631496985 | 39 | |
root@mbed.org | 0:5e1631496985 | 40 | #ifdef __cplusplus |
root@mbed.org | 0:5e1631496985 | 41 | extern "C" { |
root@mbed.org | 0:5e1631496985 | 42 | #endif |
root@mbed.org | 0:5e1631496985 | 43 | |
root@mbed.org | 0:5e1631496985 | 44 | struct netifapi_msg_msg { |
root@mbed.org | 0:5e1631496985 | 45 | #if !LWIP_TCPIP_CORE_LOCKING |
root@mbed.org | 0:5e1631496985 | 46 | sys_sem_t sem; |
root@mbed.org | 0:5e1631496985 | 47 | #endif /* !LWIP_TCPIP_CORE_LOCKING */ |
root@mbed.org | 0:5e1631496985 | 48 | err_t err; |
root@mbed.org | 0:5e1631496985 | 49 | struct netif *netif; |
root@mbed.org | 0:5e1631496985 | 50 | union { |
root@mbed.org | 0:5e1631496985 | 51 | struct { |
root@mbed.org | 0:5e1631496985 | 52 | struct ip_addr *ipaddr; |
root@mbed.org | 0:5e1631496985 | 53 | struct ip_addr *netmask; |
root@mbed.org | 0:5e1631496985 | 54 | struct ip_addr *gw; |
root@mbed.org | 0:5e1631496985 | 55 | void *state; |
root@mbed.org | 0:5e1631496985 | 56 | err_t (* init) (struct netif *netif); |
root@mbed.org | 0:5e1631496985 | 57 | err_t (* input)(struct pbuf *p, struct netif *netif); |
root@mbed.org | 0:5e1631496985 | 58 | } add; |
root@mbed.org | 0:5e1631496985 | 59 | struct { |
root@mbed.org | 0:5e1631496985 | 60 | void (* voidfunc)(struct netif *netif); |
root@mbed.org | 0:5e1631496985 | 61 | err_t (* errtfunc)(struct netif *netif); |
root@mbed.org | 0:5e1631496985 | 62 | } common; |
root@mbed.org | 0:5e1631496985 | 63 | } msg; |
root@mbed.org | 0:5e1631496985 | 64 | }; |
root@mbed.org | 0:5e1631496985 | 65 | |
root@mbed.org | 0:5e1631496985 | 66 | struct netifapi_msg { |
root@mbed.org | 0:5e1631496985 | 67 | void (* function)(struct netifapi_msg_msg *msg); |
root@mbed.org | 0:5e1631496985 | 68 | struct netifapi_msg_msg msg; |
root@mbed.org | 0:5e1631496985 | 69 | }; |
root@mbed.org | 0:5e1631496985 | 70 | |
root@mbed.org | 0:5e1631496985 | 71 | |
root@mbed.org | 0:5e1631496985 | 72 | /* API for application */ |
root@mbed.org | 0:5e1631496985 | 73 | err_t netifapi_netif_add ( struct netif *netif, |
root@mbed.org | 0:5e1631496985 | 74 | struct ip_addr *ipaddr, |
root@mbed.org | 0:5e1631496985 | 75 | struct ip_addr *netmask, |
root@mbed.org | 0:5e1631496985 | 76 | struct ip_addr *gw, |
root@mbed.org | 0:5e1631496985 | 77 | void *state, |
root@mbed.org | 0:5e1631496985 | 78 | err_t (* init)(struct netif *netif), |
root@mbed.org | 0:5e1631496985 | 79 | err_t (* input)(struct pbuf *p, struct netif *netif) ); |
root@mbed.org | 0:5e1631496985 | 80 | |
root@mbed.org | 0:5e1631496985 | 81 | err_t netifapi_netif_set_addr ( struct netif *netif, |
root@mbed.org | 0:5e1631496985 | 82 | struct ip_addr *ipaddr, |
root@mbed.org | 0:5e1631496985 | 83 | struct ip_addr *netmask, |
root@mbed.org | 0:5e1631496985 | 84 | struct ip_addr *gw ); |
root@mbed.org | 0:5e1631496985 | 85 | |
root@mbed.org | 0:5e1631496985 | 86 | err_t netifapi_netif_common ( struct netif *netif, |
root@mbed.org | 0:5e1631496985 | 87 | void (* voidfunc)(struct netif *netif), |
root@mbed.org | 0:5e1631496985 | 88 | err_t (* errtfunc)(struct netif *netif) ); |
root@mbed.org | 0:5e1631496985 | 89 | |
root@mbed.org | 0:5e1631496985 | 90 | #define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL) |
root@mbed.org | 0:5e1631496985 | 91 | #define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL) |
root@mbed.org | 0:5e1631496985 | 92 | #define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL) |
root@mbed.org | 0:5e1631496985 | 93 | #define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL) |
root@mbed.org | 0:5e1631496985 | 94 | #define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start) |
root@mbed.org | 0:5e1631496985 | 95 | #define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL) |
root@mbed.org | 0:5e1631496985 | 96 | #define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start) |
root@mbed.org | 0:5e1631496985 | 97 | #define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop) |
root@mbed.org | 0:5e1631496985 | 98 | |
root@mbed.org | 0:5e1631496985 | 99 | #ifdef __cplusplus |
root@mbed.org | 0:5e1631496985 | 100 | } |
root@mbed.org | 0:5e1631496985 | 101 | #endif |
root@mbed.org | 0:5e1631496985 | 102 | |
root@mbed.org | 0:5e1631496985 | 103 | #endif /* LWIP_NETIF_API */ |
root@mbed.org | 0:5e1631496985 | 104 | |
root@mbed.org | 0:5e1631496985 | 105 | #endif /* __LWIP_NETIFAPI_H__ */ |