ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

netifapi.c
Go to the documentation of this file.
00001 
00007 /*
00008  * Redistribution and use in source and binary forms, with or without modification, 
00009  * are permitted provided that the following conditions are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright notice,
00012  *    this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright notice,
00014  *    this list of conditions and the following disclaimer in the documentation
00015  *    and/or other materials provided with the distribution.
00016  * 3. The name of the author may not be used to endorse or promote products
00017  *    derived from this software without specific prior written permission. 
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
00020  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
00021  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
00022  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00023  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
00024  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00025  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00026  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
00027  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
00028  * OF SUCH DAMAGE.
00029  *
00030  * This file is part of the lwIP TCP/IP stack.
00031  * 
00032  */
00033 
00034 #include "lwip/opt.h"
00035 
00036 #if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
00037 
00038 #include "lwip/netifapi.h"
00039 #include "lwip/tcpip.h"
00040 
00044 void
00045 do_netifapi_netif_add(struct netifapi_msg_msg *msg)
00046 {
00047   if (!netif_add( msg->netif,
00048                   msg->msg.add.ipaddr,
00049                   msg->msg.add.netmask,
00050                   msg->msg.add.gw,
00051                   msg->msg.add.state,
00052                   msg->msg.add.init,
00053                   msg->msg.add.input)) {
00054     msg->err = ERR_IF;
00055   } else {
00056     msg->err = ERR_OK;
00057   }
00058   TCPIP_NETIFAPI_ACK(msg);
00059 }
00060 
00064 void
00065 do_netifapi_netif_set_addr(struct netifapi_msg_msg *msg)
00066 {
00067   netif_set_addr( msg->netif,
00068                   msg->msg.add.ipaddr,
00069                   msg->msg.add.netmask,
00070                   msg->msg.add.gw);
00071   msg->err = ERR_OK;
00072   TCPIP_NETIFAPI_ACK(msg);
00073 }
00074 
00079 void
00080 do_netifapi_netif_common(struct netifapi_msg_msg *msg)
00081 {
00082   if (msg->msg.common.errtfunc != NULL) {
00083     msg->err = msg->msg.common.errtfunc(msg->netif);
00084   } else {
00085     msg->err = ERR_OK;
00086     msg->msg.common.voidfunc(msg->netif);
00087   }
00088   TCPIP_NETIFAPI_ACK(msg);
00089 }
00090 
00097 err_t
00098 netifapi_netif_add(struct netif *netif,
00099                    ip_addr_t *ipaddr,
00100                    ip_addr_t *netmask,
00101                    ip_addr_t *gw,
00102                    void *state,
00103                    netif_init_fn init,
00104                    netif_input_fn input)
00105 {
00106   struct netifapi_msg msg;
00107   msg.function = do_netifapi_netif_add;
00108   msg.msg.netif = netif;
00109   msg.msg.msg.add.ipaddr  = ipaddr;
00110   msg.msg.msg.add.netmask = netmask;
00111   msg.msg.msg.add.gw      = gw;
00112   msg.msg.msg.add.state   = state;
00113   msg.msg.msg.add.init    = init;
00114   msg.msg.msg.add.input   = input;
00115   TCPIP_NETIFAPI(&msg);
00116   return msg.msg.err;
00117 }
00118 
00125 err_t
00126 netifapi_netif_set_addr(struct netif *netif,
00127                         ip_addr_t *ipaddr,
00128                         ip_addr_t *netmask,
00129                         ip_addr_t *gw)
00130 {
00131   struct netifapi_msg msg;
00132   msg.function = do_netifapi_netif_set_addr;
00133   msg.msg.netif = netif;
00134   msg.msg.msg.add.ipaddr  = ipaddr;
00135   msg.msg.msg.add.netmask = netmask;
00136   msg.msg.msg.add.gw      = gw;
00137   TCPIP_NETIFAPI(&msg);
00138   return msg.msg.err;
00139 }
00140 
00147 err_t
00148 netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc,
00149                        netifapi_errt_fn errtfunc)
00150 {
00151   struct netifapi_msg msg;
00152   msg.function = do_netifapi_netif_common;
00153   msg.msg.netif = netif;
00154   msg.msg.msg.common.voidfunc = voidfunc;
00155   msg.msg.msg.common.errtfunc = errtfunc;
00156   TCPIP_NETIFAPI(&msg);
00157   return msg.msg.err;
00158 }
00159 
00160 #endif /* LWIP_NETIF_API */

Generated on Sun May 27 2012 04:36:00 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.