Exemplo n.º 1
0
		public DicomPresContext(byte pcid, SopClass abstractSyntax) {
			_pcid = pcid;
			_result = DicomPresContextResult.Proposed;
			_roles = DicomRoleSelection.Disabled;
			_abstract = abstractSyntax;
            if (abstractSyntax.Uid.Length == 0)
                throw new DicomException("Invalid abstract syntax for presentation context, UID is zero length.");
			_transfers = new List<TransferSyntax>();
		}
Exemplo n.º 2
0
 public DicomPresContext(byte pcid, SopClass abstractSyntax)
 {
     _pcid     = pcid;
     _result   = DicomPresContextResult.Proposed;
     _roles    = DicomRoleSelection.Disabled;
     _abstract = abstractSyntax;
     if (abstractSyntax.Uid.Length == 0)
     {
         throw new DicomException("Invalid abstract syntax for presentation context, UID is zero length.");
     }
     _transfers = new List <TransferSyntax>();
 }
Exemplo n.º 3
0
        void IDicomServerHandler.OnReceiveAssociateRequest(DicomServer server, ServerAssociationParameters association)
        {
            if (_verifier != null)
            {
                DicomRejectResult result;
                DicomRejectReason reason;
                bool verified = _verifier(_context, association, out result, out reason);
                if (verified == false)
                {
                    server.SendAssociateReject(result, DicomRejectSource.ServiceUser, reason);
                    LogAdapter.Logger.Info("Association rejected from {0} to {1}",
                                           association.CallingAE, association.CalledAE);
                    return;
                }
            }

            // Let the extensions have its say on whether a presentation context is really acceptable.
            //
            bool atLeastOneAccepted = false;

            foreach (byte pcid in association.GetPresentationContextIDs())
            {
                if (association.GetPresentationContextResult(pcid) == DicomPresContextResult.Accept)
                {
                    IDicomScp <TContext>   scp = _extensionList[pcid];
                    DicomPresContextResult res = scp.VerifyAssociation(association, pcid);
                    if (res != DicomPresContextResult.Accept)
                    {
                        association.GetPresentationContext(pcid).ClearTransfers();
                        association.SetPresentationContextResult(pcid, res);
                    }
                    else
                    {
                        atLeastOneAccepted = true;
                    }
                }
            }

            if (!atLeastOneAccepted)
            {
                LogAdapter.Logger.Info("None of the proposed presentation context is accepted. Rejecting association from {0} to {1}", association.CallingAE, association.CalledAE);
                server.SendAssociateReject(DicomRejectResult.Permanent, DicomRejectSource.ServiceUser, DicomRejectReason.NoReasonGiven);
                return;
            }

            server.SendAssociateAccept(association);

            // Optimization to speed query performance
            Task.Factory.StartNew(() => LogAdapter.Logger.Info("Received association:\r\n{0}", association.ToString()));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Verify a presentation context.
        /// </summary>
        /// <param name="association"></param>
        /// <param name="pcid"></param>
        /// <returns></returns>
        public DicomPresContextResult VerifyAssociation(AssociationParameters association, byte pcid)
        {
            bool isNew;

            Device = DeviceManager.LookupDevice(Partition, association, out isNew);

            // Let the subclass perform the verification
            DicomPresContextResult result = OnVerifyAssociation(association, pcid);

            if (result != DicomPresContextResult.Accept)
            {
                Platform.Log(LogLevel.Debug, "Rejecting Presentation Context {0}:{1} in association between {2} and {3}.",
                             pcid, association.GetAbstractSyntax(pcid).Description,
                             association.CallingAE, association.CalledAE);
            }

            return(result);
        }
Exemplo n.º 5
0
		internal void AddPresentationContext(byte pcid, DicomUid abstractSyntax, TransferSyntax transferSyntax, DicomPresContextResult result) {
			_presContexts.Add(pcid, new DicomPresContext(pcid, SopClass.GetSopClass(abstractSyntax.UID), transferSyntax, result));
		}
Exemplo n.º 6
0
		/// <summary>
		/// Sets the result of the specified Presentation Context.
		/// </summary>
		/// <param name="pcid">Presentation Context ID</param>
		/// <param name="result">Result</param>
		public void SetPresentationContextResult(byte pcid, DicomPresContextResult result) {
			GetPresentationContext(pcid).SetResult(result);
		}
Exemplo n.º 7
0
		public void SetResult(DicomPresContextResult result) {
			_result = result;
		}
Exemplo n.º 8
0
 internal void AddPresentationContext(byte pcid, DicomUid abstractSyntax, TransferSyntax transferSyntax, DicomPresContextResult result)
 {
     _presContexts.Add(pcid, new DicomPresContext(pcid, SopClass.GetSopClass(abstractSyntax.UID), transferSyntax, result));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Sets the result of the specified Presentation Context.
 /// </summary>
 /// <param name="pcid">Presentation Context ID</param>
 /// <param name="result">Result</param>
 public void SetPresentationContextResult(byte pcid, DicomPresContextResult result)
 {
     GetPresentationContext(pcid).SetResult(result);
 }
Exemplo n.º 10
0
 public void SetResult(DicomPresContextResult result)
 {
     _result = result;
 }