Dependents:   SNMPAgent HTTPServer think_speak_a cyassl-client ... more

Committer:
mamezu
Date:
Thu Dec 09 01:33:56 2010 +0000
Revision:
0:0f6c82fcde82

        

Who changed what in which revision?

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