use of streamer.Pipeline in project cloudstack by apache.
the class ServerBitmapUpdate method main.
/**
* Example.
*/
public static void main(String[] args) {
ByteBuffer packet = new ByteBuffer(new byte[] { 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, 0x00, 0x01, 0x04, 0x0a, 0x00, 0x0c, (byte) 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
Element bitmap = new ServerBitmapUpdate("bitmap") {
{
verbose = true;
}
};
FakeSink fakeSink = new FakeSink("sink") {
{
verbose = true;
}
};
Pipeline pipeline = new PipelineImpl("test");
// BufferedImageCanvas canvas = new BufferedImageCanvas(1024, 768);
// Element adapter = new AwtRdpAdapter("test",canvas );
// pipeline.addAndLink(bitmap, adapter);
pipeline.addAndLink(bitmap, fakeSink);
bitmap.handleData(packet, null);
}
use of streamer.Pipeline in project cloudstack by apache.
the class ServerIOChannelRouter 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");
byte[] packet = new byte[] { // TPKT Header: TPKT version = 3
(byte) 0x03, // TPKT Header: TPKT version = 3
(byte) 0x00, // TPKT length: 27 bytes
(byte) 0x00, // TPKT length: 27 bytes
(byte) 0x1B, // X224 Length: 2 bytes
(byte) 0x02, // X224 Type: Data
(byte) 0xF0, // X224 EOT
(byte) 0x80, // ??
(byte) 0x68, // User ID: 1002 (1001+1)
(byte) 0x00, // User ID: 1002 (1001+1)
(byte) 0x01, // Channel ID: 1003
(byte) 0x03, // Channel ID: 1003
(byte) 0xEB, // Data priority: high, segmentation: begin|end
(byte) 0x70, // Payload length: 13 bytes
(byte) 0x0D, // Length: 13 bytes (LE)
(byte) 0x0D, // Length: 13 bytes (LE)
(byte) 0x00, // ProtocolVersion: (000000000001....) 1
(byte) 0x16, (byte) 0x00, // PDU source: 1002 (LE)
(byte) 0xEA, // PDU source: 1002 (LE)
(byte) 0x03, // ShareID = 66538
(byte) 0xEA, // ShareID = 66538
(byte) 0x03, // ShareID = 66538
(byte) 0x01, // ShareID = 66538
(byte) 0x00, // Length if source descriptor: 1 (LE)
(byte) 0x01, // Length if source descriptor: 1 (LE)
(byte) 0x00, // Source descriptor (should be set to 0): 0
(byte) 0x00 };
MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
RdpState rdpState = new RdpState() {
{
serverShareId = 66538;
}
};
Element channel1003 = new ServerIOChannelRouter("channel_1003", rdpState);
Element mcs = new ServerMCSPDU("mcs");
Element tpkt = new ServerTpkt("tpkt");
Element x224 = new ServerX224DataPdu("x224");
Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { // Length: 13 bytes (LE)
(byte) 0x0D, // Length: 13 bytes (LE)
(byte) 0x00, // ProtocolVersion: (000000000001....) 1
(byte) 0x16, (byte) 0x00, // PDU source: 1002 (LE)
(byte) 0xEA, // PDU source: 1002 (LE)
(byte) 0x03, // ShareID = 66538
(byte) 0xEA, // ShareID = 66538
(byte) 0x03, // ShareID = 66538
(byte) 0x01, // ShareID = 66538
(byte) 0x00, // Length if source descriptor: 1 (LE)
(byte) 0x01, // Length if source descriptor: 1 (LE)
(byte) 0x00, // Source descriptor (should be set to 0): 0
(byte) 0x00 }));
Pipeline pipeline = new PipelineImpl("test");
pipeline.add(source, tpkt, x224, mcs, channel1003, sink);
pipeline.link("source", "tpkt", "x224", "mcs >channel_1003", "channel_1003 >deactivate_all", "sink");
pipeline.runMainLoop("source", STDOUT, false, false);
}
use of streamer.Pipeline in project cloudstack by apache.
the class ServerMCSAttachUserConfirmPDU method main.
/**
* Example.
*/
/**
* 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");
byte[] packet = new byte[] { // MCS user confirm (001011..,
(byte) 0x2E, // RT successfull (0000...., 0x0)
(byte) 0x00, // Initiator: 1001+3 = 1004
(byte) 0x00, (byte) 0x03 };
RdpState rdpState = new RdpState();
MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet, new byte[] { 1, 2, 3 }));
Element atachUserConfirm = new ServerMCSAttachUserConfirmPDU("attach_user_confirm", rdpState);
Element sink = new MockSink("sink");
Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }));
Pipeline pipeline = new PipelineImpl("test");
pipeline.add(source, atachUserConfirm, sink, mainSink);
pipeline.link("source", "attach_user_confirm", "mainSink");
pipeline.link("attach_user_confirm >" + OTOUT, "sink");
pipeline.runMainLoop("source", STDOUT, false, false);
if (rdpState.serverUserChannelId != 1004)
System.err.println("Incorrect user channel ID. Expected value: 1004, actual value: " + rdpState.serverUserChannelId + ".");
}
use of streamer.Pipeline in project cloudstack by apache.
the class ServerMCSPDU 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");
byte[] packet = new byte[] { // TPKT Header: TPKT version = 3
(byte) 0x03, // TPKT Header: TPKT version = 3
(byte) 0x00, // TPKT length: 27 bytes
(byte) 0x00, // TPKT length: 27 bytes
(byte) 0x1B, // X224 Length: 2 bytes
(byte) 0x02, // X224 Type: Data
(byte) 0xF0, // X224 EOT
(byte) 0x80, // ??
(byte) 0x68, // User ID: 1002 (1001+1)
(byte) 0x00, // User ID: 1002 (1001+1)
(byte) 0x01, // Channel ID: 1003
(byte) 0x03, // Channel ID: 1003
(byte) 0xEB, // Data priority: high, segmentation: begin|end
(byte) 0x70, // Payload length: 13 bytes
(byte) 0x0D, // Length: 13 bytes (LE)
(byte) 0x0D, // Length: 13 bytes (LE)
(byte) 0x00, // ProtocolVersion: (000000000001....) 1
(byte) 0x16, (byte) 0x00, // PDU source: 1002 (LE)
(byte) 0xEA, // PDU source: 1002 (LE)
(byte) 0x03, // ShareID = 66538
(byte) 0xEA, // ShareID = 66538
(byte) 0x03, // ShareID = 66538
(byte) 0x01, // ShareID = 66538
(byte) 0x00, // Length if source descriptor: 1 (LE)
(byte) 0x01, // Length if source descriptor: 1 (LE)
(byte) 0x00, // Source descriptor (should be set to 0): 0
(byte) 0x00 };
MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
Element mcs = new ServerMCSPDU("mcs") {
{
verbose = true;
}
};
Element tpkt = new ServerTpkt("tpkt");
Element x224 = new ServerX224DataPdu("x224");
Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { // Length: 13 bytes (LE)
(byte) 0x0D, // Length: 13 bytes (LE)
(byte) 0x00, // ProtocolVersion: (000000000001....) 1
(byte) 0x16, (byte) 0x00, // PDU source: 1002 (LE)
(byte) 0xEA, // PDU source: 1002 (LE)
(byte) 0x03, // ShareID = 66538
(byte) 0xEA, // ShareID = 66538
(byte) 0x03, // ShareID = 66538
(byte) 0x01, // ShareID = 66538
(byte) 0x00, // Length if source descriptor: 1 (LE)
(byte) 0x01, // Length if source descriptor: 1 (LE)
(byte) 0x00, // Source descriptor (should be set to 0): 0
(byte) 0x00 }));
Pipeline pipeline = new PipelineImpl("test");
pipeline.add(source, tpkt, x224, mcs, sink);
pipeline.link("source", "tpkt", "x224", "mcs >channel_1003", "sink");
pipeline.runMainLoop("source", STDOUT, false, false);
}
use of streamer.Pipeline in project cloudstack by apache.
the class ServerX224ConnectionConfirmPDU 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");
// byte[] packet = new byte[] {
//
// 0x03, // -> TPKT Header: TPKT version = 3
// 0x00, // TPKT Header: Reserved = 0
// 0x00, 0x13, // TPKT Header: Packet length - (total = 19 bytes)
// 0x0e, // X.224: Length indicator (14 bytes)
// (byte) 0xd0, // X.224: Type (high nibble) = 0xd = CC TPDU; credit
// // (low nibble) = 0
// 0x00, 0x00, // X.224: Destination reference = 0
// 0x12, 0x34, // X.224: Source reference = 0x1234 (bogus value)
// 0x00, // X.224: Class and options = 0
//
// 0x02, // RDP_NEG_RSP::type (TYPE_RDP_NEG_RSP)
// 0x00, // RDP_NEG_RSP::flags (0)
// 0x08, 0x00, // RDP_NEG_RSP::length (8 bytes)
// 0x01, 0x00, 0x00, 0x00 // RDP_NEG_RSP: Selected protocols (PROTOCOL_SSL)
// };
// Connection failure
// 03 00 00 13 0e d0 00 00 12 34 00 03 00 08 00 05 00 00 00
byte[] packet = new byte[] { // -> TPKT Header: TPKT version = 3
0x03, // TPKT Header: Reserved = 0
0x00, // TPKT Header: Packet length - (total = 19 bytes)
0x00, // TPKT Header: Packet length - (total = 19 bytes)
0x13, // X.224: Length indicator (14 bytes)
0x0e, // X.224: Type (high nibble) = 0xd = CC TPDU; credit
(byte) 0xd0, // X.224: Destination reference = 0
0x00, // X.224: Destination reference = 0
0x00, // X.224: Source reference = 0x1234 (bogus value)
0x12, // X.224: Source reference = 0x1234 (bogus value)
0x34, // X.224: Class and options = 0
0x00, // Failure
(byte) 0x03, // RDP_NEG_RSP::flags (0)
(byte) 0x00, // RDP_NEG_RSP::length (8 bytes)
(byte) 0x08, // RDP_NEG_RSP::length (8 bytes)
(byte) 0x00, // Code: HYBRID_REQUIRED_BY_SERVER
(byte) 0x05, // Code: HYBRID_REQUIRED_BY_SERVER
(byte) 0x00, // Code: HYBRID_REQUIRED_BY_SERVER
(byte) 0x00, // Code: HYBRID_REQUIRED_BY_SERVER
(byte) 0x00 };
MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
Element cc = new ServerX224ConnectionConfirmPDU("cc");
Element tpkt = new ServerTpkt("tpkt");
Element sink = new MockSink("sink", new ByteBuffer[] {});
Element mainSink = new MockSink("mainSink", new ByteBuffer[] {});
Pipeline pipeline = new PipelineImpl("test");
pipeline.add(source, tpkt, cc, sink, mainSink);
pipeline.link("source", "tpkt", "cc", "mainSink");
pipeline.link("cc >" + OTOUT, "sink");
pipeline.runMainLoop("source", STDOUT, false, false);
}
Aggregations