A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers netifapi.h Source File

netifapi.h

00001 /*
00002  * Redistribution and use in source and binary forms, with or without modification, 
00003  * are permitted provided that the following conditions are met:
00004  *
00005  * 1. Redistributions of source code must retain the above copyright notice,
00006  *    this list of conditions and the following disclaimer.
00007  * 2. Redistributions in binary form must reproduce the above copyright notice,
00008  *    this list of conditions and the following disclaimer in the documentation
00009  *    and/or other materials provided with the distribution.
00010  * 3. The name of the author may not be used to endorse or promote products
00011  *    derived from this software without specific prior written permission. 
00012  *
00013  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
00014  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
00015  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
00016  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00017  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
00018  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00019  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00020  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
00021  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
00022  * OF SUCH DAMAGE.
00023  *
00024  * This file is part of the lwIP TCP/IP stack.
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 /* don't build if not configured for use in lwipopts.h */
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 /* !LWIP_TCPIP_CORE_LOCKING */
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 /* API for application */
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 /* LWIP_NETIF_API */
00104 
00105 #endif /* __LWIP_NETIFAPI_H__ */