Dependents:   TimeZoneDemo EthernetJackTestCode MMEx_Challenge ntp_mem ... more

Committer:
segundo
Date:
Tue Nov 09 20:54:15 2010 +0000
Revision:
0:ac1725ba162c

        

Who changed what in which revision?

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