Version of http://mbed.org/cookbook/NetServicesTribute with setting set the same for LPC2368

Dependents:   UDPSocketExample 24LCxx_I2CApp WeatherPlatform_pachube HvZServerLib ... more

Committer:
simon
Date:
Tue Nov 23 14:15:36 2010 +0000
Revision:
0:350011bf8be7
Experimental version for testing UDP

Who changed what in which revision?

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