dhcp4_nic.h

00001 /* @file dhcp4_nic.h
00002  *
00003  * Network Interface Configurator for the ISC DHCP IPv4 client library API.
00004  *
00005  */
00006 /*
00007  * Copyright (C) 2006  Red Hat, Inc. All rights reserved.
00008  *
00009  * This copyrighted material is made available to anyone wishing to use,
00010  * modify, copy, or redistribute it subject to the terms and conditions of
00011  * the GNU General Public License v.2.  This program is distributed in the
00012  * hope that it will be useful, but WITHOUT ANY WARRANTY expressed or
00013  * implied, including the implied warranties of MERCHANTABILITY or FITNESS
00014  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
00015  * details.  You should have received a copy of the GNU General Public
00016  * License along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
00018  * USA. Any Red Hat trademarks that are incorporated in the source code or
00019  * documentation are not subject to the GNU General Public License and may
00020  * only be used or replicated with the express permission of Red Hat, Inc.
00021  *
00022  * Red Hat Author(s): Jason Vas Dias
00023  *                    David Cantrell
00024  */
00025 #include <libdhcp.h>
00026 #include <dhcp4_lease.h>
00027 #include <nic.h>
00028 #include <stdarg.h>
00029 
00030 /**
00031  * @addtogroup  DHCPv4
00032  * @{
00033  */
00034 typedef struct dhcpv4_control_s DHCPv4_control; /**<
00035  * The DHCPv4 client control structure. This has more
00036  * fields than the plain LIBDHCP_Control structure,
00037  * and must be obtained by calling dhcpv4_control.
00038  */
00039 
00040 /**
00041  * dhcpv4_control(): returns a new DHCPv4_control structure.
00042  */
00043 extern
00044 DHCPv4_control*
00045 dhcpv4_control
00046 (
00047     NLH_t                  nic_handle,     /**< nic library handle - @ref NICH */
00048     char                  *eth_if_name,    /**< ethernet interface name */
00049     LIBDHCP_Capability     dhc_cap,        /**< DHCP capability - @see ::LIBDHCP_Capability */
00050     time_t                 timeout,        /**< timeout - @see ::LIBDHCP_Control::timeout */
00051     LIBDHCP_Error_Handler  error_handler,  /**< error handler - @see ::LIBDHCP_Control::error_handler */
00052     uint8_t                log_level,      /**< log_level - @see ::LIBDHCP_Control::log_level */
00053     ... /**< extra dhclient args - see man 8 dhclient -
00054          * last arg MUST be 0.
00055          */
00056 );
00057 
00058 /**
00059  * dhcpv4_control_va - dhcpv4_control() that can be called with a va_list.
00060  */
00061 extern
00062 DHCPv4_control*
00063 dhcpv4_control_va
00064 (
00065     NLH_t                  nic_handle,
00066     char                  *eth_if_name,
00067     LIBDHCP_Capability     dhc_cap, 
00068     time_t                 timeout,    
00069     LIBDHCP_Error_Handler  error_handler,
00070     uint8_t                log_level,
00071     va_list                dhclient_va
00072 );
00073 
00074 /**
00075  * dhcpv4_control_free( ctl ) : frees all resources associated with ctl.
00076  */
00077 extern
00078 void dhcpv4_control_free( DHCPv4_control* );
00079 
00080 /**
00081  * DHCPv4_nic: structure representing the network interface configuration
00082  * parameters associated with a DHCPv4_lease.
00083  */
00084 typedef
00085 struct dhcp4_nic_s
00086 {
00087     NLH_t          nh;           /**< NIC library handle */
00088     NIC_t          nic;          /**< Network Interface structure */
00089     IPaddr_list_t  address_list; /**< list of lease addresses */
00090     IProute_list_t route_list;   /**< list of lease routes */
00091     IPaddr_list_t  dns_list;     /**< list of resolver DNS servers */
00092     char          *search_list;  /**< DNS resolver search list */
00093     char          *host_name;    /**< lease host-name option */
00094     DHCPv4_lease  *lease;        /**< the DHCPv4_lease structure */
00095 } DHCPv4_nic;
00096 
00097 extern
00098 DHCPv4_nic *do_dhcpv4( DHCPv4_control * );
00099 
00100 extern
00101 NIC_Res_t dhcpv4_nic(NLH_t, DHCPv4_nic * );
00102 
00103 extern
00104 uint32_t dhcpv4_mtu_option( DHCPv4_control * );
00105 
00106 extern
00107 int dhcp4_process_lease(DHCPv4_control *);
00108 
00109 extern 
00110 DHCPv4_nic *dhcp4_set_lease(DHCPv4_control *, DHCPv4_lease *);
00111 
00112 extern
00113 void dhcp4_nic_option_handler
00114 (   DHCPv4_option *option, 
00115     void *arg                 /* must be a DHCPv4_control */
00116 );
00117 
00118 extern
00119 int dhcp4_nic_callback
00120 (   LIBDHCP_Control *control, /* must be a DHCPv4_control */
00121     DHCP_State state, 
00122     void *arg
00123 );
00124 
00125 /**@}*/

Generated on Mon Aug 14 17:25:56 2006 for libdhcp by  doxygen 1.4.7