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