Package com.lixia.rdp.Package

Examples of com.lixia.rdp.Package.RdpPackage


            "Too Many Users", "Unspecified Failure", "User Rejected"};

        int result;
        int length = 0;

        RdpPackage buffer = IsoLayer.receive();
//        logger.debug("Received buffer");
        length = berParseHeader(buffer, CONNECT_RESPONSE);
        length = berParseHeader(buffer, BER_TAG_RESULT);

        result = buffer.get8();
        if (result != 0) {
            throw new RdesktopException("MCS Connect failed: "
                    + connect_results[result]);
        }
        length = berParseHeader(buffer, BER_TAG_INTEGER);
        length = buffer.get8(); //connect id
        parseDomainParams(buffer);
        length = berParseHeader(buffer, BER_TAG_OCTET_STRING);

        RDPConnection.conf.secure.processMcsData(buffer);
    }
View Full Code Here


     * @throws IOException
     * @throws RdesktopException
     */
    public void send_edrq() throws IOException, RdesktopException {
//        logger.debug("send_edrq");
        RdpPackage buffer = IsoLayer.init(5);
        buffer.set8(EDRQ << 2);
        buffer.setBigEndian16(1); //height
        buffer.setBigEndian16(1); //interval
        buffer.markEnd();
        IsoLayer.send(buffer);
    }
View Full Code Here

     * @param channelid Id of channel to be identified in request
     * @throws IOException
     * @throws RdesktopException
     */
    public void send_cjrq(int channelid) throws IOException, RdesktopException {
        RdpPackage buffer = IsoLayer.init(5);
        buffer.set8(CJRQ << 2);
        buffer.setBigEndian16(this.McsUserID); //height
        buffer.setBigEndian16(channelid); //interval
        buffer.markEnd();
        IsoLayer.send(buffer);
    }
View Full Code Here

     *
     * @throws IOException
     * @throws RdesktopException
     */
    public void send_aucf() throws IOException, RdesktopException {
        RdpPackage buffer = IsoLayer.init(2);
        buffer.set8(AUCF << 2);
        buffer.set8(0);
        buffer.markEnd();
        IsoLayer.send(buffer);
    }
View Full Code Here

     *
     * @throws IOException
     * @throws RdesktopException
     */
    public void send_aurq() throws IOException, RdesktopException {
        RdpPackage buffer = IsoLayer.init(1);
        buffer.set8(AURQ << 2);
        buffer.markEnd();
        IsoLayer.send(buffer);
    }
View Full Code Here

     * @throws RdesktopException
     */
    public void receive_cjcf() throws IOException, RdesktopException, OrderException, CryptoException {
//        logger.debug("receive_cjcf");
        int opcode, result;
        RdpPackage buffer = IsoLayer.receive();

        opcode = buffer.get8();
        if ((opcode >> 2) != CJCF) {
            throw new RdesktopException("Expected CJCF got" + opcode);
        }

        result = buffer.get8();
        if (result != 0) {
            throw new RdesktopException("Expected CJRQ got " + result);
        }

        buffer.incrementPosition(4); //skip userid, req_channelid

        if ((opcode & 2) != 0) {
            buffer.incrementPosition(2); // skip join_channelid
        }

        if (buffer.getPosition() != buffer.getEnd()) {
            throw new RdesktopException();
        }
    }
View Full Code Here

     * @throws CryptoException
     */
    public int receive_aucf() throws IOException, RdesktopException, OrderException, CryptoException {
//        logger.debug("receive_aucf");
        int opcode, result, UserID = 0;
        RdpPackage buffer = IsoLayer.receive();

        opcode = buffer.get8();
        if ((opcode >> 2) != AUCF) {
            throw new RdesktopException("Expected AUCF got " + opcode);
        }

        result = buffer.get8();
        if (result != 0) {
            throw new RdesktopException("Expected AURQ got " + result);
        }

        if ((opcode & 2) != 0) {
            UserID = buffer.getBigEndian16();
        }

        if (buffer.getPosition() != buffer.getEnd()) {
            throw new RdesktopException();
        }
        return UserID;
    }
View Full Code Here

        } catch (CryptoException e) {
        }
    }

    private void rdpdr_send_client_name_request() {
        RdpPackage s;
        int hostlen;

        if (null == rdpdr_clientname) {
            try {
                rdpdr_clientname = java.net.InetAddress.getLocalHost().getHostName();
            } catch (UnknownHostException e) {
                rdpdr_clientname = "127.0.0.1";
            }
        }
        hostlen = rdpdr_clientname.length() * 2;

        s = new RdpPackage(16 + hostlen + 2);
        s.setLittleEndian16(RDPDR_COMPONENT_TYPE_CORE);
        s.setLittleEndian16(PAKID_CORE_CLIENT_NAME);
        s.setLittleEndian32(1);// unicodeFlag, 0 for ASCII and 1 for Unicode
        s.setLittleEndian32(0);// codePage, must be set to zero
        s.setLittleEndian32(hostlen + 2); // clientID, given by the server in a Server Announce Request
        if (hostlen > 0) {
            try {
                s.copyFromByteArray(rdpdr_clientname.getBytes("UTF-16LE"), 0, s.getPosition(), hostlen);
            } catch (UnsupportedEncodingException e) {
            }
            s.incrementPosition(hostlen);
        }
        s.setLittleEndian16(0);
        s.markEnd();
        try {
            this.send_packet(s);
        } catch (RdesktopException e) {
        } catch (IOException e) {
        } catch (CryptoException e) {
View Full Code Here

        int capabilityLength = data.getLittleEndian16();
        int version = data.getLittleEndian32();
    }

    private void rdpdr_send_capabilities() {
        RdpPackage s;

        s = new RdpPackage(0x54);
        s.setLittleEndian16(RDPDR_COMPONENT_TYPE_CORE);
        s.setLittleEndian16(PAKID_CORE_CLIENT_CAPABILITY);
        s.setLittleEndian16(5);// numCapabilities
        s.setLittleEndian16(0);// pad

        /* Output device direction general capability set */
//    s.setLittleEndian16(1);  /* first */
//    s.setLittleEndian16(0x28);  /* length */
//    s.setLittleEndian32(1);
//    s.setLittleEndian32(2);
//    s.setLittleEndian16(2);
//    s.setLittleEndian16(5);
//    s.setLittleEndian16(1);
//    s.setLittleEndian16(5);
//    s.setLittleEndian16(0xFFFF);
//    s.setLittleEndian16(0);
//    s.setLittleEndian32(0);
//    s.setLittleEndian32(3);
//    s.setLittleEndian32(0);
//    s.setLittleEndian32(0);
        s.setLittleEndian16(CAP_GENERAL_TYPE);
        s.setLittleEndian16(44);
        s.setLittleEndian32(GENERAL_CAPABILITY_VERSION_01);
        s.setLittleEndian32(0);// osType, ignored on receipt
        s.setLittleEndian32(0);// osVersion, unused and must be set to zero
        s.setLittleEndian16(1); // protocolMajorVersion, must be set to 1
        s.setLittleEndian16(DR_MINOR_RDP_VERSION_5_2);// protocolMinorVersion
        s.setLittleEndian32(0x0000FFFF); // ioCode1
        s.setLittleEndian32(0); // ioCode2, must be set to zero, reserved for future use
        s.setLittleEndian32(RDPDR_DEVICE_REMOVE_PDUS | RDPDR_CLIENT_DISPLAY_NAME_PDU | RDPDR_USER_LOGGEDON_PDU); // extendedPDU
        s.setLittleEndian32(ENABLE_ASYNCIO); // extraFlags1
        s.setLittleEndian32(0); // extraFlags2, must be set to zero, reserved for future use5f7pre
        s.setLittleEndian32(0); /* SpecialTypeDeviceCap, number of special devices to be redirected before logon */

        s.setLittleEndian16(CAP_PRINTER_TYPE);
        s.setLittleEndian16(8);
        s.setLittleEndian32(PRINT_CAPABILITY_VERSION_01);

        s.setLittleEndian16(CAP_PORT_TYPE)/* third */

        s.setLittleEndian16(8)/* length */

        s.setLittleEndian32(PORT_CAPABILITY_VERSION_01);

        s.setLittleEndian16(CAP_DRIVE_TYPE)/* fourth */

        s.setLittleEndian16(8)/* length */

        s.setLittleEndian32(DRIVE_CAPABILITY_VERSION_01);

        s.setLittleEndian16(CAP_SMARTCARD_TYPE)/* fifth */

        s.setLittleEndian16(8)/* length */

        s.setLittleEndian32(SMARTCARD_CAPABILITY_VERSION_01);

        s.markEnd();

        try {
            this.send_packet(s);
        } catch (RdesktopException e) {
        } catch (CryptoException e) {
View Full Code Here

     * @param size Size of RDP data
     * @return Packet initialised for RDP
     * @throws RdesktopException
     */
    private RdpPackage initData(int size) throws RdesktopException {
        RdpPackage buffer;

        buffer = SecureLayer.init(RDPConnection.conf.encryption ? Secure.SEC_ENCRYPT : 0, size + 18);
        buffer.pushLayer(RdpPackage.RDP_HEADER, 18);
        // buffer.setHeader(RdpPackage.RDP_HEADER);
        // buffer.incrementPosition(18);
        // buffer.setStart(buffer.getPosition());
        return buffer;
    }
View Full Code Here

TOP

Related Classes of com.lixia.rdp.Package.RdpPackage

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.