Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/lwip/netifapi.h need to be fixed.

0001 /*
0002  * Redistribution and use in source and binary forms, with or without modification, 
0003  * are permitted provided that the following conditions are met:
0004  *
0005  * 1. Redistributions of source code must retain the above copyright notice,
0006  *    this list of conditions and the following disclaimer.
0007  * 2. Redistributions in binary form must reproduce the above copyright notice,
0008  *    this list of conditions and the following disclaimer in the documentation
0009  *    and/or other materials provided with the distribution.
0010  * 3. The name of the author may not be used to endorse or promote products
0011  *    derived from this software without specific prior written permission. 
0012  *
0013  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
0014  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
0015  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
0016  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
0017  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
0018  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
0019  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
0020  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
0021  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
0022  * OF SUCH DAMAGE.
0023  *
0024  * This file is part of the lwIP TCP/IP stack.
0025  * 
0026  */
0027  
0028 #ifndef __LWIP_NETIFAPI_H__
0029 #define __LWIP_NETIFAPI_H__
0030 
0031 #include "lwip/opt.h"
0032 
0033 #if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
0034 
0035 #include "lwip/sys.h"
0036 #include "lwip/netif.h"
0037 #include "lwip/dhcp.h"
0038 #include "lwip/autoip.h"
0039 
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043 
0044 struct netifapi_msg_msg {
0045 #if !LWIP_TCPIP_CORE_LOCKING
0046   sys_sem_t sem;
0047 #endif /* !LWIP_TCPIP_CORE_LOCKING */
0048   err_t err;
0049   struct netif *netif;
0050   union {
0051     struct {
0052       struct ip_addr *ipaddr;
0053       struct ip_addr *netmask;
0054       struct ip_addr *gw;
0055       void *state;
0056       err_t (* init) (struct netif *netif);
0057       err_t (* input)(struct pbuf *p, struct netif *netif);
0058     } add;
0059     struct {
0060       void  (* voidfunc)(struct netif *netif);
0061       err_t (* errtfunc)(struct netif *netif);
0062     } common;
0063   } msg;
0064 };
0065 
0066 struct netifapi_msg {
0067   void (* function)(struct netifapi_msg_msg *msg);
0068   struct netifapi_msg_msg msg;
0069 };
0070 
0071 
0072 /* API for application */
0073 err_t netifapi_netif_add       ( struct netif *netif,
0074                                  struct ip_addr *ipaddr,
0075                                  struct ip_addr *netmask,
0076                                  struct ip_addr *gw,
0077                                  void *state,
0078                                  err_t (* init)(struct netif *netif),
0079                                  err_t (* input)(struct pbuf *p, struct netif *netif) );
0080 
0081 err_t netifapi_netif_set_addr  ( struct netif *netif,
0082                                  struct ip_addr *ipaddr,
0083                                  struct ip_addr *netmask,
0084                                  struct ip_addr *gw );
0085 
0086 err_t netifapi_netif_common    ( struct netif *netif,
0087                                  void  (* voidfunc)(struct netif *netif),
0088                                  err_t (* errtfunc)(struct netif *netif) );
0089 
0090 #define netifapi_netif_remove(n)      netifapi_netif_common(n, netif_remove, NULL)
0091 #define netifapi_netif_set_up(n)      netifapi_netif_common(n, netif_set_up, NULL)
0092 #define netifapi_netif_set_down(n)    netifapi_netif_common(n, netif_set_down, NULL)
0093 #define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL)
0094 #define netifapi_dhcp_start(n)        netifapi_netif_common(n, NULL, dhcp_start)
0095 #define netifapi_dhcp_stop(n)         netifapi_netif_common(n, dhcp_stop, NULL)
0096 #define netifapi_autoip_start(n)      netifapi_netif_common(n, NULL, autoip_start)
0097 #define netifapi_autoip_stop(n)       netifapi_netif_common(n, NULL, autoip_stop)
0098 
0099 #ifdef __cplusplus
0100 }
0101 #endif
0102 
0103 #endif /* LWIP_NETIF_API */
0104 
0105 #endif /* __LWIP_NETIFAPI_H__ */