DhcpdOptions.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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* DhcpdOptions models the option settings for the in.dhcpd daemon. We read
* and write the option settings in the daemon's defaults file.
* Getter and setter methods are provided for each individual option.
*/
/* The list of facility choices the user may select from for logging */
private static final Integer [] loggingFacilities = {
};
// Store the option settings here
/**
* Dirty flag. Set after a clear or a set on an option.
*/
private boolean dirty = false;
public DhcpdOptions() {
}
}
DhcpdOptions o = new DhcpdOptions();
return o;
}
/**
* Test whether a particular option is set.
* @param key
* The name of the option to set.
* @return
* True if the option is set, otherwise false.
*/
return internalIsSet(key);
}
/**
* Set an option to a supplied value.
* @param key
* The name of the option to set.
* @param value
* The value of the option.
*/
}
/**
* Set an option to a supplied value, or add a comment line to the
* table.
* @param key
* The name of the option to set.
* @param value
* The value of the option.
* @param comment
* true if this is a comment, in which case value is ignored
* and the comment text is contained entirely in key.
*/
/*
* Ensure that the run mode is kept consistent with the
* configuration parameters. Mgt. tools rely on this!
*/
}
}
/**
* Clear an option.
* @param key
* The name of the option to clear.
*/
}
}
/**
* Return the value of an option setting; null if it's not set.
* @param key
* The option whose value is to be retrieved.
* @return
* The value of an option setting; null if it's not set.
*/
return internalValueOf(key);
}
// Test whether a particular option is set
}
// Set an option to a supplied value
}
/**
* Set an option to a supplied value, or add a comment line to the
* table.
* @param key The name of the option to set
* @param value The value of the option
* @param comment true if this is a comment, in which case value is ignored
* and the comment text is contained entirely in key.
*/
if (i != -1) {
dirty = true;
}
} else {
dirty = true;
}
}
// Clear an option
if (i != -1) {
dirty = true;
}
}
/**
* Return the value of an option setting; null if it's not set
* @param key The option whose value is to be retrieved
* @return The value of an option setting; null if it's not set
*/
if (i != -1) {
} else {
return null;
}
}
/**
* Return all of the option settings as an array
* @return An array of Objects which will all be DhcpResources
*/
}
/**
* Test to see whether or not the daemon is enabled.
* @return true if daemon is enabled, false if not.
*/
public boolean isDaemonEnabled() {
}
/**
* Set daemon enabled or disabled
* @param state true for enabled, false for disabled
*/
public void setDaemonEnabled(boolean state) {
}
/**
* Set the DhcpDatastore attributes.
* @param resource the data store resource attribute
* @param location the data store location attribute
* @param config the data store config attribute
* @param version the data store version attribute
*/
} // setDhcpDatastore
/**
* Set the DhcpDatastore attributes.
* @param datastore a datastore object whose attributes
* are the desired attributes.
*/
} // setDhcpDatastore
/**
* Set the DhcpDatastore attributes.
* @param resource the data store resource attribute
* @param location the data store location attribute
* @param config the data store config attribute
* @param version the data store version attribute
*/
public DhcpDatastore getDhcpDatastore() {
getConfig(), getResourceVersion()));
} // getDhcpDatastore
/**
* Set the resource (aka data store) in which DHCP data is stored.
* This automatically also sets the run mode to server.
* @param s Unique name of resource
*/
public void setResource(String s) {
set(DSVC_CK_RESOURCE, s);
}
/**
* @return The unique name of the resource; null if not set
*/
public String getResource() {
return valueOf(DSVC_CK_RESOURCE);
}
/**
* Set the version of the resource in which DHCP data is stored.
* @param i version number
*/
public void setResourceVersion(int i) {
}
/**
* @return The version number or -1 if not valid.
*/
public int getResourceVersion() {
try {
} catch (NumberFormatException e) {
return -1;
}
}
/**
* Set the path within the resource in which to place the tables.
* For files, this is a Unix pathname; for NIS+, the directory name.
* @param s The path
*/
set(DSVC_CK_PATH, s);
}
/**
* Get the path used for data storage.
* @return The path within the resource; null if not set
*/
return valueOf(DSVC_CK_PATH);
}
/**
* Set the config for the resource.
* @param s The config
*/
if (s != null) {
} else {
}
}
/**
* Get the config for data store.
* @return The config; null if not set
*/
return valueOf(DSVC_CK_RESOURCE_CONFIG);
}
/**
* Set the hosts resource (aka data store) in which host data is stored.
* @param s Unique name of resource
*/
public void setHostsResource(String s) {
}
/**
* @return The unique name of the resource; null if not set
*/
public String getHostsResource() {
return valueOf(DSVC_CK_HOSTS_RESOURCE);
}
/**
* Set the domain within the hosts resource in which to place the tables.
* For files resource, this value is meaningless.
* @param s The domain
*/
public void setHostsDomain(String s) {
set(DSVC_CK_HOSTS_DOMAIN, s);
}
/**
* Get the domain used for hosts data storage.
* @return The domain within the resource; null if not set
*/
public String getHostsDomain() {
return valueOf(DSVC_CK_HOSTS_DOMAIN);
}
/**
* Test whether BOOTP compatibility is enabled.
* @return true if BOOTP compatibility is enabled.
*/
public boolean isBootpCompatible() {
return isSet(DSVC_CK_BOOTP_COMPAT);
}
/**
* Enable or disable BOOTP compatibility.
* @param state true if BOOTP compatibility is enabled, false if not.
* @param isAutomatic true if automatic allocation is allowed.
*/
if (state) {
if (isAutomatic) {
} else {
}
} else {
}
}
/**
* Test whether BOOTP compatibility is automatic or manual
* @return true if BOOTP compatibility is automatic.
*/
public boolean isBootpAutomatic() {
}
/**
* Test whether relay hop limit is set.
* @return true if the limit is set, false if default value is used.
*/
public boolean isRelayHops() {
return isSet(DSVC_CK_RELAY_HOPS);
}
/**
* Set the relay hop limit.
* @param state true if hop limit should be set, false if not
* @param hops Number of hops to limit forwarding to
*/
if (state) {
} else {
}
}
/**
* Get the relay hop limit.
* @return The number of hops currently set, or null if this isn't set.
*/
public Integer getRelayHops() {
} else {
return null;
}
}
/**
* Test whether a network interface list is set; failure to set an interface
* list implies that all interfaces will be monitored.
* @return true if an interface list is set
*/
public boolean isInterfaces() {
return isSet(DSVC_CK_INTERFACES);
}
/**
* Set the network interface list.
* @param state true if interface list is to be set, false if it should be
* cleared
* @param list A comma-separated list of interface names
*/
if (state) {
} else {
}
}
/**
* Get the list of network interfaces.
* @return The comma-separated list of interfaces; null if not set
*/
public String getInterfaces() {
return valueOf(DSVC_CK_INTERFACES);
}
/**
* Test whether ICMP address verification is enabled
* @return true if ICMP verification is performed
*/
public boolean isICMPVerify() {
/*
* Use this double-inverse comparison so that the default behavior of
* ICMP enabled is handled correctly.
*/
}
/**
* Set ICMP verification
* @param state true if verification should be done, false otherwise
*/
public void setICMPVerify(boolean state) {
}
/**
* Test whether offer cache timeout is set
* @return true if it is set
*/
public boolean isOfferTtl() {
return isSet(DSVC_CK_OFFER_CACHE_TIMEOUT);
}
/**
* Set offer cache timeout value
* @param state true if offer cache timeout value is set, false if server's
* default will be used instead
* @param time Number of seconds to hold offers in the cache
*/
if (state) {
} else {
}
}
/**
* Get the offer cache timeout value
* @return timeout value set, or null if server default is used
*/
public Integer getOfferTtl() {
if (s != null) {
return new Integer(s);
} else {
return null;
}
}
/**
* Test whether server is running in relay mode
* @return true if running as relay
*/
public boolean isRelay() {
}
/**
* Set relay mode and server list
* @param state true if relay mode is desired, false for normal server
* @param servers list of servers to which requests should be forwarded
*/
if (state) {
} else {
}
}
/**
* Get list of server targets for relay
* @return list of relay targets; null if not set
*/
return valueOf(DSVC_CK_RELAY_DESTINATIONS);
}
/**
* Test for server automatic reload of dhcptab
* @return true if server is rescanning dhcptab
*/
public boolean isRescan() {
return isSet(DSVC_CK_RESCAN_INTERVAL);
}
/**
* Set the rescan interval
* @param state true if rescanning is enabled, false if not
* @param interval number of minutes between rescans
*/
if (state) {
} else {
}
}
/**
* Get the rescan interval
* @return the rescan interval in minutes, or null if rescan is not enabled
*/
if (s != null) {
return new Integer(s);
} else {
return null;
}
}
/**
* Test whether ownerip
* @return true if ownerip
*/
public boolean isOwnerip() {
return isSet(DSVC_CK_OWNER_IP);
}
/**
* Set ownerip server list
* @param state true if ownerip is desired, false for normal server
* @param ownerips list of servers ownerips
*/
if (state) {
} else {
}
}
/**
* Get list of server targets for ownerip
* @return list of ownerip targets; null if not set
*/
public String getOwnerip() {
return valueOf(DSVC_CK_OWNER_IP);
}
/**
* Test for server dynamic DNS updates
* @return true if server is updating DNS
*/
public boolean isDnsUpdated() {
return isSet(DSVC_CK_NSU_TIMEOUT);
}
/**
* Set the DNS update timeout value
* @param state true if DNS updates are enabled, false if not
* @param timeout number of seconds before timeout
*/
if (state) {
} else {
}
}
/**
* Get the DNS update timeout value
* @return the timeout in seconds, or null if DNS updates are not enabled
*/
public Integer getDnsTimeout() {
if (s != null) {
return new Integer(s);
} else {
return null;
}
}
/**
* Test for verbose logging mode
* @return true if verbose logging, false for normal
*/
public boolean isVerbose() {
}
/**
* Set verbose logging mode
* @param state true for verbose, false for normal
*/
public void setVerbose(boolean state) {
}
/**
* Test for transaction logging mode.
* @return true if transaction logging is enabled
*/
public boolean isLogging() {
return isSet(DSVC_CK_LOGGING_FACILITY);
}
/**
* Get the syslog facility number used for transaction logging
* @return facility number, which will be between 0 and 7
*/
public Integer getLogging() {
if (s != null) {
return new Integer(s);
} else {
return null;
}
}
/**
* Set transaction logging
* @param state true to enable transaction logging, false to disable
* @param value syslog facility number 0-7 used for logging
*/
if (state) {
} else {
}
}
/**
* Get the list of logging facility choices
* @return an array of facility numbers
*/
public static Integer [] getLoggingFacilities() {
return loggingFacilities;
}
/**
* Return an indicator of whether the parameters may have been changed
* by a set() or a clear() since the last call to clearDirty().
*
* @return
* True if a set() or a clear() has occurred since the last call to
* clearDirty(), otherwise false.
*/
public boolean isDirty() {
return dirty;
}
/**
* Set the dirty indicator to false. Any subsequent calls to set() or
* clear() may set the dirty flag.
*/
public void clearDirty() {
dirty = false;
}
/**
* Get the parameters qualifier.
*
* @param key
* Parameters keyword.
* @return
* The qualifier for the parameter if one exists, otherwise null.
*/
new QualifierImpl(DSVC_CK_BOOTP_COMPAT, false, false,
new QualifierStringEnum(
new String[] {
}));
new QualifierImpl(DSVC_CK_CACHE_TIMEOUT, false, false,
0,
new QualifierImpl(DSVC_CK_CONVER, true, false,
new QualifierInteger());
new QualifierImpl(DSVC_CK_DAEMON_ENABLED, true, false,
new QualifierBoolean(
new QualifierImpl(DSVC_CK_DBG_MEMORY_NET, false, true,
0,
new QualifierImpl(DSVC_CK_DBG_PORT_OFFSET, false, true,
0,
new QualifierImpl(DSVC_CK_HOSTS_DOMAIN, true, false,
new QualifierStringEnum(
new String[] {
}));
new QualifierImpl(DSVC_CK_HOSTS_RESOURCE, true, false,
new QualifierStringEnum(
new String[] {
}));
new QualifierImpl(DSVC_CK_ICMP_VERIFY, false, false,
new QualifierBoolean(
new QualifierImpl(DSVC_CK_INTERFACES, false, false,
new QualifierArray(
new QualifierString()));
new QualifierImpl(DSVC_CK_LEASE_MIN_LRU, false, true,
0,
new QualifierImpl(DSVC_CK_LOGGING_FACILITY, false, false,
new QualifierImpl(DSVC_CK_MAX_CLIENTS, false, true,
-1,
new QualifierImpl(DSVC_CK_MAX_THREADS, false, true,
-1,
new QualifierImpl(DSVC_CK_OFFER_CACHE_TIMEOUT, false, false,
0,
new QualifierImpl(DSVC_CK_PATH, true, false,
new QualifierString());
new QualifierImpl(DSVC_CK_RELAY_DESTINATIONS, false, false,
new QualifierArray(
new QualifierOr(
new QualifierFQDN(),
new QualifierIPv4())));
new QualifierImpl(DSVC_CK_RELAY_HOPS, false, false,
0,
new QualifierImpl(DSVC_CK_RESCAN_INTERVAL, false, false,
new QualifierImpl(DSVC_CK_OWNER_IP, false, false,
new QualifierArray(
new QualifierIPv4()));
new QualifierImpl(DSVC_CK_RESOURCE, true, false,
new QualifierString());
new QualifierImpl(DSVC_CK_RESOURCE_CONFIG, true, false,
new QualifierString());
new QualifierImpl(DSVC_CK_RUN_MODE, true, false,
new QualifierStringEnum(
new String[] {
}));
new QualifierImpl(DSVC_CK_RENOG_INTERVAL, false, false,
0,
new QualifierImpl(DSVC_CK_NSU_TIMEOUT, false, false,
-1,
new QualifierImpl(DSVC_CK_VERBOSE, false, false,
new QualifierBoolean(
}
return qualifier;
}
/**
* Convert this object to a String representation
*/
StringBuffer b = new StringBuffer();
if (s != null) {
b.append('=');
b.append(s);
}
b.append('\n');
}
return b.toString();
}
}