directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r377135 [13/36] - in /directory/sandbox/akarasulu/rc1: apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ apacheds/core-shared/...
Date Sun, 12 Feb 2006 05:51:22 GMT
Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java Sat Feb 11 21:50:03 2006
@@ -1,47 +1,47 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.directory.server.dhcp.protocol;
-
-
-import org.apache.directory.server.dhcp.io.DhcpMessageEncoder;
-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.ProtocolEncoder;
-import org.apache.mina.filter.codec.ProtocolEncoderOutput;
-
-
-public class DhcpEncoder implements ProtocolEncoder
-{
-    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
-    {
-    }
-}
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.server.dhcp.protocol;
+
+
+import org.apache.directory.server.dhcp.io.DhcpMessageEncoder;
+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.ProtocolEncoder;
+import org.apache.mina.filter.codec.ProtocolEncoderOutput;
+
+
+public class DhcpEncoder implements ProtocolEncoder
+{
+    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
+    {
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolCodecFactory.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolCodecFactory.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolCodecFactory.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolCodecFactory.java Sat Feb 11 21:50:03 2006
@@ -1,50 +1,50 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.directory.server.dhcp.protocol;
-
-
-import org.apache.mina.filter.codec.ProtocolCodecFactory;
-import org.apache.mina.filter.codec.ProtocolDecoder;
-import org.apache.mina.filter.codec.ProtocolEncoder;
-
-
-public class DhcpProtocolCodecFactory implements ProtocolCodecFactory
-{
-    // Codec factory is also usually a singleton.
-    private static DhcpProtocolCodecFactory INSTANCE = new DhcpProtocolCodecFactory();
-
-
-    public static DhcpProtocolCodecFactory getInstance()
-    {
-        return INSTANCE;
-    }
-
-
-    public ProtocolEncoder getEncoder()
-    {
-        // Create a new encoder.
-        return new DhcpEncoder();
-    }
-
-
-    public ProtocolDecoder getDecoder()
-    {
-        // Create a new decoder.
-        return new DhcpDecoder();
-    }
-}
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.server.dhcp.protocol;
+
+
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+
+
+public class DhcpProtocolCodecFactory implements ProtocolCodecFactory
+{
+    // Codec factory is also usually a singleton.
+    private static DhcpProtocolCodecFactory INSTANCE = new DhcpProtocolCodecFactory();
+
+
+    public static DhcpProtocolCodecFactory getInstance()
+    {
+        return INSTANCE;
+    }
+
+
+    public ProtocolEncoder getEncoder()
+    {
+        // Create a new encoder.
+        return new DhcpEncoder();
+    }
+
+
+    public ProtocolDecoder getDecoder()
+    {
+        // Create a new decoder.
+        return new DhcpDecoder();
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolCodecFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolCodecFactory.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java Sat Feb 11 21:50:03 2006
@@ -1,100 +1,100 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.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.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;
-
-
-public class DhcpProtocolHandler implements IoHandler
-{
-    public void sessionCreated( IoSession session ) throws Exception
-    {
-        System.out.println( session.getRemoteAddress() + " CREATED" );
-        session.getFilterChain().addFirst( "codec", new ProtocolCodecFilter( new DhcpProtocolCodecFactory() ) );
-    }
-
-
-    public void sessionOpened( IoSession session )
-    {
-        System.out.println( session.getRemoteAddress() + " OPENED" );
-    }
-
-
-    public void sessionClosed( IoSession session )
-    {
-        System.out.println( session.getRemoteAddress() + " CLOSED" );
-    }
-
-
-    public void sessionIdle( IoSession session, IdleStatus status )
-    {
-        System.out.println( session.getRemoteAddress() + " IDLE(" + status + ")" );
-    }
-
-
-    public void exceptionCaught( IoSession session, Throwable cause )
-    {
-        System.out.println( session.getRemoteAddress() + " EXCEPTION" );
-        cause.printStackTrace( System.out );
-
-        session.close();
-    }
-
-
-    public void messageReceived( IoSession session, Object message ) throws Exception
-    {
-        System.out.println( session.getRemoteAddress() + " RCVD: " + 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 )
-    {
-        System.out.println( session.getRemoteAddress() + " SENT: " + message );
-    }
-}
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.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.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;
+
+
+public class DhcpProtocolHandler implements IoHandler
+{
+    public void sessionCreated( IoSession session ) throws Exception
+    {
+        System.out.println( session.getRemoteAddress() + " CREATED" );
+        session.getFilterChain().addFirst( "codec", new ProtocolCodecFilter( new DhcpProtocolCodecFactory() ) );
+    }
+
+
+    public void sessionOpened( IoSession session )
+    {
+        System.out.println( session.getRemoteAddress() + " OPENED" );
+    }
+
+
+    public void sessionClosed( IoSession session )
+    {
+        System.out.println( session.getRemoteAddress() + " CLOSED" );
+    }
+
+
+    public void sessionIdle( IoSession session, IdleStatus status )
+    {
+        System.out.println( session.getRemoteAddress() + " IDLE(" + status + ")" );
+    }
+
+
+    public void exceptionCaught( IoSession session, Throwable cause )
+    {
+        System.out.println( session.getRemoteAddress() + " EXCEPTION" );
+        cause.printStackTrace( System.out );
+
+        session.close();
+    }
+
+
+    public void messageReceived( IoSession session, Object message ) throws Exception
+    {
+        System.out.println( session.getRemoteAddress() + " RCVD: " + 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 )
+    {
+        System.out.println( session.getRemoteAddress() + " SENT: " + message );
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/DhcpServiceImpl.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/test/java/org/apache/directory/server/dhcp/AbstractDhcpTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/test/java/org/apache/directory/server/dhcp/AbstractDhcpTestCase.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/test/java/org/apache/directory/server/dhcp/DhcpMessageDecoderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dhcp/src/test/java/org/apache/directory/server/dhcp/DhcpMessageDecoderTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsConfiguration.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsException.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/DnsServer.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/Decoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/ResourceRecordDecoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/ResourceRecordDecoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/A6RecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/AddressRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/CanonicalNameRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/CertificateRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/DnameRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/HostInformationRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/Inet6AddressRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/KeyExchangeRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/KeyRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/LocationRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/MailExchangeRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/MailInformationRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/NameAuthorityPointerEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/NameServerRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/NextNameRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/PointerRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/QuestionRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/RecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/ResourceRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/ServerSelectionRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/SignatureRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/StartOfAuthorityRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/TextRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/WellKnownServicesRecordEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/DnsMessage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/DnsMessage.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/DnsMessageModifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/DnsMessageModifier.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/MessageType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/MessageType.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/OpCode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/OpCode.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ProtocolType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ProtocolType.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/QuestionRecord.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/QuestionRecord.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/QuestionRecords.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordType.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ResourceRecord.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ResourceRecord.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ResourceRecordImpl.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ResourceRecordModifier.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ResourceRecords.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ResponseCode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ResponseCode.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ServiceType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/ServiceType.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsDecoder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsDecoder.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsDecoder.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsDecoder.java Sat Feb 11 21:50:03 2006
@@ -1,264 +1,264 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.directory.server.dns.protocol;
-
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.directory.server.dns.io.decoder.Decoder;
-import org.apache.directory.server.dns.messages.DnsMessage;
-import org.apache.directory.server.dns.messages.DnsMessageModifier;
-import org.apache.directory.server.dns.messages.MessageType;
-import org.apache.directory.server.dns.messages.OpCode;
-import org.apache.directory.server.dns.messages.QuestionRecord;
-import org.apache.directory.server.dns.messages.QuestionRecords;
-import org.apache.directory.server.dns.messages.RecordClass;
-import org.apache.directory.server.dns.messages.RecordType;
-import org.apache.directory.server.dns.messages.ResourceRecordImpl;
-import org.apache.directory.server.dns.messages.ResourceRecords;
-import org.apache.directory.server.dns.messages.ResponseCode;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.codec.ProtocolDecoder;
-import org.apache.mina.filter.codec.ProtocolDecoderOutput;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class DnsDecoder implements ProtocolDecoder
-{
-    /** the log for this class */
-    private static final Logger log = LoggerFactory.getLogger( DnsDecoder.class );
-
-    /**
-     * A Hashed Adapter mapping record types to their encoders.
-     */
-    private static final Map DEFAULT_DECODERS;
-
-    static
-    {
-        Map map = new HashMap();
-
-        // map.put( RecordType.SOA, new StartOfAuthorityRecordEncoder() );
-
-        DEFAULT_DECODERS = Collections.unmodifiableMap( map );
-    }
-
-
-    public void decode( IoSession session, ByteBuffer in, ProtocolDecoderOutput out )
-    {
-        out.write( decode( in ) );
-    }
-
-
-    DnsMessage decode( ByteBuffer in )
-    {
-        DnsMessageModifier modifier = new DnsMessageModifier();
-
-        modifier.setTransactionId( in.getShort() );
-
-        byte header = in.get();
-        modifier.setMessageType( decodeMessageType( header ) );
-        modifier.setOpCode( decodeOpCode( header ) );
-        modifier.setAuthoritativeAnswer( decodeAuthoritativeAnswer( header ) );
-        modifier.setTruncated( decodeTruncated( header ) );
-        modifier.setRecursionDesired( decodeRecursionDesired( header ) );
-
-        header = in.get();
-        modifier.setRecursionAvailable( decodeRecursionAvailable( header ) );
-        modifier.setResponseCode( decodeResponseCode( header ) );
-
-        short questionCount = in.getShort();
-        short answerCount = in.getShort();
-        short authorityCount = in.getShort();
-        short additionalCount = in.getShort();
-
-        modifier.setQuestionRecords( decodeQuestions( questionCount, in ) );
-        modifier.setAnswerRecords( decodeRecords( answerCount, in ) );
-        modifier.setAuthorityRecords( decodeRecords( authorityCount, in ) );
-        modifier.setAdditionalRecords( decodeRecords( additionalCount, in ) );
-
-        return modifier.getDnsMessage();
-    }
-
-
-    private ResourceRecords decodeRecords( short recordCount, ByteBuffer byteBuffer )
-    {
-        ResourceRecords records = new ResourceRecords( recordCount );
-
-        for ( int ii = 0; ii < recordCount; ii++ )
-        {
-            String domainName = decodeDomainName( byteBuffer );
-
-            RecordType recordType = RecordType.getTypeByOrdinal( byteBuffer.getShort() );
-            RecordClass recordClass = RecordClass.getTypeByOrdinal( byteBuffer.getShort() );
-
-            int timeToLive = byteBuffer.getInt();
-            short dataLength = byteBuffer.getShort();
-
-            byte[] data = new byte[dataLength];
-            byteBuffer.get( data );
-
-            try
-            {
-                Map attributes = decode( recordType, data );
-                records.add( new ResourceRecordImpl( domainName, recordType, recordClass, timeToLive, attributes ) );
-            }
-            catch ( IOException ioe )
-            {
-                log.error( ioe.getMessage(), ioe );
-            }
-        }
-
-        return records;
-    }
-
-
-    private Map decode( RecordType type, byte[] resourceData ) throws IOException
-    {
-        Decoder decoder = ( Decoder ) DEFAULT_DECODERS.get( type );
-
-        if ( decoder == null )
-        {
-            throw new IOException( "Decoder unavailable for " + type );
-        }
-
-        return decoder.decode( resourceData );
-    }
-
-
-    private QuestionRecords decodeQuestions( short questionCount, ByteBuffer byteBuffer )
-    {
-        QuestionRecords questions = new QuestionRecords( questionCount );
-
-        for ( int ii = 0; ii < questionCount; ii++ )
-        {
-            String domainName = decodeDomainName( byteBuffer );
-
-            RecordType recordType = RecordType.getTypeByOrdinal( byteBuffer.getShort() );
-            RecordClass recordClass = RecordClass.getTypeByOrdinal( byteBuffer.getShort() );
-
-            questions.add( new QuestionRecord( domainName, recordType, recordClass ) );
-        }
-
-        return questions;
-    }
-
-
-    private String decodeDomainName( ByteBuffer byteBuffer )
-    {
-        StringBuffer domainName = new StringBuffer();
-        recurseDomainName( domainName, byteBuffer );
-
-        return domainName.toString();
-    }
-
-
-    private void recurseDomainName( StringBuffer domainName, ByteBuffer byteBuffer )
-    {
-        byte currentByte = byteBuffer.get();
-
-        boolean isCompressed = ( ( currentByte & ( byte ) 0xc0 ) == ( byte ) 0xc0 );
-        boolean isLabelLength = ( ( currentByte != 0 ) && !isCompressed );
-
-        if ( isCompressed )
-        {
-            int position = byteBuffer.get();
-            int originalPosition = byteBuffer.position();
-            byteBuffer.position( position );
-
-            int labelLength = byteBuffer.get();
-            getLabel( labelLength, byteBuffer, domainName );
-            recurseDomainName( domainName, byteBuffer );
-
-            byteBuffer.position( originalPosition );
-        }
-
-        if ( isLabelLength )
-        {
-            int labelLength = currentByte;
-            getLabel( labelLength, byteBuffer, domainName );
-            recurseDomainName( domainName, byteBuffer );
-        }
-    }
-
-
-    private void getLabel( int labelLength, ByteBuffer byteBuffer, StringBuffer domainName )
-    {
-        for ( int jj = 0; jj < labelLength; jj++ )
-        {
-            char character = ( char ) byteBuffer.get();
-            domainName.append( character );
-        }
-
-        if ( byteBuffer.get( byteBuffer.position() ) != 0 )
-        {
-            domainName.append( "." );
-        }
-    }
-
-
-    private MessageType decodeMessageType( byte header )
-    {
-        return MessageType.getTypeByOrdinal( ( header & 0x80 ) >>> 7 );
-    }
-
-
-    private OpCode decodeOpCode( byte header )
-    {
-        return OpCode.getTypeByOrdinal( ( header & 0x78 ) >>> 3 );
-    }
-
-
-    private boolean decodeAuthoritativeAnswer( byte header )
-    {
-        return ( ( header & 0x04 ) >>> 2 ) == 1;
-    }
-
-
-    private boolean decodeTruncated( byte header )
-    {
-        return ( ( header & 0x02 ) >>> 1 ) == 1;
-    }
-
-
-    private boolean decodeRecursionDesired( byte header )
-    {
-        return ( ( header & 0x01 ) ) == 1;
-    }
-
-
-    private boolean decodeRecursionAvailable( byte header )
-    {
-        return ( ( header & 0x80 ) >>> 7 ) == 1;
-    }
-
-
-    private ResponseCode decodeResponseCode( byte header )
-    {
-        return ResponseCode.getTypeByOrdinal( header & 0x0F );
-    }
-
-
-    public void dispose( IoSession arg0 ) throws Exception
-    {
-    }
-}
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.server.dns.protocol;
+
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.server.dns.io.decoder.Decoder;
+import org.apache.directory.server.dns.messages.DnsMessage;
+import org.apache.directory.server.dns.messages.DnsMessageModifier;
+import org.apache.directory.server.dns.messages.MessageType;
+import org.apache.directory.server.dns.messages.OpCode;
+import org.apache.directory.server.dns.messages.QuestionRecord;
+import org.apache.directory.server.dns.messages.QuestionRecords;
+import org.apache.directory.server.dns.messages.RecordClass;
+import org.apache.directory.server.dns.messages.RecordType;
+import org.apache.directory.server.dns.messages.ResourceRecordImpl;
+import org.apache.directory.server.dns.messages.ResourceRecords;
+import org.apache.directory.server.dns.messages.ResponseCode;
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DnsDecoder implements ProtocolDecoder
+{
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( DnsDecoder.class );
+
+    /**
+     * A Hashed Adapter mapping record types to their encoders.
+     */
+    private static final Map DEFAULT_DECODERS;
+
+    static
+    {
+        Map map = new HashMap();
+
+        // map.put( RecordType.SOA, new StartOfAuthorityRecordEncoder() );
+
+        DEFAULT_DECODERS = Collections.unmodifiableMap( map );
+    }
+
+
+    public void decode( IoSession session, ByteBuffer in, ProtocolDecoderOutput out )
+    {
+        out.write( decode( in ) );
+    }
+
+
+    DnsMessage decode( ByteBuffer in )
+    {
+        DnsMessageModifier modifier = new DnsMessageModifier();
+
+        modifier.setTransactionId( in.getShort() );
+
+        byte header = in.get();
+        modifier.setMessageType( decodeMessageType( header ) );
+        modifier.setOpCode( decodeOpCode( header ) );
+        modifier.setAuthoritativeAnswer( decodeAuthoritativeAnswer( header ) );
+        modifier.setTruncated( decodeTruncated( header ) );
+        modifier.setRecursionDesired( decodeRecursionDesired( header ) );
+
+        header = in.get();
+        modifier.setRecursionAvailable( decodeRecursionAvailable( header ) );
+        modifier.setResponseCode( decodeResponseCode( header ) );
+
+        short questionCount = in.getShort();
+        short answerCount = in.getShort();
+        short authorityCount = in.getShort();
+        short additionalCount = in.getShort();
+
+        modifier.setQuestionRecords( decodeQuestions( questionCount, in ) );
+        modifier.setAnswerRecords( decodeRecords( answerCount, in ) );
+        modifier.setAuthorityRecords( decodeRecords( authorityCount, in ) );
+        modifier.setAdditionalRecords( decodeRecords( additionalCount, in ) );
+
+        return modifier.getDnsMessage();
+    }
+
+
+    private ResourceRecords decodeRecords( short recordCount, ByteBuffer byteBuffer )
+    {
+        ResourceRecords records = new ResourceRecords( recordCount );
+
+        for ( int ii = 0; ii < recordCount; ii++ )
+        {
+            String domainName = decodeDomainName( byteBuffer );
+
+            RecordType recordType = RecordType.getTypeByOrdinal( byteBuffer.getShort() );
+            RecordClass recordClass = RecordClass.getTypeByOrdinal( byteBuffer.getShort() );
+
+            int timeToLive = byteBuffer.getInt();
+            short dataLength = byteBuffer.getShort();
+
+            byte[] data = new byte[dataLength];
+            byteBuffer.get( data );
+
+            try
+            {
+                Map attributes = decode( recordType, data );
+                records.add( new ResourceRecordImpl( domainName, recordType, recordClass, timeToLive, attributes ) );
+            }
+            catch ( IOException ioe )
+            {
+                log.error( ioe.getMessage(), ioe );
+            }
+        }
+
+        return records;
+    }
+
+
+    private Map decode( RecordType type, byte[] resourceData ) throws IOException
+    {
+        Decoder decoder = ( Decoder ) DEFAULT_DECODERS.get( type );
+
+        if ( decoder == null )
+        {
+            throw new IOException( "Decoder unavailable for " + type );
+        }
+
+        return decoder.decode( resourceData );
+    }
+
+
+    private QuestionRecords decodeQuestions( short questionCount, ByteBuffer byteBuffer )
+    {
+        QuestionRecords questions = new QuestionRecords( questionCount );
+
+        for ( int ii = 0; ii < questionCount; ii++ )
+        {
+            String domainName = decodeDomainName( byteBuffer );
+
+            RecordType recordType = RecordType.getTypeByOrdinal( byteBuffer.getShort() );
+            RecordClass recordClass = RecordClass.getTypeByOrdinal( byteBuffer.getShort() );
+
+            questions.add( new QuestionRecord( domainName, recordType, recordClass ) );
+        }
+
+        return questions;
+    }
+
+
+    private String decodeDomainName( ByteBuffer byteBuffer )
+    {
+        StringBuffer domainName = new StringBuffer();
+        recurseDomainName( domainName, byteBuffer );
+
+        return domainName.toString();
+    }
+
+
+    private void recurseDomainName( StringBuffer domainName, ByteBuffer byteBuffer )
+    {
+        byte currentByte = byteBuffer.get();
+
+        boolean isCompressed = ( ( currentByte & ( byte ) 0xc0 ) == ( byte ) 0xc0 );
+        boolean isLabelLength = ( ( currentByte != 0 ) && !isCompressed );
+
+        if ( isCompressed )
+        {
+            int position = byteBuffer.get();
+            int originalPosition = byteBuffer.position();
+            byteBuffer.position( position );
+
+            int labelLength = byteBuffer.get();
+            getLabel( labelLength, byteBuffer, domainName );
+            recurseDomainName( domainName, byteBuffer );
+
+            byteBuffer.position( originalPosition );
+        }
+
+        if ( isLabelLength )
+        {
+            int labelLength = currentByte;
+            getLabel( labelLength, byteBuffer, domainName );
+            recurseDomainName( domainName, byteBuffer );
+        }
+    }
+
+
+    private void getLabel( int labelLength, ByteBuffer byteBuffer, StringBuffer domainName )
+    {
+        for ( int jj = 0; jj < labelLength; jj++ )
+        {
+            char character = ( char ) byteBuffer.get();
+            domainName.append( character );
+        }
+
+        if ( byteBuffer.get( byteBuffer.position() ) != 0 )
+        {
+            domainName.append( "." );
+        }
+    }
+
+
+    private MessageType decodeMessageType( byte header )
+    {
+        return MessageType.getTypeByOrdinal( ( header & 0x80 ) >>> 7 );
+    }
+
+
+    private OpCode decodeOpCode( byte header )
+    {
+        return OpCode.getTypeByOrdinal( ( header & 0x78 ) >>> 3 );
+    }
+
+
+    private boolean decodeAuthoritativeAnswer( byte header )
+    {
+        return ( ( header & 0x04 ) >>> 2 ) == 1;
+    }
+
+
+    private boolean decodeTruncated( byte header )
+    {
+        return ( ( header & 0x02 ) >>> 1 ) == 1;
+    }
+
+
+    private boolean decodeRecursionDesired( byte header )
+    {
+        return ( ( header & 0x01 ) ) == 1;
+    }
+
+
+    private boolean decodeRecursionAvailable( byte header )
+    {
+        return ( ( header & 0x80 ) >>> 7 ) == 1;
+    }
+
+
+    private ResponseCode decodeResponseCode( byte header )
+    {
+        return ResponseCode.getTypeByOrdinal( header & 0x0F );
+    }
+
+
+    public void dispose( IoSession arg0 ) throws Exception
+    {
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsDecoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsDecoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsEncoder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsEncoder.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsEncoder.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsEncoder.java Sat Feb 11 21:50:03 2006
@@ -1,234 +1,234 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.directory.server.dns.protocol;
-
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.directory.server.dns.io.encoder.AddressRecordEncoder;
-import org.apache.directory.server.dns.io.encoder.CanonicalNameRecordEncoder;
-import org.apache.directory.server.dns.io.encoder.MailExchangeRecordEncoder;
-import org.apache.directory.server.dns.io.encoder.NameServerRecordEncoder;
-import org.apache.directory.server.dns.io.encoder.PointerRecordEncoder;
-import org.apache.directory.server.dns.io.encoder.QuestionRecordEncoder;
-import org.apache.directory.server.dns.io.encoder.RecordEncoder;
-import org.apache.directory.server.dns.io.encoder.ServerSelectionRecordEncoder;
-import org.apache.directory.server.dns.io.encoder.StartOfAuthorityRecordEncoder;
-import org.apache.directory.server.dns.io.encoder.TextRecordEncoder;
-import org.apache.directory.server.dns.messages.DnsMessage;
-import org.apache.directory.server.dns.messages.MessageType;
-import org.apache.directory.server.dns.messages.OpCode;
-import org.apache.directory.server.dns.messages.QuestionRecord;
-import org.apache.directory.server.dns.messages.QuestionRecords;
-import org.apache.directory.server.dns.messages.RecordType;
-import org.apache.directory.server.dns.messages.ResourceRecord;
-import org.apache.directory.server.dns.messages.ResourceRecords;
-import org.apache.directory.server.dns.messages.ResponseCode;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.codec.ProtocolEncoder;
-import org.apache.mina.filter.codec.ProtocolEncoderOutput;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class DnsEncoder implements ProtocolEncoder
-{
-    /** the log for this class */
-    private static final Logger log = LoggerFactory.getLogger( DnsEncoder.class );
-
-    /**
-     * A Hashed Adapter mapping record types to their encoders.
-     */
-    private static final Map DEFAULT_ENCODERS;
-
-    static
-    {
-        Map map = new HashMap();
-
-        map.put( RecordType.SOA, new StartOfAuthorityRecordEncoder() );
-        map.put( RecordType.A, new AddressRecordEncoder() );
-        map.put( RecordType.NS, new NameServerRecordEncoder() );
-        map.put( RecordType.CNAME, new CanonicalNameRecordEncoder() );
-        map.put( RecordType.PTR, new PointerRecordEncoder() );
-        map.put( RecordType.MX, new MailExchangeRecordEncoder() );
-        map.put( RecordType.SRV, new ServerSelectionRecordEncoder() );
-        map.put( RecordType.TXT, new TextRecordEncoder() );
-
-        DEFAULT_ENCODERS = Collections.unmodifiableMap( map );
-    }
-
-
-    public void encode( IoSession session, Object message, ProtocolEncoderOutput out )
-    {
-        ByteBuffer buf = ByteBuffer.allocate( 1024 );
-        encode( buf, ( DnsMessage ) message );
-
-        buf.flip();
-
-        out.write( buf );
-    }
-
-
-    public void encode( ByteBuffer byteBuffer, DnsMessage message )
-    {
-        byteBuffer.putShort( message.getTransactionId() );
-
-        byte header = ( byte ) 0x00;
-        header = encodeMessageType( message.getMessageType(), header );
-        header = encodeOpCode( message.getOpCode(), header );
-        header = encodeAuthoritativeAnswer( message.isAuthoritativeAnswer(), header );
-        header = encodeTruncated( message.isTruncated(), header );
-        header = encodeRecursionDesired( message.isRecursionDesired(), header );
-        byteBuffer.put( header );
-
-        header = ( byte ) 0x00;
-        header = encodeRecursionAvailable( message.isRecursionAvailable(), header );
-        header = encodeResponseCode( message.getResponseCode(), header );
-        byteBuffer.put( header );
-
-        byteBuffer.putShort( ( short ) message.getQuestionRecords().size() );
-        byteBuffer.putShort( ( short ) message.getAnswerRecords().size() );
-        byteBuffer.putShort( ( short ) message.getAuthorityRecords().size() );
-        byteBuffer.putShort( ( short ) message.getAdditionalRecords().size() );
-
-        encodeRecords( message.getQuestionRecords(), byteBuffer );
-        encodeRecords( message.getAnswerRecords(), byteBuffer );
-        encodeRecords( message.getAuthorityRecords(), byteBuffer );
-        encodeRecords( message.getAdditionalRecords(), byteBuffer );
-    }
-
-
-    private void encodeRecords( QuestionRecords questions, ByteBuffer byteBuffer )
-    {
-        QuestionRecordEncoder encoder = new QuestionRecordEncoder();
-
-        Iterator it = questions.iterator();
-
-        while ( it.hasNext() )
-        {
-            QuestionRecord question = ( QuestionRecord ) it.next();
-            encoder.encode( byteBuffer, question );
-        }
-    }
-
-
-    private void encodeRecords( ResourceRecords records, ByteBuffer byteBuffer )
-    {
-        Iterator it = records.iterator();
-
-        while ( it.hasNext() )
-        {
-            ResourceRecord record = ( ResourceRecord ) it.next();
-
-            try
-            {
-                encode( byteBuffer, record );
-            }
-            catch ( IOException ioe )
-            {
-                log.error( ioe.getMessage(), ioe );
-            }
-        }
-    }
-
-
-    private void encode( ByteBuffer out, ResourceRecord record ) throws IOException
-    {
-        RecordType type = record.getRecordType();
-
-        RecordEncoder encoder = ( RecordEncoder ) DEFAULT_ENCODERS.get( type );
-
-        if ( encoder == null )
-        {
-            throw new IOException( "Encoder unavailable for " + type );
-        }
-
-        encoder.encode( out, record );
-    }
-
-
-    private byte encodeMessageType( MessageType messageType, byte header )
-    {
-        byte oneBit = ( byte ) ( messageType.getOrdinal() & 0x01 );
-        return ( byte ) ( ( oneBit << 7 ) | header );
-    }
-
-
-    private byte encodeOpCode( OpCode opCode, byte header )
-    {
-        byte fourBits = ( byte ) ( opCode.getOrdinal() & 0x0F );
-        return ( byte ) ( ( fourBits << 3 ) | header );
-    }
-
-
-    private byte encodeAuthoritativeAnswer( boolean authoritative, byte header )
-    {
-        if ( authoritative )
-        {
-            header = ( byte ) ( ( ( byte ) 0x01 << 2 ) | header );
-        }
-        return header;
-    }
-
-
-    private byte encodeTruncated( boolean truncated, byte header )
-    {
-        if ( truncated )
-        {
-            header = ( byte ) ( ( ( byte ) 0x01 << 1 ) | header );
-        }
-        return header;
-    }
-
-
-    private byte encodeRecursionDesired( boolean recursionDesired, byte header )
-    {
-        if ( recursionDesired )
-        {
-            header = ( byte ) ( ( ( byte ) 0x01 ) | header );
-        }
-        return header;
-    }
-
-
-    private byte encodeRecursionAvailable( boolean recursionAvailable, byte header )
-    {
-        if ( recursionAvailable )
-        {
-            header = ( byte ) ( ( ( byte ) 0x01 << 7 ) | header );
-        }
-        return header;
-    }
-
-
-    private byte encodeResponseCode( ResponseCode responseCode, byte header )
-    {
-        byte fourBits = ( byte ) ( responseCode.getOrdinal() & 0x0F );
-        return ( byte ) ( fourBits | header );
-    }
-
-
-    public void dispose( IoSession arg0 ) throws Exception
-    {
-    }
-}
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.server.dns.protocol;
+
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.directory.server.dns.io.encoder.AddressRecordEncoder;
+import org.apache.directory.server.dns.io.encoder.CanonicalNameRecordEncoder;
+import org.apache.directory.server.dns.io.encoder.MailExchangeRecordEncoder;
+import org.apache.directory.server.dns.io.encoder.NameServerRecordEncoder;
+import org.apache.directory.server.dns.io.encoder.PointerRecordEncoder;
+import org.apache.directory.server.dns.io.encoder.QuestionRecordEncoder;
+import org.apache.directory.server.dns.io.encoder.RecordEncoder;
+import org.apache.directory.server.dns.io.encoder.ServerSelectionRecordEncoder;
+import org.apache.directory.server.dns.io.encoder.StartOfAuthorityRecordEncoder;
+import org.apache.directory.server.dns.io.encoder.TextRecordEncoder;
+import org.apache.directory.server.dns.messages.DnsMessage;
+import org.apache.directory.server.dns.messages.MessageType;
+import org.apache.directory.server.dns.messages.OpCode;
+import org.apache.directory.server.dns.messages.QuestionRecord;
+import org.apache.directory.server.dns.messages.QuestionRecords;
+import org.apache.directory.server.dns.messages.RecordType;
+import org.apache.directory.server.dns.messages.ResourceRecord;
+import org.apache.directory.server.dns.messages.ResourceRecords;
+import org.apache.directory.server.dns.messages.ResponseCode;
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+import org.apache.mina.filter.codec.ProtocolEncoderOutput;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DnsEncoder implements ProtocolEncoder
+{
+    /** the log for this class */
+    private static final Logger log = LoggerFactory.getLogger( DnsEncoder.class );
+
+    /**
+     * A Hashed Adapter mapping record types to their encoders.
+     */
+    private static final Map DEFAULT_ENCODERS;
+
+    static
+    {
+        Map map = new HashMap();
+
+        map.put( RecordType.SOA, new StartOfAuthorityRecordEncoder() );
+        map.put( RecordType.A, new AddressRecordEncoder() );
+        map.put( RecordType.NS, new NameServerRecordEncoder() );
+        map.put( RecordType.CNAME, new CanonicalNameRecordEncoder() );
+        map.put( RecordType.PTR, new PointerRecordEncoder() );
+        map.put( RecordType.MX, new MailExchangeRecordEncoder() );
+        map.put( RecordType.SRV, new ServerSelectionRecordEncoder() );
+        map.put( RecordType.TXT, new TextRecordEncoder() );
+
+        DEFAULT_ENCODERS = Collections.unmodifiableMap( map );
+    }
+
+
+    public void encode( IoSession session, Object message, ProtocolEncoderOutput out )
+    {
+        ByteBuffer buf = ByteBuffer.allocate( 1024 );
+        encode( buf, ( DnsMessage ) message );
+
+        buf.flip();
+
+        out.write( buf );
+    }
+
+
+    public void encode( ByteBuffer byteBuffer, DnsMessage message )
+    {
+        byteBuffer.putShort( message.getTransactionId() );
+
+        byte header = ( byte ) 0x00;
+        header = encodeMessageType( message.getMessageType(), header );
+        header = encodeOpCode( message.getOpCode(), header );
+        header = encodeAuthoritativeAnswer( message.isAuthoritativeAnswer(), header );
+        header = encodeTruncated( message.isTruncated(), header );
+        header = encodeRecursionDesired( message.isRecursionDesired(), header );
+        byteBuffer.put( header );
+
+        header = ( byte ) 0x00;
+        header = encodeRecursionAvailable( message.isRecursionAvailable(), header );
+        header = encodeResponseCode( message.getResponseCode(), header );
+        byteBuffer.put( header );
+
+        byteBuffer.putShort( ( short ) message.getQuestionRecords().size() );
+        byteBuffer.putShort( ( short ) message.getAnswerRecords().size() );
+        byteBuffer.putShort( ( short ) message.getAuthorityRecords().size() );
+        byteBuffer.putShort( ( short ) message.getAdditionalRecords().size() );
+
+        encodeRecords( message.getQuestionRecords(), byteBuffer );
+        encodeRecords( message.getAnswerRecords(), byteBuffer );
+        encodeRecords( message.getAuthorityRecords(), byteBuffer );
+        encodeRecords( message.getAdditionalRecords(), byteBuffer );
+    }
+
+
+    private void encodeRecords( QuestionRecords questions, ByteBuffer byteBuffer )
+    {
+        QuestionRecordEncoder encoder = new QuestionRecordEncoder();
+
+        Iterator it = questions.iterator();
+
+        while ( it.hasNext() )
+        {
+            QuestionRecord question = ( QuestionRecord ) it.next();
+            encoder.encode( byteBuffer, question );
+        }
+    }
+
+
+    private void encodeRecords( ResourceRecords records, ByteBuffer byteBuffer )
+    {
+        Iterator it = records.iterator();
+
+        while ( it.hasNext() )
+        {
+            ResourceRecord record = ( ResourceRecord ) it.next();
+
+            try
+            {
+                encode( byteBuffer, record );
+            }
+            catch ( IOException ioe )
+            {
+                log.error( ioe.getMessage(), ioe );
+            }
+        }
+    }
+
+
+    private void encode( ByteBuffer out, ResourceRecord record ) throws IOException
+    {
+        RecordType type = record.getRecordType();
+
+        RecordEncoder encoder = ( RecordEncoder ) DEFAULT_ENCODERS.get( type );
+
+        if ( encoder == null )
+        {
+            throw new IOException( "Encoder unavailable for " + type );
+        }
+
+        encoder.encode( out, record );
+    }
+
+
+    private byte encodeMessageType( MessageType messageType, byte header )
+    {
+        byte oneBit = ( byte ) ( messageType.getOrdinal() & 0x01 );
+        return ( byte ) ( ( oneBit << 7 ) | header );
+    }
+
+
+    private byte encodeOpCode( OpCode opCode, byte header )
+    {
+        byte fourBits = ( byte ) ( opCode.getOrdinal() & 0x0F );
+        return ( byte ) ( ( fourBits << 3 ) | header );
+    }
+
+
+    private byte encodeAuthoritativeAnswer( boolean authoritative, byte header )
+    {
+        if ( authoritative )
+        {
+            header = ( byte ) ( ( ( byte ) 0x01 << 2 ) | header );
+        }
+        return header;
+    }
+
+
+    private byte encodeTruncated( boolean truncated, byte header )
+    {
+        if ( truncated )
+        {
+            header = ( byte ) ( ( ( byte ) 0x01 << 1 ) | header );
+        }
+        return header;
+    }
+
+
+    private byte encodeRecursionDesired( boolean recursionDesired, byte header )
+    {
+        if ( recursionDesired )
+        {
+            header = ( byte ) ( ( ( byte ) 0x01 ) | header );
+        }
+        return header;
+    }
+
+
+    private byte encodeRecursionAvailable( boolean recursionAvailable, byte header )
+    {
+        if ( recursionAvailable )
+        {
+            header = ( byte ) ( ( ( byte ) 0x01 << 7 ) | header );
+        }
+        return header;
+    }
+
+
+    private byte encodeResponseCode( ResponseCode responseCode, byte header )
+    {
+        byte fourBits = ( byte ) ( responseCode.getOrdinal() & 0x0F );
+        return ( byte ) ( fourBits | header );
+    }
+
+
+    public void dispose( IoSession arg0 ) throws Exception
+    {
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsEncoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsEncoder.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolCodecFactory.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolCodecFactory.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolCodecFactory.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolCodecFactory.java Sat Feb 11 21:50:03 2006
@@ -1,54 +1,54 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.directory.server.dns.protocol;
-
-
-import org.apache.mina.filter.codec.ProtocolCodecFactory;
-import org.apache.mina.filter.codec.ProtocolDecoder;
-import org.apache.mina.filter.codec.ProtocolEncoder;
-
-
-public class DnsProtocolCodecFactory implements ProtocolCodecFactory
-{
-    private static final DnsProtocolCodecFactory INSTANCE = new DnsProtocolCodecFactory();
-
-
-    public static DnsProtocolCodecFactory getInstance()
-    {
-        return INSTANCE;
-    }
-
-
-    private DnsProtocolCodecFactory()
-    {
-    }
-
-
-    public ProtocolEncoder getEncoder()
-    {
-        // Create a new encoder.
-        return new DnsEncoder();
-    }
-
-
-    public ProtocolDecoder getDecoder()
-    {
-        // Create a new decoder.
-        return new DnsDecoder();
-    }
-}
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.server.dns.protocol;
+
+
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+
+
+public class DnsProtocolCodecFactory implements ProtocolCodecFactory
+{
+    private static final DnsProtocolCodecFactory INSTANCE = new DnsProtocolCodecFactory();
+
+
+    public static DnsProtocolCodecFactory getInstance()
+    {
+        return INSTANCE;
+    }
+
+
+    private DnsProtocolCodecFactory()
+    {
+    }
+
+
+    public ProtocolEncoder getEncoder()
+    {
+        // Create a new encoder.
+        return new DnsEncoder();
+    }
+
+
+    public ProtocolDecoder getDecoder()
+    {
+        // Create a new decoder.
+        return new DnsDecoder();
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolCodecFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolCodecFactory.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolHandler.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolHandler.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolHandler.java Sat Feb 11 21:50:03 2006
@@ -1,115 +1,115 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.directory.server.dns.protocol;
-
-
-import org.apache.directory.server.dns.DnsConfiguration;
-import org.apache.directory.server.dns.messages.DnsMessage;
-import org.apache.directory.server.dns.service.DnsContext;
-import org.apache.directory.server.dns.service.DomainNameServiceChain;
-import org.apache.directory.server.dns.store.RecordStore;
-import org.apache.directory.server.protocol.shared.chain.Command;
-import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.IoHandler;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.codec.ProtocolCodecFilter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class DnsProtocolHandler implements IoHandler
-{
-    private static final Logger log = LoggerFactory.getLogger( DnsProtocolHandler.class );
-
-    private DnsConfiguration config;
-    private RecordStore store;
-
-    private Command dnsService;
-
-
-    public DnsProtocolHandler(DnsConfiguration config, RecordStore store)
-    {
-        this.config = config;
-        this.store = store;
-
-        dnsService = new DomainNameServiceChain();
-    }
-
-
-    public void sessionCreated( IoSession session ) throws Exception
-    {
-        log.debug( "{} CREATED", session.getRemoteAddress() );
-
-        session.getFilterChain().addFirst( "codec", new ProtocolCodecFilter( DnsProtocolCodecFactory.getInstance() ) );
-    }
-
-
-    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.error( session.getRemoteAddress() + " EXCEPTION", cause );
-        session.close();
-    }
-
-
-    public void messageReceived( IoSession session, Object message )
-    {
-        log.debug( "{} RCVD: {}", session.getRemoteAddress(), message );
-
-        DnsMessage request = ( DnsMessage ) message;
-
-        try
-        {
-            DnsContext dnsContext = new DnsContext();
-            dnsContext.setConfig( config );
-            dnsContext.setStore( store );
-            dnsContext.setRequest( request );
-
-            dnsService.execute( dnsContext );
-
-            session.write( dnsContext.getReply() );
-        }
-        catch ( Exception e )
-        {
-            log.error( e.getMessage(), e );
-        }
-    }
-
-
-    public void messageSent( IoSession session, Object message )
-    {
-        log.debug( "{} SENT: {}", session.getRemoteAddress(), message );
-    }
-}
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.directory.server.dns.protocol;
+
+
+import org.apache.directory.server.dns.DnsConfiguration;
+import org.apache.directory.server.dns.messages.DnsMessage;
+import org.apache.directory.server.dns.service.DnsContext;
+import org.apache.directory.server.dns.service.DomainNameServiceChain;
+import org.apache.directory.server.dns.store.RecordStore;
+import org.apache.directory.server.protocol.shared.chain.Command;
+import org.apache.mina.common.IdleStatus;
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DnsProtocolHandler implements IoHandler
+{
+    private static final Logger log = LoggerFactory.getLogger( DnsProtocolHandler.class );
+
+    private DnsConfiguration config;
+    private RecordStore store;
+
+    private Command dnsService;
+
+
+    public DnsProtocolHandler(DnsConfiguration config, RecordStore store)
+    {
+        this.config = config;
+        this.store = store;
+
+        dnsService = new DomainNameServiceChain();
+    }
+
+
+    public void sessionCreated( IoSession session ) throws Exception
+    {
+        log.debug( "{} CREATED", session.getRemoteAddress() );
+
+        session.getFilterChain().addFirst( "codec", new ProtocolCodecFilter( DnsProtocolCodecFactory.getInstance() ) );
+    }
+
+
+    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.error( session.getRemoteAddress() + " EXCEPTION", cause );
+        session.close();
+    }
+
+
+    public void messageReceived( IoSession session, Object message )
+    {
+        log.debug( "{} RCVD: {}", session.getRemoteAddress(), message );
+
+        DnsMessage request = ( DnsMessage ) message;
+
+        try
+        {
+            DnsContext dnsContext = new DnsContext();
+            dnsContext.setConfig( config );
+            dnsContext.setStore( store );
+            dnsContext.setRequest( request );
+
+            dnsService.execute( dnsContext );
+
+            session.write( dnsContext.getReply() );
+        }
+        catch ( Exception e )
+        {
+            log.error( e.getMessage(), e );
+        }
+    }
+
+
+    public void messageSent( IoSession session, Object message )
+    {
+        log.debug( "{} SENT: {}", session.getRemoteAddress(), message );
+    }
+}

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/protocol/DnsProtocolHandler.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/service/BuildReply.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/service/DnsContext.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/service/DnsExceptionHandler.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/service/DomainNameServiceChain.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/service/GetResourceRecords.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/service/MonitorContext.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/service/MonitorMessage.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/service/MonitorReply.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/service/MonitorRequest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/store/DnsAttribute.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/store/DnsCatalog.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/store/JndiRecordStoreImpl.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/store/MultiBaseSearch.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id



Mime
View raw message