Exemplo n.º 1
0
  /**
   * Handle MCS info from server (server info, encryption info and channel information)
   *
   * @param mcs_data Data received from server
   */
  public void processMcsData(RdpPacket_Localised mcs_data)
      throws RdesktopException, CryptoException {
    logger.debug("Secure.processMcsData");
    int tag = 0, len = 0, length = 0, nexttag = 0;

    mcs_data.incrementPosition(21); // header (T.124 stuff, probably)
    len = mcs_data.get8();

    if ((len & 0x00000080) != 0) {
      len = mcs_data.get8();
    }

    while (mcs_data.getPosition() < mcs_data.getEnd()) {
      tag = mcs_data.getLittleEndian16();
      length = mcs_data.getLittleEndian16();

      if (length <= 4) return;

      nexttag = mcs_data.getPosition() + length - 4;

      switch (tag) {
        case (Secure.SEC_TAG_SRV_INFO):
          processSrvInfo(mcs_data);
          break;
        case (Secure.SEC_TAG_SRV_CRYPT):
          this.processCryptInfo(mcs_data);
          break;
        case (Secure.SEC_TAG_SRV_CHANNELS):
          /*
           * FIXME: We should parse this information and use it to map
           * RDP5 channels to MCS channels
           */
          break;

        default:
          throw new RdesktopException("Not implemented! Tag:" + tag + "not recognized!");
      }

      mcs_data.setPosition(nexttag);
    }
  }