Committer:
mbed714
Date:
Sat Sep 18 23:05:49 2010 +0000
Revision:
0:d616ece2d859

        

Who changed what in which revision?

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