Search in sources :

Example 86 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class AwtMouseEventSource method mouseReleased.

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

Example 87 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class BufferedImagePixelsAdapter method main.

public static void main(String[] args) {
    System.setProperty("streamer.Element.debug", "true");
    BufferedImageCanvas canvas = new BufferedImageCanvas(4, 4);
    Element renderer = new BufferedImagePixelsAdapter("renderer", canvas);
    byte[] pixels = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
    int[] pixelsLE = new int[] { 0x04030201, 0x08070605, 0x0c0b0a09, 0x100f0e0d, 0x04030201, 0x08070605, 0x0c0b0a09, 0x100f0e0d, 0x04030201, 0x08070605, 0x0c0b0a09, 0x100f0e0d, 0x04030201, 0x08070605, 0x0c0b0a09, 0x100f0e0d };
    ByteBuffer buf = new ByteBuffer(pixels);
    buf.putMetadata(TARGET_X, 0);
    buf.putMetadata(TARGET_Y, 0);
    buf.putMetadata(WIDTH, 4);
    buf.putMetadata(HEIGHT, 4);
    buf.putMetadata(PIXEL_FORMAT, RGB888LE32);
    renderer.handleData(buf, null);
    String actualData = Arrays.toString(((DataBufferInt) canvas.getOfflineImage().getRaster().getDataBuffer()).getData());
    String expectedData = Arrays.toString(pixelsLE);
    if (!actualData.equals(expectedData))
        s_logger.error("Actual image:   " + actualData + "\nExpected image: " + expectedData + ".");
}
Also used : Element(streamer.Element) BaseElement(streamer.BaseElement) ByteBuffer(streamer.ByteBuffer)

Example 88 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class ClientNtlmsspPubKeyAuth method getServerPublicKey.

private byte[] getServerPublicKey() {
    // SSL certificate public key with algorithm
    ByteBuffer subjectPublicKeyInfo = new ByteBuffer(sslState.serverCertificateSubjectPublicKeyInfo);
    // Parse subjectPublicKeyInfo
    SubjectPublicKeyInfo parser = new SubjectPublicKeyInfo("SubjectPublicKeyInfo");
    parser.readTag(subjectPublicKeyInfo);
    // Copy subjectPublicKey subfield to separate byte buffer
    ByteBuffer subjectPublicKey = new ByteBuffer(subjectPublicKeyInfo.length);
    parser.subjectPublicKey.writeTag(subjectPublicKey);
    subjectPublicKeyInfo.unref();
    subjectPublicKey.trimAtCursor();
    // Skip tag:
    // 03 82 01 0f (tag) 00 (padding byte)
    // FIXME: parse it properly
    subjectPublicKey.trimHeader(5);
    // * DEBUG */System.out.println("DEBUG: subjectPublicKey:\n" +
    // subjectPublicKey.dump());
    ntlmState.subjectPublicKey = subjectPublicKey.toByteArray();
    return ntlmState.subjectPublicKey;
}
Also used : ByteBuffer(streamer.ByteBuffer) SubjectPublicKeyInfo(rdpclient.ntlmssp.asn1.SubjectPublicKeyInfo)

Example 89 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class ClientNtlmsspUserCredentials method generateTSCredentials.

private ByteBuffer generateTSCredentials() {
    ByteBuffer buf = new ByteBuffer(4096);
    TSCredentials tsCredentials = new TSCredentials("authInfo");
    // 1 means that credentials field contains a TSPasswordCreds structure
    tsCredentials.credType.value = 1L;
    ByteBuffer tsPasswordCredsBuf = new ByteBuffer(4096, true);
    TSPasswordCreds tsPasswordCreds = new TSPasswordCreds("credentials");
    tsPasswordCreds.domainName.value = new ByteBuffer(ntlmState.domain.getBytes(RdpConstants.CHARSET_16));
    tsPasswordCreds.userName.value = new ByteBuffer(ntlmState.user.getBytes(RdpConstants.CHARSET_16));
    tsPasswordCreds.password.value = new ByteBuffer(ntlmState.password.getBytes(RdpConstants.CHARSET_16));
    tsPasswordCreds.writeTag(tsPasswordCredsBuf);
    tsPasswordCredsBuf.trimAtCursor();
    //* DEBUG */System.out.println("TSPasswordCreds:\n" + tsPasswordCredsBuf.dump());
    tsCredentials.credentials.value = tsPasswordCredsBuf;
    tsCredentials.writeTag(buf);
    tsPasswordCredsBuf.unref();
    // Trim buffer to actual length of data written
    buf.trimAtCursor();
    return buf;
}
Also used : TSCredentials(rdpclient.ntlmssp.asn1.TSCredentials) ByteBuffer(streamer.ByteBuffer) TSPasswordCreds(rdpclient.ntlmssp.asn1.TSPasswordCreds)

Example 90 with ByteBuffer

use of streamer.ByteBuffer in project cloudstack by apache.

the class ClientNtlmsspUserCredentials method onStart.

@Override
protected void onStart() {
    super.onStart();
    ByteBuffer buf = new ByteBuffer(4096, true);
    TSRequest tsRequest = new TSRequest("TSRequest");
    tsRequest.version.value = 2L;
    ByteBuffer tsCredentialsBuf = generateTSCredentials();
    tsRequest.authInfo.value = encryptTSCredentials(tsCredentialsBuf);
    tsCredentialsBuf.unref();
    tsRequest.writeTag(buf);
    // Trim buffer to actual length of data written
    buf.trimAtCursor();
    pushDataToOTOut(buf);
    switchOff();
}
Also used : ByteBuffer(streamer.ByteBuffer) TSRequest(rdpclient.ntlmssp.asn1.TSRequest)

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