Author: erodriguez Date: Sat Jan 8 21:47:51 2005 New Revision: 124704 URL: http://svn.apache.org/viewcvs?view=rev&rev=124704 Log: Introducing options base classes to handle single and multiple IP addresses. Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/AddressListOption.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/AddressOption.java
Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/AddressListOption.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/AddressListOption.java?view=auto&rev=124704 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/AddressListOption.java Sat Jan 8 21:47:51 2005 @@ -0,0 +1,47 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.dhcp.options; + +import java.nio.ByteBuffer; + + +/** + * The Dynamic Host Configuration Protocol (DHCP) provides a framework + * for passing configuration information to hosts on a TCP/IP network. + * Configuration parameters and other control information are carried in + * tagged data items that are stored in the 'options' field of the DHCP + * message. The data items themselves are also called "options." + * + * This abstract base class is for options that carry lists of IP addresses. + */ +public abstract class AddressListOption extends DhcpOption +{ + private byte[] value; + + public AddressListOption( int tag, byte[] value ) + { + super( tag, value.length ); + this.value = value; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( value ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/AddressOption.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/AddressOption.java?view=auto&rev=124704 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/AddressOption.java Sat Jan 8 21:47:51 2005 @@ -0,0 +1,49 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.dhcp.options; + +import java.nio.ByteBuffer; + + +/** + * The Dynamic Host Configuration Protocol (DHCP) provides a framework + * for passing configuration information to hosts on a TCP/IP network. + * Configuration parameters and other control information are carried in + * tagged data items that are stored in the 'options' field of the DHCP + * message. The data items themselves are also called "options." + * + * This abstract base class is for options that carry a single IP address. + */ +public abstract class AddressOption extends DhcpOption +{ + private static final int length = 4; + + private byte[] value; + + public AddressOption( int tag, byte[] value ) + { + super( tag, length ); + this.value = value; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( value ); + } +} +
