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 struct netifapi_msg_msg {
00045 #if !LWIP_TCPIP_CORE_LOCKING
00046 sys_sem_t sem;
00047 #endif
00048 err_t err;
00049 struct netif *netif;
00050 union {
00051 struct {
00052 struct ip_addr *ipaddr;
00053 struct ip_addr *netmask;
00054 struct ip_addr *gw;
00055 void *state;
00056 err_t (* init) (struct netif *netif);
00057 err_t (* input)(struct pbuf *p, struct netif *netif);
00058 } add;
00059 struct {
00060 void (* voidfunc)(struct netif *netif);
00061 err_t (* errtfunc)(struct netif *netif);
00062 } common;
00063 } msg;
00064 };
00065
00066 struct netifapi_msg {
00067 void (* function)(struct netifapi_msg_msg *msg);
00068 struct netifapi_msg_msg msg;
00069 };
00070
00071
00072
00073 err_t netifapi_netif_add ( struct netif *netif,
00074 struct ip_addr *ipaddr,
00075 struct ip_addr *netmask,
00076 struct ip_addr *gw,
00077 void *state,
00078 err_t (* init)(struct netif *netif),
00079 err_t (* input)(struct pbuf *p, struct netif *netif) );
00080
00081 err_t netifapi_netif_set_addr ( struct netif *netif,
00082 struct ip_addr *ipaddr,
00083 struct ip_addr *netmask,
00084 struct ip_addr *gw );
00085
00086 err_t netifapi_netif_common ( struct netif *netif,
00087 void (* voidfunc)(struct netif *netif),
00088 err_t (* errtfunc)(struct netif *netif) );
00089
00090 #define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL)
00091 #define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL)
00092 #define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL)
00093 #define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL)
00094 #define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start)
00095 #define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL)
00096 #define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start)
00097 #define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop)
00098
00099 #ifdef __cplusplus
00100 }
00101 #endif
00102
00103 #endif
00104
00105 #endif