Search in sources :

Example 6 with MockSink

use of streamer.debug.MockSink in project cloudstack by apache.

the class ClientMCSConnectInitial method main.

/**
     * 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);
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) Element(streamer.Element) Pipeline(streamer.Pipeline)

Example 7 with MockSink

use of streamer.debug.MockSink in project cloudstack by apache.

the class ClientMCSErectDomainRequest method main.

/**
     * 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[] { //  TPKT Header (length = 12 bytes)
    0x03, //  TPKT Header (length = 12 bytes)
    0x00, //  TPKT Header (length = 12 bytes)
    0x00, //  TPKT Header (length = 12 bytes)
    0x0c, //  X.224 Data TPDU
    0x02, //  X.224 Data TPDU
    (byte) 0xf0, //  X.224 Data TPDU
    (byte) 0x80, // PER encoded (ALIGNED variant of BASIC-PER) PDU contents:
    0x04, 0x01, 0x00, 0x01, 0x00 };
    /* @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);
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) Element(streamer.Element) Pipeline(streamer.Pipeline)

Example 8 with MockSink

use of streamer.debug.MockSink in project cloudstack by apache.

the class ClientSynchronizePDU method main.

/**
     * 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);
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) Element(streamer.Element) Pipeline(streamer.Pipeline)

Example 9 with MockSink

use of streamer.debug.MockSink in project cloudstack by apache.

the class ClientInfoPDU 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[] { // TPKT
    (byte) 0x03, (byte) 0x00, // TPKT length: 343 bytes
    (byte) 0x01, (byte) 0x57, // X224 Data PDU
    (byte) 0x02, (byte) 0xf0, (byte) 0x80, // MCS Send Data Request PDU
    (byte) 0x64, // Initiator: 0x03 + 1001 = 1004
    (byte) 0x00, (byte) 0x03, // Channel ID: 1003 (IO Channel)
    (byte) 0x03, (byte) 0xeb, // Data priority: high, segmentation: begin | end (0x40 | 0x20 | 0x10 = 0x70)
    (byte) 0x70, // User data length: 328  (0x148) bytes, variable length field
    (byte) 0x81, (byte) 0x48, // Flags: SEC_INFO_PKT (0x4000)
    (byte) 0x40, (byte) 0x00, // TS_SECURITY_HEADER::flagsHi - ignored
    (byte) 0x00, (byte) 0x00, // Codepage: 0 (UNKNOWN, LE) (use  0x04090409  (1033,1033) for EN_US)
    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, // INFO_MOUSE_HAS_WHEEL (0x00020000), INFO_NOAUDIOPLAYBACK (0x00080000),
    (byte) 0x73, (byte) 0x01, (byte) 0x0a, (byte) 0x00, // cbDomain length: 0 bytes (LE) (NOT including size of mandatory NULL terminator)
    (byte) 0x00, (byte) 0x00, // cbUserName length: 16 bytes (0x10, LE) (NOT including size of mandatory NULL terminator)
    (byte) 0x10, (byte) 0x00, // cbPassword length: 0 bytes (LE) (NOT including size of mandatory NULL terminator)
    (byte) 0x00, (byte) 0x00, // cbAlternateShell:  0 bytes (LE) (NOT including size of mandatory NULL terminator)
    (byte) 0x00, (byte) 0x00, // cbWorkingDir: 0 bytes (LE) (NOT including size of mandatory NULL terminator)
    (byte) 0x00, (byte) 0x00, // Domain: "" (UCS2), see cbDomain
    (byte) 0x00, (byte) 0x00, // User name: "vlisivka" (UCS2), see cbUserName
    (byte) 0x76, (byte) 0x00, (byte) 0x6c, (byte) 0x00, (byte) 0x69, (byte) 0x00, (byte) 0x73, (byte) 0x00, (byte) 0x69, (byte) 0x00, (byte) 0x76, (byte) 0x00, (byte) 0x6b, (byte) 0x00, (byte) 0x61, (byte) 0x00, (byte) 0x00, (byte) 0x00, // Password: "" (UCS2), see cbPassword
    (byte) 0x00, (byte) 0x00, // Alternate shell: "" (UCS2), see cbAlternateShell
    (byte) 0x00, (byte) 0x00, // Working directory: "" (UCS2), see cbWorkingDir
    (byte) 0x00, (byte) 0x00, // Client address family: 2 (AF_INET, LE)
    (byte) 0x02, (byte) 0x00, // cbClientAddress = 28 bytes (0x1c, LE) (including the size of the mandatory NULL terminator)
    (byte) 0x1c, (byte) 0x00, // Client address: "192.168.0.100" (UCS2)
    (byte) 0x31, (byte) 0x00, (byte) 0x39, (byte) 0x00, (byte) 0x32, (byte) 0x00, (byte) 0x2e, (byte) 0x00, (byte) 0x31, (byte) 0x00, (byte) 0x36, (byte) 0x00, (byte) 0x38, (byte) 0x00, (byte) 0x2e, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x2e, (byte) 0x00, (byte) 0x31, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x00, (byte) 0x00, // cbClientDir: 64 bytes (0x40, LE) (including the size of the mandatory NULL terminator)
    (byte) 0x40, (byte) 0x00, // Client directory: "C:\Windows\System32\mstscax.dll" (UCS2)
    (byte) 0x43, (byte) 0x00, (byte) 0x3a, (byte) 0x00, (byte) 0x5c, (byte) 0x00, (byte) 0x57, (byte) 0x00, (byte) 0x69, (byte) 0x00, (byte) 0x6e, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0x6f, (byte) 0x00, (byte) 0x77, (byte) 0x00, (byte) 0x73, (byte) 0x00, (byte) 0x5c, (byte) 0x00, (byte) 0x53, (byte) 0x00, (byte) 0x79, (byte) 0x00, (byte) 0x73, (byte) 0x00, (byte) 0x74, (byte) 0x00, (byte) 0x65, (byte) 0x00, (byte) 0x6d, (byte) 0x00, (byte) 0x33, (byte) 0x00, (byte) 0x32, (byte) 0x00, (byte) 0x5c, (byte) 0x00, (byte) 0x6d, (byte) 0x00, (byte) 0x73, (byte) 0x00, (byte) 0x74, (byte) 0x00, (byte) 0x73, (byte) 0x00, (byte) 0x63, (byte) 0x00, (byte) 0x61, (byte) 0x00, (byte) 0x78, (byte) 0x00, (byte) 0x2e, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0x6c, (byte) 0x00, (byte) 0x6c, (byte) 0x00, (byte) 0x00, (byte) 0x00, // Bias: 0 minutes (LE)
    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, // Standard name: "EET, Standard Time" (fixed string: 64 bytes, UCS2)
    (byte) 0x45, (byte) 0x00, (byte) 0x45, (byte) 0x00, (byte) 0x54, (byte) 0x00, (byte) 0x2c, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x53, (byte) 0x00, (byte) 0x74, (byte) 0x00, (byte) 0x61, (byte) 0x00, (byte) 0x6e, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0x61, (byte) 0x00, (byte) 0x72, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x54, (byte) 0x00, (byte) 0x69, (byte) 0x00, (byte) 0x6d, (byte) 0x00, (byte) 0x65, (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, // wYear: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMonth: unknown (LE)
    (byte) 0x00, (byte) 0x00, // wDayOfWeek: Sunday (LE)
    (byte) 0x00, (byte) 0x00, // wDay: unknown (LE)
    (byte) 0x00, (byte) 0x00, // wHour: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMinute: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wSecond: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMilliseconds: 0
    (byte) 0x00, (byte) 0x00, // StandardBias: 0 minutes (LE)
    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, // Daylight name: "EET, Summer Time" (fixed string: 64 bytes, UCS2)
    (byte) 0x45, (byte) 0x00, (byte) 0x45, (byte) 0x00, (byte) 0x54, (byte) 0x00, (byte) 0x2c, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x53, (byte) 0x00, (byte) 0x75, (byte) 0x00, (byte) 0x6d, (byte) 0x00, (byte) 0x6d, (byte) 0x00, (byte) 0x65, (byte) 0x00, (byte) 0x72, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x54, (byte) 0x00, (byte) 0x69, (byte) 0x00, (byte) 0x6d, (byte) 0x00, (byte) 0x65, (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, // wYear: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMonth: unknown (LE)
    (byte) 0x00, (byte) 0x00, // wDayOfWeek: Sunday (LE)
    (byte) 0x00, (byte) 0x00, // wDay: unknown (LE)
    (byte) 0x00, (byte) 0x00, // wHour: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMinute: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wSecond: 0 (LE)
    (byte) 0x00, (byte) 0x00, // wMilliseconds: 0
    (byte) 0x00, (byte) 0x00, // Daylight bias: 60 minutes (LE)
    (byte) 0x3c, (byte) 0x00, (byte) 0x00, (byte) 0x00, // Client session ID: 0x00000000 (LE)
    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, // Performance flags: 0x7 (LE) = PERF_DISABLE_WALLPAPER (0x1), PERF_DISABLE_FULLWINDOWDRAG (0x2), PERF_DISABLE_MENUANIMATIONS (0x4)
    (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x00, // cbAutoReconnectCookie: 0 bytes (LE)
    (byte) 0x00, (byte) 0x00 };
    /* @formatter:on */
    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
    Element client_info = new ClientInfoPDU("client_info", "vlisivka");
    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, client_info, x224, tpkt, sink, mainSink);
    pipeline.link("source", "client_info", "mainSink");
    pipeline.link("client_info >" + OTOUT, "x224", "tpkt", "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 10 with MockSink

use of streamer.debug.MockSink in project cloudstack by apache.

the class VncMessageHandler 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");
    Element source = new MockSource("source") {

        {
            // Split messages at random boundaries to check "pushback" logic
            bufs = ByteBuffer.convertByteArraysToByteBuffers(new byte[] { // Message type: server bell
            RfbConstants.SERVER_BELL, // Message type: clipboard text
            RfbConstants.SERVER_CUT_TEXT, // Padding
            0, 0, 0, // Length (test)
            0, 0, 0, 4 }, new byte[] { // Clipboard text
            't', 'e', 's', 't', // Message type: frame buffer update
            RfbConstants.SERVER_FRAMEBUFFER_UPDATE, // Padding
            0, // Number of rectangles
            0, 3 }, new byte[] { // x, y, width, height: 0x0@4x4
            0, 0, 0, 0, 0, 4, 0, 4, // Encoding: desktop size
            (byte) ((RfbConstants.ENCODING_DESKTOP_SIZE >> 24) & 0xff), (byte) ((RfbConstants.ENCODING_DESKTOP_SIZE >> 16) & 0xff), (byte) ((RfbConstants.ENCODING_DESKTOP_SIZE >> 8) & 0xff), (byte) ((RfbConstants.ENCODING_DESKTOP_SIZE >> 0) & 0xff) }, new byte[] { // x, y, width, height: 0x0@4x4
            0, 0, 0, 0, 0, 4, 0, 4, // Encoding: raw rect
            (byte) ((RfbConstants.ENCODING_RAW >> 24) & 0xff), (byte) ((RfbConstants.ENCODING_RAW >> 16) & 0xff), (byte) ((RfbConstants.ENCODING_RAW >> 8) & 0xff), (byte) ((RfbConstants.ENCODING_RAW >> 0) & 0xff), // Raw pixel data 4x4x1 bpp
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, new byte[] { 11, 12, 13, 14, 15, 16, // x, y, width, height: 0x0@2x2
            0, 0, 0, 0, 0, 2, 0, 2, // Encoding: copy rect
            (byte) ((RfbConstants.ENCODING_COPY_RECT >> 24) & 0xff), (byte) ((RfbConstants.ENCODING_COPY_RECT >> 16) & 0xff), (byte) ((RfbConstants.ENCODING_COPY_RECT >> 8) & 0xff), (byte) ((RfbConstants.ENCODING_COPY_RECT >> 0) & 0xff), // srcX, srcY: 2x2
            0, 2, 0, 2 });
        }
    };
    ScreenDescription screen = new ScreenDescription() {

        {
            bytesPerPixel = 1;
        }
    };
    final Element handler = new VncMessageHandler("handler", screen);
    ByteBuffer[] emptyBuf = ByteBuffer.convertByteArraysToByteBuffers(new byte[] {});
    Element fburSink = new MockSink("fbur", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {}, new byte[] {}));
    Element bellSink = new MockSink("bell", emptyBuf);
    Element clipboardSink = new MockSink("clipboard", emptyBuf);
    Element desktopSizeChangeSink = new MockSink("desktop_size", emptyBuf);
    Element pixelsSink = new MockSink("pixels", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }));
    Element copyRectSink = new MockSink("copy_rect", emptyBuf);
    Pipeline pipeline = new PipelineImpl("test");
    pipeline.addAndLink(source, handler);
    pipeline.add(fburSink, bellSink, clipboardSink, desktopSizeChangeSink, pixelsSink, copyRectSink);
    pipeline.link("handler >" + FRAME_BUFFER_UPDATE_REQUEST_ADAPTER_PAD, "fbur");
    pipeline.link("handler >" + SERVER_BELL_ADAPTER_PAD, "bell");
    pipeline.link("handler >" + SERVER_CLIPBOARD_ADAPTER_PAD, "clipboard");
    pipeline.link("handler >" + PIXEL_ADAPTER_PAD, "pixels");
    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) ScreenDescription(common.ScreenDescription) ByteBuffer(streamer.ByteBuffer) Pipeline(streamer.Pipeline)

Aggregations

Element (streamer.Element)24 Pipeline (streamer.Pipeline)24 PipelineImpl (streamer.PipelineImpl)24 MockSink (streamer.debug.MockSink)24 MockSource (streamer.debug.MockSource)24 BaseElement (streamer.BaseElement)9 ByteBuffer (streamer.ByteBuffer)5 ScreenDescription (common.ScreenDescription)4 FakeSink (streamer.debug.FakeSink)1 SSLState (streamer.ssl.SSLState)1