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