Exemplo n.º 1
0
  /**
   * Create the bitmask of what the target requires.
   *
   * @param tc the transport configuration metadata.
   * @return an {@code int} representing the transport mechanism required by the target.
   */
  public static int createTargetRequires(IORTransportConfigMetaData tc) {
    int requires = 0;

    if (tc != null) {
      if (tc.getIntegrity().equals(IORTransportConfigMetaData.INTEGRITY_REQUIRED)) {
        requires = requires | Integrity.value;
      }
      if (tc.getConfidentiality().equals(IORTransportConfigMetaData.CONFIDENTIALITY_REQUIRED)) {
        requires = requires | Confidentiality.value;
      }
      if (tc.getDetectMisordering()
          .equalsIgnoreCase(IORTransportConfigMetaData.DETECT_MISORDERING_REQUIRED)) {
        requires = requires | DetectMisordering.value;
      }
      if (tc.getDetectReplay()
          .equalsIgnoreCase(IORTransportConfigMetaData.DETECT_REPLAY_REQUIRED)) {
        requires = requires | DetectReplay.value;
      }
      // no EstablishTrustInTarget required - client decides
      if (tc.getEstablishTrustInClient()
          .equals(IORTransportConfigMetaData.ESTABLISH_TRUST_IN_CLIENT_REQUIRED)) {
        requires = requires | EstablishTrustInClient.value;
      }
    }

    return requires;
  }
Exemplo n.º 2
0
  /**
   * Create the bitmask of what the target supports.
   *
   * @param tc the transport configuration metadata.
   * @return an {@code int} representing the transport mechanisms supported by the target.
   */
  public static int createTargetSupports(IORTransportConfigMetaData tc) {
    int supports = 0;

    if (tc != null) {
      if (!tc.getIntegrity().equals(IORTransportConfigMetaData.INTEGRITY_NONE)) {
        supports = supports | Integrity.value;
      }
      if (!tc.getConfidentiality().equals(IORTransportConfigMetaData.CONFIDENTIALITY_NONE)) {
        supports = supports | Confidentiality.value;
      }
      if (!tc.getDetectMisordering()
          .equalsIgnoreCase(IORTransportConfigMetaData.DETECT_MISORDERING_NONE)) {
        supports = supports | DetectMisordering.value;
      }
      if (!tc.getDetectReplay().equalsIgnoreCase(IORTransportConfigMetaData.DETECT_REPLAY_NONE)) {
        supports = supports | DetectReplay.value;
      }
      if (!tc.getEstablishTrustInTarget()
          .equals(IORTransportConfigMetaData.ESTABLISH_TRUST_IN_TARGET_NONE)) {
        supports = supports | EstablishTrustInTarget.value;
      }
      if (!tc.getEstablishTrustInClient()
          .equals(IORTransportConfigMetaData.ESTABLISH_TRUST_IN_CLIENT_NONE)) {
        supports = supports | EstablishTrustInClient.value;
      }
    }

    return supports;
  }