cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From devd...@apache.org
Subject [19/22] CLOUDSTACK-5344: Update to allow rdp console to access hyper-v vm virtual framebuffer.
Date Mon, 23 Dec 2013 09:13:13 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSAttachUserRequest.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSAttachUserRequest.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSAttachUserRequest.java
deleted file mode 100644
index 10a7eff..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSAttachUserRequest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-// 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 rdpclient;
-
-import streamer.ByteBuffer;
-import streamer.Element;
-import streamer.Link;
-import streamer.MockSink;
-import streamer.MockSource;
-import streamer.OneTimeSwitch;
-import streamer.Pipeline;
-import streamer.PipelineImpl;
-/**
- * @see http://msdn.microsoft.com/en-us/library/cc240684.aspx
- */
-public class ClientMCSAttachUserRequest extends OneTimeSwitch {
-
-  public ClientMCSAttachUserRequest(String id) {
-    super(id);
-  }
-
-  @Override
-  protected void handleOneTimeData(ByteBuffer buf, Link link) {
-    if (buf == null)
-      return;
-
-    throw new RuntimeException("Unexpected packet: " + buf + ".");
-  }
-
-  @Override
-  protected void onStart() {
-    super.onStart();
-
-    int length = 1;
-    ByteBuffer buf = new ByteBuffer(length, true);
-
-    buf.writeByte(0x28); // AttachUserRequest
-
-    pushDataToOTOut(buf);
-
-    switchOff();
-  }
-
-  /**
-   * Example.
-   */
-  public static void main(String args[]) {
-    // System.setProperty("streamer.Link.debug", "true");
-    System.setProperty("streamer.Element.debug", "true");
-    // System.setProperty("streamer.Pipeline.debug", "true");
-
-    /* @formatter:off */
-    byte[] packet = new byte[] {
-
-        0x03, 0x00, 0x00, 0x08,  //  TPKT Header (length = 8 bytes)
-        0x02, (byte) 0xf0, (byte) 0x80,  //  X.224 Data TPDU
-        
-        // PER encoded (ALIGNED variant of BASIC-PER) PDU contents:
-        0x28, 
-        
-        // 0x28:
-        // 0 - --\
-        // 0 -   |
-        // 1 -   | CHOICE: From DomainMCSPDU select attachUserRequest (10) 
-        // 0 -   | of type AttachUserRequest
-        // 1 -   |
-        // 0 - --/
-        // 0 - padding
-        // 0 - padding
-
-    };
-    /* @formatter:on */
-
-    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-    Element todo = new ClientMCSAttachUserRequest("TODO");
-    Element x224 = new ClientX224DataPdu("x224");
-    Element tpkt = new ClientTpkt("tpkt");
-    Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(packet));
-    Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-
-    Pipeline pipeline = new PipelineImpl("test");
-    pipeline.add(source, todo, x224, tpkt, sink, mainSink);
-    pipeline.link("source", "TODO", "mainSink");
-    pipeline.link("TODO >" + OTOUT, "x224", "tpkt", "sink");
-    pipeline.runMainLoop("source", STDOUT, false, false);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSChannelJoinRequest_ServerMCSChannelConfirmPDUs.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSChannelJoinRequest_ServerMCSChannelConfirmPDUs.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSChannelJoinRequest_ServerMCSChannelConfirmPDUs.java
deleted file mode 100644
index f082539..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSChannelJoinRequest_ServerMCSChannelConfirmPDUs.java
+++ /dev/null
@@ -1,222 +0,0 @@
-// 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 rdpclient;
-
-import streamer.ByteBuffer;
-import streamer.Element;
-import streamer.Link;
-import streamer.MockSink;
-import streamer.MockSource;
-import streamer.OneTimeSwitch;
-import streamer.Pipeline;
-import streamer.PipelineImpl;
-
-/**
- * The MCS Channel Join Request PDUs are sent sequentially. The first PDU is
- * sent after receiving the MCS Attach User Confirm PDU and subsequent PDUs are
- * sent after receiving the MCS Channel Join Confirm PDU for the previous
- * request. Sending of the MCS Channel Join Request PDUs MUST continue until all
- * channels have been successfully joined.
- * 
- * @see http://msdn.microsoft.com/en-us/library/cc240686.aspx
- */
-public class ClientMCSChannelJoinRequest_ServerMCSChannelConfirmPDUs extends OneTimeSwitch {
-
-  private static final int MCS_CHANNEL_CONFIRM_PDU = 15;
-
-  protected int[] channels;
-  protected int channelRequestsSent = 0;
-
-  protected RdpState state;
-
-  public ClientMCSChannelJoinRequest_ServerMCSChannelConfirmPDUs(String id, int[] channels, RdpState state) {
-    super(id);
-    this.channels = channels;
-    this.state=state;
-  }
-
-  @Override
-  protected void handleOneTimeData(ByteBuffer buf, Link link) {
-    if (buf == null)
-      return;
-
-    // Parse channel confirm response
-    int typeAndFlags = buf.readUnsignedByte();
-    int type = typeAndFlags >> 2;
-    // int flags = typeAndFlags & 0x3;
-
-    if (type != MCS_CHANNEL_CONFIRM_PDU)
-      throw new RuntimeException("["+this+"] ERROR: Incorrect type of MCS AttachUserConfirm PDU. Expected value: 15, actual value: " + type + ", data: " + buf + ".");
-
-    int rtSuccess = buf.readUnsignedByte() >> 4;
-    if (rtSuccess != 0)
-      throw new RuntimeException("["+this+"] ERROR: Cannot connect to channel: request failed. Error code: " + rtSuccess + ", channel ID: " + channels[channelRequestsSent - 1]
-          + ", data: " + buf + ".");
-
-    // Initiator and requested fields MAY be ignored, however, the channelId
-    // field MUST be examined. If the value of the channelId field does not
-    // correspond with the value of the channelId field sent in the previous MCS
-    // Channel Join Request PDU the connection SHOULD be dropped.
-
-    // Initiator: 1007 (6+1001)
-    // int initator=buf.readUnsignedShort();
-    buf.skipBytes(2);
-
-    // Requested channel
-    // int requestedChannel=buf.readUnsignedShort();
-    buf.skipBytes(2);
-
-    // Actual channel
-    int actualChannel = buf.readUnsignedShort();
-    if (actualChannel != channels[channelRequestsSent - 1])
-      throw new RuntimeException("Unexpeceted channeld ID returned. Expected channeld ID: " + channels[channelRequestsSent - 1] + ", actual channel ID: "
-          + actualChannel + ", data: " + buf + ".");
-    
-    state.channelJoined(actualChannel);
-    
-    buf.unref();
-    
-
-    if (channelRequestsSent < channels.length)
-      sendChannelRequest(channels[channelRequestsSent++]);
-    else
-      switchOff();
-  }
-
-  @Override
-  protected void onStart() {
-    super.onStart();
-
-    sendChannelRequest(channels[channelRequestsSent++]);
-
-    // Switch off after receiving response(s)
-  }
-
-  private void sendChannelRequest(int channel) {
-    ByteBuffer buf = new ByteBuffer(5, true);
-
-    buf.writeByte(0x38); // Channel Join request
-
-    buf.writeShort(0x03); // ChannelJoinRequest::initiator: 1004
-    buf.writeShort(channel);
-
-    pushDataToOTOut(buf);
-  }
-
-  /**
-   * Example.
-   * 
-   * @see http://msdn.microsoft.com/en-us/library/cc240834.aspx
-   */
-  public static void main(String args[]) {
-    // System.setProperty("streamer.Link.debug", "true");
-    System.setProperty("streamer.Element.debug", "true");
-    // System.setProperty("streamer.Pipeline.debug", "true");
-
-    /* @formatter:off */
-    byte[] clientRequestPacket = new byte[] {
-        0x03, 0x00, 0x00, 0x0c,  //  TPKT Header (length = 12 bytes)
-        0x02, (byte) 0xf0, (byte) 0x80,  //  X.224 Data TPDU
-        
-        // PER encoded (ALIGNED variant of BASIC-PER) PDU contents:
-        0x38, 0x00, 0x03, 0x03, (byte) 0xef, 
-
-         // 0x38:
-         // 0 - --\
-         // 0 -   |
-         // 1 -   | CHOICE: From DomainMCSPDU select channelJoinRequest (14) 
-         // 1 -   | of type ChannelJoinRequest
-         // 1 -   |
-         // 0 - --/
-         // 0 - padding
-         // 0 - padding
-
-         // 0x00:
-         // 0 - --\
-         // 0 -   | 
-         // 0 -   | 
-         // 0 -   | 
-         // 0 -   | 
-         // 0 -   | 
-         // 0 -   | 
-         // 0 -   | 
-         //       | ChannelJoinRequest::initiator = 0x03 + 1001 = 1004
-         // 0x03: |
-         // 0 -   | 
-         // 0 -   | 
-         // 0 -   | 
-         // 0 -   | 
-         // 0 -   | 
-         // 1 -   | 
-         // 1 -   | 
-         // 0 - --/
-
-         // 0x03:
-         // 0 - --\
-         // 0 -   |
-         // 0 -   |
-         // 0 -   |
-         // 0 -   |
-         // 0 -   |
-         // 1 -   |
-         // 1 -   |
-         //       | ChannelJoinRequest::channelId = 0x03ef = 1007
-         // 0xef: |
-         // 1 -   |
-         // 1 -   |
-         // 1 -   |
-         // 0 -   |
-         // 1 -   |
-         // 1 -   |
-         // 1 -   |
-         // 1 - --/
-    };
-    
-    byte[] serverResponsePacket = new byte[] {
-        // MCS Channel Confirm
-    (byte)0x3e, 
-    
-    // result: rt-successful (0)
-    (byte)0x00, 
-    
-    // Initiator: 1007 (6+1001)
-    (byte)0x00, (byte)0x06, 
-    
-    // Requested channel
-    (byte)0x03, (byte)0xef,
-    
-    // Actual channel
-    (byte)0x03, (byte)0xef,
-    };
-    /* @formatter:on */
-
-    RdpState rdpState = new RdpState();
-    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(serverResponsePacket, new byte[] { 1, 2, 3 }));
-    Element todo = new ClientMCSChannelJoinRequest_ServerMCSChannelConfirmPDUs("channels", new int[] { 1007 }, rdpState);
-    Element x224 = new ClientX224DataPdu("x224");
-    Element tpkt = new ClientTpkt("tpkt");
-    Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(clientRequestPacket));
-    Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-
-    Pipeline pipeline = new PipelineImpl("test");
-    pipeline.add(source, todo, x224, tpkt, sink, mainSink);
-    pipeline.link("source", "channels", "mainSink");
-    pipeline.link("channels >" + OTOUT, "x224", "tpkt", "sink");
-    pipeline.runMainLoop("source", STDOUT, false, false);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSConnectInitial.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSConnectInitial.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSConnectInitial.java
deleted file mode 100644
index 0189987..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSConnectInitial.java
+++ /dev/null
@@ -1,669 +0,0 @@
-// 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 rdpclient;
-
-import streamer.ByteBuffer;
-import streamer.Element;
-import streamer.Link;
-import streamer.MockSink;
-import streamer.MockSource;
-import streamer.OneTimeSwitch;
-import streamer.Pipeline;
-import streamer.PipelineImpl;
-
-public class ClientMCSConnectInitial extends OneTimeSwitch {
-
-  public ClientMCSConnectInitial(String id) {
-    super(id);
-  }
-
-  @Override
-  protected void handleOneTimeData(ByteBuffer buf, Link link) {
-    if (buf == null)
-      return;
-
-    throw new RuntimeException("Unexpected packet: " + buf + ".");
-  }
-
-  @Override
-  protected void onStart() {
-    super.onStart();
-
-    int length = 1024; // Large enough
-    ByteBuffer buf = new ByteBuffer(length, true);
-
-    /* @formatter:off */
-    buf.writeBytes(new byte[] {
-//        - T125: MCSConnect Initial
-//        - MCSConnectInitial: Identifier=Generic Conference Control (0.0.20.124.0.1), ConnectPDULength=254
-//         - ConnectInitialHeader: 
-      (byte)0x7F, (byte)0x65, 
-//          - AsnId: Application Constructed Tag (101)
-//           - HighTag: 
-//              Class:     (01......) Application (1)
-//              Type:      (..1.....) Constructed
-//              TagNumber: (...11111)
-//              TagValueEnd: 101 (0x65)
-      (byte)0x82, (byte)0x01, (byte)0x6C, 
-//          - AsnLen: Length = 364, LengthOfLength = 2
-//             LengthType: LengthOfLength = 2
-//             Length: 364 bytes
-      (byte)0x04, (byte)0x01, (byte)0x01, 
-//         - CallingDomainSelector: 0x1
-//          - AsnOctetStringHeader: 
-//           - AsnId: OctetString type (Universal 4)
-//            - LowTag: 
-//               Class:    (00......) Universal (0)
-//               Type:     (..0.....) Primitive
-//               TagValue: (...00100) 4
-//           - AsnLen: Length = 1, LengthOfLength = 0
-//              Length: 1 bytes, LengthOfLength = 0
-//            OctetStream: 0x1
-      (byte)0x04, (byte)0x01, (byte)0x01,
-//         - CalledDomainSelector: 0x1
-//          - AsnOctetStringHeader: 
-//           - AsnId: OctetString type (Universal 4)
-//            - LowTag: 
-//               Class:    (00......) Universal (0)
-//               Type:     (..0.....) Primitive
-//               TagValue: (...00100) 4
-//           - AsnLen: Length = 1, LengthOfLength = 0
-//              Length: 1 bytes, LengthOfLength = 0
-//            OctetStream: 0x1
-      (byte)0x01, (byte)0x01, (byte)0xFF,
-//         - UpwardFlag: True
-//          - AsnBooleanHeader: 
-//           - AsnId: Boolean type (Universal 1)
-//            - LowTag: 
-//               Class:    (00......) Universal (0)
-//               Type:     (..0.....) Primitive
-//               TagValue: (...00001) 1
-//           - AsnLen: Length = 1, LengthOfLength = 0
-//              Length: 1 bytes, LengthOfLength = 0
-//            Tf: 255 (0xFF)
-
-//
-//         - TargetParameters: Length = 26, LengthOfLength = 0
-      (byte)0x30, (byte)0x1A, 
-//          - DomainParametersHeader: 0x1
-//           - AsnId: Sequence and SequenceOf types (Universal 16)
-//            - LowTag: 
-//               Class:    (00......) Universal (0)
-//               Type:     (..1.....) Constructed
-//               TagValue: (...10000) 16
-//           - AsnLen: Length = 26, LengthOfLength = 0
-//              Length: 26 bytes, LengthOfLength = 0
-      (byte)0x02, (byte)0x01, (byte)0x22, 
-//          - ChannelIds: 34
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 34 (0x22)
-      (byte)0x02, (byte)0x01, (byte)0x02,
-//          - UserIDs: 2
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 2 (0x2)
-      (byte)0x02, (byte)0x01, (byte)0x00,
-//          - TokenIds: 0
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 0 (0x0)
-      (byte)0x02, (byte)0x01, (byte)0x01,
-//          - NumPriorities: 1
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 1 (0x1)
-      (byte)0x02, (byte)0x01, (byte)0x00,
-//          - MinThroughput: 0
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 0 (0x0)
-      (byte)0x02, (byte)0x01, (byte)0x01,
-//          - Height: 1
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 1 (0x1)
-      (byte)0x02, (byte)0x03, (byte)0x00, (byte)0xFF, (byte)0xFF,
-//          - MCSPDUsize: 65535
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 3, LengthOfLength = 0
-//               Length: 3 bytes, LengthOfLength = 0
-//             AsnInt: 65535 (0xFFFF)
-      (byte)0x02, (byte)0x01, (byte)0x02, 
-//          - protocolVersion: 2
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 2 (0x2)
-
-//      
-//         - MinimumParameters: Length = 25, LengthOfLength = 0
-      (byte)0x30, (byte)0x19, 
-//          - DomainParametersHeader: 0x1
-//           - AsnId: Sequence and SequenceOf types (Universal 16)
-//            - LowTag: 
-//               Class:    (00......) Universal (0)
-//               Type:     (..1.....) Constructed
-//               TagValue: (...10000) 16
-//           - AsnLen: Length = 25, LengthOfLength = 0
-//              Length: 25 bytes, LengthOfLength = 0
-      (byte)0x02, (byte)0x01, (byte)0x01,
-//          - ChannelIds: 1
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 1 (0x1)
-      (byte)0x02, (byte)0x01, (byte)0x01,
-//          - UserIDs: 1
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 1 (0x1)
-      (byte)0x02, (byte)0x01, (byte)0x01,
-//          - TokenIds: 1
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 1 (0x1)
-      (byte)0x02, (byte)0x01, (byte)0x01,
-//          - NumPriorities: 1
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 1 (0x1)
-      (byte)0x02, (byte)0x01, (byte)0x00,
-//          - MinThroughput: 0
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 0 (0x0)
-      (byte)0x02, (byte)0x01, (byte)0x01, 
-//          - Height: 1
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 1 (0x1)
-      (byte)0x02, (byte)0x02, (byte)0x04, (byte)0x20, 
-//          - MCSPDUsize: 1056
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 2, LengthOfLength = 0
-//               Length: 2 bytes, LengthOfLength = 0
-//             AsnInt: 1056 (0x420)
-      (byte)0x02, (byte)0x01, (byte)0x02, 
-//          - protocolVersion: 2
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 2 (0x2)
-//         - MaximumParameters: Length = 31, LengthOfLength = 0
-//          - DomainParametersHeader: 0x1
-      (byte)0x30, (byte)0x1F,
-//           - AsnId: Sequence and SequenceOf types (Universal 16)
-//            - LowTag: 
-//               Class:    (00......) Universal (0)
-//               Type:     (..1.....) Constructed
-//               TagValue: (...10000) 16
-//           - AsnLen: Length = 31, LengthOfLength = 0
-//              Length: 31 bytes, LengthOfLength = 0
-      (byte)0x02, (byte)0x03, (byte)0x00, (byte)0xFF, (byte)0xFF, 
-//          - ChannelIds: 65535
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 3, LengthOfLength = 0
-//               Length: 3 bytes, LengthOfLength = 0
-//             AsnInt: 65535 (0xFFFF)
-      (byte)0x02, (byte)0x02, (byte)0xFC, (byte)0x17, 
-//          - UserIDs: 64535
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 2, LengthOfLength = 0
-//               Length: 2 bytes, LengthOfLength = 0
-//             AsnInt: 64535 (0xFC17)
-      (byte)0x02, (byte)0x03, (byte)0x00, (byte)0xFF, (byte)0xFF,
-//          - TokenIds: 65535
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 3, LengthOfLength = 0
-//               Length: 3 bytes, LengthOfLength = 0
-//             AsnInt: 65535 (0xFFFF)
-      (byte)0x02, (byte)0x01, (byte)0x01, 
-//          - NumPriorities: 1
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 1 (0x1)
-      (byte)0x02, (byte)0x01, (byte)0x00, 
-//          - MinThroughput: 0
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 0 (0x0)
-      (byte)0x02, (byte)0x01, (byte)0x01, 
-//          - Height: 1
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 1 (0x1)
-      (byte)0x02, (byte)0x03, (byte)0x00, (byte)0xFF, (byte)0xFF, 
-//          - MCSPDUsize: 65535
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 3, LengthOfLength = 0
-//               Length: 3 bytes, LengthOfLength = 0
-//             AsnInt: 65535 (0xFFFF)
-      (byte)0x02, (byte)0x01, (byte)0x02, 
-//          - protocolVersion: 2
-//           - AsnIntegerHeader: 
-//            - AsnId: Integer type (Universal 2)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00010) 2
-//            - AsnLen: Length = 1, LengthOfLength = 0
-//               Length: 1 bytes, LengthOfLength = 0
-//             AsnInt: 2 (0x2)
-//         - UserData: Identifier=Generic Conference Contro (0.0.20.124.0.1), ConnectPDULength=254
-//          - UserDataHeader: 
-      (byte)0x04, (byte)0x82, (byte)0x01, (byte)0x07, 
-//           - AsnId: OctetString type (Universal 4)
-//            - LowTag: 
-//               Class:    (00......) Universal (0)
-//               Type:     (..0.....) Primitive
-//               TagValue: (...00100) 4
-//           - AsnLen: Length = 263, LengthOfLength = 2
-//              LengthType: LengthOfLength = 2
-//              Length: 263 bytes
-      (byte)0x00, (byte)0x05, (byte)0x00, (byte)0x14, (byte)0x7C, (byte)0x00, (byte)0x01, 
-//          - AsnBerObjectIdentifier: Generic Conference Contro (0.0.20.124.0.1)
-//           - AsnObjectIdentifierHeader: 
-//            - AsnId: Reserved for use by the encoding rules (Universal 0)
-//             - LowTag: 
-//                Class:    (00......) Universal (0)
-//                Type:     (..0.....) Primitive
-//                TagValue: (...00000) 0
-//            - AsnLen: Length = 5, LengthOfLength = 0
-//               Length: 5 bytes, LengthOfLength = 0
-//             First: 0 (0x0)
-//             Final: 20 (0x14)
-//             Final: 124 (0x7C)
-//             Final: 0 (0x0)
-//             Final: 1 (0x1)
-      (byte)0x80, (byte)0xFE, 
-//          - ConnectPDULength: 254
-//             Align: No Padding
-//             Length: 254
-      (byte)0x00, (byte)0x08, (byte)0x00, (byte)0x10,
-//          - ConnectGCCPDU: conferenceCreateRequest
-//             ExtensionBit: 0 (0x0)
-//           - ChoiceValue: conferenceCreateRequest
-//              Value: (000.....) 0x0
-//           - conferenceCreateRequest: 
-//              ExtensionBit: 0 (0x0)
-//              convenerPasswordPresent: 0 (0x0)
-//              passwordPresent: 0 (0x0)
-//              conductorPrivilegesPresent: 0 (0x0)
-//              conductedPrivilegesPresent: 0 (0x0)
-//              nonConductedPrivilegesPresent: 0 (0x0)
-//              conferenceDescriptionPresent: 0 (0x0)
-//              callerIdentifierPresent: 0 (0x0)
-//              userDataPresent: 1 (0x1)
-//            - conferenceName: 
-//               ExtensionBit: 0 (0x0)
-//               textPresent: 0 (0x0)
-//             - numeric: 1
-//              - SimpleNumericString: 1
-//               - NumericString: 1
-//                - Align: No Padding
-//                   Padding1: (0.......) 0x0
-//                - Length: 1
-//                   Value: (00000000) 0x0
-//                - Restrictedstr: 1
-//                   FourBits: (0001....) 0x1
-//            - lockedConference: False
-//               Value: False 0.......
-//            - listedConference: False
-//               Value: False 0.......
-//            - conductibleConference: False
-//               Value: False 0.......
-//            - TerminationMethod: automatic
-//               ExtensionBit: 0 (0x0)
-//             - RootIndex: 0
-//                Value: (0.......) 0x0
-//            - userData: 
-      (byte)0x00, (byte)0x01, 
-//             - Size: 1
-//              - Align: No Padding
-//                 Padding7: (0000000.) 0x0
-//                Length: 1
-//             - UserData: 0x44756361
-      (byte)0xC0, (byte)0x00, (byte)0x44, (byte)0x75, (byte)0x63, (byte)0x61, 
-//                valuePresent: 1 (0x1)
-//              - key: h221NonStandard "Duca"
-//               - ChoiceValue: h221NonStandard
-//                  Value: (1.......) 0x1
-//               - h221NonStandard: 
-//                - H221NonStandardIdentifier: length: 4
-//                 - ConstrainedLength: 4
-//                    Value: (00000000) 0x0
-//                 - Align: No Padding
-//                    Padding6: (000000..) 0x0
-//                   Value: Binary Large Object (4 Bytes) "Duca"
-//              - ClientMcsConnectInitialPdu: 
-      (byte)0x80, (byte)0xF0, 
-//               - RDPGCCUserDataRequestLength: 240
-//                  Align: No Padding
-//                  Length: 240
-//               - TsUd: CS_CORE
-      (byte)0x01, (byte)0xC0, (byte)0xD8, (byte)0x00, 
-//                - TsUdHeader: Type = CS_CORE, Length = 216
-//                   Type: CS_CORE
-//                   Length: 216 (0xD8)
-//                - TsUdCsCore: 
-      (byte)0x04, (byte)0x00, (byte)0x08, (byte)0x00, 
-//                   Version: RDP 5.0, 5.1, 5.2, 6.0, 6.1, and 7.0 
-      (byte)0x00, (byte)0x04, 
-//                   DesktopWidth: 1024 (0x400)
-      (byte)0x00, (byte)0x03, 
-//                   DesktopHeight: 768 (0x300)
-      (byte)0x01, (byte)0xCA, 
-//                   ColorDepth: 8 bpp
-      (byte)0x03, (byte)0xAA, 
-//                   SASSequence: 0xaa03, SHOULD be set to RNS_UD_SAS_DEL(0xAA03)
-      (byte)0x09, (byte)0x04, (byte)0x00, (byte)0x00, 
-//                   KeyboardLayout: Language: English, Location: United States
-      (byte)0x28, (byte)0x0A, (byte)0x00, (byte)0x00, 
-//                   ClientBuild: 2600 (0xA28)
-      (byte)0x61, (byte)0x00, (byte)0x70, (byte)0x00, (byte)0x6F, (byte)0x00, (byte)0x6C, (byte)0x00, (byte)0x6C, (byte)0x00, (byte)0x6F, (byte)0x00, (byte)0x33, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, 
-//                   ClientName: apollo3
-      (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, 
-//                   KeyboardType: Undefined value: 0
-      (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, 
-//                   KeyboardSubType: 0 (0x0)
-      (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, 
-//                   KeyboardFunctionKey: 0 (0x0)
-      (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, 
-//                   ImeFileName: 
-      (byte)0x01, (byte)0xCA, 
-//                   PostBeta2ColorDepth: 8 bpp
-      (byte)0x01, (byte)0x00, 
-//                   ClientProductId: 0x1, SHOULD be set to initialized to 1
-      (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, 
-//                   SerialNumber: 0x0, SHOULD be set to 0
-      (byte)0x10, (byte)0x00, 
-//                   HighColorDepth: 16-bit 565 RGB
-      (byte)0x07, (byte)0x00, 
-//                 - SupportedColorDepth: 7 (0x7)
-//                    Support24BPP: (...............1) Support 24BPP
-//                    Support16BPP: (..............1.) Support 16BPP
-//                    Support15BPP: (.............1..) Support 15BPP
-//                    Support32BPP: (............0...) Not Support 32BPP
-//                    Reserved:     (000000000000....)
-      (byte)0x01, (byte)0x00, 
-//                 - EarlyCapabilityFlags: 1 (0x1)
-//                    SupportSetErrorPdu:      (...............1) Indicates that the client supports the Set Error Info PDU
-//                    Want32BppSession:        (..............0.) Client is not requesting 32BPP session
-//                    SupportStatusInfoPdu:    (.............0..) Client not supports the Server Status Info PDU
-//                    StrongAsymmetricKeys:    (............0...) Not support asymmetric keys larger than 512-bits
-//                    Unused:                  (...........0....)
-//                    ValidConnection:         (..........0.....) Not Indicates ConnectionType field contains valid data
-//                    SupportMonitorLayoutPdu: (.........0......) Not Indicates that the client supports the Monitor Layout PDU
-//                    Unused2:                 (000000000.......)
-      (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, 
-//      ClientDigProductId: 
-(byte)0x00, 
-//      connectionType: invalid connection type
-(byte)0x00, 
-//      pad1octet: 0 (0x0)
-(byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, 
-//      ServerSelectedProtocols: TLS 1.0
-//
-//  - TsUd: CS_CLUSTER
-//   - TsUdHeader: Type = CS_CLUSTER, Length = 12
-(byte)0x04, (byte)0xC0, 
-//      Type: CS_CLUSTER
-(byte)0x0C, (byte)0x00, 
-//      Length: 12 (0xC)
-(byte)0x0D, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-//   - TsUdCsCluster: 
-//    - Flags: 13 (0xD)
-//       RedirectedSupported: (...............................1) Support Redirected
-//       SessionIDFieldValid: (..............................0.) SessionID Field not Valid
-//       SupportedVersion:    (..........................0011..) REDIRECTION_VERSION4
-//       RedirectedSmartcard: (.........................0......) Not Logon with Smartcard
-//       Unused:           (0000000000000000000000000.......)
-//      RedirectedSessionID: 0 (0x0)
-//
-//  - TsUd: CS_SECURITY
-//   - TsUdHeader: Type = CS_SECURITY, Length = 12
-(byte)0x02, (byte)0xC0, 
-//      Type: CS_SECURITY
-(byte)0x0C, (byte)0x00, 
-//      Length: 12 (0xC)
-//      
-//   - TsUdCsSec: 
-(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, 
-//    - EncryptionMethod: 
-//       Support40Bit:  (...............................0) Not Support 
-//       Support128Bit: (..............................0.) Not Support 128-bit
-//       Reserved1:     (.............................0..)
-//       Support56Bit:  (............................0...) Not Support 56-bit
-//       SupportFIPS:   (...........................0....) Not Support FIPS Compliant
-//       Reserved2:     (000000000000000000000000000.....)
-(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, 
-//    - ExtEncryptionMethod: 
-//       Support40Bit:  (...............................0) Not Support 
-//       Support128Bit: (..............................0.) Not Support 128-bit
-//       Reserved1:     (.............................0..)
-//       Support56Bit:  (............................0...) Not Support 56-bit
-//       SupportFIPS:   (...........................0....) Not Support FIPS Compliant
-//       Reserved2:     (000000000000000000000000000.....)
-    });
-    /* @formatter:on */
-
-    buf.length = buf.cursor;
-
-    pushDataToOTOut(buf);
-
-    switchOff();
-  }
-
-  /**
-   * Example.
-   * 
-   * @see http://msdn.microsoft.com/en-us/library/cc240836.aspx
-   */
-  public static void main(String args[]) {
-    // System.setProperty("streamer.Link.debug", "true");
-    System.setProperty("streamer.Element.debug", "true");
-    // System.setProperty("streamer.Pipeline.debug", "true");
-
-    /* @formatter:off */
-    byte[] packet = new byte[] {
-        // TPKT: TPKT version = 3
-        (byte) 0x03,  (byte) 0x00,  
-        // TPKT: Packet length: 378 bytes
-        (byte) 0x01,  (byte) 0x78, 
-        
-        // X.224: Length indicator = 2
-        (byte) 0x02,  
-        // X.224: Type: Data TPDU
-        (byte) 0xf0,  
-        // X.224: EOT
-        (byte) 0x80,  
-        
-        // Captured packet
-        (byte)0x7f, (byte)0x65, (byte)0x82, (byte)0x01, (byte)0x6c, (byte)0x04, (byte)0x01, (byte)0x01, (byte)0x04,
-        (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0xff, (byte)0x30, (byte)0x1a, (byte)0x02, (byte)0x01, (byte)0x22, (byte)0x02, (byte)0x01, (byte)0x02, (byte)0x02, (byte)0x01, (byte)0x00,
-        (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, (byte)0x01, (byte)0x00, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x02, (byte)0x01,
-        (byte)0x02, (byte)0x30, (byte)0x19, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02,
-        (byte)0x01, (byte)0x00, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, (byte)0x02, (byte)0x04, (byte)0x20, (byte)0x02, (byte)0x01, (byte)0x02, (byte)0x30, (byte)0x1f, (byte)0x02, (byte)0x03,
-        (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x02, (byte)0x02, (byte)0xfc, (byte)0x17, (byte)0x02, (byte)0x03, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02,
-        (byte)0x01, (byte)0x00, (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0x02, (byte)0x01, (byte)0x02, (byte)0x04, (byte)0x82, (byte)0x01,
-        (byte)0x07, (byte)0x00, (byte)0x05, (byte)0x00, (byte)0x14, (byte)0x7c, (byte)0x00, (byte)0x01, (byte)0x80, (byte)0xfe, (byte)0x00, (byte)0x08, (byte)0x00, (byte)0x10, (byte)0x00, (byte)0x01,
-        (byte)0xc0, (byte)0x00, (byte)0x44, (byte)0x75, (byte)0x63, (byte)0x61, (byte)0x80, (byte)0xf0, (byte)0x01, (byte)0xc0, (byte)0xd8, (byte)0x00, (byte)0x04, (byte)0x00, (byte)0x08, (byte)0x00,
-        (byte)0x00, (byte)0x04, (byte)0x00, (byte)0x03, (byte)0x01, (byte)0xca, (byte)0x03, (byte)0xaa, (byte)0x09, (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x28, (byte)0x0a, (byte)0x00, (byte)0x00,
-        (byte)0x61, (byte)0x00, (byte)0x70, (byte)0x00, (byte)0x6f, (byte)0x00, (byte)0x6c, (byte)0x00, (byte)0x6c, (byte)0x00, (byte)0x6f, (byte)0x00, (byte)0x33, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0xca, (byte)0x01, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x10, (byte)0x00, (byte)0x07, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
-        (byte)0x04, (byte)0xc0, (byte)0x0c, (byte)0x00, (byte)0x0d, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x02, (byte)0xc0, (byte)0x0c, (byte)0x00,
-        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
-    };
-    /* @formatter:on */
-
-    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-    Element todo = new ClientMCSConnectInitial("ClientMCSConnectInitial");
-    Element x224 = new ClientX224DataPdu("x224");
-    Element tpkt = new ClientTpkt("tpkt");
-
-    Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(packet));
-
-    Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-
-    Pipeline pipeline = new PipelineImpl("test");
-    pipeline.add(source, todo, x224, tpkt, sink, mainSink);
-    pipeline.link("source", "ClientMCSConnectInitial", "mainSink");
-    pipeline.link("ClientMCSConnectInitial >" + OTOUT, "x224", "tpkt", "sink");
-    pipeline.runMainLoop("source", STDOUT, false, false);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSErectDomainRequest.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSErectDomainRequest.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSErectDomainRequest.java
deleted file mode 100644
index 4a0fd04..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientMCSErectDomainRequest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-// 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 rdpclient;
-
-import streamer.ByteBuffer;
-import streamer.Element;
-import streamer.Link;
-import streamer.MockSink;
-import streamer.MockSource;
-import streamer.OneTimeSwitch;
-import streamer.Pipeline;
-import streamer.PipelineImpl;
-
-/**
- * @see http://msdn.microsoft.com/en-us/library/cc240683.aspx
- */
-public class ClientMCSErectDomainRequest extends OneTimeSwitch {
-
-  public ClientMCSErectDomainRequest(String id) {
-    super(id);
-  }
-
-  @Override
-  protected void handleOneTimeData(ByteBuffer buf, Link link) {
-    if (buf == null)
-      return;
-
-    throw new RuntimeException("Unexpected packet: " + buf + ".");
-  }
-
-  @Override
-  protected void onStart() {
-    super.onStart();
-
-    int length = 5;
-    ByteBuffer buf = new ByteBuffer(length, true);
-
-    buf.writeByte(0x04); // Erect Domain Request
-    
-    // Client SHOULD initialize both the subHeight and subinterval fields of the MCS Erect Domain Request PDU to zero.
-    
-    buf.writeByte(1); // ErectDomainRequest::subHeight length = 1 byte
-    buf.writeByte(0); // ErectDomainRequest::subHeight
-    
-    buf.writeByte(1); // ErectDomainRequest::subInterval length = 1 byte
-    buf.writeByte(0); // ErectDomainRequest::subInterval
-    
-    
-    pushDataToOTOut(buf);
-
-    switchOff();
-  }
-
-  /**
-   * Example.
-   * @see http://msdn.microsoft.com/en-us/library/cc240837.aspx
-   */
-  public static void main(String args[]) {
-    // System.setProperty("streamer.Link.debug", "true");
-    System.setProperty("streamer.Element.debug", "true");
-    // System.setProperty("streamer.Pipeline.debug", "true");
-
-    /* @formatter:off */
-    byte[] packet = new byte[] {
-
-        0x03, 0x00, 0x00, 0x0c,  //  TPKT Header (length = 12 bytes)
-        0x02, (byte) 0xf0, (byte) 0x80,  //  X.224 Data TPDU
-        
-        // PER encoded (ALIGNED variant of BASIC-PER) PDU contents:
-        0x04, 0x01, 0x00, 0x01, 0x00,
-         
-        // 0x04:
-        // 0 - --\
-        // 0 -   |
-        // 0 -   | CHOICE: From DomainMCSPDU select erectDomainRequest (1) 
-        // 0 -   | of type ErectDomainRequest
-        // 0 -   |
-        // 1 - --/
-        // 0 - padding
-        // 0 - padding
-        
-        // 0x01:
-        // 0 - --\
-        // 0 -   |
-        // 0 -   |
-        // 0 -   | ErectDomainRequest::subHeight length = 1 byte
-        // 0 -   |
-        // 0 -   |
-        // 0 -   |
-        // 1 - --/
-        
-        // 0x00:
-        // 0 - --\
-        // 0 -   |
-        // 0 -   |
-        // 0 -   | ErectDomainRequest::subHeight = 0
-        // 0 -   |
-        // 0 -   |
-        // 0 -   |
-        // 0 - --/
-        
-        // 0x01:
-        // 0 - --\
-        // 0 -   |
-        // 0 -   |
-        // 0 -   | ErectDomainRequest::subInterval length = 1 byte
-        // 0 -   |
-        // 0 -   |
-        // 0 -   |
-        // 1 - --/
-        
-        // 0x00:
-        // 0 - --\
-        // 0 -   |
-        // 0 -   |
-        // 0 -   | ErectDomainRequest::subInterval = 0
-        // 0 -   |
-        // 0 -   |
-        // 0 -   |
-        // 0 - --/
-
-        
-    };
-    /* @formatter:on */
-
-    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-    Element todo = new ClientMCSErectDomainRequest("TODO");
-    Element x224 = new ClientX224DataPdu("x224");
-    Element tpkt = new ClientTpkt("tpkt");
-    Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(packet));
-    Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-
-    Pipeline pipeline = new PipelineImpl("test");
-    pipeline.add(source, todo, x224, tpkt, sink, mainSink);
-    pipeline.link("source", "TODO", "mainSink");
-    pipeline.link("TODO >" + OTOUT, "x224", "tpkt", "sink");
-    pipeline.runMainLoop("source", STDOUT, false, false);
-  }
-
-}
-
-/*
- * 03 00 00 0C 02 F0 80 04 01 00 01 00
-
-  Frame: Number = 14, Captured Frame Length = 69, MediaType = DecryptedPayloadHeader
-+ DecryptedPayloadHeader: FrameCount = 1, ErrorStatus = SUCCESS
-  TLSSSLData: Transport Layer Security (TLS) Payload Data
-+ TLS: TLS Rec Layer-1 SSL Application Data
-  ISOTS: TPKTCount = 1
-- TPKT: version: 3, Length: 12
-    version: 3 (0x3)
-    Reserved: 0 (0x0)
-    PacketLength: 12 (0xC)
-- X224: Data
-    Length: 2 (0x2)
-    Type: Data
-    EOT: 128 (0x80)
-- T125: Erect Domain Request, SubHeight = 0, SubInterval = 0
-  - MCSHeader: Type=Erect Domain Request
-   - Type: Erect Domain Request
-    - RootIndex: 1
-       Value: (000001..) 0x1
-  - MCSErectDomainRequest: SubHeight = 0, SubInterval = 0
-   - SubHeight: 0x0
-    - Length: 1
-     - Align: No Padding
-        Padding2: (00......) 0x0
-       Length: 1
-      Value: 0 (0x0)
-   - SubInterval: 0x0
-    - Length: 1
-       Align: No Padding
-       Length: 1
-      Value: 0 (0x0)
-
- */

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientPacketSniffer.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientPacketSniffer.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientPacketSniffer.java
deleted file mode 100644
index 651d002..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientPacketSniffer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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 rdpclient;
-
-
-/**
- * Try to determine packet content by it header fingerprint.
- */
-public class ClientPacketSniffer extends PacketSniffer {
-
-  private static final Pair[] clientRegexps = new Pair[] {
-// @formatter:off
-    new Pair("Client FastPath input",           "04"),
-    new Pair("Client X224ConnectionRequest",    "03 00 XX XX 27 E0"),
-    new Pair("Client ConnectionRequest",        "03 00 XX XX XX E0"),
-    new Pair("Client MCConnectInitial",         "03 00 XX XX 02 F0 80 7F 65"),
-    new Pair("Client ErectDomainRequest",       "03 00 XX XX 02 F0 80 04"),
-    new Pair("Client AttachUserRequest",        "03 00 XX XX 02 F0 80 28"),
-    new Pair("Client ChannelJoinRequest",       "03 00 XX XX 02 F0 80 38"),
-    new Pair("Client Info",                     "03 00 XX XX 02 F0 80 64 00 03 03 EB 70 XX XX XX XX 00 00"),
-    new Pair("Client ConfirmActivePDU",         "03 00 XX XX 02 F0 80 64 00 03 03 EB 70 XX XX XX XX 13 00"),
-    new Pair("Client SynchronizePDU",           "03 00 XX XX 02 F0 80 64 00 03 03 EB 70 XX XX XX XX 17 00 EC 03 EA 03 XX 00 XX XX XX XX 1F"),
-    new Pair("Client ControlPDU",               "03 00 XX XX 02 F0 80 64 00 03 03 EB 70 XX XX XX XX 17 00 EC 03 EA 03 XX 00 XX XX XX XX 14"),
-    new Pair("Client FontListPDU",              "03 00 XX XX 02 F0 80 64 00 03 03 EB 70 XX XX XX XX 17 00 EC 03 EA 03 XX 00 XX XX XX XX 27"),
-    new Pair("Client BitmapCachePersistentList","03 00 XX XX 02 F0 80 64 00 03 03 EB 70 XX XX XX XX 17 00 EC 03 EA 03 XX XX XX XX XX XX 2b"), 
-//    new Pair("Client TPKT Unknown packet",      "03"),
-//    new Pair("Client UNKNOWN PACKET (ERROR)",   ".*"),
-    // @formatter:on
-
-  };
-
-  public ClientPacketSniffer(String id) {
-    super(id, clientRegexps);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientSynchronizePDU.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientSynchronizePDU.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientSynchronizePDU.java
deleted file mode 100644
index 9631976..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientSynchronizePDU.java
+++ /dev/null
@@ -1,248 +0,0 @@
-// 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 rdpclient;
-
-import streamer.ByteBuffer;
-import streamer.Element;
-import streamer.Link;
-import streamer.MockSink;
-import streamer.MockSource;
-import streamer.OneTimeSwitch;
-import streamer.Pipeline;
-import streamer.PipelineImpl;
-
-/**
- * @see http://msdn.microsoft.com/en-us/library/cc240489.aspx
- */
-public class ClientSynchronizePDU extends OneTimeSwitch {
-
-  public ClientSynchronizePDU(String id) {
-    super(id);
-  }
-
-  @Override
-  protected void handleOneTimeData(ByteBuffer buf, Link link) {
-    if (buf == null)
-      return;
-
-    throw new RuntimeException("Unexpected packet: " + buf + ".");
-  }
-
-  @Override
-  protected void onStart() {
-    super.onStart();
-
-    int length = 1024; // Large enough
-    ByteBuffer buf = new ByteBuffer(length, true);
-
-    /* @formatter:off */
-    buf.writeBytes(new byte[] {
-        // MCS send data request
-        (byte)0x64,
-        // Initiator: 1004 (1001+3)
-        (byte)0x00, (byte)0x03,
-        // Channel ID: 1003 (I/O Channel)
-        (byte)0x03, (byte)0xeb,
-        // Data priority: high (0x40), segmentation: begin (0x20) | end (0x10)
-        (byte)0x70, 
-        // Data length:  22 bytes (0x16, variable length field)
-        (byte)0x80,  (byte)0x16, 
-        
-        // RDP: total length: 22 bytes (LE)
-        (byte)0x16, (byte)0x00, 
-        
-        // PDU type: PDUTYPE_DATAPDU (0x7), TS_PROTOCOL_VERSION (0x10) (LE)
-        (byte)0x17, (byte)0x00,
-        
-        // PDU source: 1007 (LE)
-        (byte)0xec, (byte)0x03,
-        // Share ID: 0x000103ea (LE)
-        (byte)0xea, (byte)0x03, (byte)0x01,  (byte)0x00,
-        // Padding: 1 byte
-        (byte)0x00,
-        // Stream ID: STREAM_LOW (1)
-        (byte)0x01, 
-        // uncompressedLength : 8 bytes (LE)
-        (byte)0x08, (byte)0x00,
-        // pduType2 = PDUTYPE2_SYNCHRONIZE (31)
-        (byte)0x1f, 
-        // generalCompressedType: 0
-        (byte)0x00,
-        // generalCompressedLength: 0 (LE?)
-        (byte)0x00, (byte)0x00,
-        //  messageType: SYNCMSGTYPE_SYNC (1) (LE)
-        (byte)0x01, (byte)0x00, 
-        // targetUser: 0x03ea
-        (byte)0xea, (byte)0x03,
-    });
-    /* @formatter:on */
-
-    // Trim buffer to actual length of data written
-    buf.trimAtCursor();
-
-    pushDataToOTOut(buf);
-
-    switchOff();
-  }
-
-  /**
-   * Example.
-   * 
-   * @see http://msdn.microsoft.com/en-us/library/cc240841.aspx
-   */
-  public static void main(String args[]) {
-    // System.setProperty("streamer.Link.debug", "true");
-    System.setProperty("streamer.Element.debug", "true");
-    // System.setProperty("streamer.Pipeline.debug", "true");
-
-    /* @formatter:off */
-    byte[] packet = new byte[] {
-        // TPKT
-        (byte)0x03, (byte)0x00,
-        // TPKT length: 37 bytes
-        (byte)0x00, (byte)0x25,
-        // X224 Data PDU 
-        (byte)0x02, (byte)0xf0, (byte)0x80,
-        
-        // MCS send data request
-        (byte)0x64,
-        // Initiator: 1004 (1001+3)
-        (byte)0x00, (byte)0x03,
-        // Channel ID: 1003 (I/O Channel)
-        (byte)0x03, (byte)0xeb,
-        // Data priority: high (0x40), segmentation: begin (0x20) | end (0x10)
-        (byte)0x70, 
-        // Data length:  22 bytes (0x16, variable length field)
-        (byte)0x80,  (byte)0x16, 
-        
-        // RDP: total length: 22 bytes (LE)
-        (byte)0x16, (byte)0x00, 
-        // PDU type: PDUTYPE_DATAPDU (0x7), TS_PROTOCOL_VERSION (0x10) (LE)
-        (byte)0x17, (byte)0x00,
-        // PDU source: 1007 (LE)
-        (byte)0xec, (byte)0x03,
-        // Share ID: 0x000103ea (LE)
-        (byte)0xea, (byte)0x03, (byte)0x01,  (byte)0x00,
-        // Padding: 1 byte
-        (byte)0x00,
-        // Stream ID: STREAM_LOW (1)
-        (byte)0x01, 
-        // uncompressedLength : 8 bytes (LE)
-        (byte)0x08, (byte)0x00,
-        // pduType2 = PDUTYPE2_SYNCHRONIZE (31)
-        (byte)0x1f, 
-        // generalCompressedType: 0
-        (byte)0x00,
-        // generalCompressedLength: 0 (LE?)
-        (byte)0x00, (byte)0x00,
-        //  messageType: SYNCMSGTYPE_SYNC (1) (LE)
-        (byte)0x01, (byte)0x00, 
-        // targetUser: 0x03ea
-        (byte)0xea, (byte)0x03,
-        
-    };
-    /* @formatter:on */
-
-    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-    Element todo = new ClientSynchronizePDU("TODO");
-    Element x224 = new ClientX224DataPdu("x224");
-    Element tpkt = new ClientTpkt("tpkt");
-    Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(packet));
-    Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-
-    Pipeline pipeline = new PipelineImpl("test");
-    pipeline.add(source, todo, x224, tpkt, sink, mainSink);
-    pipeline.link("source", "TODO", "mainSink");
-    pipeline.link("TODO >" + OTOUT, "x224", "tpkt", "sink");
-    pipeline.runMainLoop("source", STDOUT, false, false);
-  }
-
-}
-
-/*
- * @formatting:off
-
- * 03 00 00 25 02 F0 80 64 00 03 03 EB 70 80 16 16 00 17 00 EC 03 EA 03 01 00 00 01 08 00 1F 00 00 00 01 00 EA 03 
-
-  Frame: Number = 40, Captured Frame Length = 94, MediaType = DecryptedPayloadHeader
-+ DecryptedPayloadHeader: FrameCount = 1, ErrorStatus = SUCCESS
-  TLSSSLData: Transport Layer Security (TLS) Payload Data
-+ TLS: TLS Rec Layer-1 SSL Application Data
-  ISOTS: TPKTCount = 1
-- TPKT: version: 3, Length: 37
-    version: 3 (0x3)
-    Reserved: 0 (0x0)
-    PacketLength: 37 (0x25)
-- X224: Data
-    Length: 2 (0x2)
-    Type: Data
-    EOT: 128 (0x80)
-- T125: Data Packet
-  - MCSHeader: Type=Send Data Request, UserID=1004, ChannelID=1003
-   - Type: Send Data Request
-    - RootIndex: 25
-       Value: (011001..) 0x19
-   - UserID: 0x3ec
-    - UserID: 0x3ec
-     - ChannelId: 1004
-      - Align: No Padding
-         Padding2: (00......) 0x0
-        Value: 3 (0x3)
-   - Channel: 0x3eb
-    - ChannelId: 1003
-       Align: No Padding
-       Value: 1003 (0x3EB)
-   - DataPriority: high
-    - DataPriority: high
-     - RootIndex: 1
-        Value: (01......) 0x1
-   - Segmentation: Begin End
-      Begin: (1.......) Begin
-      End:   (.1......) End
-   - Length: 22
-    - Align: No Padding
-       Padding4: (0000....) 0x0
-      Length: 22
-    RDP: RDPBCGR
-- RDPBCGR: SynchronizePDU
-  - SlowPathPacket: SynchronizePDU 
-   - SlowPath: Type = TS_PDUTYPE_DATAPDU
-    - TsShareControlHeader: Type = TS_PDUTYPE_DATAPDU
-       TotalLength: 22 (0x16)
-     - PDUType: 23 (0x17)
-        Type:            (............0111) TS_PDUTYPE_DATAPDU
-        ProtocolVersion: (000000000001....) 1
-       PDUSource: 1004 (0x3EC)
-    - SlowPathIoPacket: 0x0
-     - ShareDataHeader: TS_PDUTYPE2_SYNCHRONIZE
-        ShareID: 66538 (0x103EA)
-        Pad1: 0 (0x0)
-        StreamID: TS_STREAM_LOW
-        UncompressedLength: 8 (0x8)
-        PDUType2: TS_PDUTYPE2_SYNCHRONIZE
-      - CompressedType: Not Compressed
-         MPPC:       (....0000) MPPC 8K
-         Reserved:   (...0....)
-         Compressed: (..0.....) Not Compressed
-         Front:      (.0......) Not At Front
-         Flush:      (0.......) Not Flushed
-        CompressedLength: 0 (0x0)
-     - TsSynchronizePDU: 0x1
-        MessageType: 0x1, MUST be set to SYNCMSGTYPE_SYNC (1)
-        TargetUser: 1002 (0x3EA)
- */
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientTpkt.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientTpkt.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientTpkt.java
deleted file mode 100644
index c92d832..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientTpkt.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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 rdpclient;
-
-import streamer.BaseElement;
-import streamer.ByteBuffer;
-import streamer.Link;
-
-public class ClientTpkt extends BaseElement {
-
-  public ClientTpkt(String id) {
-    super(id);
-  }
-
-  @Override
-  public void handleData(ByteBuffer buf, Link link) {
-    if (buf == null)
-      return;
-
-    if (verbose)
-      System.out.println("[" + this + "] INFO: Data received: " + buf + ".");
-
-    if (buf.length + 4 > 65535)
-      throw new RuntimeException("Packet is too long for TPKT (max length 65535-4): " + buf + ".");
-
-    ByteBuffer data = new ByteBuffer(4);
-    // TPKT version
-    data.writeByte(3);
-    // Reserved
-    data.writeByte(0);
-    // Packet length, including length of the header
-    data.writeShort(buf.length + 4);
-
-    buf.prepend(data);
-    data.unref();
-
-    pushDataToPad(STDOUT, buf);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientX224ConnectionRequestPDU.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientX224ConnectionRequestPDU.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientX224ConnectionRequestPDU.java
deleted file mode 100644
index 48ac089..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientX224ConnectionRequestPDU.java
+++ /dev/null
@@ -1,156 +0,0 @@
-// 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 rdpclient;
-
-import streamer.ByteBuffer;
-import streamer.Element;
-import streamer.Link;
-import streamer.MockSink;
-import streamer.MockSource;
-import streamer.OneTimeSwitch;
-import streamer.Pipeline;
-import streamer.PipelineImpl;
-
-/**
- * @see http://msdn.microsoft.com/en-us/library/cc240470.aspx
- * @see http://msdn.microsoft.com/en-us/library/cc240663.aspx
- */
-public class ClientX224ConnectionRequestPDU extends OneTimeSwitch {
-
-  public static final int X224_TPDU_CONNECTION_REQUEST = 0xe0;
-  public static final int X224_TPDU_CONNECTION_CONFIRM = 0xd0;
-  public static final int X224_TPDU_DISCONNECTION_REQUEST = 0x80;
-  public static final int X224_TPDU_DISCONNECTION_CONFIRM = 0xc0;
-  public static final int X224_TPDU_EXPEDITED_DATA = 0x10;
-  public static final int X224_TPDU_DATA_ACKNOWLEDGE = 0x61;
-  public static final int X224_TPDU_EXPEDITET_ACKNOWLEDGE = 0x40;
-  public static final int X224_TPDU_REJECT = 0x51;
-  public static final int X224_TPDU_ERROR = 0x70;
-  public static final int X224_TPDU_PROTOCOL_IDENTIFIER = 0x01;
-
-  /**
-   * Reconnection cookie.
-   */
-  protected String userName;
-
-  public ClientX224ConnectionRequestPDU(String id, String userName) {
-    super(id);
-    this.userName = userName;
-  }
-
-  @Override
-  protected void handleOneTimeData(ByteBuffer buf, Link link) {
-    if (buf == null)
-      return;
-
-    throw new RuntimeException("Unexpected packet: " + buf + ".");
-  }
-
-  @Override
-  protected void onStart() {
-    super.onStart();
-
-    // Length of packet without length field
-    int length = 33 + userName.length();
-    ByteBuffer buf = new ByteBuffer(length, true);
-
-    // Type (high nibble) = 0xe = CR TPDU; credit (low nibble) = 0
-    buf.writeByte(X224_TPDU_CONNECTION_REQUEST);
-
-    buf.writeShort(0); // Destination reference = 0
-    buf.writeShort(0); // Source reference = 0
-    buf.writeByte(0); // Class and options = 0
-    buf.writeString("Cookie: mstshash=" + userName + "\r\n", RdpConstants.CHARSET_8); // Cookie
-
-    // RDP_NEG_REQ::type
-    buf.writeByte(RdpConstants.RDP_NEG_REQ_TYPE_NEG_REQ);
-    // RDP_NEG_REQ::flags (0)
-    buf.writeByte(RdpConstants.RDP_NEG_REQ_FLAGS);
-    // RDP_NEG_REQ::length (constant: 8) short int in LE format
-    buf.writeByte(0x08);
-    buf.writeByte(0x00);
-
-    // RDP_NEG_REQ: Requested protocols: PROTOCOL_SSL
-    buf.writeIntLE(RdpConstants.RDP_NEG_REQ_PROTOCOL_SSL);
-
-    // Calculate length of packet and prepend it to buffer
-    ByteBuffer data = new ByteBuffer(5);
-
-    // Write length
-    data.writeVariableIntLE(buf.length);
-
-    // Reset length of buffer to actual length of data written
-    data.length = data.cursor;
-
-    buf.prepend(data);
-    data.unref();
-
-    pushDataToOTOut(buf);
-
-    switchOff();
-  }
-
-  /**
-   * Example.
-   * 
-   * @see http://msdn.microsoft.com/en-us/library/cc240842.aspx
-   * @see http://msdn.microsoft.com/en-us/library/cc240500.aspx
-   */
-  public static void main(String args[]) {
-    // System.setProperty("streamer.Link.debug", "true");
-    System.setProperty("streamer.Element.debug", "true");
-    // System.setProperty("streamer.Pipeline.debug", "true");
-
-    String cookie = "eltons";
-
-    byte[] packet = new byte[] {
-
-    0x03, // TPKT Header: version = 3
-        0x00, // TPKT Header: Reserved = 0
-        0x00, // TPKT Header: Packet length - high part
-        0x2c, // TPKT Header: Packet length - low part (total = 44 bytes)
-        0x27, // X.224: Length indicator (39 bytes)
-        (byte) 0xe0, // X.224: Type (high nibble) = 0xe = CR TPDU;
-                     // credit (low nibble) = 0
-        0x00, 0x00, // X.224: Destination reference = 0
-        0x00, 0x00, // X.224: Source reference = 0
-        0x00, // X.224: Class and options = 0
-
-        'C', 'o', 'o', 'k', 'i', 'e', ':', ' ', 'm', 's', 't', 's', 'h', 'a', 's', 'h', '=', 'e', 'l', 't', 'o', 'n', 's', // "Cookie: mstshash=eltons"
-        '\r', '\n', // -Cookie terminator sequence
-
-        0x01, // RDP_NEG_REQ::type (TYPE_RDP_NEG_REQ)
-        0x00, // RDP_NEG_REQ::flags (0)
-        0x08, 0x00, // RDP_NEG_REQ::length (8 bytes)
-        0x01, 0x00, 0x00, 0x00 // RDP_NEG_REQ: Requested protocols
-                               // (PROTOCOL_SSL in little endian format)
-    };
-
-    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-    Element cr = new ClientX224ConnectionRequestPDU("cr", cookie);
-    Element tpkt = new ClientTpkt("tpkt");
-    Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(packet));
-    Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
-
-    Pipeline pipeline = new PipelineImpl("test");
-    pipeline.add(source, cr, tpkt, sink, mainSink);
-    pipeline.link("source", "cr", "mainSink");
-    pipeline.link("cr >" + OTOUT, "tpkt", "sink");
-    pipeline.runMainLoop("source", STDOUT, false, false);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientX224DataPdu.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientX224DataPdu.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientX224DataPdu.java
deleted file mode 100644
index 2cf9b72..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/ClientX224DataPdu.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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 rdpclient;
-
-import streamer.BaseElement;
-import streamer.ByteBuffer;
-import streamer.Link;
-
-public class ClientX224DataPdu extends BaseElement {
-
-  public static final int X224_TPDU_DATA = 0xF0;
-  public static final int X224_TPDU_LAST_DATA_UNIT = 0x80;
-
-  public ClientX224DataPdu(String id) {
-    super(id);
-  }
-  
-  @Override
-  public void handleData(ByteBuffer buf, Link link) {
-    if (buf == null)
-      return;
-
-    if (verbose)
-      System.out.println("[" + this + "] INFO: Data received: " + buf + ".");
-
-    ByteBuffer data = new ByteBuffer(3);
-    // X224 header
-    data.writeByte(2); // Header length indicator
-    data.writeByte(X224_TPDU_DATA);
-    data.writeByte(X224_TPDU_LAST_DATA_UNIT);
-
-    buf.prepend(data);
-    data.unref();
-
-    pushDataToPad(STDOUT, buf);
-  }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/HandshakeEnd.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/HandshakeEnd.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/HandshakeEnd.java
deleted file mode 100644
index 62242de..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/HandshakeEnd.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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 rdpclient;
-
-import streamer.BaseElement;
-
-public class HandshakeEnd extends BaseElement {
-
-  public HandshakeEnd(String id) {
-    super(id);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/MockServer.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/MockServer.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/MockServer.java
deleted file mode 100644
index b141917..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/MockServer.java
+++ /dev/null
@@ -1,197 +0,0 @@
-// 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 rdpclient;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.Arrays;
-
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
-
-public class MockServer implements Runnable {
-
-    private boolean shutdown = false;
-    private ServerSocket serverSocket;
-    private Packet[] packets;
-    private Throwable exception;
-    private boolean shutdowned;
-
-    /**
-     * Set to true to enable debugging messages.
-     */
-    protected boolean verbose = System.getProperty("rdpclient.MockServer.debug", "false").equals("true");
-
-    public MockServer(Packet packets[]) {
-	this.packets = packets;
-    }
-
-    public void start() throws IOException {
-	serverSocket = new ServerSocket(0);
-
-	shutdown = false;
-	exception = null;
-	shutdowned = false;
-
-	new Thread(this).start();
-    }
-
-    public void run() {
-
-	try {
-	    Socket socket = serverSocket.accept();
-
-	    InputStream is = socket.getInputStream();
-	    OutputStream os = socket.getOutputStream();
-
-	    try {
-		for (int i = 0; i < packets.length && !shutdown; i++) {
-
-		    Packet packet = packets[i];
-		    switch (packet.type) {
-		    case CLIENT: {
-			// Read client data and compare it with mock data
-			// (unless "ignore" option is set)
-			byte actualData[] = new byte[packet.data.length];
-			int actualDataLength = is.read(actualData);
-
-			if (verbose)
-			    System.out.println("[" + this + "] INFO: Data is read: {" + Arrays.toString(Arrays.copyOf(actualData, actualDataLength)) + "}.");
-
-			if (!packet.ignore) {
-			    // Compare actual data with expected data
-			    if (actualDataLength != packet.data.length) {
-				throw new AssertionError("Actual length of client request for packet #" + (i + 1) + " (\"" + packet.id + "\")"
-					+ " does not match length of expected client request. Actual length: " + actualDataLength + ", expected legnth: "
-					+ packet.data.length + ".");
-			    }
-
-			    for (int j = 0; j < packet.data.length; j++) {
-
-				if (packet.data[j] != actualData[j]) {
-				    throw new AssertionError("Actual byte #" + (j + 1) + " of client request for packet #" + (i + 1) + " (\"" + packet.id
-					    + "\")" + " does not match corresponding byte of expected client request. Actual byte: " + actualData[j]
-					    + ", expected byte: " + packet.data[j] + ".");
-				}
-			    }
-			}
-			break;
-		    }
-		    case SERVER: {
-			// Send mock data to client
-			os.write(packet.data);
-
-			if (verbose)
-			    System.out.println("[" + this + "] INFO: Data is written: {" + Arrays.toString(packet.data) + "}.");
-
-			break;
-		    }
-		    case UPGRADE_TO_SSL: {
-			// Attach SSL context to socket
-
-			final SSLSocketFactory sslSocketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
-			SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(socket, null, serverSocket.getLocalPort(), true);
-			sslSocket.setEnabledCipherSuites(sslSocket.getSupportedCipherSuites());
-			sslSocket.setUseClientMode(false);
-			sslSocket.startHandshake();
-			is = sslSocket.getInputStream();
-			os = sslSocket.getOutputStream();
-
-			break;
-		    }
-		    default:
-			throw new RuntimeException("Unknown packet type: " + packet.type);
-		    }
-
-		}
-	    } finally {
-		try {
-		    is.close();
-		} catch (Throwable e) {
-		}
-		try {
-		    os.close();
-		} catch (Throwable e) {
-		}
-		try {
-		    socket.close();
-		} catch (Throwable e) {
-		}
-		try {
-		    serverSocket.close();
-		} catch (Throwable e) {
-		}
-	    }
-	} catch (Throwable e) {
-	    System.err.println("Error in mock server: " + e.getMessage());
-	    e.printStackTrace(System.err);
-	    exception = e;
-	}
-	shutdowned = true;
-	if (verbose)
-	    System.out.println("[" + this + "] INFO: Mock server shutdowned.");
-
-    }
-
-    public void shutdown() {
-	shutdown = true;
-    }
-
-    public InetSocketAddress getAddress() {
-	return (InetSocketAddress) serverSocket.getLocalSocketAddress();
-    }
-
-    public Throwable getException() {
-	return exception;
-    }
-
-    public static class Packet {
-	public static enum PacketType {
-	    SERVER, CLIENT, UPGRADE_TO_SSL;
-	}
-
-	public String id = "";
-
-	public Packet() {
-	}
-
-	public Packet(String id) {
-	    this.id = id;
-	}
-
-	public PacketType type;
-
-	public boolean ignore = false;
-
-	public byte data[];
-    }
-
-    public boolean isShutdowned() {
-	return shutdowned;
-    }
-
-    public void waitUntilShutdowned(long timeToWaitMiliseconds) throws InterruptedException {
-	long deadline = System.currentTimeMillis() + timeToWaitMiliseconds;
-	while (!shutdowned && System.currentTimeMillis() < deadline) {
-	    Thread.sleep(10);
-	}
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f3611f9/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/PacketSniffer.java
----------------------------------------------------------------------
diff --git a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/PacketSniffer.java b/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/PacketSniffer.java
deleted file mode 100644
index 9fe2499..0000000
--- a/services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/PacketSniffer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// 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 rdpclient;
-
-import java.util.regex.Pattern;
-
-import streamer.BaseElement;
-import streamer.ByteBuffer;
-import streamer.Link;
-
-/**
- * Try to determine packet content by it header fingerprint.
- */
-public class PacketSniffer  extends BaseElement {
-
-  protected Pair regexps[]=null;
-
-  public PacketSniffer(String id, Pair[] regexps) {
-    super(id);
-    this.regexps=regexps;
-  }
-
-  @Override
-  public void handleData(ByteBuffer buf, Link link) {
-
-    matchPacket(buf);
-
-    super.handleData(buf, link);
-  }
-
-  private void matchPacket(ByteBuffer buf) {
-    String header = buf.toPlainHexString(100);
-    for (Pair pair : regexps) {
-      if (pair.regexp.matcher(header).find()) {
-        System.out.println("[" + this + "] INFO: Packet: " + pair.name + ".");
-        return;
-      }
-    }
-
-    System.out.println("[" + this + "] INFO: Unknown packet: " + header + ".");
-  }
-
-  protected static class Pair {
-    String name;
-    Pattern regexp;
-
-    protected Pair(String name, String regexp) {
-      this.name = name;
-      this.regexp = Pattern.compile("^" + replaceShortcuts(regexp), Pattern.CASE_INSENSITIVE);
-    }
-
-    private static String replaceShortcuts(String regexp) {
-      String result = regexp; 
-      result = result.replaceAll("XX\\*", "([0-9a-fA-F]{2} )*?");
-      result = result.replaceAll("XX\\?", "([0-9a-fA-F]{2} )?");
-      result = result.replaceAll("XX", "[0-9a-fA-F]{2}");
-      return result;
-    }
-  }
-
-}


Mime
View raw message