Dependents:   RTnoV3 RTnoV3_LED RTnoV3_Template RTnoV3_ADC ... more

Committer:
sherckuith
Date:
Sat Dec 31 11:25:27 2011 +0000
Revision:
0:479ce5546098
Ethernet

Who changed what in which revision?

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