00001 /* pump.h 00002 * 00003 * libdhcp pump compatibility API for anaconda - 00004 * only the pump symbols used by anaconda are defined. 00005 * 00006 ****************************************************************************** 00007 * Original pump credits: 00008 * 00009 * There are a bunch of folks who made this code possible. I'm sure I've missed 00010 * some in this list :-( 00011 * 00012 * Alan Cox <alan@redhat.com> 00013 * Bruce Beare <bbeare@cisco.com> 00014 * David Blythe <blythe@routefree.com> 00015 * Stephen Carville <carville@cpl.net> 00016 * Guy Delamarter <delamart@pas.rochester.edu> 00017 * Chris Johnson <cjohnson@mint.net> 00018 * Michael Johnson <johnsonm@redhat.com> 00019 * H. J. Lu <hjl@valinux.com> 00020 * Kristof Petr <Petr@Kristof.CZ> 00021 * Marco Pietrobono <pietrobo@pietrobo.com> 00022 * Benjamin Reed <breed@cse.ucsc.edu> 00023 * George Staikos <staikos@0wned.org> 00024 * Jay Turner <jturner@redhat.com> 00025 * Matt Wilson <msw@redhat.com> 00026 * <aaron@schrab.com> 00027 * <duanev@io.com> 00028 * <dunham@cse.msu.edu> 00029 * <safford@watson.ibm.com> 00030 * weejock@ferret.lmh.ox.ac.uk 00031 * 00032 ******************************************************************************* 00033 * 00034 * Copyright 1999-2001 Red Hat, Inc. 00035 * 00036 * All Rights Reserved. 00037 * 00038 * The above copyright notice and this permission notice shall be included in 00039 * all copies or substantial portions of the Software. 00040 * 00041 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00042 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00043 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00044 * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00045 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00046 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00047 * 00048 * Except as contained in this notice, the name of Red Hat shall not be 00049 * used in advertising or otherwise to promote the sale, use or other dealings 00050 * in this Software without prior written authorization from Red Hat. 00051 * 00052 ****************************************************************************** 00053 * 00054 * Copyright(C) Jason Vas Dias <jvdias@redhat.com> Red Hat Inc. May 2006 00055 * 00056 * This program is free software; you can redistribute it and/or modify 00057 * it under the terms of the GNU General Public License as published by 00058 * the Free Software Foundation at 00059 * http://www.fsf.org/licensing/licenses/gpl.txt 00060 * and included in this software distribution as the "LICENSE" file. 00061 * 00062 * This program is distributed in the hope that it will be useful, 00063 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00064 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00065 * GNU General Public License for more details. 00066 * 00067 ****************************************************************************** 00068 */ 00069 00070 #ifndef H_NET 00071 #define H_NET 00072 00073 #include <dhcp_nic.h> 00074 #include <resolv.h> 00075 00076 #define MAX_DNS_SERVERS (MAXNS) 00077 00078 typedef 00079 enum pump_defs_e 00080 { 00081 PUMP_INTFINFO_HAS_IP = 1, 00082 PUMP_INTFINFO_HAS_IPV4_IP = (1<<1), 00083 PUMP_INTFINFO_HAS_IPV6_IP = (1<<2), 00084 PUMP_INTFINFO_HAS_IPV6_PREFIX= (1<<3), 00085 PUMP_INTFINFO_HAS_NETMASK = (1<<4), 00086 PUMP_INTFINFO_HAS_BROADCAST = (1<<5), 00087 PUMP_INTFINFO_HAS_NETWORK = (1<<6), 00088 PUMP_INTFINFO_HAS_MTU = (1<<7), 00089 PUMP_INTFINFO_HAS_NEXTSERVER = (1<<8), 00090 PUMP_INTFINFO_HAS_BOOTFILE = (1<<9), 00091 /* room for more ... */ 00092 PUMP_NETINFO_HAS_DNS = (1<<16), 00093 PUMP_NETINFO_HAS_DOMAIN = (1<<17), 00094 PUMP_NETINFO_HAS_GATEWAY = (1<<18), 00095 PUMP_NETINFO_HAS_HOSTNAME = (1<<19) 00096 } pump_defs_t; 00097 00098 /** 00099 * pump struct pumpNetIntf stripped down to fields 00100 * actually used by modern anaconda - plus some new 00101 * fields. 00102 * 00103 * Code which uses any of the type ip_addr_t fields, 00104 * that were type 'struct in_addr', now need to check 00105 * the fields' .sa_family and deal with either AF_INET 00106 * or AF_INET6 addresses (ip_addr_t is cast compatible 00107 * with 'struct sockaddr_in' and 'struct sockaddr_in6'). 00108 */ 00109 struct pumpNetIntf 00110 { 00111 char device[IF_NAMESIZE]; 00112 00113 ip_addr_t 00114 ip, ipv4, ipv6, netmask, broadcast, network, 00115 gateway, nextServer, dnsServers[MAX_DNS_SERVERS]; 00116 00117 int set, mtu, numDns, 00118 ipv6_prefixlen; /**< set this if 'ip' is IPv6 00119 * to set subnet prefix length 00120 */ 00121 char * bootFile, * hostname, * domain;/**< dynamically allocated */ 00122 00123 NLH_t nh; /**< the libdhcp NIC Library Handle */ 00124 00125 DHCP_nic *dhcp_nic; /**< the libdhcp DHCP 00126 * Network Interface Configuration. 00127 */ 00128 }; 00129 00130 00131 extern char * pumpSetupInterface(struct pumpNetIntf * ifx); 00132 00133 /* int pumpSetupDefaultGateway( struct in_addr * gw ) ; 00134 * 00135 * this is now done by pumpSetupInterface 00136 * if (intf.set & PUMP_NETINFO_HAS_GATEWAY) 00137 * (we need an interface to set the default gateway on). 00138 */ 00139 00140 /** 00141 * pump's pumpDhcpClassRun function. 00142 * The prototype is changed slightly to pass in libdhcp 00143 * control parameters and remove parameters not used 00144 * by anaconda. 00145 */ 00146 extern char * pumpDhcpClassRun 00147 ( 00148 struct pumpNetIntf * ifx, /**< DHCP configuration to be stored here 00149 * 'ifx->device' must be set to the name of 00150 * the interface to configure. 00151 */ 00152 char * hostname, /**< DHCP 'host-name' option to send */ 00153 char * vendor_class, /**< DHCP 'vendor-class-identifier' to send */ 00154 DHCP_Preference dhcp_preference, /**< DHCP policy - see dhcp_nic.h */ 00155 LIBDHCP_Capability dhcp_capability, /**< DHCP policy - see libdhcp.h */ 00156 time_t timeout, /**< time in seconds each client has to obtain lease */ 00157 void (*logger)(void*,int,char*,va_list),/**< in case you want to do something with 00158 * libdhcp log / debug messages - otherwise, 00159 * pass in as NULL. 00160 */ 00161 int max_log_priority /**< if a logger was specified, the maximum 00162 * priority to log (same as syslog priority). 00163 */ 00164 ); 00165 00166 extern char * pumpDisableInterface(char * device); 00167 00168 #endif