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));
}
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 + ".");
}
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;
}
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;
}
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();
}
Aggregations