Search in sources :

Example 1 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class ObjectID method copyFrom.

@Override
public Tag copyFrom(Tag tag) {
    super.copyFrom(tag);
    value = new ByteBuffer(((ObjectID) tag).value.toByteArray());
    return this;
}
Also used : ByteBuffer(streamer.ByteBuffer)

Example 2 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class AwtKeyEventSource method sendEvent.

private void sendEvent(KeyEvent e, boolean pressed) {
    ByteBuffer buf = new ByteBuffer(new KeyOrder(e, pressed));
    pushDataToAllOuts(buf);
}
Also used : ByteBuffer(streamer.ByteBuffer)

Example 3 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class AwtMouseEventSource method mousePressed.

@Override
public void mousePressed(MouseEvent e) {
    MouseOrder order = new MouseOrder(e);
    order.pressed = true;
    pushDataToAllOuts(new ByteBuffer(order));
}
Also used : ByteBuffer(streamer.ByteBuffer)

Example 4 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class BufferedImageCopyRectAdapter method main.

public static void main(String[] args) {
    System.setProperty("streamer.Element.debug", "true");
    BufferedImageCanvas canvas = new BufferedImageCanvas(4, 4);
    Element renderer = new BufferedImageCopyRectAdapter("renderer", canvas);
    int[] pixelsBeforeCopy = new int[] { // 0
    1, 2, 3, 4, // 1
    5, 6, 7, 8, // 2
    9, 10, 11, 12, // 3
    13, 14, 15, 16 };
    int[] pixelsAfterCopy = new int[] { // 0
    11, 12, 3, 4, // 1
    15, 16, 7, 8, // 2
    9, 10, 11, 12, // 3
    13, 14, 15, 16 };
    // Initalize image
    int[] data = ((DataBufferInt) canvas.getOfflineImage().getRaster().getDataBuffer()).getData();
    System.arraycopy(pixelsBeforeCopy, 0, data, 0, pixelsBeforeCopy.length);
    ByteBuffer buf = new ByteBuffer(new byte[0]);
    buf.putMetadata(TARGET_X, 0);
    buf.putMetadata(TARGET_Y, 0);
    buf.putMetadata(WIDTH, 2);
    buf.putMetadata(HEIGHT, 2);
    buf.putMetadata(SRC_X, 2);
    buf.putMetadata(SRC_Y, 2);
    renderer.handleData(buf, null);
    data = ((DataBufferInt) canvas.getOfflineImage().getRaster().getDataBuffer()).getData();
    String actualData = Arrays.toString(data);
    String expectedData = Arrays.toString(pixelsAfterCopy);
    if (!actualData.equals(expectedData))
        System.err.println("Actual image:   " + actualData + "\nExpected image: " + expectedData + ".");
}
Also used : Element(streamer.Element) BaseElement(streamer.BaseElement) DataBufferInt(java.awt.image.DataBufferInt) ByteBuffer(streamer.ByteBuffer)

Example 5 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class TSRequest method main.

/**
 * Example.
 */
public static void main(String[] args) {
    /* @formatter:off */
    byte[] packet = new byte[] { // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 258 bytes
    0x30, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 258 bytes
    (byte) 0x82, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 258 bytes
    0x01, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 258 bytes
    0x02, // TAG: [0] (constructed) LEN: 3 bytes
    (byte) 0xa0, // TAG: [0] (constructed) LEN: 3 bytes
    0x03, // TAG: [UNIVERSAL 2] (primitive) "INTEGER" LEN: 1 bytes, Version: 0x3
    0x02, // TAG: [UNIVERSAL 2] (primitive) "INTEGER" LEN: 1 bytes, Version: 0x3
    0x01, // TAG: [UNIVERSAL 2] (primitive) "INTEGER" LEN: 1 bytes, Version: 0x3
    0x03, // TAG: [1] (constructed) LEN: 250 bytes
    (byte) 0xa1, // TAG: [1] (constructed) LEN: 250 bytes
    (byte) 0x81, // TAG: [1] (constructed) LEN: 250 bytes
    (byte) 0xfa, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 247 bytes
    0x30, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 247 bytes
    (byte) 0x81, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 247 bytes
    (byte) 0xf7, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 244 bytes
    0x30, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 244 bytes
    (byte) 0x81, // TAG: [UNIVERSAL 16] (constructed) "SEQUENCE" LEN: 244 bytes
    (byte) 0xf4, // TAG: [0] (constructed) LEN: 241 bytes
    (byte) 0xa0, // TAG: [0] (constructed) LEN: 241 bytes
    (byte) 0x81, // TAG: [0] (constructed) LEN: 241 bytes
    (byte) 0xf1, // TAG: [UNIVERSAL 4] (primitive) "OCTET STRING" LEN: 238 bytes
    0x04, // TAG: [UNIVERSAL 4] (primitive) "OCTET STRING" LEN: 238 bytes
    (byte) 0x81, // TAG: [UNIVERSAL 4] (primitive) "OCTET STRING" LEN: 238 bytes
    (byte) 0xee, // "NTLMSSP\0"
    0x4e, // "NTLMSSP\0"
    0x54, // "NTLMSSP\0"
    0x4c, // "NTLMSSP\0"
    0x4d, // "NTLMSSP\0"
    0x53, // "NTLMSSP\0"
    0x53, // "NTLMSSP\0"
    0x50, // "NTLMSSP\0"
    0x00, // MessageType (CHALLENGE)
    0x02, // MessageType (CHALLENGE)
    0x00, // MessageType (CHALLENGE)
    0x00, // MessageType (CHALLENGE)
    0x00, // TargetName (length: 30, allocated space: 30, offset: 56)
    0x1e, // TargetName (length: 30, allocated space: 30, offset: 56)
    0x00, // TargetName (length: 30, allocated space: 30, offset: 56)
    0x1e, // TargetName (length: 30, allocated space: 30, offset: 56)
    0x00, // TargetName (length: 30, allocated space: 30, offset: 56)
    0x38, // TargetName (length: 30, allocated space: 30, offset: 56)
    0x00, // TargetName (length: 30, allocated space: 30, offset: 56)
    0x00, // TargetName (length: 30, allocated space: 30, offset: 56)
    0x00, // NegotiateFlags TODO
    0x35, // NegotiateFlags TODO
    (byte) 0x82, // NegotiateFlags TODO
    (byte) 0x8a, // NegotiateFlags TODO
    (byte) 0xe2, // ServerChallenge
    0x52, // ServerChallenge
    (byte) 0xbe, // ServerChallenge
    (byte) 0x83, // ServerChallenge
    (byte) 0xd1, // ServerChallenge
    (byte) 0xf8, // ServerChallenge
    (byte) 0x80, // ServerChallenge
    0x16, // ServerChallenge
    0x6a, // Reserved
    0x00, // Reserved
    0x00, // Reserved
    0x00, // Reserved
    0x00, // Reserved
    0x00, // Reserved
    0x00, // Reserved
    0x00, // Reserved
    0x00, // TargetInfo (length: 152, allocated space: 152, offset: 86)
    (byte) 0x98, // TargetInfo (length: 152, allocated space: 152, offset: 86)
    0x00, // TargetInfo (length: 152, allocated space: 152, offset: 86)
    (byte) 0x98, // TargetInfo (length: 152, allocated space: 152, offset: 86)
    0x00, // TargetInfo (length: 152, allocated space: 152, offset: 86)
    0x56, // TargetInfo (length: 152, allocated space: 152, offset: 86)
    0x00, // TargetInfo (length: 152, allocated space: 152, offset: 86)
    0x00, // TargetInfo (length: 152, allocated space: 152, offset: 86)
    0x00, // Version (6.3, build 9431) , NTLM current revision: 15
    0x06, // Version (6.3, build 9431) , NTLM current revision: 15
    0x03, // Version (6.3, build 9431) , NTLM current revision: 15
    (byte) 0xd7, // Version (6.3, build 9431) , NTLM current revision: 15
    0x24, // Version (6.3, build 9431) , NTLM current revision: 15
    0x00, // Version (6.3, build 9431) , NTLM current revision: 15
    0x00, // Version (6.3, build 9431) , NTLM current revision: 15
    0x00, // Version (6.3, build 9431) , NTLM current revision: 15
    0x0f, // Target name value: "WIN-LO419B2LSR0"
    0x57, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x49, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x4e, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x2d, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x4c, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x4f, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x34, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x31, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x39, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x42, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x32, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x4c, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x53, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x52, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Target name value: "WIN-LO419B2LSR0"
    0x30, // Target name value: "WIN-LO419B2LSR0"
    0x00, // Item Type: NetBIOS domain name (0x0002, LE)
    0x02, // Item Type: NetBIOS domain name (0x0002, LE)
    0x00, // Item Length: 30 (LE)
    0x1e, // Item Length: 30 (LE)
    0x00, // "WIN-LO419B2LSR0"
    0x57, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x49, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4e, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x2d, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4c, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4f, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x34, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x31, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x39, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x42, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x32, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4c, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x53, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x52, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x30, // "WIN-LO419B2LSR0"
    0x00, // Item Type: NetBIOS computer name (0x0001, LE)
    0x01, // Item Type: NetBIOS computer name (0x0001, LE)
    0x00, // Item Length: 30 (LE)
    0x1e, // Item Length: 30 (LE)
    0x00, // "WIN-LO419B2LSR0"
    0x57, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x49, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4e, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x2d, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4c, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4f, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x34, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x31, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x39, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x42, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x32, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4c, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x53, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x52, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x30, // "WIN-LO419B2LSR0"
    0x00, // Item Type: DNS domain name (0x0004, LE)
    0x04, // Item Type: DNS domain name (0x0004, LE)
    0x00, // Item Length: 30 (LE)
    0x1e, // Item Length: 30 (LE)
    0x00, // "WIN-LO419B2LSR0"
    0x57, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x49, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4e, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x2d, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4c, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4f, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x34, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x31, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x39, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x42, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x32, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4c, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x53, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x52, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x30, // "WIN-LO419B2LSR0"
    0x00, // Item Type: DNS computer name (0x0003, LE)
    0x03, // Item Type: DNS computer name (0x0003, LE)
    0x00, // Item Length: 30 (LE)
    0x1e, // Item Length: 30 (LE)
    0x00, // "WIN-LO419B2LSR0"
    0x57, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x49, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4e, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x2d, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4c, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4f, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x34, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x31, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x39, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x42, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x32, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x4c, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x53, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x52, // "WIN-LO419B2LSR0"
    0x00, // "WIN-LO419B2LSR0"
    0x30, // "WIN-LO419B2LSR0"
    0x00, // Item Type: Timestamp (0x0007, LE)
    0x07, // Item Type: Timestamp (0x0007, LE)
    0x00, // Item Length: 8 (LE)
    0x08, // Item Length: 8 (LE)
    0x00, // TODO
    (byte) 0x99, // TODO
    0x4f, // TODO
    0x02, // TODO
    (byte) 0xd8, // TODO
    (byte) 0xf4, // TODO
    (byte) 0xaf, // TODO
    (byte) 0xce, // TODO
    0x01, // Attribute: End of list
    0x00, 0x00, 0x00, 0x00 };
    /* @formatter:on */
    TSRequest request = new TSRequest("TSRequest");
    // Read request from buffer
    // System.out.println("Request BER tree before parsing: " + request);
    ByteBuffer toReadBuf = new ByteBuffer(packet);
    request.readTag(toReadBuf);
    // System.out.println("Request BER tree after parsing: " + request);
    // System.out.println("version value: " + request.version.value);
    // System.out.println("negoToken value: " + ((NegoItem)
    // request.negoTokens.tags[0]).negoToken.value);
    // Write request to buffer and compare with original
    ByteBuffer toWriteBuf = new ByteBuffer(packet.length + 100, true);
    request.writeTag(toWriteBuf);
    toWriteBuf.trimAtCursor();
    if (!toReadBuf.equals(toWriteBuf))
        throw new RuntimeException("Data written to buffer is not equal to data read from buffer. \nExpected: " + toReadBuf + "\nActual: " + toWriteBuf + ".");
}
Also used : ByteBuffer(streamer.ByteBuffer)

Aggregations

ByteBuffer (streamer.ByteBuffer)110 Element (streamer.Element)12 BaseElement (streamer.BaseElement)9 Pipeline (streamer.Pipeline)7 PipelineImpl (streamer.PipelineImpl)7 TSRequest (rdpclient.ntlmssp.asn1.TSRequest)6 MockSink (streamer.debug.MockSink)5 MockSource (streamer.debug.MockSource)5 BitmapRectangle (common.BitmapRectangle)3 ScreenDescription (common.ScreenDescription)3 SyncLink (streamer.SyncLink)3 AssertingByteBuffer (streamer.debug.AssertingByteBuffer)3 BitmapOrder (common.BitmapOrder)2 KeyOrder (common.KeyOrder)2 MouseOrder (common.MouseOrder)2 NegoItem (rdpclient.ntlmssp.asn1.NegoItem)2 Link (streamer.Link)2 FakeSink (streamer.debug.FakeSink)2 BufferedImageCanvas (common.BufferedImageCanvas)1 CopyRectOrder (common.CopyRectOrder)1