NetworkManager/dhcpcd/dhcpcd.h
Dan Williams 86ac9e930d 2004-11-22 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerDevicePrivate.h
		- Split out the NMDevice struct to a different file so that stuff like
			NetworkManagerDHCP.c and NetworkManagerSystem.c can use it

	* dhcpcd/client.c
		- fprintf->syslog
		- (dhcpSendAndRecv): do non-blocking sends and receives, and check to see if we
			need to cancel the dhcp request during the send and recv

	* dhcpcd/client.h
		- Move the DHCP option enum to dhcpcd.h

	* src/NetworkManagerDHCP.c
		- Split out the actual IP/netmask/etc setting code
		- New Renew/Rebind functions
		- New timer setup function for renew/rebind operations

	* src/NetworkManagerDevice.c
		- For device activation, if we are using DHCP then keep the activation thread
			alive until device deactivation.  We need to renew/rebind the DHCP address
			after the T1 (renew) and T2 (rebind) times have expired.
		- Increase some timeouts after bringing wireless cards up/down


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@320 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-22 14:42:34 +00:00

134 lines
3.8 KiB
C

/*
* dhcpcd - DHCP client daemon -
* Copyright (C) 1996 - 1997 Yoichi Hariguchi <yoichi@fore.com>
* Copyright (C) January, 1998 Sergei Viznyuk <sv@phystech.com>
*
* dhcpcd is an RFC2131 and RFC1541 compliant DHCP client daemon.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef DHCPCD_H
#define DHCPCD_H
#include <time.h>
#define DHCP_DEFAULT_TIMEOUT 60
#define DHCP_DEFAULT_LEASETIME 0xffffffff /* infinite lease time */
#define DHCP_CLASS_ID_MAX_LEN 48
#define DHCP_CLIENT_ID_MAX_LEN 48
#define DHCP_HOSTNAME_MAX_LEN 64
/* DHCP option and value (cf. RFC1533) */
enum
{
padOption = 0,
subnetMask = 1,
timerOffset = 2,
routersOnSubnet = 3,
timeServer = 4,
nameServer = 5,
dns = 6,
logServer = 7,
cookieServer = 8,
lprServer = 9,
impressServer = 10,
resourceLocationServer = 11,
hostName = 12,
bootFileSize = 13,
meritDumpFile = 14,
domainName = 15,
swapServer = 16,
rootPath = 17,
extentionsPath = 18,
IPforwarding = 19,
nonLocalSourceRouting = 20,
policyFilter = 21,
maxDgramReasmSize = 22,
defaultIPTTL = 23,
pathMTUagingTimeout = 24,
pathMTUplateauTable = 25,
ifMTU = 26,
allSubnetsLocal = 27,
broadcastAddr = 28,
performMaskDiscovery = 29,
maskSupplier = 30,
performRouterDiscovery = 31,
routerSolicitationAddr = 32,
staticRoute = 33,
trailerEncapsulation = 34,
arpCacheTimeout = 35,
ethernetEncapsulation = 36,
tcpDefaultTTL = 37,
tcpKeepaliveInterval = 38,
tcpKeepaliveGarbage = 39,
nisDomainName = 40,
nisServers = 41,
ntpServers = 42,
vendorSpecificInfo = 43,
netBIOSnameServer = 44,
netBIOSdgramDistServer = 45,
netBIOSnodeType = 46,
netBIOSscope = 47,
xFontServer = 48,
xDisplayManager = 49,
dhcpRequestedIPaddr = 50,
dhcpIPaddrLeaseTime = 51,
dhcpOptionOverload = 52,
dhcpMessageType = 53,
dhcpServerIdentifier = 54,
dhcpParamRequest = 55,
dhcpMsg = 56,
dhcpMaxMsgSize = 57,
dhcpT1value = 58,
dhcpT2value = 59,
dhcpClassIdentifier = 60,
dhcpClientIdentifier = 61,
endOption = 255
};
/* Return codes */
#define RET_DHCP_ERROR 0
#define RET_DHCP_ADDRESS_IN_USE 1
#define RET_DHCP_TIMEOUT 2
#define RET_DHCP_CEASED 3
#define RET_DHCP_NAK 4
#define RET_DHCP_SUCCESS 5
#define RET_DHCP_BOUND 6
typedef struct dhcp_client_options
{
unsigned char host_name[DHCP_HOSTNAME_MAX_LEN];
unsigned char class_id[DHCP_CLASS_ID_MAX_LEN];
unsigned char client_id[DHCP_CLIENT_ID_MAX_LEN];
int do_rfc1541;
int do_broadcast_response;
time_t base_timeout;
int do_checksum;
int send_second_discover;
int window;
} dhcp_client_options;
struct dhcp_interface *dhcp_interface_init (const char *if_name, dhcp_client_options *in_opts);
void dhcp_interface_free (struct dhcp_interface *iface);
void dhcp_interface_cease (struct dhcp_interface *iface);
int dhcp_interface_dhcp_field_exists (struct dhcp_interface *iface, int val);
int dhcp_interface_get_dhcp_field_len (struct dhcp_interface *iface, int val);
void *dhcp_interface_get_dhcp_field (struct dhcp_interface *iface, int val);
int dhcp_individual_value_len (int val);
#endif