예제 #1
0
  private TransferCapability roleSelection(AAssociateRQ rq, AAssociateAC ac, String asuid) {
    RoleSelection rqrs = rq.getRoleSelectionFor(asuid);
    if (rqrs == null) return getTC(scpTCs, asuid, rq);

    RoleSelection acrs = ac.getRoleSelectionFor(asuid);
    if (acrs != null) return getTC(acrs.isSCU() ? scpTCs : scuTCs, asuid, rq);

    TransferCapability tcscu = null;
    TransferCapability tcscp = null;
    boolean scu = rqrs.isSCU() && (tcscp = getTC(scpTCs, asuid, rq)) != null;
    boolean scp = rqrs.isSCP() && (tcscu = getTC(scuTCs, asuid, rq)) != null;
    ac.addRoleSelection(new RoleSelection(asuid, scu, scp));
    return scu ? tcscp : tcscu;
  }
예제 #2
0
  protected PresentationContext negotiate(
      AAssociateRQ rq, AAssociateAC ac, PresentationContext rqpc) {
    String as = rqpc.getAbstractSyntax();
    TransferCapability tc = roleSelection(rq, ac, as);
    int pcid = rqpc.getPCID();
    if (tc == null)
      return new PresentationContext(
          pcid, PresentationContext.ABSTRACT_SYNTAX_NOT_SUPPORTED, rqpc.getTransferSyntax());

    for (String ts : rqpc.getTransferSyntaxes())
      if (tc.containsTransferSyntax(ts)) {
        byte[] info = negotiate(rq.getExtNegotiationFor(as), tc);
        if (info != null) ac.addExtendedNegotiation(new ExtendedNegotiation(as, info));
        return new PresentationContext(pcid, PresentationContext.ACCEPTANCE, ts);
      }

    return new PresentationContext(
        pcid, PresentationContext.TRANSFER_SYNTAX_NOT_SUPPORTED, rqpc.getTransferSyntax());
  }