Search in sources :

Example 26 with PipelineImpl

use of streamer.PipelineImpl in project cloudstack by apache.

the class ClientPreConnectionBlob method main.

/**
     * 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[] { // Header
    (byte) 0x5e, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, // Length of string in wide characters + two wide \0 (LE)
    (byte) 0x26, (byte) 0x00, // Wide string
    (byte) 0x33, (byte) 0x00, (byte) 0x39, (byte) 0x00, (byte) 0x34, (byte) 0x00, (byte) 0x31, (byte) 0x00, (byte) 0x38, (byte) 0x00, (byte) 0x46, (byte) 0x00, (byte) 0x39, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x2d, (byte) 0x00, (byte) 0x36, (byte) 0x00, (byte) 0x44, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x33, (byte) 0x00, (byte) 0x2d, (byte) 0x00, (byte) 0x34, (byte) 0x00, (byte) 0x36, (byte) 0x00, (byte) 0x38, (byte) 0x00, (byte) 0x45, (byte) 0x00, (byte) 0x2d, (byte) 0x00, (byte) 0x42, (byte) 0x00, (byte) 0x37, (byte) 0x00, (byte) 0x39, (byte) 0x00, (byte) 0x36, (byte) 0x00, (byte) 0x2d, (byte) 0x00, (byte) 0x39, (byte) 0x00, (byte) 0x31, (byte) 0x00, (byte) 0x43, (byte) 0x00, (byte) 0x36, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x44, (byte) 0x00, (byte) 0x44, (byte) 0x00, (byte) 0x36, (byte) 0x00, (byte) 0x36, (byte) 0x00, (byte) 0x35, (byte) 0x00, (byte) 0x33, (byte) 0x00, (byte) 0x41, (byte) 0x00, // Two wide \0
    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
    /* @formatter:on */
    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
    Element pcb = new ClientPreConnectionBlob("pcb", "39418F90-6D03-468E-B796-91C60DD6653A");
    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, pcb, sink, mainSink);
    pipeline.link("source", "pcb", "mainSink");
    pipeline.link("pcb >" + OTOUT, "sink");
    pipeline.runMainLoop("source", STDOUT, false, false);
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) Element(streamer.Element) Pipeline(streamer.Pipeline)

Example 27 with PipelineImpl

use of streamer.PipelineImpl in project cloudstack by apache.

the class ClientNtlmsspNegotiate method main.

/**
     * 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[] { // Sequence
    (byte) 0x30, // Length, 55 bytes
    (byte) 0x37, // TAG: [0] (constructed) LEN: 3 byte
    (byte) 0xa0, // TAG: [0] (constructed) LEN: 3 byte
    (byte) 0x03, // Version: (int, 1 byte, 0x02)
    (byte) 0x02, // Version: (int, 1 byte, 0x02)
    (byte) 0x01, // Version: (int, 1 byte, 0x02)
    (byte) 0x02, // TAG: [1] (constructed) LEN: 48 bytes
    (byte) 0xa1, // TAG: [1] (constructed) LEN: 48 bytes
    (byte) 0x30, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 46 bytes
    (byte) 0x30, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 46 bytes
    (byte) 0x2e, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 44 bytes
    (byte) 0x30, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 44 bytes
    (byte) 0x2c, // TAG: [0] (constructed) LEN: 42 bytes
    (byte) 0xa0, // TAG: [0] (constructed) LEN: 42 bytes
    (byte) 0x2a, // TAG: [UNIVERSAL 4] (primitive) "OCTET STRING" LEN: 40 bytes
    (byte) 0x04, // TAG: [UNIVERSAL 4] (primitive) "OCTET STRING" LEN: 40 bytes
    (byte) 0x28, // "NTLMSSP\0"
    (byte) 0x4e, // "NTLMSSP\0"
    (byte) 0x54, // "NTLMSSP\0"
    (byte) 0x4c, // "NTLMSSP\0"
    (byte) 0x4d, // "NTLMSSP\0"
    (byte) 0x53, // "NTLMSSP\0"
    (byte) 0x53, // "NTLMSSP\0"
    (byte) 0x50, // "NTLMSSP\0"
    (byte) 0x00, // Message type: NEGOTIATE (0x1, LE)
    (byte) 0x01, // Message type: NEGOTIATE (0x1, LE)
    (byte) 0x00, // Message type: NEGOTIATE (0x1, LE)
    (byte) 0x00, // Message type: NEGOTIATE (0x1, LE)
    (byte) 0x00, // Flags: 0xe20882b7 (LE)
    (byte) 0xb7, // Flags: 0xe20882b7 (LE)
    (byte) 0x82, // Flags: 0xe20882b7 (LE)
    (byte) 0x08, // Flags: 0xe20882b7 (LE)
    (byte) 0xe2, // Domain (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Domain (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Domain (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Domain (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Domain (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Domain (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Domain (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Domain (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Workstation  (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Workstation  (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Workstation  (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Workstation  (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Workstation  (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Workstation  (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Workstation  (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // Workstation  (security buffer, 8bit, 8 bytes): length: 0x0000 (LE), allocated space: 0x0000 (LE), offset: 0x00000000 (LE)
    (byte) 0x00, // OS Version: 6.1 (Build 7601); NTLM Current Revision 15, 8 bytes
    (byte) 0x06, // OS Version: 6.1 (Build 7601); NTLM Current Revision 15, 8 bytes
    (byte) 0x01, // OS Version: 6.1 (Build 7601); NTLM Current Revision 15, 8 bytes
    (byte) 0xb1, // OS Version: 6.1 (Build 7601); NTLM Current Revision 15, 8 bytes
    (byte) 0x1d, // OS Version: 6.1 (Build 7601); NTLM Current Revision 15, 8 bytes
    (byte) 0x00, // OS Version: 6.1 (Build 7601); NTLM Current Revision 15, 8 bytes
    (byte) 0x00, // OS Version: 6.1 (Build 7601); NTLM Current Revision 15, 8 bytes
    (byte) 0x00, // OS Version: 6.1 (Build 7601); NTLM Current Revision 15, 8 bytes
    (byte) 0x0f };
    /* @formatter:on */
    NtlmState state = new NtlmState();
    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
    Element ntlmssp_negotiate = new ClientNtlmsspNegotiate("ntlmssp_negotiate", state);
    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, ntlmssp_negotiate, sink, mainSink);
    pipeline.link("source", "ntlmssp_negotiate", "mainSink");
    pipeline.link("ntlmssp_negotiate >" + OTOUT, "sink");
    pipeline.runMainLoop("source", STDOUT, false, false);
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) Element(streamer.Element) Pipeline(streamer.Pipeline)

Example 28 with PipelineImpl

use of streamer.PipelineImpl in project cloudstack by apache.

the class ServerClipboardCapabilitiesPDU method main.

/**
     * 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[] { //  CLIPRDR_HEADER::msgType = CB_CLIP_CAPS (7)
    0x07, //  CLIPRDR_HEADER::msgType = CB_CLIP_CAPS (7)
    0x00, //  CLIPRDR_HEADER::msgFlags = 0
    0x00, //  CLIPRDR_HEADER::msgFlags = 0
    0x00, //  CLIPRDR_HEADER::dataLen = 0x10 = 16 bytes
    0x10, //  CLIPRDR_HEADER::dataLen = 0x10 = 16 bytes
    0x00, //  CLIPRDR_HEADER::dataLen = 0x10 = 16 bytes
    0x00, //  CLIPRDR_HEADER::dataLen = 0x10 = 16 bytes
    0x00, //  CLIPRDR_CAPS::cCapabilitiesSets = 1
    0x01, //  CLIPRDR_CAPS::cCapabilitiesSets = 1
    0x00, //  CLIPRDR_CAPS::pad1
    0x00, //  CLIPRDR_CAPS::pad1
    0x00, //  CLIPRDR_CAPS_SET::capabilitySetType = CB_CAPSTYPE_GENERAL (1)
    0x01, //  CLIPRDR_CAPS_SET::capabilitySetType = CB_CAPSTYPE_GENERAL (1)
    0x00, //  CLIPRDR_CAPS_SET::lengthCapability = 0x0c = 12 bytes
    0x0c, //  CLIPRDR_CAPS_SET::lengthCapability = 0x0c = 12 bytes
    0x00, //  CLIPRDR_GENERAL_CAPABILITY::version = CB_CAPS_VERSION_2 (2)
    0x02, //  CLIPRDR_GENERAL_CAPABILITY::version = CB_CAPS_VERSION_2 (2)
    0x00, //  CLIPRDR_GENERAL_CAPABILITY::version = CB_CAPS_VERSION_2 (2)
    0x00, //  CLIPRDR_GENERAL_CAPABILITY::version = CB_CAPS_VERSION_2 (2)
    0x00, //  CLIPRDR_GENERAL_CAPABILITY::capabilityFlags = 0x0000000e = 0x02 |0x04 |0x08 = CB_USE_LONG_FORMAT_NAMES | CB_STREAM_FILECLIP_ENABLED | CB_FILECLIP_NO_FILE_PATHS
    0x0e, //  CLIPRDR_GENERAL_CAPABILITY::capabilityFlags = 0x0000000e = 0x02 |0x04 |0x08 = CB_USE_LONG_FORMAT_NAMES | CB_STREAM_FILECLIP_ENABLED | CB_FILECLIP_NO_FILE_PATHS
    0x00, //  CLIPRDR_GENERAL_CAPABILITY::capabilityFlags = 0x0000000e = 0x02 |0x04 |0x08 = CB_USE_LONG_FORMAT_NAMES | CB_STREAM_FILECLIP_ENABLED | CB_FILECLIP_NO_FILE_PATHS
    0x00, //  CLIPRDR_GENERAL_CAPABILITY::capabilityFlags = 0x0000000e = 0x02 |0x04 |0x08 = CB_USE_LONG_FORMAT_NAMES | CB_STREAM_FILECLIP_ENABLED | CB_FILECLIP_NO_FILE_PATHS
    0x00 };
    /* @formatter:on */
    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
    Element router = new ServerClipRdrChannelRouter("router");
    ClipboardState state = new ClipboardState();
    Element clip_cap = new ServerClipboardCapabilitiesPDU("clip_cap", state);
    Element sink = new MockSink("sink", new ByteBuffer[] {});
    Pipeline pipeline = new PipelineImpl("test");
    pipeline.add(source, router, clip_cap, sink);
    pipeline.link("source", "router >clipboard_capabilities", "clip_cap", "sink");
    pipeline.runMainLoop("source", STDOUT, false, false);
    // Check state
    if (!state.serverUseLongFormatNames || !state.serverStreamFileClipEnabled || !state.serverFileClipNoFilePaths || state.serverCanLockClipdata)
        throw new RuntimeException("Server clipboard capabilities packet parsed incorrectly.");
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) Element(streamer.Element) BaseElement(streamer.BaseElement) Pipeline(streamer.Pipeline)

Example 29 with PipelineImpl

use of streamer.PipelineImpl in project cloudstack by apache.

the class ServerFormatDataResponsePDU method main.

/**
     * 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[] { //  CLIPRDR_HEADER::msgType = CB_FORMAT_DATA_RESPONSE (5)
    0x05, //  CLIPRDR_HEADER::msgType = CB_FORMAT_DATA_RESPONSE (5)
    0x00, //  CLIPRDR_HEADER::msgFlags = 0x0001 = CB_RESPONSE_OK
    0x01, //  CLIPRDR_HEADER::msgFlags = 0x0001 = CB_RESPONSE_OK
    0x00, //  CLIPRDR_HEADER::dataLen = 0x18 = 24 bytes
    0x18, //  CLIPRDR_HEADER::dataLen = 0x18 = 24 bytes
    0x00, //  CLIPRDR_HEADER::dataLen = 0x18 = 24 bytes
    0x00, //  CLIPRDR_HEADER::dataLen = 0x18 = 24 bytes
    0x00, 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x6f, 0x00, 0x20, 0x00, 0x77, 0x00, 0x6f, 0x00, //  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
    0x72, //  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
    0x00, //  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
    0x6c, //  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
    0x00, //  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
    0x64, //  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
    0x00, //  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
    0x00, //  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
    0x00 };
    /* @formatter:on */
    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
    Element router = new ServerClipRdrChannelRouter("router");
    ClipboardState state = new ClipboardState();
    state.serverRequestedFormat = new ClipboardDataFormat(ClipboardDataFormat.CB_FORMAT_UNICODETEXT, "");
    Element format_data_response = new ServerFormatDataResponsePDU("format_data_response", state);
    ByteBuffer clipboardAdapterPacket = new ByteBuffer(0);
    clipboardAdapterPacket.putMetadata(AwtClipboardAdapter.CLIPBOARD_CONTENT, "hello world");
    Element sink = new MockSink("sink", new ByteBuffer[] { clipboardAdapterPacket });
    Pipeline pipeline = new PipelineImpl("test");
    pipeline.add(source, router, format_data_response, sink);
    pipeline.link("source", "router >format_data_response", "format_data_response >clipboard", "sink");
    pipeline.runMainLoop("source", STDOUT, false, false);
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) Element(streamer.Element) BaseElement(streamer.BaseElement) ByteBuffer(streamer.ByteBuffer) Pipeline(streamer.Pipeline)

Example 30 with PipelineImpl

use of streamer.PipelineImpl in project cloudstack by apache.

the class ServerFormatListPDU method main.

/**
     * 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[] { //  CLIPRDR_HEADER::msgType = CB_FORMAT_LIST (2)
    0x02, //  CLIPRDR_HEADER::msgType = CB_FORMAT_LIST (2)
    0x00, //  CLIPRDR_HEADER::msgFlags = 0
    0x00, //  CLIPRDR_HEADER::msgFlags = 0
    0x00, //  CLIPRDR_HEADER::dataLen = 0xe0 = 224 bytes
    (byte) 0xe0, //  CLIPRDR_HEADER::dataLen = 0xe0 = 224 bytes
    0x00, //  CLIPRDR_HEADER::dataLen = 0xe0 = 224 bytes
    0x00, //  CLIPRDR_HEADER::dataLen = 0xe0 = 224 bytes
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc08a = 49290
    (byte) 0x8a, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc08a = 49290
    (byte) 0xc0, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc08a = 49290
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc08a = 49290
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x52, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x69, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x63, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x68, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x20, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x54, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x65, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x78, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x74, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x20, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x46, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x6f, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x72, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x6d, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x61, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x74, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc145 = 49477
    0x45, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc145 = 49477
    (byte) 0xc1, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc145 = 49477
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc145 = 49477
    0x00, 0x52, 0x00, 0x69, 0x00, 0x63, 0x00, 0x68, 0x00, 0x20, 0x00, 0x54, 0x00, 0x65, 0x00, 0x78, 0x00, 0x74, 0x00, 0x20, 0x00, 0x46, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x74, 0x00, 0x20, 0x00, 0x57, 0x00, 0x69, 0x00, 0x74, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x75, 0x00, 0x74, 0x00, 0x20, 0x00, 0x4f, 0x00, 0x62, 0x00, 0x6a, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x73, 0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format Without Objects"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Rich Text Format Without Objects"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc143 = 49475
    0x43, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc143 = 49475
    (byte) 0xc1, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc143 = 49475
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc143 = 49475
    0x00, 0x52, 0x00, 0x54, 0x00, 0x46, 0x00, 0x20, 0x00, 0x41, 0x00, 0x73, 0x00, 0x20, 0x00, 0x54, 0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "RTF As Text"
    0x65, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "RTF As Text"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "RTF As Text"
    0x78, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "RTF As Text"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "RTF As Text"
    0x74, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "RTF As Text"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "RTF As Text"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "RTF As Text"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 1
    0x01, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 1
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 1
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 1
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0x0d = 13
    0x0d, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0x0d = 13
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0x0d = 13
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0x0d = 13
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc004 = 49156
    0x04, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc004 = 49156
    (byte) 0xc0, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc004 = 49156
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc004 = 49156
    0x00, //  "Native"
    0x4e, //  "Native"
    0x00, //  "Native"
    0x61, //  "Native"
    0x00, //  "Native"
    0x74, //  "Native"
    0x00, //  "Native"
    0x69, //  "Native"
    0x00, //  "Native"
    0x76, //  "Native"
    0x00, //  "Native"
    0x65, //  "Native"
    0x00, //  "Native"
    0x00, //  "Native"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc00e = 49166
    0x0e, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc00e = 49166
    (byte) 0xc0, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc00e = 49166
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 0xc00e = 49166
    0x00, 0x4f, 0x00, 0x62, 0x00, 0x6a, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x20, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x6f, 0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Object Descriptor"
    0x72, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Object Descriptor"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Object Descriptor"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = "Object Descriptor"
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 3
    0x03, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 3
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 3
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 3
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 16
    0x10, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 16
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 16
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 16
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 7
    0x07, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 7
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 7
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatId = 7
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00, //  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    0x00 };
    /* @formatter:on */
    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
    Element router = new ServerClipRdrChannelRouter("router");
    ClipboardState state = new ClipboardState();
    state.serverUseLongFormatNames = true;
    Element format_list = new ServerFormatListPDU("format_list", state);
    Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { // CLIPRDR_HEADER::msgType = CB_FORMAT_LIST_RESPONSE (3)
    0x03, // CLIPRDR_HEADER::msgType = CB_FORMAT_LIST_RESPONSE (3)
    0x00, // CLIPRDR_HEADER::msgFlags = 0x0001 = CB_RESPONSE_OK
    0x01, // CLIPRDR_HEADER::msgFlags = 0x0001 = CB_RESPONSE_OK
    0x00, // CLIPRDR_HEADER::dataLen = 0 bytes
    0x00, // CLIPRDR_HEADER::dataLen = 0 bytes
    0x00, // CLIPRDR_HEADER::dataLen = 0 bytes
    0x00, // CLIPRDR_HEADER::dataLen = 0 bytes
    0x00 }, new byte[] { // CLIPRDR_HEADER::msgType = CB_FORMAT_DATA_REQUEST (4)
    0x04, // CLIPRDR_HEADER::msgType = CB_FORMAT_DATA_REQUEST (4)
    0x00, // CLIPRDR_HEADER::msgFlags = 0
    0x00, // CLIPRDR_HEADER::msgFlags = 0
    0x00, // CLIPRDR_HEADER::dataLen = 4 bytes
    0x04, // CLIPRDR_HEADER::dataLen = 4 bytes
    0x00, // CLIPRDR_HEADER::dataLen = 4 bytes
    0x00, // CLIPRDR_HEADER::dataLen = 4 bytes
    0x00, // CLIPRDR_FORMAT_DATA_REQUEST::requestedFormatId
    0x0d, // CLIPRDR_FORMAT_DATA_REQUEST::requestedFormatId
    0x00, // CLIPRDR_FORMAT_DATA_REQUEST::requestedFormatId
    0x00, // CLIPRDR_FORMAT_DATA_REQUEST::requestedFormatId
    0x00 }));
    Pipeline pipeline = new PipelineImpl("test");
    pipeline.add(source, router, format_list, sink);
    pipeline.link("source", "router >format_list", "format_list", "sink");
    pipeline.runMainLoop("source", STDOUT, false, false);
    // Check state
    if (!(state.serverClipboardDataFormats.containsKey(49475) && state.serverClipboardDataFormats.containsKey("Rich Text Format")))
        throw new RuntimeException("Server format list packet parsed incorrectly.");
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) Element(streamer.Element) BaseElement(streamer.BaseElement) Pipeline(streamer.Pipeline)

Aggregations

Pipeline (streamer.Pipeline)32 PipelineImpl (streamer.PipelineImpl)32 Element (streamer.Element)28 MockSource (streamer.debug.MockSource)25 MockSink (streamer.debug.MockSink)24 BaseElement (streamer.BaseElement)14 ByteBuffer (streamer.ByteBuffer)7 ScreenDescription (common.ScreenDescription)6 FakeSink (streamer.debug.FakeSink)3 InetSocketAddress (java.net.InetSocketAddress)2 SSLState (streamer.ssl.SSLState)2 RdpBufferedImageCanvas (com.cloud.consoleproxy.rdp.RdpBufferedImageCanvas)1 BufferedImageCanvas (common.BufferedImageCanvas)1 SizeChangeListener (common.SizeChangeListener)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 RdpClient (rdpclient.RdpClient)1 ServerBitmapUpdate (rdpclient.rdp.ServerBitmapUpdate)1