Author: erodriguez Date: Fri Jan 7 22:41:15 2005 New Revision: 124637 URL: http://svn.apache.org/viewcvs?view=rev&rev=124637 Log: DHCP Extensions, options specific to DHCP per RFC 2132. Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/BootfileName.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ClientIdentifier.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/DhcpMessageType.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/IpAddressLeaseTime.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/MaximumDhcpMessageSize.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/Message.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/OptionOverload.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ParameterRequestList.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RebindingTimeValue.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RenewalTimeValue.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RequestedIpAddress.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ServerIdentifier.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/TftpServerName.java incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/VendorClassIdentifier.java
Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/BootfileName.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/BootfileName.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/BootfileName.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,45 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used to identify a bootfile when the 'file' field in + * the DHCP header has been used for DHCP options. + * + * The code for this option is 67, and its minimum length is 1. + */ +public class BootfileName extends DhcpOption +{ + private byte[] bootFileName; + + public BootfileName( byte[] bootFileName ) + { + super( 67, 1 ); + this.bootFileName = bootFileName; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( bootFileName ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ClientIdentifier.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ClientIdentifier.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ClientIdentifier.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,63 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used by DHCP clients to specify their unique + * identifier. DHCP servers use this value to index their database of + * address bindings. This value is expected to be unique for all + * clients in an administrative domain. + * + * Identifiers SHOULD be treated as opaque objects by DHCP servers. + * + * The client identifier MAY consist of type-value pairs similar to the + * 'htype'/'chaddr' fields. For instance, it MAY consist + * of a hardware type and hardware address. In this case the type field + * SHOULD be one of the ARP hardware types defined in STD2. A + * hardware type of 0 (zero) should be used when the value field + * contains an identifier other than a hardware address (e.g. a fully + * qualified domain name). + * + * For correct identification of clients, each client's client- + * identifier MUST be unique among the client-identifiers used on the + * subnet to which the client is attached. Vendors and system + * administrators are responsible for choosing client-identifiers that + * meet this requirement for uniqueness. + * + * The code for this option is 61, and its minimum length is 2. + */ +public class ClientIdentifier extends DhcpOption +{ + private byte[] clientIdentifier; + + public ClientIdentifier( byte[] clientIdentifier ) + { + super( 61, 1 ); + this.clientIdentifier = clientIdentifier; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( clientIdentifier ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/DhcpMessageType.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/DhcpMessageType.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/DhcpMessageType.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,55 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used to convey the type of the DHCP message. The code + * for this option is 53, and its length is 1. Legal values for this + * option are: + * + * Value Message Type + * ----- ------------ + * 1 DHCPDISCOVER + * 2 DHCPOFFER + * 3 DHCPREQUEST + * 4 DHCPDECLINE + * 5 DHCPACK + * 6 DHCPNAK + * 7 DHCPRELEASE + * 8 DHCPINFORM + */ +public class DhcpMessageType extends DhcpOption +{ + private byte[] messageType; + + public DhcpMessageType( byte[] messageType ) + { + super( 53, 1 ); + this.messageType = messageType; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( messageType ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/IpAddressLeaseTime.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/IpAddressLeaseTime.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/IpAddressLeaseTime.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,50 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used in a client request (DHCPDISCOVER or DHCPREQUEST) + * to allow the client to request a lease time for the IP address. In a + * server reply (DHCPOFFER), a DHCP server uses this option to specify + * the lease time it is willing to offer. + * + * The time is in units of seconds, and is specified as a 32-bit + * unsigned integer. + * + * The code for this option is 51, and its length is 4. + */ +public class IpAddressLeaseTime extends DhcpOption +{ + private byte[] ipAddressLeaseTime; + + public IpAddressLeaseTime( byte[] ipAddressLeaseTime ) + { + super( 51, 4 ); + this.ipAddressLeaseTime = ipAddressLeaseTime; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( ipAddressLeaseTime ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/MaximumDhcpMessageSize.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/MaximumDhcpMessageSize.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/MaximumDhcpMessageSize.java Fri Jan 7 22:41:15 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option specifies the maximum length DHCP message that it is + * willing to accept. The length is specified as an unsigned 16-bit + * integer. A client may use the maximum DHCP message size option in + * DHCPDISCOVER or DHCPREQUEST messages, but should not use the option + * in DHCPDECLINE messages. + * + * The code for this option is 57, and its length is 2. The minimum + * legal value is 576 octets. + */ +public class MaximumDhcpMessageSize extends DhcpOption +{ + private byte[] maximumDhcpMessageSize; + + public MaximumDhcpMessageSize( byte[] maximumDhcpMessageSize ) + { + super( 57, 2 ); + this.maximumDhcpMessageSize = maximumDhcpMessageSize; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( maximumDhcpMessageSize ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/Message.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/Message.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/Message.java Fri Jan 7 22:41:15 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used by a DHCP server to provide an error message to a + * DHCP client in a DHCPNAK message in the event of a failure. A client + * may use this option in a DHCPDECLINE message to indicate the why the + * client declined the offered parameters. The message consists of n + * octets of NVT ASCII text, which the client may display on an + * available output device. + * + * The code for this option is 56 and its minimum length is 1. + */ +public class Message extends DhcpOption +{ + private byte[] message; + + public Message( byte[] message ) + { + super( 56, 1 ); + this.message = message; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( message ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/OptionOverload.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/OptionOverload.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/OptionOverload.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,58 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used to indicate that the DHCP 'sname' or 'file' + * fields are being overloaded by using them to carry DHCP options. A + * DHCP server inserts this option if the returned parameters will + * exceed the usual space allotted for options. + * + * If this option is present, the client interprets the specified + * additional fields after it concludes interpretation of the standard + * option fields. + * + * The code for this option is 52, and its length is 1. Legal values + * for this option are: + * + * Value Meaning + * ----- -------- + * 1 the 'file' field is used to hold options + * 2 the 'sname' field is used to hold options + * 3 both fields are used to hold options + */ +public class OptionOverload extends DhcpOption +{ + private byte[] optionOverload; + + public OptionOverload( byte[] optionOverload ) + { + super( 52, 1 ); + this.optionOverload = optionOverload; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( optionOverload ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ParameterRequestList.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ParameterRequestList.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ParameterRequestList.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,52 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used by a DHCP client to request values for specified + * configuration parameters. The list of requested parameters is + * specified as n octets, where each octet is a valid DHCP option code + * as defined in this document. + * + * The client MAY list the options in order of preference. The DHCP + * server is not required to return the options in the requested order, + * but MUST try to insert the requested options in the order requested + * by the client. + * + * The code for this option is 55. Its minimum length is 1. + */ +public class ParameterRequestList extends DhcpOption +{ + private byte[] parameterRequestList; + + public ParameterRequestList( byte[] parameterRequestList ) + { + super( 55, 1 ); + this.parameterRequestList = parameterRequestList; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( parameterRequestList ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RebindingTimeValue.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RebindingTimeValue.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RebindingTimeValue.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,48 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option specifies the time interval from address assignment until + * the client transitions to the REBINDING state. + * + * The value is in units of seconds, and is specified as a 32-bit + * unsigned integer. + * + * The code for this option is 59, and its length is 4. + */ +public class RebindingTimeValue extends DhcpOption +{ + private int rebindingTimeValue; + + public RebindingTimeValue( int rebindingTimeValue ) + { + super( 59, 4 ); + this.rebindingTimeValue = rebindingTimeValue; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.putInt( rebindingTimeValue ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RenewalTimeValue.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RenewalTimeValue.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RenewalTimeValue.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,48 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option specifies the time interval from address assignment until + * the client transitions to the RENEWING state. + * + * The value is in units of seconds, and is specified as a 32-bit + * unsigned integer. + * + * The code for this option is 58, and its length is 4. + */ +public class RenewalTimeValue extends DhcpOption +{ + private int renewalTimeValue; + + public RenewalTimeValue( int renewalTimeValue ) + { + super( 58, 4 ); + this.renewalTimeValue = renewalTimeValue; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.putInt( renewalTimeValue ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RequestedIpAddress.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RequestedIpAddress.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/RequestedIpAddress.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,45 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used in a client request (DHCPDISCOVER) to allow the + * client to request that a particular IP address be assigned. + * + * The code for this option is 50, and its length is 4. + */ +public class RequestedIpAddress extends DhcpOption +{ + private byte[] requestedIpAddress; + + public RequestedIpAddress( byte[] requestedIpAddress ) + { + super( 50, 4 ); + this.requestedIpAddress = requestedIpAddress; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( requestedIpAddress ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ServerIdentifier.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ServerIdentifier.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/ServerIdentifier.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,53 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used in DHCPOFFER and DHCPREQUEST messages, and may + * optionally be included in the DHCPACK and DHCPNAK messages. DHCP + * servers include this option in the DHCPOFFER in order to allow the + * client to distinguish between lease offers. DHCP clients use the + * contents of the 'server identifier' field as the destination address + * for any DHCP messages unicast to the DHCP server. DHCP clients also + * indicate which of several lease offers is being accepted by including + * this option in a DHCPREQUEST message. + * + * The identifier is the IP address of the selected server. + * + * The code for this option is 54, and its length is 4. + */ +public class ServerIdentifier extends DhcpOption +{ + private byte[] serverIdentifier; + + public ServerIdentifier( byte[] serverIdentifier ) + { + super( 54, 4 ); + this.serverIdentifier = serverIdentifier; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( serverIdentifier ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/TftpServerName.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/TftpServerName.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/TftpServerName.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,45 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used to identify a TFTP server when the 'sname' field + * in the DHCP header has been used for DHCP options. + * + * The code for this option is 66, and its minimum length is 1. + */ +public class TftpServerName extends DhcpOption +{ + private byte[] tftpServerName; + + public TftpServerName( byte[] tftpServerName ) + { + super( 66, 1 ); + this.tftpServerName = tftpServerName; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( tftpServerName ); + } +} + Added: incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/VendorClassIdentifier.java Url: http://svn.apache.org/viewcvs/incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/VendorClassIdentifier.java?view=auto&rev=124637 ============================================================================== --- (empty file) +++ incubator/directory/dhcp/trunk/core/src/java/org/apache/dhcp/options/dhcp/VendorClassIdentifier.java Fri Jan 7 22:41:15 2005 @@ -0,0 +1,54 @@ +/* + * 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.dhcp; + +import java.nio.ByteBuffer; + +import org.apache.dhcp.options.DhcpOption; + +/** + * This option is used by DHCP clients to optionally identify the vendor + * type and configuration of a DHCP client. The information is a string + * of n octets, interpreted by servers. Vendors may choose to define + * specific vendor class identifiers to convey particular configuration + * or other identification information about a client. For example, the + * identifier may encode the client's hardware configuration. Servers + * not equipped to interpret the class-specific information sent by a + * client MUST ignore it (although it may be reported). Servers that + * + * respond SHOULD only use option 43 to return the vendor-specific + * information to the client. + * + * The code for this option is 60, and its minimum length is 1. + */ +public class VendorClassIdentifier extends DhcpOption +{ + private byte[] vendorClassIdentifier; + + public VendorClassIdentifier( byte[] vendorClassIdentifier ) + { + super( 60, 1 ); + this.vendorClassIdentifier = vendorClassIdentifier; + } + + protected void valueToByteBuffer( ByteBuffer out ) + { + out.put( vendorClassIdentifier ); + } +} +
