ConfigureDhcp.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
/**
* The main class for the "configure DHCP server" functionality of dhcpconfig.
*/
public class ConfigureDhcp extends DhcpCfgFunction {
/**
* The valid options associated with configuring a DHCP server.
*/
static final int supportedOptions[] = {
};
/**
* Constructs a ConfigureDhcp object.
*/
public ConfigureDhcp() {
} // constructor
/**
* Returns the option flag for this function.
* @returns the option flag for this function.
*/
public int getFunctionFlag() {
return (DhcpCfg.CONFIGURE_DHCP);
}
/**
* Executes the "configure DHCP server" functionality.
* @return DhcpCfg.SUCCESS or DhcpCfg.FAILURE
*/
public int execute() throws IllegalArgumentException {
// Check to see if DHCP or BOOTP relay is already configured.
//
boolean isServer = false;
boolean isRelay = false;
try {
isRelay = true;
} else {
isServer = true;
}
} catch (Throwable e) {
// this is to be expected
}
if (isServer) {
}
if (isRelay) {
}
// User must define both resource and path.
//
throw new IllegalArgumentException(msg);
}
try {
} catch (Throwable e) {
// resource will not be valid
}
}
// Retrieve the hosts resource and domain options and validate.
//
if (hostsResource == null) {
if (hostsDomain != null) {
throw new IllegalArgumentException(msg);
}
if (hostsDomain == null) {
getString("config_requires_hosts_domain_error"),
}
if (hostsDomain != null) {
}
} else {
}
// Retrieve the leaseLength option and check its validity.
// The default (3600*24 = 1 day) should be defined as static somewhere.
//
try {
} catch (Throwable e) {
}
}
}
// Are leases negotiable
//
boolean leaseNegotiable =
// Get the DNS information.
//
throw new IllegalArgumentException(msg);
}
try {
}
if (dnsServers != null) {
} else {
dnsAddresses = new IPAddressList(
}
} catch (ValidationException e) {
} catch (Throwable e) {
// Ignore, DNS info will not be configured in the server macro.
}
// Create the location if it does not exist.
//
try {
} catch (ExistsException e) {
// this is o.k.
} catch (Throwable e) {
}
// Create the DHCP configuration file
//
dhcpdOptions.setDaemonEnabled(true);
if (hostsResource != null) {
}
if (hostsDomain != null) {
}
try {
} catch (Throwable e) {
}
// Create the dhcptab
//
try {
} catch (TableExistsException e) {
// Not an error; some data stores are shared by multiple servers
} catch (Throwable e) {
}
// Create the locale macro
//
try {
} catch (ExistsException e) {
/*
* Ignore this error, if one's already there we'll assume
* it's correct
*/
} catch (Throwable e) {
}
// Create the Server macro
//
try {
} catch (Throwable e) {
// Couldn't create it; inform user because this is serious
}
// Start it up.
//
try {
} catch (Throwable e) {
}
} // execute
} // ConfigureDhcp