Package streamer

Examples of streamer.ByteBuffer


        sendOtherRequredPackets();

    }

    private ByteBuffer createMCSHeader(ByteBuffer buf) {
        ByteBuffer header = new ByteBuffer(100);
        // MCS Send Data Request
        header.writeByte(0x64);

        // Initiator: 1004 (1001+3)
        header.writeShort(3);

        // Channel ID: 1003 (I/O channel)
        header.writeShort(RdpConstants.CHANNEL_IO);

        // Data priority: high (0x40), segmentation: begin (0x20) | end (0x10)
        header.writeByte(0x70);

        int length = buf.length + 26;

        // User data length: (variable length field, LE)
        header.writeVariableShort(length);

        // Total length: (LE)
        header.writeShortLE(length);

        // PDU type: Confirm Active PDU (0x3), TS_PROTOCOL_VERSION (0x10) (LE)
        header.writeShortLE(0x13);

        // PDU source: 1004 (LE)
        header.writeShortLE(1004);

        // Share ID, e.g. 0x000103ea (LE)
        header.writeIntLE((int)state.serverShareId);

        // Originator ID: 1002 (LE)
        header.writeShortLE(1002);
        return header;
    }
View Full Code Here


    }

    private void sendFontListPDU() {
        {
            int length = 1024; // Large enough
            ByteBuffer buf = new ByteBuffer(length, true);

            /* @formatter:off */
            buf.writeBytes(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: 26 bytes (0x1a, variable length field)
                    (byte)0x80, (byte)0x1a,

                    // Total length: 26 bytes (0x1a, LE)
                    (byte)0x1a, (byte)0x00,
                    // PDU type: PDUTYPE_DATAPDU (0x7), PDU version: 1 (0x0010) (LE)
                    (byte)0x17, (byte)0x00,
                    // PDU source: 1004 (LE)
                    (byte)0xec, (byte)0x03,
            });
            // Share ID, 4 bytes  (LE)
            buf.writeIntLE((int)state.serverShareId);

            buf.writeBytes(new byte[] {
                    // Padding 1 byte
                    (byte)0x00,
                    // Stream ID: STREAM_LOW (1)
                    (byte)0x01,
                    // uncompressedLength : 12 bytes (LE)
                    (byte)0x0c, (byte)0x00,

                    // pduType2: PDUTYPE2_FONTLIST (39)
                    (byte)0x27,
                    // generalCompressedType: 0
                    (byte)0x00,
                    // generalCompressedLength: 0 (LE)
                    (byte)0x00, (byte)0x00,

                    // numberEntries (should be set to zero): 0 (LE)
                    (byte)0x00, (byte)0x00,
                    // totalNumEntries (should be set to zero): 0 (LE)
                    (byte)0x00, (byte)0x00,
                    // listFlags  (should be set to 0x3): 0x0003 (LE), FONTLIST_LAST(0x2) | FONTLIST_FIRST(0x1)
                    (byte)0x03, (byte)0x00,
                    // entrySize: 50 bytes (0x0032, LE)
                    (byte)0x32, (byte)0x00,
            });
            /* @formatter:on */

            // Trim buffer to actual length of data written
            buf.trimAtCursor();

            pushDataToPad(STDOUT, buf);
        }
    }
View Full Code Here

        }
    }

    private void sendControlPDUActionRequestControl() {
        int length = 1024; // Large enough
        ByteBuffer buf = new ByteBuffer(length, true);

        /* @formatter:off */
        buf.writeBytes(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: 26 bytes (0x1a, variable length field)
                (byte)0x80, (byte)0x1a,

                // Total length: 26 bytes (0x1a, LE)
                (byte)0x1a, (byte)0x00,
                // PDU type: PDUTYPE_DATAPDU (0x7), PDU version: 1 (0x0010) (LE)
                (byte)0x17, (byte)0x00,
                // PDU source: 1004 (LE)
                (byte)0xec, (byte)0x03,
        });
        // Share ID, 4 bytes  (LE)
        buf.writeIntLE((int)state.serverShareId);

        buf.writeBytes(new byte[] {
                // Padding 1 byte
                (byte)0x00,
                // Stream ID: STREAM_LOW (1)
                (byte)0x01,
                // uncompressedLength : 12 bytes (LE)
                (byte)0x0c, (byte)0x00,
                // pduType2: PDUTYPE2_CONTROL (20)
                (byte)0x14,
                // generalCompressedType: 0
                (byte)0x00,
                // generalCompressedLength: 0 (LE)
                (byte)0x00, (byte)0x00,

                // action: CTRLACTION_REQUEST_CONTROL (1) (LE)
                (byte)0x01, (byte)0x00,
                // grantId: 0 (LE)
                (byte)0x00, (byte)0x00,
                // controlId: 0 (LE)
                (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
        });
        /* @formatter:on */

        // Trim buffer to actual length of data written
        buf.trimAtCursor();

        pushDataToPad(STDOUT, buf);
    }
View Full Code Here

        pushDataToPad(STDOUT, buf);
    }

    private void sendControlPDUActionCooperate() {
        int length = 1024; // Large enough
        ByteBuffer buf = new ByteBuffer(length, true);

        /* @formatter:off */
        buf.writeBytes(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: 26 bytes (0x1a, variable length field)
                (byte)0x80, (byte)0x1a,

                // Total length: 26 bytes (0x1a, LE)
                (byte)0x1a,(byte)0x00,
                // PDU type: PDUTYPE_DATAPDU (0x7), PDU version: 1 (0x0010) (LE)
                (byte)0x17, (byte)0x00,
                // PDU source: 1004 (LE)
                (byte)0xec, (byte)0x03,
        });
        // Share ID, 4 bytes  (LE)
        buf.writeIntLE((int)state.serverShareId);

        buf.writeBytes(new byte[] {
                // Padding 1 byte
                (byte)0x00,
                // Stream ID: STREAM_LOW (1)
                (byte)0x01,
                // uncompressedLength : 12 bytes (LE)
                (byte)0x0c, (byte)0x00,
                // pduType2: PDUTYPE2_CONTROL (20)
                (byte)0x14,
                // generalCompressedType: 0
                (byte)0x00,
                // generalCompressedLength: 0 (LE?)
                (byte)0x00, (byte)0x00,
                // action: CTRLACTION_COOPERATE (4) (LE)
                (byte)0x04, (byte)0x00,
                // grantId: 0 (LE)
                (byte)0x00, (byte)0x00,
                // controlId: 0
                (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
        });
        /* @formatter:on */

        buf.trimAtCursor();

        pushDataToPad(STDOUT, buf);
    }
View Full Code Here

        pushDataToPad(STDOUT, buf);
    }

    private void sendSynchronizePDU() {

        ByteBuffer buf = new ByteBuffer(1024, true);
        /* @formatter:off */
        buf.writeBytes(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,
                // Data length:  22 bytes (0x16, variable length field)
                (byte)0x80(byte)0x16,

                // RDP: total length: 22 bytes (LE)
                (byte)0x16, (byte)0x00,

                // PDU type: PDUTYPE_DATAPDU (0x7), TS_PROTOCOL_VERSION (0x10) (LE)
                (byte)0x17, (byte)0x00,

                // PDU source: 1007 (LE)
                (byte)0xec, (byte)0x03,
        });
        // Share ID, 4 bytes  (LE)
        buf.writeIntLE((int)state.serverShareId);

        buf.writeBytes(new byte[] {
                // Padding: 1 byte
                (byte)0x00,
                // Stream ID: STREAM_LOW (1)
                (byte)0x01,
                // uncompressedLength : 8 bytes (LE)
                (byte)0x08, (byte)0x00,
                // pduType2 = PDUTYPE2_SYNCHRONIZE (31)
                (byte)0x1f,
                // generalCompressedType: 0
                (byte)0x00,
                // generalCompressedLength: 0 (LE?)
                (byte)0x00, (byte)0x00,
                //  messageType: SYNCMSGTYPE_SYNC (1) (LE)
                (byte)0x01, (byte)0x00,
                // targetUser: 0x03ea
                (byte)0xea, (byte)0x03,
        });
        /* @formatter:on */
        buf.trimAtCursor();
        pushDataToPad(STDOUT, buf);
    }
View Full Code Here

            if ((flags & 0x30) != 0x30)
                throw new RuntimeException("Fragmented MCS packets are not supported.");

            int payloadLength = buf.readVariableUnsignedShort();

            ByteBuffer data = buf.readBytes(payloadLength);

            buf.unref();

            pushDataToPad("channel_" + channelId, data);
            break;
View Full Code Here

            System.out.println("[" + this + "] INFO: Data received: " + buf + ".");

        if (buf.length + 4 > 65535)
            throw new RuntimeException("Packet is too long for TPKT (max length 65535-4): " + buf + ".");

        ByteBuffer data = new ByteBuffer(4);
        // TPKT version
        data.writeByte(3);
        // Reserved
        data.writeByte(0);
        // Packet length, including length of the header
        data.writeShort(buf.length + 4);

        buf.prepend(data);
        data.unref();

        pushDataToPad(STDOUT, buf);
    }
View Full Code Here

            return;

        if (verbose)
            System.out.println("[" + this + "] INFO: Data received: " + buf + ".");

        ByteBuffer data = new ByteBuffer(3);
        // X224 header
        data.writeByte(2); // Header length indicator
        data.writeByte(X224_TPDU_DATA);
        data.writeByte(X224_TPDU_LAST_DATA_UNIT);

        buf.prepend(data);
        data.unref();

        pushDataToPad(STDOUT, buf);
    }
View Full Code Here

    @Override
    protected void onStart() {
        super.onStart();

        int length = 5;
        ByteBuffer buf = new ByteBuffer(length, true);

        buf.writeByte(0x04); // Erect Domain Request

        // Client SHOULD initialize both the subHeight and subinterval fields of the MCS Erect Domain Request PDU to zero.

        buf.writeByte(1); // ErectDomainRequest::subHeight length = 1 byte
        buf.writeByte(0); // ErectDomainRequest::subHeight

        buf.writeByte(1); // ErectDomainRequest::subInterval length = 1 byte
        buf.writeByte(0); // ErectDomainRequest::subInterval

        pushDataToOTOut(buf);

        switchOff();
    }
View Full Code Here

            // lengthCapability fields.
            int lengthCapability = buf.readUnsignedShortLE();

            // (variable): Capability set data which conforms to the structure of the
            // type given by the capabilitySetType field.
            ByteBuffer capabilityData = buf.readBytes(lengthCapability - 4);

            switch (capabilitySetType) {
            case CAPSTYPE_GENERAL:
                break;
            case CAPSTYPE_BITMAP:
                handleBitmapCapabilities(capabilityData);
                break;
            case CAPSTYPE_ORDER:
                break;
            case CAPSTYPE_BITMAPCACHE:
                break;
            case CAPSTYPE_CONTROL:
                break;
            case CAPSTYPE_ACTIVATION:
                break;
            case CAPSTYPE_POINTER:
                break;
            case CAPSTYPE_SHARE:
                break;
            case CAPSTYPE_COLORCACHE:
                break;
            case CAPSTYPE_SOUND:
                break;
            case CAPSTYPE_INPUT:
                break;
            case CAPSTYPE_FONT:
                break;
            case CAPSTYPE_BRUSH:
                break;
            case CAPSTYPE_GLYPHCACHE:
                break;
            case CAPSTYPE_OFFSCREENCACHE:
                break;
            case CAPSTYPE_BITMAPCACHE_HOSTSUPPORT:
                break;
            case CAPSTYPE_BITMAPCACHE_REV2:
                break;
            case CAPSTYPE_VIRTUALCHANNEL:
                break;
            case CAPSTYPE_DRAWNINEGRIDCACHE:
                break;
            case CAPSTYPE_DRAWGDIPLUS:
                break;
            case CAPSTYPE_RAIL:
                break;
            case CAPSTYPE_WINDOW:
                break;
            case CAPSETTYPE_COMPDESK:
                break;
            case CAPSETTYPE_MULTIFRAGMENTUPDATE:
                break;
            case CAPSETTYPE_LARGE_POINTER:
                break;
            case CAPSETTYPE_SURFACE_COMMANDS:
                break;
            case CAPSETTYPE_BITMAP_CODECS:
                break;
            case CAPSSETTYPE_FRAME_ACKNOWLEDGE:
                break;
            default:
                // Ignore
                break;
            }

            capabilityData.unref();
        }

        // TODO

        buf.unref();
View Full Code Here

TOP

Related Classes of streamer.ByteBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.