directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henn...@apache.org
Subject svn commit: r628890 [3/4] - in /directory/apacheds/branches/bigbang/protocol-dhcp/src: main/java/org/apache/directory/server/dhcp/ main/java/org/apache/directory/server/dhcp/io/ main/java/org/apache/directory/server/dhcp/messages/ main/java/org/apache/...
Date Mon, 18 Feb 2008 22:14:21 GMT
Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/BroadcastAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/BroadcastAddress.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/BroadcastAddress.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/BroadcastAddress.java Mon Feb 18 14:14:09 2008
@@ -21,9 +21,7 @@
 package org.apache.directory.server.dhcp.options.perinterface;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.AddressOption;
 
 
 /**
@@ -35,25 +33,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class BroadcastAddress extends DhcpOption
+public class BroadcastAddress extends AddressOption
 {
-    private byte[] broadcastAddress;
-
-
-    /**
-     * Creates a new instance of BroadcastAddress.
-     *
-     * @param broadcastAddress
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public BroadcastAddress( byte[] broadcastAddress )
-    {
-        super( 28, 4 );
-        this.broadcastAddress = broadcastAddress;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( broadcastAddress );
+        return 28;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/InterfaceMtu.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/InterfaceMtu.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/InterfaceMtu.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/InterfaceMtu.java Mon Feb 18 14:14:09 2008
@@ -21,9 +21,7 @@
 package org.apache.directory.server.dhcp.options.perinterface;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.ShortOption;
 
 
 /**
@@ -36,25 +34,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class InterfaceMtu extends DhcpOption
+public class InterfaceMtu extends ShortOption
 {
-    private byte[] interfaceMtu;
-
-
-    /**
-     * Creates a new instance of InterfaceMtu.
-     *
-     * @param interfaceMtu
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public InterfaceMtu( byte[] interfaceMtu )
-    {
-        super( 26, 2 );
-        this.interfaceMtu = interfaceMtu;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( interfaceMtu );
+        return 26;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/MaskSupplier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/MaskSupplier.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/MaskSupplier.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/MaskSupplier.java Mon Feb 18 14:14:09 2008
@@ -21,9 +21,7 @@
 package org.apache.directory.server.dhcp.options.perinterface;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.ByteOption;
 
 
 /**
@@ -37,25 +35,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class MaskSupplier extends DhcpOption
+public class MaskSupplier extends ByteOption
 {
-    private byte[] maskSupplier;
-
-
-    /**
-     * Creates a new instance of MaskSupplier.
-     *
-     * @param maskSupplier
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public MaskSupplier( byte[] maskSupplier )
-    {
-        super( 30, 1 );
-        this.maskSupplier = maskSupplier;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( maskSupplier );
+        return 30;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/PerformMaskDiscovery.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/PerformMaskDiscovery.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/PerformMaskDiscovery.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/PerformMaskDiscovery.java Mon Feb 18 14:14:09 2008
@@ -21,9 +21,7 @@
 package org.apache.directory.server.dhcp.options.perinterface;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.ByteOption;
 
 
 /**
@@ -37,25 +35,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class PerformMaskDiscovery extends DhcpOption
+public class PerformMaskDiscovery extends ByteOption
 {
-    private byte[] performMaskDiscovery;
-
-
-    /**
-     * Creates a new instance of PerformMaskDiscovery.
-     *
-     * @param performMaskDiscovery
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public PerformMaskDiscovery( byte[] performMaskDiscovery )
-    {
-        super( 29, 1 );
-        this.performMaskDiscovery = performMaskDiscovery;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( performMaskDiscovery );
+        return 29;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/PerformRouterDiscovery.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/PerformRouterDiscovery.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/PerformRouterDiscovery.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/PerformRouterDiscovery.java Mon Feb 18 14:14:09 2008
@@ -21,8 +21,6 @@
 package org.apache.directory.server.dhcp.options.perinterface;
 
 
-import java.nio.ByteBuffer;
-
 import org.apache.directory.server.dhcp.options.DhcpOption;
 
 
@@ -40,23 +38,11 @@
  */
 public class PerformRouterDiscovery extends DhcpOption
 {
-    private byte[] performRouterDiscovery;
-
-
-    /**
-     * Creates a new instance of PerformRouterDiscovery.
-     *
-     * @param performRouterDiscovery
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public PerformRouterDiscovery( byte[] performRouterDiscovery )
-    {
-        super( 31, 1 );
-        this.performRouterDiscovery = performRouterDiscovery;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( performRouterDiscovery );
+        return 31;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/RouterSolicitationAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/RouterSolicitationAddress.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/RouterSolicitationAddress.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/RouterSolicitationAddress.java Mon Feb 18 14:14:09 2008
@@ -21,9 +21,7 @@
 package org.apache.directory.server.dhcp.options.perinterface;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.AddressOption;
 
 
 /**
@@ -35,25 +33,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class RouterSolicitationAddress extends DhcpOption
+public class RouterSolicitationAddress extends AddressOption
 {
-    private byte[] routerSolicitationAddress;
-
-
-    /**
-     * Creates a new instance of RouterSolicitationAddress.
-     *
-     * @param routerSolicitationAddress
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public RouterSolicitationAddress( byte[] routerSolicitationAddress )
-    {
-        super( 32, 4 );
-        this.routerSolicitationAddress = routerSolicitationAddress;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( routerSolicitationAddress );
+        return 32;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/StaticRoute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/StaticRoute.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/StaticRoute.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/perinterface/StaticRoute.java Mon Feb 18 14:14:09 2008
@@ -21,8 +21,6 @@
 package org.apache.directory.server.dhcp.options.perinterface;
 
 
-import java.nio.ByteBuffer;
-
 import org.apache.directory.server.dhcp.options.DhcpOption;
 
 
@@ -47,23 +45,11 @@
  */
 public class StaticRoute extends DhcpOption
 {
-    private byte[] staticRoute;
-
-
-    /**
-     * Creates a new instance of StaticRoute.
-     *
-     * @param staticRoute
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public StaticRoute( byte[] staticRoute )
-    {
-        super( 33, 8 );
-        this.staticRoute = staticRoute;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( staticRoute );
+        return 33;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpDefaultTimeToLive.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpDefaultTimeToLive.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpDefaultTimeToLive.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpDefaultTimeToLive.java Mon Feb 18 14:14:09 2008
@@ -21,9 +21,7 @@
 package org.apache.directory.server.dhcp.options.tcp;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.ByteOption;
 
 
 /**
@@ -36,25 +34,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class TcpDefaultTimeToLive extends DhcpOption
+public class TcpDefaultTimeToLive extends ByteOption
 {
-    private byte[] tcpDefaultTimeToLive;
-
-
-    /**
-     * Creates a new instance of TcpDefaultTimeToLive.
-     *
-     * @param tcpDefaultTimeToLive
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public TcpDefaultTimeToLive( byte[] tcpDefaultTimeToLive )
-    {
-        super( 37, 1 );
-        this.tcpDefaultTimeToLive = tcpDefaultTimeToLive;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( tcpDefaultTimeToLive );
+        return 37;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpKeepaliveGarbage.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpKeepaliveGarbage.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpKeepaliveGarbage.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpKeepaliveGarbage.java Mon Feb 18 14:14:09 2008
@@ -21,9 +21,7 @@
 package org.apache.directory.server.dhcp.options.tcp;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.IntOption;
 
 
 /**
@@ -38,25 +36,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class TcpKeepaliveGarbage extends DhcpOption
+public class TcpKeepaliveGarbage extends IntOption
 {
-    private byte[] tcpKeepaliveGarbage;
-
-
-    /**
-     * Creates a new instance of TcpKeepaliveGarbage.
-     *
-     * @param tcpKeepaliveGarbage
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public TcpKeepaliveGarbage( byte[] tcpKeepaliveGarbage )
-    {
-        super( 38, 4 );
-        this.tcpKeepaliveGarbage = tcpKeepaliveGarbage;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( tcpKeepaliveGarbage );
+        return 38;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpKeepaliveInterval.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpKeepaliveInterval.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpKeepaliveInterval.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/tcp/TcpKeepaliveInterval.java Mon Feb 18 14:14:09 2008
@@ -21,9 +21,7 @@
 package org.apache.directory.server.dhcp.options.tcp;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.ByteOption;
 
 
 /**
@@ -38,25 +36,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class TcpKeepaliveInterval extends DhcpOption
+public class TcpKeepaliveInterval extends ByteOption
 {
-    private byte[] tcpKeepaliveInterval;
-
-
-    /**
-     * Creates a new instance of TcpKeepaliveInterval.
-     *
-     * @param tcpKeepaliveInterval
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public TcpKeepaliveInterval( byte[] tcpKeepaliveInterval )
-    {
-        super( 39, 1 );
-        this.tcpKeepaliveInterval = tcpKeepaliveInterval;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( tcpKeepaliveInterval );
+        return 39;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/BootFileSize.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/BootFileSize.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/BootFileSize.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/BootFileSize.java Mon Feb 18 14:14:09 2008
@@ -18,44 +18,29 @@
  *  
  */
 
-/**
- * This option specifies the length in 512-octet blocks of the default
- * boot image for the client.  The file length is specified as an
- * unsigned 16-bit integer.
- * 
- * The code for this option is 13, and its length is 2.
- */
 package org.apache.directory.server.dhcp.options.vendor;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.ShortOption;
 
 
 /**
+ * This option specifies the length in 512-octet blocks of the default
+ * boot image for the client.  The file length is specified as an
+ * unsigned 16-bit integer.
+ * 
+ * The code for this option is 13, and its length is 2.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class BootFileSize extends DhcpOption
+public class BootFileSize extends ShortOption
 {
-    private byte[] bootFileSize;
-
-
-    /**
-     * Creates a new instance of BootFileSize.
-     *
-     * @param bootFileSize
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public BootFileSize( byte[] bootFileSize )
-    {
-        super( 13, 2 );
-        this.bootFileSize = bootFileSize;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( bootFileSize );
+        return 21;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/CookieServers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/CookieServers.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/CookieServers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/CookieServers.java Mon Feb 18 14:14:09 2008
@@ -1,31 +1,20 @@
 /*
- *  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. 
- *  
+ *   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.
+ *
  */
 
-/**
- * The cookie server option specifies a list of RFC 865 cookie
- * servers available to the client.  Servers SHOULD be listed in order
- * of preference.
- * 
- * The code for the log server option is 8.  The minimum length for this
- * option is 4 octets, and the length MUST always be a multiple of 4.
- */
 package org.apache.directory.server.dhcp.options.vendor;
 
 
@@ -33,18 +22,23 @@
 
 
 /**
+ * The cookie server option specifies a list of RFC 865 cookie
+ * servers available to the client.  Servers SHOULD be listed in order
+ * of preference.
+ * 
+ * The code for the log server option is 8.  The minimum length for this
+ * option is 4 octets, and the length MUST always be a multiple of 4.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class CookieServers extends AddressListOption
 {
-    /**
-     * Creates a new instance of CookieServers.
-     *
-     * @param cookieServers
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public CookieServers( byte[] cookieServers )
+    public byte getTag()
     {
-        super( 8, cookieServers );
+        return 8;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/DomainName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/DomainName.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/DomainName.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/DomainName.java Mon Feb 18 14:14:09 2008
@@ -18,43 +18,29 @@
  *  
  */
 
-/**
- * This option specifies the domain name that client should use when
- * resolving hostnames via the Domain Name System.
- * 
- * The code for this option is 15.  Its minimum length is 1.
- */
 package org.apache.directory.server.dhcp.options.vendor;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.StringOption;
 
 
 /**
+ * This option specifies the domain name that client should use when
+ * resolving hostnames via the Domain Name System.
+ * 
+ * The code for this option is 15.  Its minimum length is 1.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DomainName extends DhcpOption
+public class DomainName extends StringOption
 {
-    private byte[] domainName;
-
-
-    /**
-     * Creates a new instance of DomainName.
-     *
-     * @param domainName
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public DomainName( byte[] domainName )
+    public byte getTag()
     {
-        super( 15, 1 );
-        this.domainName = domainName;
+        return 15;
     }
 
-
-    protected void valueToByteBuffer( ByteBuffer out )
-    {
-        out.put( domainName );
-    }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/DomainNameServers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/DomainNameServers.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/DomainNameServers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/DomainNameServers.java Mon Feb 18 14:14:09 2008
@@ -18,6 +18,12 @@
  *  
  */
 
+package org.apache.directory.server.dhcp.options.vendor;
+
+
+import org.apache.directory.server.dhcp.options.AddressListOption;
+
+
 /**
  * The domain name server option specifies a list of Domain Name System
  * (STD 13, RFC 1035 [8]) name servers available to the client.  Servers
@@ -26,26 +32,17 @@
  * The code for the domain name server option is 6.  The minimum length
  * for this option is 4 octets, and the length MUST always be a multiple
  * of 4.
- */
-package org.apache.directory.server.dhcp.options.vendor;
-
-
-import org.apache.directory.server.dhcp.options.AddressListOption;
-
-
-/**
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class DomainNameServers extends AddressListOption
 {
-    /**
-     * Creates a new instance of DomainNameServers.
-     *
-     * @param domainNameServers
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public DomainNameServers( byte[] domainNameServers )
+    public byte getTag()
     {
-        super( 6, domainNameServers );
+        return 6;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ExtensionsPath.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ExtensionsPath.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ExtensionsPath.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ExtensionsPath.java Mon Feb 18 14:14:09 2008
@@ -18,6 +18,12 @@
  *  
  */
 
+package org.apache.directory.server.dhcp.options.vendor;
+
+
+import org.apache.directory.server.dhcp.options.StringOption;
+
+
 /**
  * A string to specify a file, retrievable via TFTP, which contains
  * information which can be interpreted in the same way as the 64-octet
@@ -30,38 +36,17 @@
  *          ignored.
  * 
  * The code for this option is 18.  Its minimum length is 1.
- */
-package org.apache.directory.server.dhcp.options.vendor;
-
-
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
-
-
-/**
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ExtensionsPath extends DhcpOption
+public class ExtensionsPath extends StringOption
 {
-    private byte[] extensionsPath;
-
-
-    /**
-     * Creates a new instance of ExtensionsPath.
-     *
-     * @param extensionsPath
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public ExtensionsPath( byte[] extensionsPath )
-    {
-        super( 18, 1 );
-        this.extensionsPath = extensionsPath;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( extensionsPath );
+        return 18;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/HostName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/HostName.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/HostName.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/HostName.java Mon Feb 18 14:14:09 2008
@@ -18,6 +18,12 @@
  *  
  */
 
+package org.apache.directory.server.dhcp.options.vendor;
+
+
+import org.apache.directory.server.dhcp.options.StringOption;
+
+
 /**
  * This option specifies the name of the client.  The name may or may
  * not be qualified with the local domain name (see section 3.17 for the
@@ -25,38 +31,30 @@
  * character set restrictions.
  * 
  * The code for this option is 12, and its minimum length is 1.
- */
-package org.apache.directory.server.dhcp.options.vendor;
-
-
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
-
-
-/**
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class HostName extends DhcpOption
+public class HostName extends StringOption
 {
-    private byte[] hostName;
-
-
+    public HostName()
+    {
+    }
+    
     /**
-     * Creates a new instance of HostName.
-     *
-     * @param hostName
+     * @param string
      */
-    public HostName( byte[] hostName )
+    public HostName(String name)
     {
-        super( 12, 1 );
-        this.hostName = hostName;
+        setString( name );
     }
 
 
-    protected void valueToByteBuffer( ByteBuffer out )
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
+     */
+    public byte getTag()
     {
-        out.put( hostName );
+        return 12;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ImpressServers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ImpressServers.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ImpressServers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ImpressServers.java Mon Feb 18 14:14:09 2008
@@ -1,21 +1,18 @@
 /*
- *  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. 
- *  
+ *   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.
+ *
  */
 
 /**
@@ -34,18 +31,24 @@
 
 
 /**
+ * The Impress server option specifies a list of Imagen Impress servers
+ * available to the client.  Servers SHOULD be listed in order of
+ * preference.
+ * 
+ * The code for the Impress server option is 10.  The minimum length for
+ * this option is 4 octets, and the length MUST always be a multiple of
+ * 4.
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class ImpressServers extends AddressListOption
 {
-    /**
-     * Creates a new instance of ImpressServers.
-     *
-     * @param impressServers
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public ImpressServers( byte[] impressServers )
+    public byte getTag()
     {
-        super( 10, impressServers );
+        return 10;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LogServers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LogServers.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LogServers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LogServers.java Mon Feb 18 14:14:09 2008
@@ -18,14 +18,6 @@
  *  
  */
 
-/**
- * The log server option specifies a list of MIT-LCS UDP log servers
- * available to the client.  Servers SHOULD be listed in order of
- * preference.
- * 
- * The code for the log server option is 7.  The minimum length for this
- * option is 4 octets, and the length MUST always be a multiple of 4.
- */
 package org.apache.directory.server.dhcp.options.vendor;
 
 
@@ -33,18 +25,23 @@
 
 
 /**
+ * The log server option specifies a list of MIT-LCS UDP log servers
+ * available to the client.  Servers SHOULD be listed in order of
+ * preference.
+ * 
+ * The code for the log server option is 7.  The minimum length for this
+ * option is 4 octets, and the length MUST always be a multiple of 4.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class LogServers extends AddressListOption
 {
-    /**
-     * Creates a new instance of LogServers.
-     *
-     * @param logServers
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public LogServers( byte[] logServers )
+    public byte getTag()
     {
-        super( 7, logServers );
+        return 7;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LprServers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LprServers.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LprServers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LprServers.java Mon Feb 18 14:14:09 2008
@@ -18,14 +18,6 @@
  *  
  */
 
-/**
- * The LPR server option specifies a list of RFC 1179 line printer
- * servers available to the client.  Servers SHOULD be listed in order
- * of preference.
- * 
- * The code for the LPR server option is 9.  The minimum length for this
- * option is 4 octets, and the length MUST always be a multiple of 4.
- */
 package org.apache.directory.server.dhcp.options.vendor;
 
 
@@ -33,18 +25,23 @@
 
 
 /**
+ * The LPR server option specifies a list of RFC 1179 line printer
+ * servers available to the client.  Servers SHOULD be listed in order
+ * of preference.
+ * 
+ * The code for the LPR server option is 9.  The minimum length for this
+ * option is 4 octets, and the length MUST always be a multiple of 4.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class LprServers extends AddressListOption
 {
-    /**
-     * Creates a new instance of LprServers.
-     *
-     * @param lprServers
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public LprServers( byte[] lprServers )
+    public byte getTag()
     {
-        super( 9, lprServers );
+        return 9;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/MeritDumpFile.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/MeritDumpFile.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/MeritDumpFile.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/MeritDumpFile.java Mon Feb 18 14:14:09 2008
@@ -18,6 +18,12 @@
  *  
  */
 
+package org.apache.directory.server.dhcp.options.vendor;
+
+
+import org.apache.directory.server.dhcp.options.StringOption;
+
+
 /**
  * This option specifies the path-name of a file to which the client's
  * core image should be dumped in the event the client crashes.  The
@@ -25,38 +31,17 @@
  * the NVT ASCII character set.
  * 
  * The code for this option is 14.  Its minimum length is 1.
- */
-package org.apache.directory.server.dhcp.options.vendor;
-
-
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
-
-
-/**
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class MeritDumpFile extends DhcpOption
+public class MeritDumpFile extends StringOption
 {
-    private byte[] meritDumpFile;
-
-
-    /**
-     * Creates a new instance of MeritDumpFile.
-     *
-     * @param meritDumpFile
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public MeritDumpFile( byte[] meritDumpFile )
-    {
-        super( 14, 1 );
-        this.meritDumpFile = meritDumpFile;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( meritDumpFile );
+        return 14;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/NameServers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/NameServers.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/NameServers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/NameServers.java Mon Feb 18 14:14:09 2008
@@ -18,6 +18,12 @@
  *  
  */
 
+package org.apache.directory.server.dhcp.options.vendor;
+
+
+import org.apache.directory.server.dhcp.options.AddressListOption;
+
+
 /**
  * The name server option specifies a list of IEN 116 name servers
  * available to the client.  Servers SHOULD be listed in order of
@@ -26,26 +32,17 @@
  * The code for the name server option is 5.  The minimum length for
  * this option is 4 octets, and the length MUST always be a multiple of
  * 4.
- */
-package org.apache.directory.server.dhcp.options.vendor;
-
-
-import org.apache.directory.server.dhcp.options.AddressListOption;
-
-
-/**
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class NameServers extends AddressListOption
 {
-    /**
-     * Creates a new instance of NameServers.
-     *
-     * @param nameServers
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public NameServers( byte[] nameServers )
+    public byte getTag()
     {
-        super( 5, nameServers );
+        return 5;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ResourceLocationServers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ResourceLocationServers.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ResourceLocationServers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ResourceLocationServers.java Mon Feb 18 14:14:09 2008
@@ -18,14 +18,6 @@
  *  
  */
 
-/**
- * This option specifies a list of RFC 887 Resource Location
- * servers available to the client.  Servers SHOULD be listed in order
- * of preference.
- * 
- * The code for this option is 11.  The minimum length for this option
- * is 4 octets, and the length MUST always be a multiple of 4.
- */
 package org.apache.directory.server.dhcp.options.vendor;
 
 
@@ -33,18 +25,23 @@
 
 
 /**
+ * This option specifies a list of RFC 887 Resource Location
+ * servers available to the client.  Servers SHOULD be listed in order
+ * of preference.
+ * 
+ * The code for this option is 11.  The minimum length for this option
+ * is 4 octets, and the length MUST always be a multiple of 4.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class ResourceLocationServers extends AddressListOption
 {
-    /**
-     * Creates a new instance of ResourceLocationServers.
-     *
-     * @param resourceLocationServers
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public ResourceLocationServers( byte[] resourceLocationServers )
+    public byte getTag()
     {
-        super( 11, resourceLocationServers );
+        return 11;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/RootPath.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/RootPath.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/RootPath.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/RootPath.java Mon Feb 18 14:14:09 2008
@@ -18,44 +18,43 @@
  *  
  */
 
-/**
- * This option specifies the path-name that contains the client's root
- * disk.  The path is formatted as a character string consisting of
- * characters from the NVT ASCII character set.
- * 
- * The code for this option is 17.  Its minimum length is 1.
- */
 package org.apache.directory.server.dhcp.options.vendor;
 
 
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
+import org.apache.directory.server.dhcp.options.StringOption;
 
 
 /**
+ * This option specifies the path-name that contains the client's root
+ * disk.  The path is formatted as a character string consisting of
+ * characters from the NVT ASCII character set.
+ * 
+ * The code for this option is 17.  Its minimum length is 1.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class RootPath extends DhcpOption
+public class RootPath extends StringOption
 {
-    private byte[] rootPath;
+    public RootPath()
+    {
+    }
 
 
     /**
-     * Creates a new instance of RootPath.
-     *
-     * @param rootPath
+     * @param path
      */
-    public RootPath( byte[] rootPath )
+    public RootPath(String path)
     {
-        super( 17, 1 );
-        this.rootPath = rootPath;
+        setString( path );
     }
 
 
-    protected void valueToByteBuffer( ByteBuffer out )
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
+     */
+    public byte getTag()
     {
-        out.put( rootPath );
+        return 17;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/Routers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/Routers.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/Routers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/Routers.java Mon Feb 18 14:14:09 2008
@@ -18,14 +18,6 @@
  *  
  */
 
-/**
- * The router option specifies a list of IP addresses for routers on the
- * client's subnet.  Routers SHOULD be listed in order of preference.
- * 
- * The code for the router option is 3.  The minimum length for the
- * router option is 4 octets, and the length MUST always be a multiple
- * of 4.
- */
 package org.apache.directory.server.dhcp.options.vendor;
 
 
@@ -33,18 +25,23 @@
 
 
 /**
+ * The router option specifies a list of IP addresses for routers on the
+ * client's subnet.  Routers SHOULD be listed in order of preference.
+ * 
+ * The code for the router option is 3.  The minimum length for the
+ * router option is 4 octets, and the length MUST always be a multiple
+ * of 4.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class Routers extends AddressListOption
 {
-    /**
-     * Creates a new instance of Routers.
-     *
-     * @param routers
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public Routers( byte[] routers )
+    public byte getTag()
     {
-        super( 3, routers );
+        return 3;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SubnetMask.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SubnetMask.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SubnetMask.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SubnetMask.java Mon Feb 18 14:14:09 2008
@@ -18,6 +18,14 @@
  *  
  */
 
+package org.apache.directory.server.dhcp.options.vendor;
+
+
+import java.net.InetAddress;
+
+import org.apache.directory.server.dhcp.options.AddressOption;
+
+
 /**
  * The subnet mask option specifies the client's subnet mask as per RFC
  * 950.
@@ -26,26 +34,30 @@
  * reply, the subnet mask option MUST be first.
  * 
  * The code for the subnet mask option is 1, and its length is 4 octets.
- */
-package org.apache.directory.server.dhcp.options.vendor;
-
-
-import org.apache.directory.server.dhcp.options.AddressOption;
-
-
-/**
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class SubnetMask extends AddressOption
 {
+    public SubnetMask()
+    {
+    }
+    
     /**
-     * Creates a new instance of SubnetMask.
-     *
-     * @param subnetMask
+     * @param netmask
+     */
+    public SubnetMask(InetAddress netmask)
+    {
+        setAddress( netmask );
+    }
+
+
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public SubnetMask( byte[] subnetMask )
+    public byte getTag()
     {
-        super( 1, subnetMask );
+        return 1;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SwapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SwapServer.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SwapServer.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SwapServer.java Mon Feb 18 14:14:09 2008
@@ -18,11 +18,6 @@
  *  
  */
 
-/**
- * This specifies the IP address of the client's swap server.
- * 
- * The code for this option is 16 and its length is 4.
- */
 package org.apache.directory.server.dhcp.options.vendor;
 
 
@@ -30,18 +25,20 @@
 
 
 /**
+ * This specifies the IP address of the client's swap server.
+ * 
+ * The code for this option is 16 and its length is 4.
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class SwapServer extends AddressOption
 {
-    /**
-     * Creates a new instance of SwapServer.
-     *
-     * @param swapServer
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public SwapServer( byte[] swapServer )
+    public byte getTag()
     {
-        super( 16, swapServer );
+        return 16;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeOffset.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeOffset.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeOffset.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeOffset.java Mon Feb 18 14:14:09 2008
@@ -18,6 +18,12 @@
  *  
  */
 
+package org.apache.directory.server.dhcp.options.vendor;
+
+
+import org.apache.directory.server.dhcp.options.AddressOption;
+
+
 /**
  * The time offset field specifies the offset of the client's subnet in
  * seconds from Coordinated Universal Time (UTC).  The offset is
@@ -26,38 +32,17 @@
  * indicates a location west of the zero meridian.
  * 
  * The code for the time offset option is 2, and its length is 4 octets.
- */
-package org.apache.directory.server.dhcp.options.vendor;
-
-
-import java.nio.ByteBuffer;
-
-import org.apache.directory.server.dhcp.options.DhcpOption;
-
-
-/**
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class TimeOffset extends DhcpOption
+public class TimeOffset extends AddressOption
 {
-    private byte[] timeOffset;
-
-
-    /**
-     * Creates a new instance of TimeOffset.
-     *
-     * @param timeOffset
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public TimeOffset( byte[] timeOffset )
-    {
-        super( 2, 4 );
-        this.timeOffset = timeOffset;
-    }
-
-
-    protected void valueToByteBuffer( ByteBuffer out )
+    public byte getTag()
     {
-        out.put( timeOffset );
+        return 2;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeServers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeServers.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeServers.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeServers.java Mon Feb 18 14:14:09 2008
@@ -18,6 +18,12 @@
  *  
  */
 
+package org.apache.directory.server.dhcp.options.vendor;
+
+
+import org.apache.directory.server.dhcp.options.AddressListOption;
+
+
 /**
  * The time server option specifies a list of RFC 868 time servers
  * available to the client.  Servers SHOULD be listed in order of
@@ -26,26 +32,17 @@
  * The code for the time server option is 4.  The minimum length for
  * this option is 4 octets, and the length MUST always be a multiple of
  * 4.
- */
-package org.apache.directory.server.dhcp.options.vendor;
-
-
-import org.apache.directory.server.dhcp.options.AddressListOption;
-
-
-/**
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class TimeServers extends AddressListOption
 {
-    /**
-     * Creates a new instance of TimeServers.
-     *
-     * @param timeServers
+    /*
+     * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
      */
-    public TimeServers( byte[] timeServers )
+    public byte getTag()
     {
-        super( 4, timeServers );
+        return 4;
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpDecoder.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpDecoder.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpDecoder.java Mon Feb 18 14:14:09 2008
@@ -25,7 +25,7 @@
 import org.apache.directory.server.dhcp.io.DhcpMessageDecoder;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.codec.ProtocolDecoderAdapter;
+import org.apache.mina.filter.codec.ProtocolDecoder;
 import org.apache.mina.filter.codec.ProtocolDecoderOutput;
 
 
@@ -33,11 +33,25 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DhcpDecoder extends ProtocolDecoderAdapter
+public class DhcpDecoder implements ProtocolDecoder
 {
     public void decode( IoSession session, ByteBuffer in, ProtocolDecoderOutput out ) throws DhcpException
     {
         DhcpMessageDecoder decoder = new DhcpMessageDecoder();
         out.write( decoder.decode( in.buf() ) );
+    }
+
+
+    public void dispose( IoSession arg0 ) throws Exception
+    {
+    }
+
+
+    /* 
+     * @see org.apache.mina.filter.codec.ProtocolDecoder#finishDecode(org.apache.mina.common.IoSession, org.apache.mina.filter.codec.ProtocolDecoderOutput)
+     */
+    public void finishDecode( IoSession session, ProtocolDecoderOutput out ) throws Exception
+    {
+        // TODO Auto-generated method stub
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java Mon Feb 18 14:14:09 2008
@@ -25,7 +25,7 @@
 import org.apache.directory.server.dhcp.messages.DhcpMessage;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.codec.ProtocolEncoderAdapter;
+import org.apache.mina.filter.codec.ProtocolEncoder;
 import org.apache.mina.filter.codec.ProtocolEncoderOutput;
 
 
@@ -33,17 +33,24 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DhcpEncoder extends ProtocolEncoderAdapter
+public class DhcpEncoder implements ProtocolEncoder
 {
+    // FIXME: what's the point of splitting this class from the actual encoder?
+    private DhcpMessageEncoder encoder = new DhcpMessageEncoder();
+
+
     public void encode( IoSession session, Object message, ProtocolEncoderOutput out )
     {
-        DhcpMessageEncoder encoder = new DhcpMessageEncoder();
-
         ByteBuffer buf = ByteBuffer.allocate( 1024 );
         encoder.encode( buf.buf(), ( DhcpMessage ) message );
 
         buf.flip();
 
         out.write( buf );
+    }
+
+
+    public void dispose( IoSession arg0 ) throws Exception
+    {
     }
 }

Modified: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java?rev=628890&r1=628889&r2=628890&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java (original)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java Mon Feb 18 14:14:09 2008
@@ -20,92 +20,155 @@
 
 package org.apache.directory.server.dhcp.protocol;
 
-
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 
-import org.apache.directory.server.dhcp.DhcpService;
 import org.apache.directory.server.dhcp.messages.DhcpMessage;
-import org.apache.directory.server.dhcp.service.DhcpServiceImpl;
-import org.apache.mina.common.ConnectFuture;
+import org.apache.directory.server.dhcp.messages.MessageType;
+import org.apache.directory.server.dhcp.service.DhcpService;
+import org.apache.mina.common.BroadcastIoSession;
 import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
-import org.apache.mina.transport.socket.nio.DatagramConnector;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
+ * Implementation of a DHCP protocol handler which delegates the work of
+ * generating replys to a DhcpService implementation.
+ * 
+ * @see org.apache.directory.server.dhcp.service.DhcpService
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DhcpProtocolHandler implements IoHandler
-{
-    private static final Logger log = LoggerFactory.getLogger( DhcpProtocolHandler.class );
-
-
-    public void sessionCreated( IoSession session ) throws Exception
-    {
-        log.debug( "{} CREATED", session.getRemoteAddress() );
-        session.getFilterChain().addFirst( "codec", new ProtocolCodecFilter( new DhcpProtocolCodecFactory() ) );
-    }
-
-
-    public void sessionOpened( IoSession session )
-    {
-        log.debug( "{} OPENED", session.getRemoteAddress() );
-    }
-
-
-    public void sessionClosed( IoSession session )
-    {
-        log.debug( "{} CLOSED", session.getRemoteAddress() );
-    }
-
-
-    public void sessionIdle( IoSession session, IdleStatus status )
-    {
-        log.debug( "{} IDLE ({})", session.getRemoteAddress(), status );
-    }
-
-
-    public void exceptionCaught( IoSession session, Throwable cause )
-    {
-        log.debug( session.getRemoteAddress() + " EXCEPTION", cause );
-        session.close();
-    }
-
-
-    public void messageReceived( IoSession session, Object message ) throws Exception
-    {
-        log.debug( "{} RCVD:  {}", session.getRemoteAddress(), message );
-
-        DhcpMessage request = ( DhcpMessage ) message;
-
-        if ( request.getOpCode() == 1 )
-        {
-            DhcpService dhcpService = new DhcpServiceImpl();
-            DhcpMessage reply = dhcpService.getReplyFor( request );
-
-            int PORT = 68;
-            IoConnector connector = new DatagramConnector();
-            InetAddress broadcast = InetAddress.getByName( null );
-
-            ConnectFuture future = connector.connect( new InetSocketAddress( broadcast, PORT ),
-                new DhcpProtocolHandler() );
-            future.join();
-            IoSession replySession = future.getSession();
-            replySession.write( reply ).join();
-            replySession.close();
-        }
-    }
-
-
-    public void messageSent( IoSession session, Object message )
-    {
-        log.debug( "{} SENT:  {}", session.getRemoteAddress(), message );
-    }
+public class DhcpProtocolHandler implements IoHandler {
+	private static final Logger logger = LoggerFactory
+			.getLogger(DhcpProtocolHandler.class);
+
+	/**
+	 * Default DHCP client port
+	 */
+	public static final int CLIENT_PORT = 68;
+
+	/**
+	 * Default DHCP server port
+	 */
+	public static final int SERVER_PORT = 67;
+
+	/**
+	 * The DHCP service implementation. The implementation is supposed to be
+	 * thread-safe.
+	 */
+	private final DhcpService dhcpService;
+
+	/**
+	 * 
+	 */
+	public DhcpProtocolHandler(DhcpService service) {
+		this.dhcpService = service;
+	}
+
+	public void sessionCreated(IoSession session) throws Exception {
+		logger.debug("{} CREATED", session.getLocalAddress());
+		session.getFilterChain().addFirst("codec",
+				new ProtocolCodecFilter(new DhcpProtocolCodecFactory()));
+	}
+
+	public void sessionOpened(IoSession session) {
+		logger.debug("{} -> {} OPENED", session.getRemoteAddress(), session
+				.getLocalAddress());
+	}
+
+	public void sessionClosed(IoSession session) {
+		logger.debug("{} -> {} CLOSED", session.getRemoteAddress(), session
+				.getLocalAddress());
+	}
+
+	public void sessionIdle(IoSession session, IdleStatus status) {
+		// ignore
+	}
+
+	public void exceptionCaught(IoSession session, Throwable cause) {
+		logger.error("EXCEPTION CAUGHT ", cause);
+		cause.printStackTrace(System.out);
+
+		session.close();
+	}
+
+	public void messageReceived(IoSession session, Object message)
+			throws Exception {
+		if (logger.isDebugEnabled())
+			logger.debug("{} -> {} RCVD: {} " + message, session.getRemoteAddress(),
+					session.getLocalAddress());
+
+		final DhcpMessage request = (DhcpMessage) message;
+
+		final DhcpMessage reply = dhcpService.getReplyFor(
+				(InetSocketAddress) session.getServiceAddress(),
+				(InetSocketAddress) session.getRemoteAddress(), request);
+
+		if (null != reply) {
+			final InetSocketAddress isa = determineMessageDestination(request, reply);
+			((BroadcastIoSession) session).write(reply, isa);
+		}
+	}
+
+	/**
+	 * Determine where to send the message: <br>
+	 * If the 'giaddr' field in a DHCP message from a client is non-zero, the
+	 * server sends any return messages to the 'DHCP server' port on the BOOTP
+	 * relay agent whose address appears in 'giaddr'. If the 'giaddr' field is
+	 * zero and the 'ciaddr' field is nonzero, then the server unicasts DHCPOFFER
+	 * and DHCPACK messages to the address in 'ciaddr'. If 'giaddr' is zero and
+	 * 'ciaddr' is zero, and the broadcast bit is set, then the server broadcasts
+	 * DHCPOFFER and DHCPACK messages to 0xffffffff. If the broadcast bit is not
+	 * set and 'giaddr' is zero and 'ciaddr' is zero, then the server unicasts
+	 * DHCPOFFER and DHCPACK messages to the client's hardware address and
+	 * 'yiaddr' address. In all cases, when 'giaddr' is zero, the server
+	 * broadcasts any DHCPNAK messages to 0xffffffff.
+	 * 
+	 * @param request
+	 * @param reply
+	 * @return
+	 */
+	private InetSocketAddress determineMessageDestination(DhcpMessage request,
+			DhcpMessage reply) {
+
+		final MessageType mt = reply.getMessageType();
+		if (!isNullAddress(request.getRelayAgentAddress()))
+			// send to agent, if received via agent.
+			return new InetSocketAddress(request.getRelayAgentAddress(), SERVER_PORT);
+		else if (null != mt && mt == MessageType.DHCPNAK)
+			// force broadcast for DHCPNAKs
+			return new InetSocketAddress("255.255.255.255", 68);
+		else // not a NAK...
+		if (!isNullAddress(request.getCurrentClientAddress()))
+			// have a current address? unicast to it.
+			return new InetSocketAddress(request.getCurrentClientAddress(),
+					CLIENT_PORT);
+		else
+			return new InetSocketAddress("255.255.255.255", 68);
+	}
+
+	/**
+	 * Determine, whether the given address ist actually the null address
+	 * "0.0.0.0".
+	 * 
+	 * @param relayAgentAddress
+	 * @return
+	 */
+	private boolean isNullAddress(InetAddress addr) {
+		final byte a[] = addr.getAddress();
+		for (int i = 0; i < a.length; i++)
+			if (a[i] != 0)
+				return false;
+		return true;
+	}
+
+	public void messageSent(IoSession session, Object message) {
+		if (logger.isDebugEnabled())
+			logger.debug("{} -> {} SENT: " + message, session.getRemoteAddress(),
+					session.getLocalAddress());
+	}
 }

Added: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java?rev=628890&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java (added)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java Mon Feb 18 14:14:09 2008
@@ -0,0 +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 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 clientAddress
+	 * @param clientAddress2
+	 * @param request the request message
+	 * @return 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 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 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 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 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
+	 */
+	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
+	 */
+	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
+	 */
+	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();
+			}
+		}
+	}
+}

Propchange: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java?rev=628890&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java (added)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java Mon Feb 18 14:14:09 2008
@@ -0,0 +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
+     * @throws DhcpException 
+     */
+    public DhcpMessage getReplyFor( InetSocketAddress localAddress, InetSocketAddress clientAddress, DhcpMessage request ) throws DhcpException;
+}

Propchange: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java?rev=628890&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java (added)
+++ directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java Mon Feb 18 14:14:09 2008
@@ -0,0 +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
+     */
+    public InetAddress getClientAddress()
+    {
+        return clientAddress;
+    }
+
+
+    /**
+     * @return
+     */
+    public InetAddress getNextServerAddress()
+    {
+        return nextServerAddress;
+    }
+
+
+    /**
+     * @return
+     */
+    public OptionsField getOptions()
+    {
+        return options;
+    }
+
+
+    /**
+     * @return
+     */
+    public int getState()
+    {
+        return state;
+    }
+
+
+    /**
+     * @param state2
+     */
+    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;
+    }
+
+}

Propchange: directory/apacheds/branches/bigbang/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/Lease.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message