DhcpNetMgrImpl.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) 1998-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
/**
* This class provides the functionality to manage the DHCP network tables and
* the hosts table.
*/
public class DhcpNetMgrImpl implements DhcpNetMgr {
}
/**
* Return the Network corresponding to the network string
* @return a Network
*/
throws BridgeException {
}
/**
* Return the list of networks currently known to DHCP
* @return an array of Networks
*/
return getNetworks(null);
}
throws BridgeException {
}
/**
* Return the list of addresses managed by DHCP on a given network
* @param network the dotted-decimal representation of the network address
* @return an array of records for the addresses defined on that network
*/
throws BridgeException {
}
/**
* Return the list of addresses managed by DHCP on a given network
* @param network the dotted-decimal representation of the network address
* @param datastore user-supplied datastore attributes
* @return an array of records for the addresses defined on that network
*/
}
/**
* Return the list of addresses managed by DHCP on a given network, with
* the hostnames for each client looked up, too.
* @param network the dotted-decimal representation of the network address
* @return an array of records for the addresses defined on that network
*/
throws BridgeException {
// Force loading of client name for each client
clients[i].getClientName();
}
return clients;
}
/**
* Modify an existing client record, and update the associated hosts
* record if needed.
* @param oldClient the existing record
* @param newClient the new record
* @param table the network on which the record is defined
*/
}
/**
* Modify an existing client record, and update the associated hosts
* record if needed.
* @param oldClient the existing record
* @param newClient the new record
* @param table the network on which the record is defined
* @param datastore user-supplied datastore attributes
*/
throws BridgeException {
newClient.getComment());
/*
* If the name changed, need to update hosts. If comment changed,
* hosts is only updated if there was already a hosts record.
*/
if (nameChanged) {
/*
* If new name is empty, delete the hosts entry. Otherwise
* try to modify it.
*/
try {
} catch (Throwable e) {
throw new NoHostsEntryException(
}
} else {
try {
} catch (NoHostsEntryException e) {
// Must not be one, so create it instead
}
}
} else if (commentChanged) {
// Try to modify, but toss all exceptions as this isn't a big deal
try {
newClient.getComment());
} catch (Throwable e) {
// Ignore
}
}
// Update the network table record
}
/**
* Create a new record in the given table, and create a hosts record.
* @param client the client to create
* @param table the network on which to create the client
*/
throws BridgeException {
}
/**
* Create a new record in the given table, and create a hosts record.
* @param client the client to create
* @param table the network on which to create the client
* @param datastore user-supplied datastore attributes
*/
/*
* If a name was supplied and we can't resolve it to this address,
* create a hosts record.
*/
}
// Create the record in the per-network table
}
/**
* Delete a record from the given table, and delete the associated hosts
* record if requested.
* @param client the client to delete
* @param table the network to delete the client from
* @param deleteHosts true if the hosts record should be removed as well
*/
boolean deleteHosts) throws BridgeException {
}
/**
* Delete a record from the given table, and delete the associated hosts
* record if requested.
* @param client the client to delete
* @param table the network to delete the client from
* @param deleteHosts true if the hosts record should be removed as well
* @param datastore user-supplied datastore attributes
*/
throws BridgeException {
// Delete the client record from the per-network table
// Delete hosts if requested
if (deleteHosts) {
try {
} catch (NoEntryException e) {
throw new NoEntryException("hosts");
}
}
}
/**
* Retrieve a client record from the given table.
* @param client the client to delete
* @param table the network to delete the client from
* @param datastore user-supplied datastore attributes
*/
// Retrieve the client record from the per-network table
return clientRecord;
}
/**
* Create a new per-network table for the given network by converting the
* one from the server's data store into a new data store.
* @param network the network number in dotted-decimal form.
* @param datastore user-supplied datastore attributes
*/
}
/**
* Create a new per-network table for the given network.
* @param network the network number in dotted-decimal form.
*/
throws BridgeException {
}
/**
* Create a new per-network table for the given network.
* @param network the network number in dotted-decimal form.
* @param datastore user-supplied datastore attributes
*/
}
/**
* Delete a per-network table, the macro associated with the network number,
* and optionally deleting the associated hosts records.
* @param network the network number in dotted-decimal form.
* @param deleteMacro true if the network macro should be deleted
* @param deleteHosts true if the associated hosts records should be deleted
*/
boolean deleteHosts) throws BridgeException {
}
/**
* Delete a per-network table, the macro associated with the network number,
* and optionally deleting the associated hosts records.
* @param network the network number in dotted-decimal form.
* @param deleteMacro true if the network macro should be deleted
* @param deleteHosts true if the associated hosts records should be deleted
* @param datastore user-supplied datastore attributes
*/
throws BridgeException {
// If we're supposed to clean up hosts, do so
if (deleteHosts) {
DhcpClientRecord [] recs =
try {
} catch (Throwable e) {
// Ignore errors here; they're not important
}
}
}
}
// Delete network table, then the macro for the network
try {
if (deleteMacro) {
}
} catch (Throwable e) {
// All the errors here are ignorable
}
}
/**
* Add a record to the hosts table.
* @param addr address of entry to add to the hosts table
* @param name alias for the entry
* @param comment comment for the entry
*/
try {
if (hostsTable != null) {
}
} finally {
if (hostsTable != null) {
}
}
} // createHostsRecord
/**
* Delete a record from the hosts table.
* @param addr address of entry to remove from the hosts table
*/
throws BridgeException {
try {
if (hostsTable != null) {
}
} finally {
if (hostsTable != null) {
}
}
} // deleteHostsRecord
/**
* Modify a record in the hosts table.
* @param oldAddr address of entry to modify in the hosts table
* @param newAddr new address of entry
* @param name alias for the entry
* @param comment comment for the entry
*/
try {
if (hostsTable != null) {
}
} finally {
if (hostsTable != null) {
}
}
} // modifyHostsRecord
}