Search in sources :

Example 1 with ScreenDescription

use of common.ScreenDescription in project cloudstack by apache.

the class ConsoleProxyRdpClient method initClient.

@Override
public void initClient(final ConsoleProxyClientParam param) {
    if ((System.currentTimeMillis() - _threadStopTime) < 1000) {
        return;
    }
    try {
        int canvasWidth = 1024;
        int canvasHeight = 768;
        setClientParam(param);
        final String host = param.getHypervHost();
        final String password = param.getPassword();
        final String instanceId = param.getClientHostAddress();
        final int port = param.getClientHostPort();
        final SSLState sslState = new SSLState();
        final String username = param.getUsername();
        String name = null;
        String domain = null;
        if (username.contains("\\")) {
            String[] tokens = username.split("\\\\");
            name = tokens[1];
            domain = tokens[0];
        } else {
            name = username;
            domain = "Workgroup";
        }
        _screen = new ScreenDescription();
        _canvas = new RdpBufferedImageCanvas(this, canvasWidth, canvasHeight);
        onFramebufferSizeChange(canvasWidth, canvasHeight);
        _screen.addSizeChangeListener(new SizeChangeListener() {

            @Override
            public void sizeChanged(int width, int height) {
                if (_canvas != null) {
                    _canvas.setCanvasSize(width, height);
                }
            }
        });
        s_logger.info("connecting to instance " + instanceId + " on host " + host);
        _client = new RdpClient("client", host, domain, name, password, instanceId, _screen, _canvas, sslState);
        _mouseEventSource = _client.getMouseEventSource();
        _keyEventSource = _client.getKeyEventSource();
        _worker = new Thread(new Runnable() {

            @Override
            public void run() {
                _socket = new AprSocketWrapperImpl("socket", sslState);
                Pipeline pipeline = new PipelineImpl("Client");
                pipeline.add(_socket, _client);
                pipeline.link("socket", _client.getId(), "socket");
                pipeline.validate();
                InetSocketAddress address = new InetSocketAddress(host, port);
                ConsoleProxy.ensureRoute(host);
                try {
                    _workerDone = false;
                    s_logger.info("Connecting socket to remote server and run main loop(s)");
                    _socket.connect(address);
                } catch (Exception e) {
                    s_logger.info(" error occurred in connecting to socket " + e.getMessage());
                } finally {
                    shutdown();
                }
                _threadStopTime = System.currentTimeMillis();
                s_logger.info("Receiver thread stopped.");
                _workerDone = true;
            }
        });
        _worker.setDaemon(true);
        _worker.start();
    } catch (Exception e) {
        _workerDone = true;
        s_logger.info("error occurred in initializing rdp client " + e.getMessage());
    }
}
Also used : PipelineImpl(streamer.PipelineImpl) InetSocketAddress(java.net.InetSocketAddress) ScreenDescription(common.ScreenDescription) SizeChangeListener(common.SizeChangeListener) Pipeline(streamer.Pipeline) AprSocketWrapperImpl(streamer.apr.AprSocketWrapperImpl) RdpBufferedImageCanvas(com.cloud.consoleproxy.rdp.RdpBufferedImageCanvas) SSLState(streamer.ssl.SSLState) RdpClient(rdpclient.RdpClient)

Example 2 with ScreenDescription

use of common.ScreenDescription in project cloudstack by apache.

the class ClientConfirmActivePDU 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[] { // 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, // User data length: 432 bytes (0x1b0, variable length field)
    (byte) 0x81, (byte) 0xb0, // Total length: 432 bytes (0x1b0, LE)
    (byte) 0xb0, (byte) 0x01, // PDU type: Confirm Active PDU (0x3), TS_PROTOCOL_VERSION (0x10) (LE)
    (byte) 0x13, (byte) 0x00, // PDU source: 1004 (LE)
    (byte) 0xec, (byte) 0x03, // Share ID: 0x000103ea (LE)
    (byte) 0xea, (byte) 0x03, (byte) 0x01, (byte) 0x00, // Originator ID: 1002 (LE)
    (byte) 0xea, (byte) 0x03, // Length of source descriptor: 6 bytes (including NULL character) (LE)
    (byte) 0x06, (byte) 0x00, // Length of combined capabilities: 410 bytes (LE)
    (byte) 0x9a, (byte) 0x01, // Source descriptor: "MSTSC" ???
    (byte) 0x4d, (byte) 0x53, (byte) 0x54, (byte) 0x53, (byte) 0x43, (byte) 0x00, // Number of capabilities: 15 (LE)
    (byte) 0x0f, (byte) 0x00, (byte) 0x00, (byte) 0x00, // capability set type: CAPSTYPE_GENERAL (1) (LE)
    (byte) 0x01, // capability set type: CAPSTYPE_GENERAL (1) (LE)
    (byte) 0x00, // length of capability set: 24 bytes (LE)
    (byte) 0x18, // length of capability set: 24 bytes (LE)
    (byte) 0x00, // TS_OSMAJORTYPE_WINDOWS (1) (LE)
    (byte) 0x01, // TS_OSMAJORTYPE_WINDOWS (1) (LE)
    (byte) 0x00, // TS_OSMINORTYPE_WINDOWS_NT (3) (LE)
    (byte) 0x03, // TS_OSMINORTYPE_WINDOWS_NT (3) (LE)
    (byte) 0x00, // TS_CAPS_PROTOCOLVERSION (0x0200) (LE)
    (byte) 0x00, // TS_CAPS_PROTOCOLVERSION (0x0200) (LE)
    (byte) 0x02, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // generalCompressionTypes: 0 (LE)
    (byte) 0x00, // generalCompressionTypes: 0 (LE)
    (byte) 0x00, // Reserved2:                  (00000...........)
    (byte) 0x0d, (byte) 0x04, // updateCapabilityFlag: 0 (LE)
    (byte) 0x00, // updateCapabilityFlag: 0 (LE)
    (byte) 0x00, // remoteUnshareFlag: 0 (LE)
    (byte) 0x00, // remoteUnshareFlag: 0 (LE)
    (byte) 0x00, // generalCompressionLevel: 0 (LE)
    (byte) 0x00, // generalCompressionLevel: 0 (LE)
    (byte) 0x00, // refreshRectSupport: FALSE (0)
    (byte) 0x00, // suppressOutputSupport: FALSE (0)
    (byte) 0x00, // capability set type: CAPSTYPE_BITMAP (2) (LE)
    (byte) 0x02, // capability set type: CAPSTYPE_BITMAP (2) (LE)
    (byte) 0x00, // length of capability set: 28 bytes (LE)
    (byte) 0x1c, // length of capability set: 28 bytes (LE)
    (byte) 0x00, // preferredBitsPerPixel: 16 bpp (LE)
    (byte) 0x10, // preferredBitsPerPixel: 16 bpp (LE)
    (byte) 0x00, // receive1BitPerPixel (ignored and SHOULD be set to TRUE (0x1)): TRUE (0x1) (LE)
    (byte) 0x01, // receive1BitPerPixel (ignored and SHOULD be set to TRUE (0x1)): TRUE (0x1) (LE)
    (byte) 0x00, // receive4BitsPerPixel (ignored and SHOULD be set to TRUE (0x1)): TRUE (0x1) (LE)
    (byte) 0x01, // receive4BitsPerPixel (ignored and SHOULD be set to TRUE (0x1)): TRUE (0x1) (LE)
    (byte) 0x00, // receive8BitsPerPixel (ignored and SHOULD be set to TRUE (0x1)): TRUE (0x1) (LE)
    (byte) 0x01, // receive8BitsPerPixel (ignored and SHOULD be set to TRUE (0x1)): TRUE (0x1) (LE)
    (byte) 0x00, // desktopWidth = 1024 pixels (LE)
    (byte) 0x00, // desktopWidth = 1024 pixels (LE)
    (byte) 0x04, // desktopHeight = 768 pixels (LE)
    (byte) 0x00, // desktopHeight = 768 pixels (LE)
    (byte) 0x03, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // desktopResizeFlag: FALSE (0x0) (LE)
    (byte) 0x00, // desktopResizeFlag: FALSE (0x0) (LE)
    (byte) 0x00, // bitmapCompressionFlag (must be set to TRUE (0x1)): TRUE (0x1) (LE)
    (byte) 0x01, // bitmapCompressionFlag (must be set to TRUE (0x1)): TRUE (0x1) (LE)
    (byte) 0x00, // highColorFlags (field is ignored and SHOULD be set to zero): 0
    (byte) 0x00, // drawingFlags: 0x1 TODO: padding, why 0x1 ???
    (byte) 0x01, // multipleRectangleSupport: TRUE (LE)
    (byte) 0x01, // multipleRectangleSupport: TRUE (LE)
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // capability set type: CAPSTYPE_ORDER (3) (LE)
    (byte) 0x03, // capability set type: CAPSTYPE_ORDER (3) (LE)
    (byte) 0x00, // length of capability set: 88 bytes (LE)
    (byte) 0x58, // length of capability set: 88 bytes (LE)
    (byte) 0x00, // terminalDescriptor = "" (16 bytes, UCS2)
    (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, // pad4octetsA
    (byte) 0x00, // pad4octetsA
    (byte) 0x00, // pad4octetsA
    (byte) 0x00, // pad4octetsA
    (byte) 0x00, // desktopSaveXGranularity (ignored): 1 (LE)
    (byte) 0x01, // desktopSaveXGranularity (ignored): 1 (LE)
    (byte) 0x00, // desktopSaveYGranularity (ignored): 20 (LE)
    (byte) 0x14, // desktopSaveYGranularity (ignored): 20 (LE)
    (byte) 0x00, // pad2octetsA (ignored)
    (byte) 0x00, // pad2octetsA (ignored)
    (byte) 0x00, // maximumOrderLevel: ORD_LEVEL_1_ORDERS (1)
    (byte) 0x01, // maximumOrderLevel: ORD_LEVEL_1_ORDERS (1)
    (byte) 0x00, // number of fonts (ignored): 0
    (byte) 0x00, // number of fonts (ignored): 0
    (byte) 0x00, // orderFlags = 0x004a (LE), SOLIDPATTERNBRUSHONLY (0x40), ZEROBOUNDSDELTASSUPPORT (0x8, MUST), NEGOTIATEORDERSUPPORT (0x2, MUST)
    (byte) 0x4a, // orderFlags = 0x004a (LE), SOLIDPATTERNBRUSHONLY (0x40), ZEROBOUNDSDELTASSUPPORT (0x8, MUST), NEGOTIATEORDERSUPPORT (0x2, MUST)
    (byte) 0x00, // TS_NEG_DSTBLT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_PATBLT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_SCRBLT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_MEMBLT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_MEM3BLT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_ATEXTOUT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_AEXTTEXTOUT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_DRAWNINEGRID_INDEX: FALSE
    (byte) 0x00, // TS_NEG_LINETO_INDEX: FALSE
    (byte) 0x00, // TS_NEG_MULTI_DRAWNINEGRID_INDEX: FALSE
    (byte) 0x00, // TS_NEG_OPAQUERECT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_SAVEBITMAP_INDEX: FALSE
    (byte) 0x00, // TS_NEG_WTEXTOUT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_MEMBLT_R2_INDEX: FALSE
    (byte) 0x00, // TS_NEG_MEM3BLT_R2_INDEX: FALSE
    (byte) 0x00, // TS_NEG_MULTIDSTBLT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_MULTIPATBLT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_MULTISCRBLT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_MULTIOPAQUERECT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_FAST_INDEX_INDEX: FALSE
    (byte) 0x00, // TS_NEG_POLYGON_SC_INDEX: FALSE
    (byte) 0x00, // TS_NEG_POLYGON_CB_INDEX: FALSE
    (byte) 0x00, // TS_NEG_POLYLINE_INDEX: TRUE
    (byte) 0x00, // Unused: 0
    (byte) 0x00, // TS_NEG_FAST_GLYPH_INDEX: FALSE
    (byte) 0x00, // TS_NEG_ELLIPSE_SC_INDEX: FALSE
    (byte) 0x00, // TS_NEG_ELLIPSE_CB_INDEX: FALSE
    (byte) 0x00, // TS_NEG_INDEX_INDEX: FALSE
    (byte) 0x00, // TS_NEG_WEXTTEXTOUT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_WLONGTEXTOUT_INDEX: FALSE
    (byte) 0x00, // TS_NEG_WLONGEXTTEXTOUT_INDEX: FALSE
    (byte) 0x00, // Unused: 0
    (byte) 0x00, // Text flags (ignored): 0  (LE)
    (byte) 0x00, // Text flags (ignored): 0  (LE)
    (byte) 0x00, // Order support extra flags: 0 (LE)
    (byte) 0x00, // Order support extra flags: 0 (LE)
    (byte) 0x00, // Padding 4 bytes
    (byte) 0x00, // Padding 4 bytes
    (byte) 0x00, // Padding 4 bytes
    (byte) 0x00, // Padding 4 bytes
    (byte) 0x00, // Desktop save size (ignored): 0 (assumed to be 230400 bytes (480*480, 0x38400, LE))
    (byte) 0x00, // Desktop save size (ignored): 0 (assumed to be 230400 bytes (480*480, 0x38400, LE))
    (byte) 0x00, // Desktop save size (ignored): 0 (assumed to be 230400 bytes (480*480, 0x38400, LE))
    (byte) 0x00, // Desktop save size (ignored): 0 (assumed to be 230400 bytes (480*480, 0x38400, LE))
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // Text ANSI Code Page: 1252,  ANSI - Latin I (0x04e4, LE)
    (byte) 0xe4, // Text ANSI Code Page: 1252,  ANSI - Latin I (0x04e4, LE)
    (byte) 0x04, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // capability set type: CAPSTYPE_BITMAPCACHE_REV2 (19) (LE)
    (byte) 0x13, // capability set type: CAPSTYPE_BITMAPCACHE_REV2 (19) (LE)
    (byte) 0x00, // length of capability set: 40 bytes (LE)
    (byte) 0x28, // length of capability set: 40 bytes (LE)
    (byte) 0x00, // Cache flags: 0 (LE)
    (byte) 0x00, // Cache flags: 0 (LE)
    (byte) 0x00, // Padding 1 byte
    (byte) 0x00, // Number of cell caches: 0
    (byte) 0x00, // Bitmap cache0 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache0 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache0 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache0 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache1 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache1 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache1 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache1 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache2 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache2 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache2 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache2 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache3 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache3 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache3 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache3 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache4 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache4 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache4 cell info: 0 (LE)
    (byte) 0x00, // Bitmap cache4 cell info: 0 (LE)
    (byte) 0x00, // Padding 12 bytes
    (byte) 0x00, // Padding 12 bytes
    (byte) 0x00, // Padding 12 bytes
    (byte) 0x00, // Padding 12 bytes
    (byte) 0x00, // Padding
    (byte) 0x00, // Padding
    (byte) 0x00, // Padding
    (byte) 0x00, // Padding
    (byte) 0x00, // Padding
    (byte) 0x00, // Padding
    (byte) 0x00, // Padding
    (byte) 0x00, // Padding
    (byte) 0x00, // capability set type: CAPSTYPE_COLORCACHE (10) (LE)
    (byte) 0x0a, // capability set type: CAPSTYPE_COLORCACHE (10) (LE)
    (byte) 0x00, // length of capability set: 8 bytes (LE)
    (byte) 0x08, // length of capability set: 8 bytes (LE)
    (byte) 0x00, // Color table cache size (must be ignored during capability exchange and is assumed to be 0x0006): 6 (LE)
    (byte) 0x06, // Color table cache size (must be ignored during capability exchange and is assumed to be 0x0006): 6 (LE)
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // capability set type: CAPSTYPE_ACTIVATION (7) (LE)
    (byte) 0x07, // capability set type: CAPSTYPE_ACTIVATION (7) (LE)
    (byte) 0x00, // length of capability set: 12 bytes (LE)
    (byte) 0x0c, // length of capability set: 12 bytes (LE)
    (byte) 0x00, // helpKeyFlag (should be set to FALSE (0)): FALSE (0, LE)
    (byte) 0x00, // helpKeyFlag (should be set to FALSE (0)): FALSE (0, LE)
    (byte) 0x00, // helpKeyIndexFlag (should be set to FALSE (0)): FALSE (0, LE)
    (byte) 0x00, // helpKeyIndexFlag (should be set to FALSE (0)): FALSE (0, LE)
    (byte) 0x00, // helpExtendedKeyFlag (should be set to FALSE (0)): FALSE (0, LE)
    (byte) 0x00, // helpExtendedKeyFlag (should be set to FALSE (0)): FALSE (0, LE)
    (byte) 0x00, // windowManagerKeyFlag (should be set to FALSE (0)): FALSE (0, LE)
    (byte) 0x00, // windowManagerKeyFlag (should be set to FALSE (0)): FALSE (0, LE)
    (byte) 0x00, // capability set type: CAPSTYPE_ACTIVATION (7)
    (byte) 0x05, // capability set type: CAPSTYPE_ACTIVATION (7)
    (byte) 0x00, // length of capability set: 12 bytes (LE)
    (byte) 0x0c, // length of capability set: 12 bytes (LE)
    (byte) 0x00, // controlFlags (should be set to 0): 0 (LE)
    (byte) 0x00, // controlFlags (should be set to 0): 0 (LE)
    (byte) 0x00, // remoteDetachFlag (should be set to 0): 0 (LE)
    (byte) 0x00, // remoteDetachFlag (should be set to 0): 0 (LE)
    (byte) 0x00, // controlInterest (should be set to CONTROLPRIORITY_NEVER): CONTROLPRIORITY_NEVER (2) (LE)
    (byte) 0x02, // controlInterest (should be set to CONTROLPRIORITY_NEVER): CONTROLPRIORITY_NEVER (2) (LE)
    (byte) 0x00, // detachInterest (should be set to CONTROLPRIORITY_NEVER): CONTROLPRIORITY_NEVER (2) (LE)
    (byte) 0x02, // detachInterest (should be set to CONTROLPRIORITY_NEVER): CONTROLPRIORITY_NEVER (2) (LE)
    (byte) 0x00, // capability set type: CAPSTYPE_POINTER (8, LE)
    (byte) 0x08, // capability set type: CAPSTYPE_POINTER (8, LE)
    (byte) 0x00, // length of capability set: 10 bytes (LE)
    (byte) 0x0a, // length of capability set: 10 bytes (LE)
    (byte) 0x00, // colorPointerFlag: FALSE (LE)
    (byte) 0x00, // colorPointerFlag: FALSE (LE)
    (byte) 0x00, // colorPointerCacheSize: 0 (LE)
    (byte) 0x00, // colorPointerCacheSize: 0 (LE)
    (byte) 0x00, // pointerCacheSize: 20 (LE)
    (byte) 0x14, // pointerCacheSize: 20 (LE)
    (byte) 0x00, // capability set type: CAPSTYPE_SHARE (9, LE)
    (byte) 0x09, // capability set type: CAPSTYPE_SHARE (9, LE)
    (byte) 0x00, // length of capability set: 8 bytes (LE)
    (byte) 0x08, // length of capability set: 8 bytes (LE)
    (byte) 0x00, // nodeID (must be set to 0 by client): 0 (LE)
    (byte) 0x00, // nodeID (must be set to 0 by client): 0 (LE)
    (byte) 0x00, // Padding 2 bytes (LE)
    (byte) 0x00, // Padding 2 bytes (LE)
    (byte) 0x00, // capability set type:  CAPSTYPE_INPUT (13, LE)
    (byte) 0x0d, // capability set type:  CAPSTYPE_INPUT (13, LE)
    (byte) 0x00, // length of capability set: 88 bytes (LE)
    (byte) 0x58, // length of capability set: 88 bytes (LE)
    (byte) 0x00, // inputFlags: 0x0035  (LE),  INPUT_FLAG_FASTPATH_INPUT2 (0x20), INPUT_FLAG_VKPACKET (0x10), INPUT_FLAG_MOUSEX (0x4), INPUT_FLAG_SCANCODES (0x1)
    (byte) 0x35, // inputFlags: 0x0035  (LE),  INPUT_FLAG_FASTPATH_INPUT2 (0x20), INPUT_FLAG_VKPACKET (0x10), INPUT_FLAG_MOUSEX (0x4), INPUT_FLAG_SCANCODES (0x1)
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // keyboardLayout: "US" keyboard layout (0x000409, LE)
    (byte) 0x09, // keyboardLayout: "US" keyboard layout (0x000409, LE)
    (byte) 0x04, // keyboardLayout: "US" keyboard layout (0x000409, LE)
    (byte) 0x00, // keyboardLayout: "US" keyboard layout (0x000409, LE)
    (byte) 0x00, // keyboardType: unknown (LE)
    (byte) 0x00, // keyboardType: unknown (LE)
    (byte) 0x00, // keyboardType: unknown (LE)
    (byte) 0x00, // keyboardType: unknown (LE)
    (byte) 0x00, // keyboardSubType: unknown (LE)
    (byte) 0x00, // keyboardSubType: unknown (LE)
    (byte) 0x00, // keyboardSubType: unknown (LE)
    (byte) 0x00, // keyboardSubType: unknown (LE)
    (byte) 0x00, // keyboardFunctionKey: unknown (LE)
    (byte) 0x00, // keyboardFunctionKey: unknown (LE)
    (byte) 0x00, // keyboardFunctionKey: unknown (LE)
    (byte) 0x00, // keyboardFunctionKey: unknown (LE)
    (byte) 0x00, // imeFileName: "", (64 bytes, including trailing NULL characters, UCS2)
    (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, // capability set type: CAPSTYPE_BRUSH (15, LE)
    (byte) 0x0f, // capability set type: CAPSTYPE_BRUSH (15, LE)
    (byte) 0x00, // length of capability set: 8 bytes (LE)
    (byte) 0x08, // length of capability set: 8 bytes (LE)
    (byte) 0x00, // brushSupportLevel: BRUSH_DEFAULT (0x0, LE)
    (byte) 0x00, // brushSupportLevel: BRUSH_DEFAULT (0x0, LE)
    (byte) 0x00, // brushSupportLevel: BRUSH_DEFAULT (0x0, LE)
    (byte) 0x00, // brushSupportLevel: BRUSH_DEFAULT (0x0, LE)
    (byte) 0x00, // capability set type: CAPSTYPE_SOUND (12, LE)
    (byte) 0x0c, // capability set type: CAPSTYPE_SOUND (12, LE)
    (byte) 0x00, // length of capability set: 8 bytes (LE)
    (byte) 0x08, // length of capability set: 8 bytes (LE)
    (byte) 0x00, // soundFlags: 0x0000 (LE) // SOUND_FLAG_BEEPS (0x1)
    (byte) 0x00, // soundFlags: 0x0000 (LE) // SOUND_FLAG_BEEPS (0x1)
    (byte) 0x00, // soundFlags: 0x0000 (LE) // SOUND_FLAG_BEEPS (0x1)
    (byte) 0x00, // soundFlags: 0x0000 (LE) // SOUND_FLAG_BEEPS (0x1)
    (byte) 0x00, // Font Capability Set (8 bytes), see http://msdn.microsoft.com/en-us/library/cc240571.aspx
    (byte) 0x0e, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, // capability set type: CAPSTYPE_OFFSCREENCACHE (17, LE)
    (byte) 0x11, // capability set type: CAPSTYPE_OFFSCREENCACHE (17, LE)
    (byte) 0x00, // length of capability set: 12 bytes (LE)
    (byte) 0x0c, // length of capability set: 12 bytes (LE)
    (byte) 0x00, // offscreenSupportLevel: FALSE (LE)
    (byte) 0x00, // offscreenSupportLevel: FALSE (LE)
    (byte) 0x00, // offscreenSupportLevel: FALSE (LE)
    (byte) 0x00, // offscreenSupportLevel: FALSE (LE)
    (byte) 0x00, // offscreenCacheSize: 0 (LE)
    (byte) 0x00, // offscreenCacheSize: 0 (LE)
    (byte) 0x00, // offscreenCacheEntries: 0 (LE)
    (byte) 0x00, // offscreenCacheEntries: 0 (LE)
    (byte) 0x00, // capability set type: CAPSTYPE_OFFSCREENCACHE (16, LE)
    (byte) 0x10, // capability set type: CAPSTYPE_OFFSCREENCACHE (16, LE)
    (byte) 0x00, // length of capability set: 52 bytes (LE)
    (byte) 0x34, // length of capability set: 52 bytes (LE)
    (byte) 0x00, // CacheEntries: 254 (LE)
    (byte) 0xfe, // CacheEntries: 254 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x04, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x00, // CacheEntries: 254 (LE)
    (byte) 0xfe, // CacheEntries: 254 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x04, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x00, // CacheEntries: 254 (LE)
    (byte) 0xfe, // CacheEntries: 254 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x08, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x00, // CacheEntries: 254 (LE)
    (byte) 0xfe, // CacheEntries: 254 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x08, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x00, // CacheEntries: 254 (LE)
    (byte) 0xfe, // CacheEntries: 254 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x10, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x00, // CacheEntries: 254 (LE)
    (byte) 0xfe, // CacheEntries: 254 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x20, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x00, // CacheEntries: 254 (LE)
    (byte) 0xfe, // CacheEntries: 254 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x40, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x00, // CacheEntries: 254 (LE)
    (byte) 0xfe, // CacheEntries: 254 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x80, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x00, // CacheEntries: 254 (LE)
    (byte) 0xfe, // CacheEntries: 254 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 4 (LE)
    (byte) 0x01, // CacheEntries: 64 (LE)
    (byte) 0x40, // CacheEntries: 64 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 2048 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 2048 (LE)
    (byte) 0x08, // CacheEntries: 256 (LE)
    (byte) 0x00, // CacheEntries: 256 (LE)
    (byte) 0x01, // CacheMaximumCellSize: 256 (LE)
    (byte) 0x00, // CacheMaximumCellSize: 256 (LE)
    (byte) 0x01, // GlyphSupportLevel: GLYPH_SUPPORT_NONE (0x0, LE)
    (byte) 0x00, // GlyphSupportLevel: GLYPH_SUPPORT_NONE (0x0, LE)
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00, // Padding 2 bytes
    (byte) 0x00 };
    /* @formatter:on */
    RdpState rdpState = new RdpState();
    ScreenDescription screenDescription = new ScreenDescription();
    screenDescription.setFramebufferSize(1024, 768);
    rdpState.serverShareId = 0x000103ea;
    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {}));
    Element confirm_active = new ClientConfirmActivePDU("confirm_active", screenDescription, rdpState);
    Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(packet));
    Pipeline pipeline = new PipelineImpl("test");
    pipeline.add(source, confirm_active, sink);
    pipeline.link("source", "confirm_active", "sink");
    pipeline.runMainLoop("source", STDOUT, false, false);
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) ScreenDescription(common.ScreenDescription) Element(streamer.Element) BaseElement(streamer.BaseElement) Pipeline(streamer.Pipeline)

Example 3 with ScreenDescription

use of common.ScreenDescription in project cloudstack by apache.

the class ServerDemandActivePDU 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[] { // TS_SHARECONTROLHEADER::totalLength = 0x0167 = 359 bytes
    0x67, // TS_SHARECONTROLHEADER::totalLength = 0x0167 = 359 bytes
    0x01, // TS_SHARECONTROLHEADER::pduType = 0x0011 0x0011 = 0x0010 | 0x0001  = TS_PROTOCOL_VERSION | PDUTYPE_DEMANDACTIVEPDU
    0x11, // TS_SHARECONTROLHEADER::pduType = 0x0011 0x0011 = 0x0010 | 0x0001  = TS_PROTOCOL_VERSION | PDUTYPE_DEMANDACTIVEPDU
    0x00, // TS_SHARECONTROLHEADER::pduSource = 0x03ea (1002)
    (byte) 0xea, // TS_SHARECONTROLHEADER::pduSource = 0x03ea (1002)
    0x03, // TS_DEMAND_ACTIVE_PDU::shareId
    (byte) 0xea, // TS_DEMAND_ACTIVE_PDU::shareId
    0x03, // TS_DEMAND_ACTIVE_PDU::shareId
    0x01, // TS_DEMAND_ACTIVE_PDU::shareId
    0x00, // TS_DEMAND_ACTIVE_PDU::lengthSourceDescriptor = 4 bytes
    0x04, // TS_DEMAND_ACTIVE_PDU::lengthSourceDescriptor = 4 bytes
    0x00, // TS_DEMAND_ACTIVE_PDU::lengthCombinedCapabilities = 0x151 = 337 bytes
    0x51, // TS_DEMAND_ACTIVE_PDU::lengthCombinedCapabilities = 0x151 = 337 bytes
    0x01, // TS_DEMAND_ACTIVE_PDU::sourceDescriptor = "RDP"
    0x52, // TS_DEMAND_ACTIVE_PDU::sourceDescriptor = "RDP"
    0x44, // TS_DEMAND_ACTIVE_PDU::sourceDescriptor = "RDP"
    0x50, // TS_DEMAND_ACTIVE_PDU::sourceDescriptor = "RDP"
    0x00, // TS_DEMAND_ACTIVE_PDU::numberCapabilities = 13
    0x0d, // TS_DEMAND_ACTIVE_PDU::numberCapabilities = 13
    0x00, // TS_DEMAND_ACTIVE_PDU::pad2octets
    0x00, // TS_DEMAND_ACTIVE_PDU::pad2octets
    0x00, // TS_SHARE_CAPABILITYSET::capabilitySetType = CAPSTYPE_SHARE (9)
    0x09, // TS_SHARE_CAPABILITYSET::capabilitySetType = CAPSTYPE_SHARE (9)
    0x00, // TS_SHARE_CAPABILITYSET::lengthCapability = 8 bytes
    0x08, // TS_SHARE_CAPABILITYSET::lengthCapability = 8 bytes
    0x00, // TS_SHARE_CAPABILITYSET::nodeID = 0x03ea (1002)
    (byte) 0xea, // TS_SHARE_CAPABILITYSET::nodeID = 0x03ea (1002)
    0x03, // TS_SHARE_CAPABILITYSET::pad2octets
    (byte) 0xdc, // TS_SHARE_CAPABILITYSET::pad2octets
    (byte) 0xe2, // TS_GENERAL_CAPABILITYSET::capabilitySetType = CAPSTYPE_GENERAL (1)
    0x01, // TS_GENERAL_CAPABILITYSET::capabilitySetType = CAPSTYPE_GENERAL (1)
    0x00, // TS_GENERAL_CAPABILITYSET::lengthCapability = 24 bytes
    0x18, // TS_GENERAL_CAPABILITYSET::lengthCapability = 24 bytes
    0x00, // TS_GENERAL_CAPABILITYSET::osMajorType = TS_OSMAJORTYPE_WINDOWS (1)
    0x01, // TS_GENERAL_CAPABILITYSET::osMajorType = TS_OSMAJORTYPE_WINDOWS (1)
    0x00, // TS_GENERAL_CAPABILITYSET::osMinorType = TS_OSMINORTYPE_WINDOWS_NT (3)
    0x03, // TS_GENERAL_CAPABILITYSET::osMinorType = TS_OSMINORTYPE_WINDOWS_NT (3)
    0x00, // TS_GENERAL_CAPABILITYSET::protocolVersion = TS_CAPS_PROTOCOLVERSION (0x0200)
    0x00, // TS_GENERAL_CAPABILITYSET::protocolVersion = TS_CAPS_PROTOCOLVERSION (0x0200)
    0x02, // TS_GENERAL_CAPABILITYSET::pad2octetsA
    0x00, // TS_GENERAL_CAPABILITYSET::pad2octetsA
    0x00, // TS_GENERAL_CAPABILITYSET::generalCompressionTypes = 0
    0x00, // TS_GENERAL_CAPABILITYSET::generalCompressionTypes = 0
    0x00, // TS_GENERAL_CAPABILITYSET::extraFlags = 0x041d = 0x0400 | 0x0010 | 0x0008 | 0x0004 | 0x0001 = NO_BITMAP_COMPRESSION_HDR | ENC_SALTED_CHECKSUM | AUTORECONNECT_SUPPORTED | LONG_CREDENTIALS_SUPPORTED | FASTPATH_OUTPUT_SUPPORTED
    0x1d, // TS_GENERAL_CAPABILITYSET::extraFlags = 0x041d = 0x0400 | 0x0010 | 0x0008 | 0x0004 | 0x0001 = NO_BITMAP_COMPRESSION_HDR | ENC_SALTED_CHECKSUM | AUTORECONNECT_SUPPORTED | LONG_CREDENTIALS_SUPPORTED | FASTPATH_OUTPUT_SUPPORTED
    0x04, // TS_GENERAL_CAPABILITYSET::updateCapabilityFlag = 0
    0x00, // TS_GENERAL_CAPABILITYSET::updateCapabilityFlag = 0
    0x00, // TS_GENERAL_CAPABILITYSET::remoteUnshareFlag = 0
    0x00, // TS_GENERAL_CAPABILITYSET::remoteUnshareFlag = 0
    0x00, // TS_GENERAL_CAPABILITYSET::generalCompressionLevel = 0
    0x00, // TS_GENERAL_CAPABILITYSET::generalCompressionLevel = 0
    0x00, // TS_GENERAL_CAPABILITYSET::refreshRectSupport = TRUE
    0x01, // TS_GENERAL_CAPABILITYSET::suppressOutputSupport = TRUE
    0x01, // TS_VIRTUALCHANNEL_CAPABILITYSET::capabilitySetType = CAPSTYPE_VIRTUALCHANNEL (20)
    0x14, // TS_VIRTUALCHANNEL_CAPABILITYSET::capabilitySetType = CAPSTYPE_VIRTUALCHANNEL (20)
    0x00, // TS_VIRTUALCHANNEL_CAPABILITYSET::lengthCapability = 8 bytes
    0x08, // TS_VIRTUALCHANNEL_CAPABILITYSET::lengthCapability = 8 bytes
    0x00, // TS_VIRTUALCHANNEL_CAPABILITYSET::vccaps1 = 0x00000002 = VCCAPS_COMPR_CS_8K
    0x02, // TS_VIRTUALCHANNEL_CAPABILITYSET::vccaps1 = 0x00000002 = VCCAPS_COMPR_CS_8K
    0x00, // TS_VIRTUALCHANNEL_CAPABILITYSET::vccaps1 = 0x00000002 = VCCAPS_COMPR_CS_8K
    0x00, // TS_VIRTUALCHANNEL_CAPABILITYSET::vccaps1 = 0x00000002 = VCCAPS_COMPR_CS_8K
    0x00, // TS_DRAW_GDIPLUS_CAPABILITYSET::capabilitySetType = CAPSTYPE_DRAWGDIPLUS (22)
    0x16, // TS_DRAW_GDIPLUS_CAPABILITYSET::capabilitySetType = CAPSTYPE_DRAWGDIPLUS (22)
    0x00, // TS_DRAW_GDIPLUS_CAPABILITYSET::lengthCapability = 40 bytes
    0x28, // TS_DRAW_GDIPLUS_CAPABILITYSET::lengthCapability = 40 bytes
    0x00, // TS_DRAW_GDIPLUS_CAPABILITYSET::drawGdiplusSupportLevel = TS_DRAW_GDIPLUS_DEFAULT (0)
    0x00, // TS_DRAW_GDIPLUS_CAPABILITYSET::drawGdiplusSupportLevel = TS_DRAW_GDIPLUS_DEFAULT (0)
    0x00, // TS_DRAW_GDIPLUS_CAPABILITYSET::drawGdiplusSupportLevel = TS_DRAW_GDIPLUS_DEFAULT (0)
    0x00, // TS_DRAW_GDIPLUS_CAPABILITYSET::drawGdiplusSupportLevel = TS_DRAW_GDIPLUS_DEFAULT (0)
    0x00, // TS_DRAW_GDIPLUS_CAPABILITYSET::GdipVersion (not initialized by server)
    0x70, // TS_DRAW_GDIPLUS_CAPABILITYSET::GdipVersion (not initialized by server)
    (byte) 0xf6, // TS_DRAW_GDIPLUS_CAPABILITYSET::GdipVersion (not initialized by server)
    0x13, // TS_DRAW_GDIPLUS_CAPABILITYSET::GdipVersion (not initialized by server)
    (byte) 0xf3, // TS_DRAW_GDIPLUS_CAPABILITYSET::drawGdiplusCacheLevel  = TS_DRAW_GDIPLUS_CACHE_LEVEL_ONE (1)
    0x01, // TS_DRAW_GDIPLUS_CAPABILITYSET::drawGdiplusCacheLevel  = TS_DRAW_GDIPLUS_CACHE_LEVEL_ONE (1)
    0x00, // TS_DRAW_GDIPLUS_CAPABILITYSET::drawGdiplusCacheLevel  = TS_DRAW_GDIPLUS_CACHE_LEVEL_ONE (1)
    0x00, // TS_DRAW_GDIPLUS_CAPABILITYSET::drawGdiplusCacheLevel  = TS_DRAW_GDIPLUS_CACHE_LEVEL_ONE (1)
    0x00, // TS_GDIPLUS_CACHE_ENTRIES::GdipGraphicsCacheEntries  (not initialized by server)
    0x01, // TS_GDIPLUS_CACHE_ENTRIES::GdipGraphicsCacheEntries  (not initialized by server)
    0x00, // TS_GDIPLUS_CACHE_ENTRIES::GdipObjectBrushCacheEntries (not initialized by server)
    0x00, // TS_GDIPLUS_CACHE_ENTRIES::GdipObjectBrushCacheEntries (not initialized by server)
    0x00, // TS_GDIPLUS_CACHE_ENTRIES::GdipObjectPenCacheEntries (not initialized by server)
    0x18, // TS_GDIPLUS_CACHE_ENTRIES::GdipObjectPenCacheEntries (not initialized by server)
    0x00, // TS_GDIPLUS_CACHE_ENTRIES::GdipObjectImageCacheEntries (not initialized by server)
    0x00, // TS_GDIPLUS_CACHE_ENTRIES::GdipObjectImageCacheEntries (not initialized by server)
    0x00, // TS_GDIPLUS_CACHE_ENTRIES::GdipObjectImageAttributesCacheEntries (not initialized by server)
    (byte) 0x9c, // TS_GDIPLUS_CACHE_ENTRIES::GdipObjectImageAttributesCacheEntries (not initialized by server)
    (byte) 0xf6, // TS_GDIPLUS_CACHE_CHUNK_SIZE::GdipGraphicsCacheChunkSize  (not initialized by server)
    0x13, // TS_GDIPLUS_CACHE_CHUNK_SIZE::GdipGraphicsCacheChunkSize  (not initialized by server)
    (byte) 0xf3, // TS_GDIPLUS_CACHE_CHUNK_SIZE::GdipObjectBrushCacheChunkSize (not initialized by server)
    0x61, // TS_GDIPLUS_CACHE_CHUNK_SIZE::GdipObjectBrushCacheChunkSize (not initialized by server)
    (byte) 0xa6, // TS_GDIPLUS_CACHE_CHUNK_SIZE::GdipObjectPenCacheChunkSize (not initialized by server)
    (byte) 0x82, // TS_GDIPLUS_CACHE_CHUNK_SIZE::GdipObjectPenCacheChunkSize (not initialized by server)
    (byte) 0x80, // TS_GDIPLUS_CACHE_CHUNK_SIZE::GdipObjectImageAttributesCacheChunkSize (not initialized by server)
    0x00, // TS_GDIPLUS_CACHE_CHUNK_SIZE::GdipObjectImageAttributesCacheChunkSize (not initialized by server)
    0x00, // TS_GDIPLUS_IMAGE_CACHE_PROPERTIES::GdipObjectImageCacheChunkSize  (not initialized by server)
    0x00, // TS_GDIPLUS_IMAGE_CACHE_PROPERTIES::GdipObjectImageCacheChunkSize  (not initialized by server)
    0x00, // TS_GDIPLUS_IMAGE_CACHE_PROPERTIES::GdipObjectImageCacheTotalSize  (not initialized by server)
    0x00, // TS_GDIPLUS_IMAGE_CACHE_PROPERTIES::GdipObjectImageCacheTotalSize  (not initialized by server)
    0x50, // TS_GDIPLUS_IMAGE_CACHE_PROPERTIES::GdipObjectImageCacheMaxSize (not initialized by server)
    (byte) 0x91, // TS_GDIPLUS_IMAGE_CACHE_PROPERTIES::GdipObjectImageCacheMaxSize (not initialized by server)
    (byte) 0xbf, // TS_FONT_CAPABILITYSET::capabilitySetType = CAPSTYPE_FONT (14)
    0x0e, // TS_FONT_CAPABILITYSET::capabilitySetType = CAPSTYPE_FONT (14)
    0x00, // TS_FONT_CAPABILITYSET::lengthCapability = 4 bytes
    0x04, // TS_FONT_CAPABILITYSET::lengthCapability = 4 bytes
    0x00, // TS_BITMAP_CAPABILITYSET::capabilitySetType = CAPSTYPE_BITMAP (2)
    0x02, // TS_BITMAP_CAPABILITYSET::capabilitySetType = CAPSTYPE_BITMAP (2)
    0x00, // TS_BITMAP_CAPABILITYSET::lengthCapability = 28 bytes
    0x1c, // TS_BITMAP_CAPABILITYSET::lengthCapability = 28 bytes
    0x00, // TS_BITMAP_CAPABILITYSET::preferredBitsPerPixel = 24 bpp
    0x18, // TS_BITMAP_CAPABILITYSET::preferredBitsPerPixel = 24 bpp
    0x00, // TS_BITMAP_CAPABILITYSET::receive1BitPerPixel = TRUE
    0x01, // TS_BITMAP_CAPABILITYSET::receive1BitPerPixel = TRUE
    0x00, // TS_BITMAP_CAPABILITYSET::receive4BitsPerPixel = TRUE
    0x01, // TS_BITMAP_CAPABILITYSET::receive4BitsPerPixel = TRUE
    0x00, // TS_BITMAP_CAPABILITYSET::receive8BitsPerPixel = TRUE
    0x01, // TS_BITMAP_CAPABILITYSET::receive8BitsPerPixel = TRUE
    0x00, // TS_BITMAP_CAPABILITYSET::desktopWidth = 1280 pixels
    0x00, // TS_BITMAP_CAPABILITYSET::desktopWidth = 1280 pixels
    0x05, // TS_BITMAP_CAPABILITYSET::desktopHeight = 1024 pixels
    0x00, // TS_BITMAP_CAPABILITYSET::desktopHeight = 1024 pixels
    0x04, // TS_BITMAP_CAPABILITYSET::pad2octets
    0x00, // TS_BITMAP_CAPABILITYSET::pad2octets
    0x00, // TS_BITMAP_CAPABILITYSET::desktopResizeFlag = TRUE
    0x01, // TS_BITMAP_CAPABILITYSET::desktopResizeFlag = TRUE
    0x00, // TS_BITMAP_CAPABILITYSET::bitmapCompressionFlag = TRUE
    0x01, // TS_BITMAP_CAPABILITYSET::bitmapCompressionFlag = TRUE
    0x00, // TS_BITMAP_CAPABILITYSET::highColorFlags = 0
    0x00, // TS_BITMAP_CAPABILITYSET::pad1octet
    0x00, // TS_BITMAP_CAPABILITYSET::multipleRectangleSupport = TRUE
    0x01, // TS_BITMAP_CAPABILITYSET::multipleRectangleSupport = TRUE
    0x00, // TS_BITMAP_CAPABILITYSET::pad2octetsB
    0x00, // TS_BITMAP_CAPABILITYSET::pad2octetsB
    0x00, // TS_ORDER_CAPABILITYSET::capabilitySetType = CAPSTYPE_ORDER (3)
    0x03, // TS_ORDER_CAPABILITYSET::capabilitySetType = CAPSTYPE_ORDER (3)
    0x00, // TS_ORDER_CAPABILITYSET::lengthCapability = 88 bytes
    0x58, // TS_ORDER_CAPABILITYSET::lengthCapability = 88 bytes
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::terminalDescriptor = ""
    0x00, // TS_ORDER_CAPABILITYSET::pad4octetsA
    0x40, // TS_ORDER_CAPABILITYSET::pad4octetsA
    0x42, // TS_ORDER_CAPABILITYSET::pad4octetsA
    0x0f, // TS_ORDER_CAPABILITYSET::pad4octetsA
    0x00, // TS_ORDER_CAPABILITYSET::desktopSaveXGranularity = 1
    0x01, // TS_ORDER_CAPABILITYSET::desktopSaveXGranularity = 1
    0x00, // TS_ORDER_CAPABILITYSET::desktopSaveYGranularity = 20
    0x14, // TS_ORDER_CAPABILITYSET::desktopSaveYGranularity = 20
    0x00, // TS_ORDER_CAPABILITYSET::pad2octetsA
    0x00, // TS_ORDER_CAPABILITYSET::pad2octetsA
    0x00, // TS_ORDER_CAPABILITYSET::maximumOrderLevel = ORD_LEVEL_1_ORDERS (1)
    0x01, // TS_ORDER_CAPABILITYSET::maximumOrderLevel = ORD_LEVEL_1_ORDERS (1)
    0x00, // TS_ORDER_CAPABILITYSET::numberFonts = 0
    0x00, // TS_ORDER_CAPABILITYSET::numberFonts = 0
    0x00, // TS_ORDER_CAPABILITYSET::orderFlags = 0x0022 = 0x0020 | 0x0002 = COLORINDEXSUPPORT | NEGOTIATEORDERSUPPORT
    0x22, // TS_ORDER_CAPABILITYSET::orderFlags = 0x0022 = 0x0020 | 0x0002 = COLORINDEXSUPPORT | NEGOTIATEORDERSUPPORT
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_DSTBLT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_PATBLT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_SCRBLT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_MEMBLT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_MEM3BLT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_ATEXTOUT_INDEX] = FALSE
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_AEXTTEXTOUT_INDEX] = FALSE
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_DRAWNINEGRID_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_LINETO_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_MULTI_DRAWNINEGRID_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_OPAQUERECT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_SAVEBITMAP_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_WTEXTOUT_INDEX] = FALSE
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_MEMBLT_R2_INDEX] = FALSE
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_MEM3BLT_R2_INDEX] = FALSE
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_MULTIDSTBLT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_MULTIPATBLT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_MULTISCRBLT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_MULTIOPAQUERECT_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_FAST_INDEX_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_POLYGON_SC_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_POLYGON_CB_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_POLYLINE_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[23] = 0
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_FAST_GLYPH_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_ELLIPSE_SC_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_ELLIPSE_CB_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_INDEX_INDEX] = TRUE
    0x01, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_WEXTTEXTOUT_INDEX] = FALSE
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_WLONGTEXTOUT_INDEX] = FALSE
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[TS_NEG_WLONGEXTTEXTOUT_INDEX] = FALSE
    0x00, // TS_ORDER_CAPABILITYSET::orderSupport[24] = 0
    0x00, // TS_ORDER_CAPABILITYSET::textFlags = 0x06a1
    (byte) 0xa1, // TS_ORDER_CAPABILITYSET::textFlags = 0x06a1
    0x06, // TS_ORDER_CAPABILITYSET::pad2octetsB
    0x00, // TS_ORDER_CAPABILITYSET::pad2octetsB
    0x00, // TS_ORDER_CAPABILITYSET::pad4octetsB
    0x40, // TS_ORDER_CAPABILITYSET::pad4octetsB
    0x42, // TS_ORDER_CAPABILITYSET::pad4octetsB
    0x0f, // TS_ORDER_CAPABILITYSET::pad4octetsB
    0x00, // TS_ORDER_CAPABILITYSET::desktopSaveSize = 0xf4240 = 1000000
    0x40, // TS_ORDER_CAPABILITYSET::desktopSaveSize = 0xf4240 = 1000000
    0x42, // TS_ORDER_CAPABILITYSET::desktopSaveSize = 0xf4240 = 1000000
    0x0f, // TS_ORDER_CAPABILITYSET::desktopSaveSize = 0xf4240 = 1000000
    0x00, // TS_ORDER_CAPABILITYSET::pad2octetsC
    0x01, // TS_ORDER_CAPABILITYSET::pad2octetsC
    0x00, // TS_ORDER_CAPABILITYSET::pad2octetsD
    0x00, // TS_ORDER_CAPABILITYSET::pad2octetsD
    0x00, // TS_ORDER_CAPABILITYSET::textANSICodePage
    0x00, // TS_ORDER_CAPABILITYSET::textANSICodePage
    0x00, // TS_ORDER_CAPABILITYSET::pad2octetsE
    0x00, // TS_ORDER_CAPABILITYSET::pad2octetsE
    0x00, // TS_COLORTABLECACHE_CAPABILITYSET::capabilitySetType = CAPSTYPE_COLORCACHE (10)
    0x0a, // TS_COLORTABLECACHE_CAPABILITYSET::capabilitySetType = CAPSTYPE_COLORCACHE (10)
    0x00, // TS_COLORTABLECACHE_CAPABILITYSET::lengthCapability = 8 bytes
    0x08, // TS_COLORTABLECACHE_CAPABILITYSET::lengthCapability = 8 bytes
    0x00, // TS_COLORTABLECACHE_CAPABILITYSET::colorTableCacheSize = 6
    0x06, // TS_COLORTABLECACHE_CAPABILITYSET::colorTableCacheSize = 6
    0x00, // TS_COLORTABLECACHE_CAPABILITYSET::pad2octets
    0x00, // TS_COLORTABLECACHE_CAPABILITYSET::pad2octets
    0x00, // TS_BITMAPCACHE_CAPABILITYSET_HOSTSUPPORT::capabilitySetType  = CAPSTYPE_BITMAPCACHE_HOSTSUPPORT (18)
    0x12, // TS_BITMAPCACHE_CAPABILITYSET_HOSTSUPPORT::capabilitySetType  = CAPSTYPE_BITMAPCACHE_HOSTSUPPORT (18)
    0x00, // TS_BITMAPCACHE_CAPABILITYSET_HOSTSUPPORT::lengthCapability  = 8 bytes
    0x08, // TS_BITMAPCACHE_CAPABILITYSET_HOSTSUPPORT::lengthCapability  = 8 bytes
    0x00, // TS_BITMAPCACHE_CAPABILITYSET_HOSTSUPPORT::CacheVersion = 1  (corresponds to rev. 2 capabilities)
    0x01, // TS_BITMAPCACHE_CAPABILITYSET_HOSTSUPPORT::Pad1
    0x00, // TS_BITMAPCACHE_CAPABILITYSET_HOSTSUPPORT::Pad2
    0x00, // TS_BITMAPCACHE_CAPABILITYSET_HOSTSUPPORT::Pad2
    0x00, // TS_POINTER_CAPABILITYSET::capabilitySetType = CAPSTYPE_POINTER (8)
    0x08, // TS_POINTER_CAPABILITYSET::capabilitySetType = CAPSTYPE_POINTER (8)
    0x00, // TS_POINTER_CAPABILITYSET::lengthCapability = 10 bytes
    0x0a, // TS_POINTER_CAPABILITYSET::lengthCapability = 10 bytes
    0x00, // TS_POINTER_CAPABILITYSET::colorPointerFlag = TRUE
    0x01, // TS_POINTER_CAPABILITYSET::colorPointerFlag = TRUE
    0x00, // TS_POINTER_CAPABILITYSET::colorPointerCacheSize = 25
    0x19, // TS_POINTER_CAPABILITYSET::colorPointerCacheSize = 25
    0x00, // TS_POINTER_CAPABILITYSET::pointerCacheSize = 25
    0x19, // TS_POINTER_CAPABILITYSET::pointerCacheSize = 25
    0x00, // TS_INPUT_CAPABILITYSET::capabilitySetType = CAPSTYPE_INPUT (13)
    0x0d, // TS_INPUT_CAPABILITYSET::capabilitySetType = CAPSTYPE_INPUT (13)
    0x00, // TS_INPUT_CAPABILITYSET::lengthCapability = 88 bytes
    0x58, // TS_INPUT_CAPABILITYSET::lengthCapability = 88 bytes
    0x00, // TS_INPUT_CAPABILITYSET::inputFlags = 0x0035 = 0x0020 | 0x0010 | 0x0004 | 0x0001 = INPUT_FLAG_FASTPATH_INPUT2 | INPUT_FLAG_VKPACKET | INPUT_FLAG_MOUSEX | INPUT_FLAG_SCANCODES
    0x35, // TS_INPUT_CAPABILITYSET::inputFlags = 0x0035 = 0x0020 | 0x0010 | 0x0004 | 0x0001 = INPUT_FLAG_FASTPATH_INPUT2 | INPUT_FLAG_VKPACKET | INPUT_FLAG_MOUSEX | INPUT_FLAG_SCANCODES
    0x00, // TS_INPUT_CAPABILITYSET::pad2octetsA
    0x00, // TS_INPUT_CAPABILITYSET::pad2octetsA
    0x00, // TS_INPUT_CAPABILITYSET::keyboardLayout (not initialized by server)
    (byte) 0xa1, // TS_INPUT_CAPABILITYSET::keyboardLayout (not initialized by server)
    0x06, // TS_INPUT_CAPABILITYSET::keyboardLayout (not initialized by server)
    0x00, // TS_INPUT_CAPABILITYSET::keyboardLayout (not initialized by server)
    0x00, // TS_INPUT_CAPABILITYSET::keyboardType (not initialized by server)
    0x40, // TS_INPUT_CAPABILITYSET::keyboardType (not initialized by server)
    0x42, // TS_INPUT_CAPABILITYSET::keyboardType (not initialized by server)
    0x0f, // TS_INPUT_CAPABILITYSET::keyboardType (not initialized by server)
    0x00, // TS_INPUT_CAPABILITYSET::keyboardSubType  (not initialized by server)
    0x0c, // TS_INPUT_CAPABILITYSET::keyboardSubType  (not initialized by server)
    (byte) 0xf6, // TS_INPUT_CAPABILITYSET::keyboardSubType  (not initialized by server)
    0x13, // TS_INPUT_CAPABILITYSET::keyboardSubType  (not initialized by server)
    (byte) 0xf3, // TS_INPUT_CAPABILITYSET::keyboardFunctionKey (not initialized by server)
    (byte) 0x93, // TS_INPUT_CAPABILITYSET::keyboardFunctionKey (not initialized by server)
    0x5a, // TS_INPUT_CAPABILITYSET::keyboardFunctionKey (not initialized by server)
    0x37, // TS_INPUT_CAPABILITYSET::keyboardFunctionKey (not initialized by server)
    (byte) 0xf3, // TS_INPUT_CAPABILITYSET::imeFileName (not initialized by server)
    0x00, (byte) 0x90, 0x30, (byte) 0xe1, 0x34, 0x1c, 0x38, (byte) 0xf3, 0x40, (byte) 0xf6, 0x13, (byte) 0xf3, 0x04, 0x00, 0x00, 0x00, 0x4c, 0x54, (byte) 0xdc, (byte) 0xe2, 0x08, 0x50, (byte) 0xdc, (byte) 0xe2, 0x01, 0x00, 0x00, 0x00, 0x08, 0x50, (byte) 0xdc, (byte) 0xe2, 0x00, 0x00, 0x00, 0x00, 0x38, (byte) 0xf6, 0x13, (byte) 0xf3, 0x2e, 0x05, 0x38, (byte) 0xf3, 0x08, 0x50, (byte) 0xdc, (byte) 0xe2, 0x2c, (byte) 0xf6, 0x13, (byte) 0xf3, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x19, 0x00, // TS_RAIL_CAPABILITYSET::capabilitySetType = CAPSTYPE_RAIL (23)
    0x17, // TS_RAIL_CAPABILITYSET::capabilitySetType = CAPSTYPE_RAIL (23)
    0x00, // TS_RAIL_CAPABILITYSET::lengthCapability = 8 bytes
    0x08, // TS_RAIL_CAPABILITYSET::lengthCapability = 8 bytes
    0x00, // TS_RAIL_CAPABILITYSET::railSupportLevel = TS_RAIL_LEVEL_DEFAULT (0)
    0x00, // TS_RAIL_CAPABILITYSET::railSupportLevel = TS_RAIL_LEVEL_DEFAULT (0)
    0x00, // TS_RAIL_CAPABILITYSET::railSupportLevel = TS_RAIL_LEVEL_DEFAULT (0)
    0x00, // TS_RAIL_CAPABILITYSET::railSupportLevel = TS_RAIL_LEVEL_DEFAULT (0)
    0x00, // TS_WINDOW_CAPABILITYSET::capabilitySetType =  CAPSTYPE_WINDOW (24)
    0x18, // TS_WINDOW_CAPABILITYSET::capabilitySetType =  CAPSTYPE_WINDOW (24)
    0x00, // TS_WINDOW_CAPABILITYSET::lengthCapability = 11 bytes
    0x0b, // TS_WINDOW_CAPABILITYSET::lengthCapability = 11 bytes
    0x00, // TS_WINDOW_CAPABILITYSET::wndSupportLevel = TS_WINDOW_LEVEL_DEFAULT (0)
    0x00, // TS_WINDOW_CAPABILITYSET::wndSupportLevel = TS_WINDOW_LEVEL_DEFAULT (0)
    0x00, // TS_WINDOW_CAPABILITYSET::wndSupportLevel = TS_WINDOW_LEVEL_DEFAULT (0)
    0x00, // TS_WINDOW_CAPABILITYSET::wndSupportLevel = TS_WINDOW_LEVEL_DEFAULT (0)
    0x00, // TS_WINDOW_CAPABILITYSET::nIconCaches = 0
    0x00, // TS_WINDOW_CAPABILITYSET::nIconCacheEntries = 0
    0x00, // TS_WINDOW_CAPABILITYSET::nIconCacheEntries = 0
    0x00, // TS_DEMAND_ACTIVE_PDU::sessionId = 0
    0x00, // TS_DEMAND_ACTIVE_PDU::sessionId = 0
    0x00, // TS_DEMAND_ACTIVE_PDU::sessionId = 0
    0x00, // TS_DEMAND_ACTIVE_PDU::sessionId = 0
    0x00 };
    /* @formatter:on */
    RdpState rdpState = new RdpState();
    ScreenDescription screenDescription = new ScreenDescription();
    MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
    Element demandActive = new ServerDemandActivePDU("demand_active", screenDescription, rdpState);
    Element sink = new FakeSink("sink");
    Pipeline pipeline = new PipelineImpl("test");
    pipeline.add(source, demandActive, sink);
    pipeline.link("source", "demand_active", "sink");
    pipeline.runMainLoop("source", STDOUT, false, false);
}
Also used : MockSource(streamer.debug.MockSource) FakeSink(streamer.debug.FakeSink) PipelineImpl(streamer.PipelineImpl) ScreenDescription(common.ScreenDescription) Element(streamer.Element) BaseElement(streamer.BaseElement) Pipeline(streamer.Pipeline)

Example 4 with ScreenDescription

use of common.ScreenDescription in project cloudstack by apache.

the class VncInitializer 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");
    final String desktopName = "test";
    Element source = new MockSource("source") {

        {
            bufs = ByteBuffer.convertByteArraysToByteBuffers(// Send screen description
            new byte[] { // Framebuffer width (short)
            0, (byte) 200, // Framebuffer height (short)
            0, 100, // Bits per pixel
            32, // Depth,
            24, // Endianness flag
            RfbConstants.LITTLE_ENDIAN, // Truecolor flag
            RfbConstants.TRUE_COLOR, // Red max (short)
            0, (byte) 255, // Green max (short)
            0, (byte) 255, // Blue max (short)
            0, (byte) 255, // Red shift
            16, // Green shift
            8, // Blue shift
            0, // Padding
            0, 0, 0, // Desktop name length (int)
            0, 0, 0, 4, // Desktop name ("test", 4 bytes)
            't', 'e', 's', 't', // Tail
            1, 2, 3 }, // Tail packet
            new byte[] { 4, 5, 6 });
        }
    };
    ScreenDescription screen = new ScreenDescription();
    final VncInitializer init = new VncInitializer("init", true, screen);
    Element initSink = new MockSink("initSink") {

        {
            // Expect shared flag
            bufs = ByteBuffer.convertByteArraysToByteBuffers(new byte[] { RfbConstants.SHARED_ACCESS });
        }
    };
    Element mainSink = new MockSink("mainSink") {

        {
            // Expect two tail packets
            bufs = ByteBuffer.convertByteArraysToByteBuffers(new byte[] { 1, 2, 3 }, new byte[] { 4, 5, 6 });
        }
    };
    ByteBuffer[] emptyBuf = ByteBuffer.convertByteArraysToByteBuffers(new byte[] {});
    Element encodingsSink = new MockSink("encodings", emptyBuf);
    Element pixelFormatSink = new MockSink("pixel_format", emptyBuf);
    Pipeline pipeline = new PipelineImpl("test");
    pipeline.addAndLink(source, init, mainSink);
    pipeline.add(encodingsSink, pixelFormatSink, initSink);
    pipeline.link("init >otout", "initSink");
    pipeline.link("init >" + CLIENT_SUPPORTED_ENCODINGS_ADAPTER_PAD, "encodings");
    pipeline.link("init >" + CLIENT_PIXEL_FORMAT_ADAPTER_PAD, "pixel_format");
    pipeline.runMainLoop("source", STDOUT, false, false);
    if (!screen.isRGB888_32_LE())
        System.err.println("Screen description was read incorrectly: " + screen + ".");
    if (!desktopName.equals(screen.getDesktopName()))
        System.err.println("Screen desktop name was read incorrectly: \"" + screen.getDesktopName() + "\".");
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) Element(streamer.Element) ScreenDescription(common.ScreenDescription) ByteBuffer(streamer.ByteBuffer) Pipeline(streamer.Pipeline)

Example 5 with ScreenDescription

use of common.ScreenDescription in project cloudstack by apache.

the class FrameBufferUpdateRequest method main.

public static void main(String[] args) {
    System.setProperty("streamer.Element.debug", "true");
    ScreenDescription screen = new ScreenDescription();
    screen.setFramebufferSize(120, 80);
    Element adapter = new FrameBufferUpdateRequest("renderer", screen);
    Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] { // Request
    RfbConstants.CLIENT_FRAMEBUFFER_UPDATE_REQUEST, // Full update (redraw area)
    RfbConstants.FRAMEBUFFER_FULL_UPDATE_REQUEST, // X
    0, 1, // Y
    0, 2, // Width
    0, 3, // Height
    0, 4 }));
    ByteBuffer buf = new ByteBuffer(new byte[0]);
    buf.putMetadata(TARGET_X, 1);
    buf.putMetadata(TARGET_Y, 2);
    buf.putMetadata(WIDTH, 3);
    buf.putMetadata(HEIGHT, 4);
    Element source = new MockSource("source", new ByteBuffer[] { buf });
    Pipeline pipeline = new PipelineImpl("test");
    pipeline.addAndLink(source, adapter, sink);
    pipeline.runMainLoop("source", STDOUT, false, false);
}
Also used : MockSource(streamer.debug.MockSource) MockSink(streamer.debug.MockSink) PipelineImpl(streamer.PipelineImpl) ScreenDescription(common.ScreenDescription) Element(streamer.Element) BaseElement(streamer.BaseElement) ByteBuffer(streamer.ByteBuffer) Pipeline(streamer.Pipeline)

Aggregations

ScreenDescription (common.ScreenDescription)6 Pipeline (streamer.Pipeline)6 PipelineImpl (streamer.PipelineImpl)6 Element (streamer.Element)5 MockSource (streamer.debug.MockSource)5 BaseElement (streamer.BaseElement)4 MockSink (streamer.debug.MockSink)4 ByteBuffer (streamer.ByteBuffer)3 RdpBufferedImageCanvas (com.cloud.consoleproxy.rdp.RdpBufferedImageCanvas)1 SizeChangeListener (common.SizeChangeListener)1 InetSocketAddress (java.net.InetSocketAddress)1 RdpClient (rdpclient.RdpClient)1 AprSocketWrapperImpl (streamer.apr.AprSocketWrapperImpl)1 FakeSink (streamer.debug.FakeSink)1 SSLState (streamer.ssl.SSLState)1