You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/08/05 19:53:20 UTC

svn commit: r801338 [1/3] - in /directory/apacheds/trunk: protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/messages/ protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ protocol-dhcp/src/main/java/org/apache/directory/serv...

Author: elecharny
Date: Wed Aug  5 17:53:19 2009
New Revision: 801338

URL: http://svn.apache.org/viewvc?rev=801338&view=rev
Log:
Removed ^M in files

Modified:
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/messages/HardwareAddress.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ByteOption.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/IntOption.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ShortOption.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/StringOption.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/dhcp/UnrecognizedOption.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/StoreBasedDhcpService.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/AbstractDhcpStore.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/DhcpConfigElement.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/DhcpStore.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Host.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/SimpleDhcpStore.java
    directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java
    directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java
    directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ProtocolService.java
    directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/TransportProtocol.java

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/messages/HardwareAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/messages/HardwareAddress.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/messages/HardwareAddress.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/messages/HardwareAddress.java Wed Aug  5 17:53:19 2009
@@ -1,203 +1,203 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.directory.server.dhcp.messages;
-
-
-import java.text.ParseException;
-import java.util.Arrays;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-
-/**
- * A representation of a DHCP hardware address.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
- */
-public final class HardwareAddress
-{
-    /**
-     * [htype] Hardware address type, see ARP section in "Assigned Numbers" RFC;
-     * e.g., '1' = 10mb ethernet.
-     */
-    private final short type;
-
-    /**
-     * [hlen] Hardware address length (e.g. '6' for 10mb ethernet).
-     */
-    private final short length;
-
-    /**
-     * [chaddr] Client hardware address.
-     */
-    private final byte[] address;
-
-
-    /**
-     * @param type
-     * @param length
-     * @param address
-     */
-    public HardwareAddress(short type, short length, byte[] address)
-    {
-        this.type = type;
-        this.length = length;
-        this.address = address;
-    }
-
-
-    public byte[] getAddress()
-    {
-        return address;
-    }
-
-
-    public short getLength()
-    {
-        return length;
-    }
-
-
-    public short getType()
-    {
-        return type;
-    }
-
-
-    /**
-     * @see java.lang.Object#hashCode()
-     * @return the instance's hash code 
-     */
-    public int hashCode()
-    {
-        int hashCode = 98643532 ^ type ^ length;
-        for ( int i = 0; i < length; i++ )
-            hashCode ^= address[i];
-
-        return hashCode;
-    }
-
-
-    /*
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
-    public boolean equals( Object obj )
-    {
-        if ( null == obj || !( obj.getClass().equals( HardwareAddress.class ) ) )
-            return false;
-
-        HardwareAddress hw = ( HardwareAddress ) obj;
-
-        return length == hw.length && type == hw.type && Arrays.equals( address, hw.address );
-    }
-
-
-    /**
-     * Create the string representation of the hardware address native to the
-     * corresponding address type. This method currently supports only type
-     * 1==ethernet with the representation <code>a1:a2:a3:a4:a5:a6</code>.<br>
-     * For all other types, this method falls back to the representation created
-     * by toString().
-     * 
-     * @see java.lang.Object#toString()
-     */
-    public String getNativeRepresentation()
-    {
-        StringBuffer sb = new StringBuffer();
-        switch ( type )
-        {
-            case 1:
-                for ( int i = 0; i < length; i++ )
-                {
-                    if ( i > 0 )
-                        sb.append( ":" );
-                    String hex = Integer.toHexString( address[i] & 0xff );
-                    if ( hex.length() < 2 )
-                        sb.append( '0' );
-                    sb.append( hex );
-                }
-                break;
-            default:
-                sb.append( toString() );
-        }
-
-        return sb.toString();
-    }
-
-
-    /**
-     * Create a string representation of the hardware address. The string
-     * representation is in the format<br>
-     * <code>t/a1:a2:a3...</code><br>
-     * Where <code>t</code> represents the address type (decimal) and
-     * <code>a<sub>n</sub></code> represent the address bytes (hexadecimal).
-     * 
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        StringBuffer sb = new StringBuffer();
-        sb.append( type );
-        sb.append( "/" );
-        for ( int i = 0; i < length; i++ )
-        {
-            if ( i > 0 )
-                sb.append( ":" );
-            String hex = Integer.toHexString( address[i] & 0xff );
-            if ( hex.length() < 2 )
-                sb.append( '0' );
-            sb.append( hex );
-        }
-
-        return sb.toString();
-    }
-
-    private static final Pattern PARSE_PATTERN = Pattern
-        .compile( "(\\d+)\\s+(?:(\\p{XDigit}{1,2}):)*(\\p{XDigit}{1,2})?" );
-
-
-    /**
-     * Parses a string representation of a hardware address according to the
-     * specification given in {@link #toString()}.
-     * 
-     * @param s
-     * @return HardwareAddress
-     * @throws ParseException
-     */
-    public static HardwareAddress valueOf( String s )
-    {
-        if ( null == s || s.length() == 0 )
-            return null;
-
-        Matcher m = PARSE_PATTERN.matcher( s );
-        if ( !m.matches() )
-            throw new IllegalArgumentException( "Can't parse string representation: " + s );
-
-        int type = Integer.parseInt( m.group( 1 ) );
-        int len = m.groupCount() - 1;
-
-        byte addr[] = new byte[len];
-        for ( int i = 0; i < addr.length; i++ )
-            addr[i] = ( byte ) Integer.parseInt( m.group( i + 2 ), 16 );
-
-        return new HardwareAddress( ( short ) type, ( short ) len, addr );
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.server.dhcp.messages;
+
+
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+/**
+ * A representation of a DHCP hardware address.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
+ */
+public final class HardwareAddress
+{
+    /**
+     * [htype] Hardware address type, see ARP section in "Assigned Numbers" RFC;
+     * e.g., '1' = 10mb ethernet.
+     */
+    private final short type;
+
+    /**
+     * [hlen] Hardware address length (e.g. '6' for 10mb ethernet).
+     */
+    private final short length;
+
+    /**
+     * [chaddr] Client hardware address.
+     */
+    private final byte[] address;
+
+
+    /**
+     * @param type
+     * @param length
+     * @param address
+     */
+    public HardwareAddress(short type, short length, byte[] address)
+    {
+        this.type = type;
+        this.length = length;
+        this.address = address;
+    }
+
+
+    public byte[] getAddress()
+    {
+        return address;
+    }
+
+
+    public short getLength()
+    {
+        return length;
+    }
+
+
+    public short getType()
+    {
+        return type;
+    }
+
+
+    /**
+     * @see java.lang.Object#hashCode()
+     * @return the instance's hash code 
+     */
+    public int hashCode()
+    {
+        int hashCode = 98643532 ^ type ^ length;
+        for ( int i = 0; i < length; i++ )
+            hashCode ^= address[i];
+
+        return hashCode;
+    }
+
+
+    /*
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( null == obj || !( obj.getClass().equals( HardwareAddress.class ) ) )
+            return false;
+
+        HardwareAddress hw = ( HardwareAddress ) obj;
+
+        return length == hw.length && type == hw.type && Arrays.equals( address, hw.address );
+    }
+
+
+    /**
+     * Create the string representation of the hardware address native to the
+     * corresponding address type. This method currently supports only type
+     * 1==ethernet with the representation <code>a1:a2:a3:a4:a5:a6</code>.<br>
+     * For all other types, this method falls back to the representation created
+     * by toString().
+     * 
+     * @see java.lang.Object#toString()
+     */
+    public String getNativeRepresentation()
+    {
+        StringBuffer sb = new StringBuffer();
+        switch ( type )
+        {
+            case 1:
+                for ( int i = 0; i < length; i++ )
+                {
+                    if ( i > 0 )
+                        sb.append( ":" );
+                    String hex = Integer.toHexString( address[i] & 0xff );
+                    if ( hex.length() < 2 )
+                        sb.append( '0' );
+                    sb.append( hex );
+                }
+                break;
+            default:
+                sb.append( toString() );
+        }
+
+        return sb.toString();
+    }
+
+
+    /**
+     * Create a string representation of the hardware address. The string
+     * representation is in the format<br>
+     * <code>t/a1:a2:a3...</code><br>
+     * Where <code>t</code> represents the address type (decimal) and
+     * <code>a<sub>n</sub></code> represent the address bytes (hexadecimal).
+     * 
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+        sb.append( type );
+        sb.append( "/" );
+        for ( int i = 0; i < length; i++ )
+        {
+            if ( i > 0 )
+                sb.append( ":" );
+            String hex = Integer.toHexString( address[i] & 0xff );
+            if ( hex.length() < 2 )
+                sb.append( '0' );
+            sb.append( hex );
+        }
+
+        return sb.toString();
+    }
+
+    private static final Pattern PARSE_PATTERN = Pattern
+        .compile( "(\\d+)\\s+(?:(\\p{XDigit}{1,2}):)*(\\p{XDigit}{1,2})?" );
+
+
+    /**
+     * Parses a string representation of a hardware address according to the
+     * specification given in {@link #toString()}.
+     * 
+     * @param s
+     * @return HardwareAddress
+     * @throws ParseException
+     */
+    public static HardwareAddress valueOf( String s )
+    {
+        if ( null == s || s.length() == 0 )
+            return null;
+
+        Matcher m = PARSE_PATTERN.matcher( s );
+        if ( !m.matches() )
+            throw new IllegalArgumentException( "Can't parse string representation: " + s );
+
+        int type = Integer.parseInt( m.group( 1 ) );
+        int len = m.groupCount() - 1;
+
+        byte addr[] = new byte[len];
+        for ( int i = 0; i < addr.length; i++ )
+            addr[i] = ( byte ) Integer.parseInt( m.group( i + 2 ), 16 );
+
+        return new HardwareAddress( ( short ) type, ( short ) len, addr );
+    }
+}

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ByteOption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ByteOption.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ByteOption.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ByteOption.java Wed Aug  5 17:53:19 2009
@@ -1,64 +1,64 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.directory.server.dhcp.options;
-
-/**
- * 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 an unsigned short value
- * (16 bit).
- *  
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
- * 
- */
-public abstract class ByteOption extends DhcpOption {
-    /**
-     * The byte value (represented as a short because of the unsignedness).
-     */
-    private short byteValue;
-
-    /*
-     * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
-     */
-    public void setData(byte[] data) {
-        byteValue = (short) (data[0] & 0xff);
-    }
-
-    /*
-     * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
-     */
-    public byte[] getData() {
-        return new byte[]{(byte) (byteValue & 0xff)};
-    }
-
-    public short getByteValue() {
-        return byteValue;
-    }
-
-    public void setShortValue(short shortValue) {
-        this.byteValue = shortValue;
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.server.dhcp.options;
+
+/**
+ * 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 an unsigned short value
+ * (16 bit).
+ *  
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
+ * 
+ */
+public abstract class ByteOption extends DhcpOption {
+    /**
+     * The byte value (represented as a short because of the unsignedness).
+     */
+    private short byteValue;
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
+     */
+    public void setData(byte[] data) {
+        byteValue = (short) (data[0] & 0xff);
+    }
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
+     */
+    public byte[] getData() {
+        return new byte[]{(byte) (byteValue & 0xff)};
+    }
+
+    public short getByteValue() {
+        return byteValue;
+    }
+
+    public void setShortValue(short shortValue) {
+        this.byteValue = shortValue;
+    }
+}

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/IntOption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/IntOption.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/IntOption.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/IntOption.java Wed Aug  5 17:53:19 2009
@@ -1,63 +1,63 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you 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.directory.server.dhcp.options;
-
-/**
- * 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 short value (16 bit).
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
- */
-public abstract class IntOption extends DhcpOption {
-    /**
-     * The int value (represented as a long because of the unsignedness).
-     */
-    private long intValue;
-
-    /*
-     * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
-     */
-    public void setData(byte[] data) {
-        intValue = (data[0] & 0xff) << 24 | (data[1] & 0xff) << 16
-                | (data[2] & 0xff) << 8 | (data[3] & 0xff);
-    }
-
-    /*
-     * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
-     */
-    public byte[] getData() {
-        return new byte[]{(byte) (intValue >> 24 & 0xff),
-                (byte) (intValue >> 16 & 0xff), (byte) (intValue >> 8 & 0xff),
-                (byte) (intValue & 0xff)};
-    }
-
-    public long getIntValue() {
-        return intValue;
-    }
-
-    public void setIntValue(long intValue) {
-        this.intValue = intValue;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you 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.directory.server.dhcp.options;
+
+/**
+ * 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 short value (16 bit).
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
+ */
+public abstract class IntOption extends DhcpOption {
+    /**
+     * The int value (represented as a long because of the unsignedness).
+     */
+    private long intValue;
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
+     */
+    public void setData(byte[] data) {
+        intValue = (data[0] & 0xff) << 24 | (data[1] & 0xff) << 16
+                | (data[2] & 0xff) << 8 | (data[3] & 0xff);
+    }
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
+     */
+    public byte[] getData() {
+        return new byte[]{(byte) (intValue >> 24 & 0xff),
+                (byte) (intValue >> 16 & 0xff), (byte) (intValue >> 8 & 0xff),
+                (byte) (intValue & 0xff)};
+    }
+
+    public long getIntValue() {
+        return intValue;
+    }
+
+    public void setIntValue(long intValue) {
+        this.intValue = intValue;
+    }
+}

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ShortOption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ShortOption.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ShortOption.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ShortOption.java Wed Aug  5 17:53:19 2009
@@ -1,64 +1,64 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.directory.server.dhcp.options;
-
-/**
- * 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 an unsigned short value
- * (16 bit).
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
- */
-public abstract class ShortOption extends DhcpOption {
-    /**
-     * The short value (represented as an int because of the unsignedness).
-     */
-    private int shortValue;
-
-    /*
-     * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
-     */
-    public void setData(byte[] data) {
-        shortValue = (data[0] & 0xff) << 8 | (data[1] & 0xff);
-    }
-
-    /*
-     * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
-     */
-    public byte[] getData() {
-        return new byte[]{(byte) (shortValue >> 8 & 0xff),
-                (byte) (shortValue & 0xff)};
-    }
-
-    public int getShortValue() {
-        return shortValue;
-    }
-
-    public void setShortValue(int shortValue) {
-        this.shortValue = shortValue;
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.server.dhcp.options;
+
+/**
+ * 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 an unsigned short value
+ * (16 bit).
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
+ */
+public abstract class ShortOption extends DhcpOption {
+    /**
+     * The short value (represented as an int because of the unsignedness).
+     */
+    private int shortValue;
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
+     */
+    public void setData(byte[] data) {
+        shortValue = (data[0] & 0xff) << 8 | (data[1] & 0xff);
+    }
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
+     */
+    public byte[] getData() {
+        return new byte[]{(byte) (shortValue >> 8 & 0xff),
+                (byte) (shortValue & 0xff)};
+    }
+
+    public int getShortValue() {
+        return shortValue;
+    }
+
+    public void setShortValue(int shortValue) {
+        this.shortValue = shortValue;
+    }
+}

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/StringOption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/StringOption.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/StringOption.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/StringOption.java Wed Aug  5 17:53:19 2009
@@ -1,93 +1,93 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.directory.server.dhcp.options;
-
-
-import java.io.UnsupportedEncodingException;
-
-
-/**
- * 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 string.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
- */
-public abstract class StringOption extends DhcpOption
-{
-    private String string;
-
-
-    /*
-     * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
-     */
-    public void setData( byte[] data )
-    {
-        try
-        {
-            string = new String( data, "ASCII" );
-        }
-        catch ( UnsupportedEncodingException e )
-        {
-            // should not happen
-            throw new RuntimeException( "ASCII encoding unavailable" );
-        }
-    }
-
-
-    /*
-     * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
-     */
-    public byte[] getData()
-    {
-        if ( null == string )
-            return new byte[]
-                {};
-
-        try
-        {
-            return string.getBytes( "ASCII" );
-        }
-        catch ( UnsupportedEncodingException e )
-        {
-            // should not happen
-            throw new RuntimeException( "ASCII encoding unavailable" );
-        }
-    }
-
-
-    public String getString()
-    {
-        return string;
-    }
-
-
-    public void setString( String string )
-    {
-        this.string = string;
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.server.dhcp.options;
+
+
+import java.io.UnsupportedEncodingException;
+
+
+/**
+ * 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 string.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
+ */
+public abstract class StringOption extends DhcpOption
+{
+    private String string;
+
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
+     */
+    public void setData( byte[] data )
+    {
+        try
+        {
+            string = new String( data, "ASCII" );
+        }
+        catch ( UnsupportedEncodingException e )
+        {
+            // should not happen
+            throw new RuntimeException( "ASCII encoding unavailable" );
+        }
+    }
+
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
+     */
+    public byte[] getData()
+    {
+        if ( null == string )
+            return new byte[]
+                {};
+
+        try
+        {
+            return string.getBytes( "ASCII" );
+        }
+        catch ( UnsupportedEncodingException e )
+        {
+            // should not happen
+            throw new RuntimeException( "ASCII encoding unavailable" );
+        }
+    }
+
+
+    public String getString()
+    {
+        return string;
+    }
+
+
+    public void setString( String string )
+    {
+        this.string = string;
+    }
+}

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/dhcp/UnrecognizedOption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/dhcp/UnrecognizedOption.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/dhcp/UnrecognizedOption.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/dhcp/UnrecognizedOption.java Wed Aug  5 17:53:19 2009
@@ -1,49 +1,49 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.directory.server.dhcp.options.dhcp;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
-
-/**
- * This pseudo option represents all options which have not been recognized and
- * parsed as specific implementations. No special semantics are associated with
- * it. Users are therefore required to manually deal with the contained data.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 552077 $, $Date: 2007-06-29 21:23:39 -0500 (Fr, 29 Jun 2007) $
- */
-public class UnrecognizedOption extends DhcpOption {
-    private final byte tag;
-
-    public UnrecognizedOption() {
-        tag = -1;
-    }
-
-    /*
-     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
-     */
-    public byte getTag() {
-        return tag;
-    }
-
-    public UnrecognizedOption(byte tag) {
-        this.tag = tag;
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.server.dhcp.options.dhcp;
+
+import org.apache.directory.server.dhcp.options.DhcpOption;
+
+/**
+ * This pseudo option represents all options which have not been recognized and
+ * parsed as specific implementations. No special semantics are associated with
+ * it. Users are therefore required to manually deal with the contained data.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 552077 $, $Date: 2007-06-29 21:23:39 -0500 (Fr, 29 Jun 2007) $
+ */
+public class UnrecognizedOption extends DhcpOption {
+    private final byte tag;
+
+    public UnrecognizedOption() {
+        tag = -1;
+    }
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
+     */
+    public byte getTag() {
+        return tag;
+    }
+
+    public UnrecognizedOption(byte tag) {
+        this.tag = tag;
+    }
+}

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java Wed Aug  5 17:53:19 2009
@@ -1,296 +1,296 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you 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.directory.server.dhcp.service;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.util.Iterator;
-
-import org.apache.directory.server.dhcp.DhcpException;
-import org.apache.directory.server.dhcp.messages.DhcpMessage;
-import org.apache.directory.server.dhcp.messages.MessageType;
-import org.apache.directory.server.dhcp.options.DhcpOption;
-import org.apache.directory.server.dhcp.options.OptionsField;
-import org.apache.directory.server.dhcp.options.dhcp.ParameterRequestList;
-import org.apache.directory.server.dhcp.options.dhcp.ServerIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Abstract implementation of the server-side DHCP protocol. This class just
- * provides some utility methods and dispatches server-bound messages to handler
- * methods which can be overridden to provide the functionality.
- * <p>
- * Client-bound messages and BOOTP messages are ignored.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 545042 $, $Date: 2007-06-06 22:32:01 -0500 (Mi, 06 Jun 2007) $
- * 
- */
-public abstract class AbstractDhcpService implements DhcpService {
-    private static final Logger logger = LoggerFactory
-            .getLogger(AbstractDhcpService.class);
-
-    /*
-     * @see org.apache.directory.server.dhcp.DhcpService#getReplyFor(org.apache.directory.server.dhcp.messages.DhcpMessage)
-     */
-    public final DhcpMessage getReplyFor(InetSocketAddress localAddress,
-            InetSocketAddress clientAddress, DhcpMessage request)
-            throws DhcpException {
-        // ignore messages with an op != REQUEST/REPLY
-        if (request.getOp() != DhcpMessage.OP_BOOTREQUEST
-                && request.getOp() != DhcpMessage.OP_BOOTREPLY)
-            return null;
-
-        // message type option MUST be set - we don't support plain BOOTP.
-        if (null == request.getMessageType()) {
-            logger.warn("Missing message type option - plain BOOTP not supported.");
-            return null;
-        }
-
-        // dispatch based on the message type
-        switch (request.getMessageType().getCode()){
-            // client-to-server messages
-            case MessageType.CODE_DHCPDISCOVER :
-                return handleDISCOVER(localAddress, clientAddress, request);
-            case MessageType.CODE_DHCPREQUEST :
-                return handleREQUEST(localAddress, clientAddress, request);
-            case MessageType.CODE_DHCPRELEASE :
-                return handleRELEASE(localAddress, clientAddress, request);
-            case MessageType.CODE_DHCPINFORM :
-                return handleINFORM(localAddress, clientAddress, request);
-
-            case MessageType.CODE_DHCPOFFER :
-                return handleOFFER(localAddress, clientAddress, request);
-
-                // server-to-client messages
-            case MessageType.CODE_DHCPDECLINE :
-            case MessageType.CODE_DHCPACK :
-            case MessageType.CODE_DHCPNAK :
-                return null; // just ignore them
-
-            default :
-                return handleUnknownMessage(clientAddress, request);
-        }
-    }
-
-    /**
-     * Handle unknown DHCP message. The default implementation just logs and
-     * ignores it.
-     * 
-     * @param clientAddress
-     * @param request the request message
-     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
-     *         it.
-     */
-    protected DhcpMessage handleUnknownMessage(InetSocketAddress clientAddress,
-            DhcpMessage request) {
-        if (logger.isWarnEnabled())
-            logger.warn("Got unknkown DHCP message: " + request + " from:  "
-                    + clientAddress);
-        return null;
-    }
-
-    /**
-     * Handle DHCPINFORM message. The default implementation just ignores it.
-     * 
-     * @param localAddress
-     * @param clientAddress
-     * @param request the request message
-     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
-     *         it.
-     */
-    protected DhcpMessage handleINFORM(InetSocketAddress localAddress,
-            InetSocketAddress clientAddress, DhcpMessage request)
-            throws DhcpException {
-        if (logger.isDebugEnabled())
-            logger.debug("Got INFORM message: " + request + " from:  "
-                    + clientAddress);
-        return null;
-    }
-
-    /**
-     * Handle DHCPRELEASE message. The default implementation just ignores it.
-     * 
-     * @param localAddress
-     * @param clientAddress
-     * @param request the request message
-     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
-     *         it.
-     */
-    protected DhcpMessage handleRELEASE(InetSocketAddress localAddress,
-            InetSocketAddress clientAddress, DhcpMessage request)
-            throws DhcpException {
-        if (logger.isDebugEnabled())
-            logger.debug("Got RELEASE message: " + request + " from:  "
-                    + clientAddress);
-        return null;
-    }
-
-    /**
-     * Handle DHCPREQUEST message. The default implementation just ignores it.
-     * 
-     * @param localAddress
-     * @param clientAddress
-     * @param request the request message
-     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
-     *         it.
-     */
-    protected DhcpMessage handleREQUEST(InetSocketAddress localAddress,
-            InetSocketAddress clientAddress, DhcpMessage request)
-            throws DhcpException {
-        if (logger.isDebugEnabled())
-            logger.debug("Got REQUEST message: " + request + " from:  "
-                    + clientAddress);
-        return null;
-    }
-
-    /**
-     * Handle DHCPDISCOVER message. The default implementation just ignores it.
-     * 
-     * @param localAddress
-     * @param clientAddress
-     * @param request the request message
-     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
-     *         it.
-     * @throws DhcpException
-     */
-    protected DhcpMessage handleDISCOVER(InetSocketAddress localAddress,
-            InetSocketAddress clientAddress, DhcpMessage request)
-            throws DhcpException {
-        if (logger.isDebugEnabled())
-            logger.debug("Got DISCOVER message: " + request + " from:  "
-                    + clientAddress);
-        return null;
-    }
-
-    /**
-     * Handle DHCPOFFER message. The default implementation just ignores it.
-     * 
-     * @param localAddress
-     * @param clientAddress
-     * @param request the request message
-     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
-     *         it.
-     * @throws DhcpException
-     */
-    protected DhcpMessage handleOFFER(InetSocketAddress localAddress,
-            InetSocketAddress clientAddress, DhcpMessage request)
-            throws DhcpException {
-        if (logger.isDebugEnabled())
-            logger
-                    .debug("Got OFFER message: " + request + " from:  " + clientAddress);
-        return null;
-    }
-
-    /**
-     * Initialize a general DHCP reply message. Sets:
-     * <ul>
-     * <li>op=BOOTREPLY
-     * <li>htype, hlen, xid, flags, giaddr, chaddr like in request message
-     * <li>hops, secs to 0.
-     * <li>server hostname to the hostname appropriate for the interface the
-     * request was received on
-     * <li>the server identifier set to the address of the interface the request
-     * was received on
-     * </ul>
-     * 
-     * @param localAddress
-     * @param request
-     * @return DhcpMessage
-     */
-    protected final DhcpMessage initGeneralReply(InetSocketAddress localAddress,
-            DhcpMessage request) {
-        final DhcpMessage reply = new DhcpMessage();
-
-        reply.setOp(DhcpMessage.OP_BOOTREPLY);
-
-        reply.setHardwareAddress(request.getHardwareAddress());
-        reply.setTransactionId(request.getTransactionId());
-        reply.setFlags(request.getFlags());
-        reply.setRelayAgentAddress(request.getRelayAgentAddress());
-
-        // set server hostname
-        reply.setServerHostname(localAddress.getHostName());
-
-        // set server identifier based on the IF on which we received the packet
-        reply.getOptions().add(new ServerIdentifier(localAddress.getAddress()));
-
-        return reply;
-    }
-
-    /**
-     * Check if an address is the zero-address
-     * 
-     * @param addr
-     * @return boolean
-     */
-    private boolean isZeroAddress(byte[] addr) {
-        for (int i = 0; i < addr.length; i++)
-            if (addr[i] != 0)
-                return false;
-        return true;
-    }
-
-    /**
-     * Determine address on which to base selection. If the relay agent address is
-     * set, we use the relay agent's address, otherwise we use the address we
-     * received the request from.
-     * 
-     * @param clientAddress
-     * @param request
-     * @return InetAddress
-     */
-    protected final InetAddress determineSelectionBase(
-            InetSocketAddress clientAddress, DhcpMessage request) {
-        // FIXME: do we know
-        // a) the interface address over which we received a message (!)
-        // b) the client address (if specified)
-        // c) the relay agent address?
-
-        // if the relay agent address is set, we use it as the selection base
-        if (!isZeroAddress(request.getRelayAgentAddress().getAddress()))
-            return request.getRelayAgentAddress();
-
-        return clientAddress.getAddress();
-    }
-
-    /**
-     * Strip options that the client doesn't want, if the ParameterRequestList
-     * option is present.
-     * 
-     * @param request
-     * @param options
-     */
-    protected final void stripUnwantedOptions(DhcpMessage request,
-            OptionsField options) {
-        final ParameterRequestList prl = (ParameterRequestList) request
-                .getOptions().get(ParameterRequestList.class);
-        if (null != prl) {
-            final byte[] list = prl.getData();
-            for (final Iterator i = options.iterator(); i.hasNext();) {
-                final DhcpOption o = (DhcpOption) i.next();
-                for (int j = 0; j < list.length; j++)
-                    if (list[j] == o.getTag())
-                        continue;
-                i.remove();
-            }
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you 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.directory.server.dhcp.service;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.util.Iterator;
+
+import org.apache.directory.server.dhcp.DhcpException;
+import org.apache.directory.server.dhcp.messages.DhcpMessage;
+import org.apache.directory.server.dhcp.messages.MessageType;
+import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.OptionsField;
+import org.apache.directory.server.dhcp.options.dhcp.ParameterRequestList;
+import org.apache.directory.server.dhcp.options.dhcp.ServerIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract implementation of the server-side DHCP protocol. This class just
+ * provides some utility methods and dispatches server-bound messages to handler
+ * methods which can be overridden to provide the functionality.
+ * <p>
+ * Client-bound messages and BOOTP messages are ignored.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 545042 $, $Date: 2007-06-06 22:32:01 -0500 (Mi, 06 Jun 2007) $
+ * 
+ */
+public abstract class AbstractDhcpService implements DhcpService {
+    private static final Logger logger = LoggerFactory
+            .getLogger(AbstractDhcpService.class);
+
+    /*
+     * @see org.apache.directory.server.dhcp.DhcpService#getReplyFor(org.apache.directory.server.dhcp.messages.DhcpMessage)
+     */
+    public final DhcpMessage getReplyFor(InetSocketAddress localAddress,
+            InetSocketAddress clientAddress, DhcpMessage request)
+            throws DhcpException {
+        // ignore messages with an op != REQUEST/REPLY
+        if (request.getOp() != DhcpMessage.OP_BOOTREQUEST
+                && request.getOp() != DhcpMessage.OP_BOOTREPLY)
+            return null;
+
+        // message type option MUST be set - we don't support plain BOOTP.
+        if (null == request.getMessageType()) {
+            logger.warn("Missing message type option - plain BOOTP not supported.");
+            return null;
+        }
+
+        // dispatch based on the message type
+        switch (request.getMessageType().getCode()){
+            // client-to-server messages
+            case MessageType.CODE_DHCPDISCOVER :
+                return handleDISCOVER(localAddress, clientAddress, request);
+            case MessageType.CODE_DHCPREQUEST :
+                return handleREQUEST(localAddress, clientAddress, request);
+            case MessageType.CODE_DHCPRELEASE :
+                return handleRELEASE(localAddress, clientAddress, request);
+            case MessageType.CODE_DHCPINFORM :
+                return handleINFORM(localAddress, clientAddress, request);
+
+            case MessageType.CODE_DHCPOFFER :
+                return handleOFFER(localAddress, clientAddress, request);
+
+                // server-to-client messages
+            case MessageType.CODE_DHCPDECLINE :
+            case MessageType.CODE_DHCPACK :
+            case MessageType.CODE_DHCPNAK :
+                return null; // just ignore them
+
+            default :
+                return handleUnknownMessage(clientAddress, request);
+        }
+    }
+
+    /**
+     * Handle unknown DHCP message. The default implementation just logs and
+     * ignores it.
+     * 
+     * @param clientAddress
+     * @param request the request message
+     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+     *         it.
+     */
+    protected DhcpMessage handleUnknownMessage(InetSocketAddress clientAddress,
+            DhcpMessage request) {
+        if (logger.isWarnEnabled())
+            logger.warn("Got unknkown DHCP message: " + request + " from:  "
+                    + clientAddress);
+        return null;
+    }
+
+    /**
+     * Handle DHCPINFORM message. The default implementation just ignores it.
+     * 
+     * @param localAddress
+     * @param clientAddress
+     * @param request the request message
+     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+     *         it.
+     */
+    protected DhcpMessage handleINFORM(InetSocketAddress localAddress,
+            InetSocketAddress clientAddress, DhcpMessage request)
+            throws DhcpException {
+        if (logger.isDebugEnabled())
+            logger.debug("Got INFORM message: " + request + " from:  "
+                    + clientAddress);
+        return null;
+    }
+
+    /**
+     * Handle DHCPRELEASE message. The default implementation just ignores it.
+     * 
+     * @param localAddress
+     * @param clientAddress
+     * @param request the request message
+     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+     *         it.
+     */
+    protected DhcpMessage handleRELEASE(InetSocketAddress localAddress,
+            InetSocketAddress clientAddress, DhcpMessage request)
+            throws DhcpException {
+        if (logger.isDebugEnabled())
+            logger.debug("Got RELEASE message: " + request + " from:  "
+                    + clientAddress);
+        return null;
+    }
+
+    /**
+     * Handle DHCPREQUEST message. The default implementation just ignores it.
+     * 
+     * @param localAddress
+     * @param clientAddress
+     * @param request the request message
+     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+     *         it.
+     */
+    protected DhcpMessage handleREQUEST(InetSocketAddress localAddress,
+            InetSocketAddress clientAddress, DhcpMessage request)
+            throws DhcpException {
+        if (logger.isDebugEnabled())
+            logger.debug("Got REQUEST message: " + request + " from:  "
+                    + clientAddress);
+        return null;
+    }
+
+    /**
+     * Handle DHCPDISCOVER message. The default implementation just ignores it.
+     * 
+     * @param localAddress
+     * @param clientAddress
+     * @param request the request message
+     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+     *         it.
+     * @throws DhcpException
+     */
+    protected DhcpMessage handleDISCOVER(InetSocketAddress localAddress,
+            InetSocketAddress clientAddress, DhcpMessage request)
+            throws DhcpException {
+        if (logger.isDebugEnabled())
+            logger.debug("Got DISCOVER message: " + request + " from:  "
+                    + clientAddress);
+        return null;
+    }
+
+    /**
+     * Handle DHCPOFFER message. The default implementation just ignores it.
+     * 
+     * @param localAddress
+     * @param clientAddress
+     * @param request the request message
+     * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+     *         it.
+     * @throws DhcpException
+     */
+    protected DhcpMessage handleOFFER(InetSocketAddress localAddress,
+            InetSocketAddress clientAddress, DhcpMessage request)
+            throws DhcpException {
+        if (logger.isDebugEnabled())
+            logger
+                    .debug("Got OFFER message: " + request + " from:  " + clientAddress);
+        return null;
+    }
+
+    /**
+     * Initialize a general DHCP reply message. Sets:
+     * <ul>
+     * <li>op=BOOTREPLY
+     * <li>htype, hlen, xid, flags, giaddr, chaddr like in request message
+     * <li>hops, secs to 0.
+     * <li>server hostname to the hostname appropriate for the interface the
+     * request was received on
+     * <li>the server identifier set to the address of the interface the request
+     * was received on
+     * </ul>
+     * 
+     * @param localAddress
+     * @param request
+     * @return DhcpMessage
+     */
+    protected final DhcpMessage initGeneralReply(InetSocketAddress localAddress,
+            DhcpMessage request) {
+        final DhcpMessage reply = new DhcpMessage();
+
+        reply.setOp(DhcpMessage.OP_BOOTREPLY);
+
+        reply.setHardwareAddress(request.getHardwareAddress());
+        reply.setTransactionId(request.getTransactionId());
+        reply.setFlags(request.getFlags());
+        reply.setRelayAgentAddress(request.getRelayAgentAddress());
+
+        // set server hostname
+        reply.setServerHostname(localAddress.getHostName());
+
+        // set server identifier based on the IF on which we received the packet
+        reply.getOptions().add(new ServerIdentifier(localAddress.getAddress()));
+
+        return reply;
+    }
+
+    /**
+     * Check if an address is the zero-address
+     * 
+     * @param addr
+     * @return boolean
+     */
+    private boolean isZeroAddress(byte[] addr) {
+        for (int i = 0; i < addr.length; i++)
+            if (addr[i] != 0)
+                return false;
+        return true;
+    }
+
+    /**
+     * Determine address on which to base selection. If the relay agent address is
+     * set, we use the relay agent's address, otherwise we use the address we
+     * received the request from.
+     * 
+     * @param clientAddress
+     * @param request
+     * @return InetAddress
+     */
+    protected final InetAddress determineSelectionBase(
+            InetSocketAddress clientAddress, DhcpMessage request) {
+        // FIXME: do we know
+        // a) the interface address over which we received a message (!)
+        // b) the client address (if specified)
+        // c) the relay agent address?
+
+        // if the relay agent address is set, we use it as the selection base
+        if (!isZeroAddress(request.getRelayAgentAddress().getAddress()))
+            return request.getRelayAgentAddress();
+
+        return clientAddress.getAddress();
+    }
+
+    /**
+     * Strip options that the client doesn't want, if the ParameterRequestList
+     * option is present.
+     * 
+     * @param request
+     * @param options
+     */
+    protected final void stripUnwantedOptions(DhcpMessage request,
+            OptionsField options) {
+        final ParameterRequestList prl = (ParameterRequestList) request
+                .getOptions().get(ParameterRequestList.class);
+        if (null != prl) {
+            final byte[] list = prl.getData();
+            for (final Iterator i = options.iterator(); i.hasNext();) {
+                final DhcpOption o = (DhcpOption) i.next();
+                for (int j = 0; j < list.length; j++)
+                    if (list[j] == o.getTag())
+                        continue;
+                i.remove();
+            }
+        }
+    }
+}

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java Wed Aug  5 17:53:19 2009
@@ -1,49 +1,49 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.directory.server.dhcp.service;
-
-
-import java.net.InetSocketAddress;
-
-import org.apache.directory.server.dhcp.DhcpException;
-import org.apache.directory.server.dhcp.messages.DhcpMessage;
-
-
-/**
- * DHCP Protocol (RFC 2131, RFC 2132). Implementations of the DHCP service must
- * be thread-safe with respect to concurrent calls to getReplyFor().
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 545042 $, $Date: 2007-06-06 22:32:01 -0500 (Mi, 06 Jun 2007) $
- */
-public interface DhcpService
-{
-    /**
-     * Retrieve the reply to a given message. The reply may be zero, if the
-     * message should be ignored.
-     * @param localAddress TODO
-     * @param clientAddress 
-     * @param request
-     * @return DhcpMessage
-     * @throws DhcpException 
-     */
-    public DhcpMessage getReplyFor( InetSocketAddress localAddress, InetSocketAddress clientAddress, DhcpMessage request ) throws DhcpException;
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.server.dhcp.service;
+
+
+import java.net.InetSocketAddress;
+
+import org.apache.directory.server.dhcp.DhcpException;
+import org.apache.directory.server.dhcp.messages.DhcpMessage;
+
+
+/**
+ * DHCP Protocol (RFC 2131, RFC 2132). Implementations of the DHCP service must
+ * be thread-safe with respect to concurrent calls to getReplyFor().
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 545042 $, $Date: 2007-06-06 22:32:01 -0500 (Mi, 06 Jun 2007) $
+ */
+public interface DhcpService
+{
+    /**
+     * Retrieve the reply to a given message. The reply may be zero, if the
+     * message should be ignored.
+     * @param localAddress TODO
+     * @param clientAddress 
+     * @param request
+     * @return DhcpMessage
+     * @throws DhcpException 
+     */
+    public DhcpMessage getReplyFor( InetSocketAddress localAddress, InetSocketAddress clientAddress, DhcpMessage request ) throws DhcpException;
+}

Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java?rev=801338&r1=801337&r2=801338&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java Wed Aug  5 17:53:19 2009
@@ -1,174 +1,174 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.directory.server.dhcp.service;
-
-
-import java.net.InetAddress;
-
-import org.apache.directory.server.dhcp.messages.HardwareAddress;
-import org.apache.directory.server.dhcp.options.OptionsField;
-
-
-/**
- * Leases represent a temporary assignment of an IP address to a DHCP client.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev: 545042 $, $Date: 2007-06-06 22:32:01 -0500 (Mi, 06 Jun 2007) $
- */
-public class Lease
-{
-    /** Lease state: newly created */
-    public static final int STATE_NEW = 1;
-
-    /** Lease state: offered to client */
-    public static final int STATE_OFFERED = 2;
-
-    /** Lease state: active - assigned to client */
-    public static final int STATE_ACTIVE = 3;
-
-    /** Lease state: released by client */
-    public static final int STATE_RELEASED = 4;
-
-    /** Lease state: expired */
-    public static final int STATE_EXPIRED = 5;
-
-    /**
-     * The lease's state.
-     * 
-     * @see #STATE_NEW
-     * @see #STATE_OFFERED
-     * @see #STATE_ACTIVE
-     * @see #STATE_RELEASED
-     * @see #STATE_EXPIRED
-     */
-    private int state;
-
-    /**
-     * The assigned client address.
-     */
-    private InetAddress clientAddress;
-
-    /**
-     * The client's hardware address.
-     */
-    private HardwareAddress hardwareAddress;
-
-    /**
-     * The next-server (boot-server) address.
-     */
-    private InetAddress nextServerAddress;
-
-    /**
-     * The DhcpOptions to provide to the client along with the lease.
-     */
-    private OptionsField options = new OptionsField();
-
-    private long acquired = -1;
-
-    private long expires = -1;
-
-
-    /**
-     * @return InetAddress
-     */
-    public InetAddress getClientAddress()
-    {
-        return clientAddress;
-    }
-
-
-    /**
-     * @return InetAddress
-     */
-    public InetAddress getNextServerAddress()
-    {
-        return nextServerAddress;
-    }
-
-
-    /**
-     * @return OptionsField
-     */
-    public OptionsField getOptions()
-    {
-        return options;
-    }
-
-
-    /**
-     * @return int
-     */
-    public int getState()
-    {
-        return state;
-    }
-
-
-    /**
-     * @param state
-     */
-    public void setState( int state )
-    {
-        this.state = state;
-    }
-
-
-    public HardwareAddress getHardwareAddress()
-    {
-        return hardwareAddress;
-    }
-
-
-    public void setHardwareAddress( HardwareAddress hardwareAddress )
-    {
-        this.hardwareAddress = hardwareAddress;
-    }
-
-
-    public long getAcquired()
-    {
-        return acquired;
-    }
-
-
-    public void setAcquired( long acquired )
-    {
-        this.acquired = acquired;
-    }
-
-
-    public long getExpires()
-    {
-        return expires;
-    }
-
-
-    public void setExpires( long expires )
-    {
-        this.expires = expires;
-    }
-
-
-    public void setClientAddress( InetAddress clientAddress )
-    {
-        this.clientAddress = clientAddress;
-    }
-
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.directory.server.dhcp.service;
+
+
+import java.net.InetAddress;
+
+import org.apache.directory.server.dhcp.messages.HardwareAddress;
+import org.apache.directory.server.dhcp.options.OptionsField;
+
+
+/**
+ * Leases represent a temporary assignment of an IP address to a DHCP client.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 545042 $, $Date: 2007-06-06 22:32:01 -0500 (Mi, 06 Jun 2007) $
+ */
+public class Lease
+{
+    /** Lease state: newly created */
+    public static final int STATE_NEW = 1;
+
+    /** Lease state: offered to client */
+    public static final int STATE_OFFERED = 2;
+
+    /** Lease state: active - assigned to client */
+    public static final int STATE_ACTIVE = 3;
+
+    /** Lease state: released by client */
+    public static final int STATE_RELEASED = 4;
+
+    /** Lease state: expired */
+    public static final int STATE_EXPIRED = 5;
+
+    /**
+     * The lease's state.
+     * 
+     * @see #STATE_NEW
+     * @see #STATE_OFFERED
+     * @see #STATE_ACTIVE
+     * @see #STATE_RELEASED
+     * @see #STATE_EXPIRED
+     */
+    private int state;
+
+    /**
+     * The assigned client address.
+     */
+    private InetAddress clientAddress;
+
+    /**
+     * The client's hardware address.
+     */
+    private HardwareAddress hardwareAddress;
+
+    /**
+     * The next-server (boot-server) address.
+     */
+    private InetAddress nextServerAddress;
+
+    /**
+     * The DhcpOptions to provide to the client along with the lease.
+     */
+    private OptionsField options = new OptionsField();
+
+    private long acquired = -1;
+
+    private long expires = -1;
+
+
+    /**
+     * @return InetAddress
+     */
+    public InetAddress getClientAddress()
+    {
+        return clientAddress;
+    }
+
+
+    /**
+     * @return InetAddress
+     */
+    public InetAddress getNextServerAddress()
+    {
+        return nextServerAddress;
+    }
+
+
+    /**
+     * @return OptionsField
+     */
+    public OptionsField getOptions()
+    {
+        return options;
+    }
+
+
+    /**
+     * @return int
+     */
+    public int getState()
+    {
+        return state;
+    }
+
+
+    /**
+     * @param state
+     */
+    public void setState( int state )
+    {
+        this.state = state;
+    }
+
+
+    public HardwareAddress getHardwareAddress()
+    {
+        return hardwareAddress;
+    }
+
+
+    public void setHardwareAddress( HardwareAddress hardwareAddress )
+    {
+        this.hardwareAddress = hardwareAddress;
+    }
+
+
+    public long getAcquired()
+    {
+        return acquired;
+    }
+
+
+    public void setAcquired( long acquired )
+    {
+        this.acquired = acquired;
+    }
+
+
+    public long getExpires()
+    {
+        return expires;
+    }
+
+
+    public void setExpires( long expires )
+    {
+        this.expires = expires;
+    }
+
+
+    public void setClientAddress( InetAddress clientAddress )
+    {
+        this.clientAddress = clientAddress;
+    }
+
+}