Пример #1
0
  /**
   * Write a server information structure
   *
   * @param buf DCEBuffer
   * @param strBuf DCEBuffer
   */
  public void writeObject(DCEBuffer buf, DCEBuffer strBuf) {

    //	Output the server information structure

    buf.putInt(getInformationLevel());
    buf.putPointer(true);

    //	Output the required information level

    switch (getInformationLevel()) {

        //	Information level 0

      case InfoLevel0:
        buf.putPointer(getServerName() != null);
        if (getServerName() != null) strBuf.putString(getServerName(), DCEBuffer.ALIGN_INT, true);
        break;

        //	Information level 101/1

      case InfoLevel1:
      case InfoLevel101:
        buf.putInt(getPlatformId());
        buf.putPointer(true);
        buf.putInt(getMajorVersion());
        buf.putInt(getMinorVersion());
        buf.putInt(getServerType());
        buf.putPointer(true);

        strBuf.putString(getServerName(), DCEBuffer.ALIGN_INT, true);
        strBuf.putString(getComment() != null ? getComment() : "", DCEBuffer.ALIGN_INT, true);
        break;

        //	Level 102

      case InfoLevel102:
        break;
    }
  }
Пример #2
0
  /**
   * Read the server information from the DCE/RPC buffer
   *
   * @param buf DCEBuffer
   * @exception DCEBufferException
   */
  public void readObject(DCEBuffer buf) throws DCEBufferException {

    //	Clear the string values

    clearStrings();

    //	Read the server information details

    m_infoLevel = buf.getInt();
    buf.skipPointer();

    //	Unpack the server information

    switch (getInformationLevel()) {

        //	Information level 0

      case InfoLevel0:
        if (buf.getPointer() != 0) m_name = buf.getString(DCEBuffer.ALIGN_INT);
        break;

        //	Information level 101/1

      case InfoLevel1:
      case InfoLevel101:
        m_platformId = buf.getInt();
        buf.skipPointer();
        m_verMajor = buf.getInt();
        m_verMinor = buf.getInt();
        m_srvType = buf.getInt();
        buf.skipPointer();

        m_name = buf.getString(DCEBuffer.ALIGN_INT);
        m_comment = buf.getString();
        break;

        //	Level 102

      case InfoLevel102:
        break;
    }
  }