00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __LWIP_NETIFAPI_H__
00029 #define __LWIP_NETIFAPI_H__
00030
00031 #include "lwip/opt.h"
00032
00033 #if LWIP_NETIF_API
00034
00035 #include "lwip/sys.h"
00036 #include "lwip/netif.h"
00037 #include "lwip/dhcp.h"
00038 #include "lwip/autoip.h"
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00044 typedef void (*netifapi_void_fn)(struct netif *netif);
00045 typedef err_t (*netifapi_errt_fn)(struct netif *netif);
00046
00047 struct netifapi_msg_msg {
00048 #if !LWIP_TCPIP_CORE_LOCKING
00049 sys_sem_t sem;
00050 #endif
00051 err_t err;
00052 struct netif *netif;
00053 union {
00054 struct {
00055 ip_addr_t *ipaddr;
00056 ip_addr_t *netmask;
00057 ip_addr_t *gw;
00058 void *state;
00059 netif_init_fn init;
00060 netif_input_fn input;
00061 } add;
00062 struct {
00063 netifapi_void_fn voidfunc;
00064 netifapi_errt_fn errtfunc;
00065 } common;
00066 } msg;
00067 };
00068
00069 struct netifapi_msg {
00070 void (* function)(struct netifapi_msg_msg *msg);
00071 struct netifapi_msg_msg msg;
00072 };
00073
00074
00075
00076 err_t netifapi_netif_add ( struct netif *netif,
00077 ip_addr_t *ipaddr,
00078 ip_addr_t *netmask,
00079 ip_addr_t *gw,
00080 void *state,
00081 netif_init_fn init,
00082 netif_input_fn input);
00083
00084 err_t netifapi_netif_set_addr ( struct netif *netif,
00085 ip_addr_t *ipaddr,
00086 ip_addr_t *netmask,
00087 ip_addr_t *gw );
00088
00089 err_t netifapi_netif_common ( struct netif *netif,
00090 netifapi_void_fn voidfunc,
00091 netifapi_errt_fn errtfunc);
00092
00093 #define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL)
00094 #define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL)
00095 #define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL)
00096 #define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL)
00097 #define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start)
00098 #define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL)
00099 #define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start)
00100 #define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop)
00101
00102 #ifdef __cplusplus
00103 }
00104 #endif
00105
00106 #endif
00107
00108 #endif