ID the MBED processor on the network if you have more than one. View MBED name on DHCP of your Router - Example \"MBED PE\" Change your ID in Core / host.h

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 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 /* !LWIP_TCPIP_CORE_LOCKING */
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 /* API for application */
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 /* LWIP_NETIF_API */
00107 
00108 #endif /* __LWIP_NETIFAPI_H__ */