예제 #1
0
 /// <summary>
 /// Initializes an instance of the <see cref="AssociationRejectedEventArgs"/> class.
 /// </summary>
 /// <param name="result">Association rejection result.</param>
 /// <param name="source">Source of association rejection.</param>
 /// <param name="reason">Reason for association rejection.</param>
 public AssociationRejectedEventArgs(DicomRejectResult result, DicomRejectSource source,
                                     DicomRejectReason reason)
 {
     Result = result;
     Source = source;
     Reason = reason;
 }
예제 #2
0
파일: PDU.cs 프로젝트: imanabu/fo-dicom
 /// <summary>
 /// Reads A-ASSOCIATE-RJ from PDU buffer
 /// </summary>
 /// <param name="raw">PDU buffer</param>
 public void Read(RawPDU raw)
 {
     raw.ReadByte("Reserved");
     _rt = (DicomRejectResult)raw.ReadByte("Result");
     _so = (DicomRejectSource)raw.ReadByte("Source");
     _rn = (DicomRejectReason)raw.ReadByte("Reason");
 }
예제 #3
0
        /// <summary>
        /// Do the actual verification if an association is acceptable.
        /// </summary>
        /// <remarks>
        /// This method primarily checks the remote AE title to see if it is a valid device that can
        /// connect to the partition.
        /// </remarks>
        /// <param name="context">Generic parameter passed in, is a DicomScpParameters instance.</param>
        /// <param name="assocParms">The association parameters.</param>
        /// <param name="result">Output parameter with the DicomRejectResult for rejecting the association.</param>
        /// <param name="reason">Output parameter with the DicomRejectReason for rejecting the association.</param>
        /// <returns>true if the association should be accepted, false if it should be rejected.</returns>
        public static bool Verify(DicomScpContext context, ServerAssociationParameters assocParms,
                                  out DicomRejectResult result, out DicomRejectReason reason)
        {
            bool   isNew;
            Device device = DeviceManager.LookupDevice(assocParms, out isNew);

            if (device == null)
            {
                reason = DicomRejectReason.CallingAENotRecognized;
                result = DicomRejectResult.Permanent;
                return(false);
            }

            if (device.Enabled == false)
            {
                LogAdapter.Logger.ErrorWithFormat("Rejecting association from {0} to {1}.  Device is disabled.",
                                                  assocParms.CallingAE, assocParms.CalledAE);

                reason = DicomRejectReason.CallingAENotRecognized;
                result = DicomRejectResult.Permanent;
                return(false);
            }

            reason = DicomRejectReason.NoReasonGiven;
            result = DicomRejectResult.Permanent;

            return(true);
        }
예제 #4
0
        /// <summary>
        /// Do the actual verification if an association is acceptable.
        /// </summary>
        /// <remarks>
        /// This method primarily checks the remote AE title to see if it is a valid device that can 
        /// connect to the partition.
        /// </remarks>
        /// <param name="context">Generic parameter passed in, is a DicomScpParameters instance.</param>
        /// <param name="assocParms">The association parameters.</param>
        /// <param name="result">Output parameter with the DicomRejectResult for rejecting the association.</param>
        /// <param name="reason">Output parameter with the DicomRejectReason for rejecting the association.</param>
        /// <returns>true if the association should be accepted, false if it should be rejected.</returns>
        public static bool Verify(DicomScpContext context, ServerAssociationParameters assocParms,
                                  out DicomRejectResult result, out DicomRejectReason reason)
        {
            bool isNew;
            Device device = DeviceManager.LookupDevice(context.Partition, assocParms, out isNew);

            if (device == null)
            {
                if (context.Partition.AcceptAnyDevice)
                {
                    reason = DicomRejectReason.NoReasonGiven;
                    result = DicomRejectResult.Permanent;
                    return true;
                }

                reason = DicomRejectReason.CallingAENotRecognized;
                result = DicomRejectResult.Permanent;
                return false;
            }

            if (device.Enabled == false)
            {
                Platform.Log(LogLevel.Error, "Rejecting association from {0} to {1}.  Device is disabled.",
                                       assocParms.CallingAE, assocParms.CalledAE);

                reason = DicomRejectReason.CallingAENotRecognized;
                result = DicomRejectResult.Permanent;
                return false;
            }

            reason = DicomRejectReason.NoReasonGiven;
            result = DicomRejectResult.Permanent;

            return true;
        }
예제 #5
0
 public void OnReceiveAssociationReject(
     DicomRejectResult result,
     DicomRejectSource source,
     DicomRejectReason reason)
 {
     this.SetComplete();
     throw new DicomAssociationRejectedException(result, source, reason);
 }
예제 #6
0
 /// <summary>
 /// Callback for handling association reject scenarios.
 /// </summary>
 /// <param name="result">Specification of rejection result.</param>
 /// <param name="source">Source of rejection.</param>
 /// <param name="reason">Detailed reason for rejection.</param>
 public void OnReceiveAssociationReject(
     DicomRejectResult result,
     DicomRejectSource source,
     DicomRejectReason reason)
 {
     this.client.associateNotifier.TrySetResult(false);
     SetComplete(new DicomAssociationRejectedException(result, source, reason));
 }
예제 #7
0
 protected virtual bool CreateVerify(DicomScpContext context,
                                     ServerAssociationParameters assocParms,
                                     out DicomRejectResult result,
                                     out DicomRejectReason reason)
 {
     return(AssociationVerifier.Verify(context,
                                       assocParms,
                                       out result,
                                       out reason));
 }
 public DicomAssociationRejectedException(
     DicomRejectResult result,
     DicomRejectSource source,
     DicomRejectReason reason)
     : base($"Association rejected [result: {result}; source: {source}; reason: {reason}]")
 {
     RejectResult = result;
     RejectSource = source;
     RejectReason = reason;
 }
 public DicomAssociationRejectedException(
     DicomRejectResult result,
     DicomRejectSource source,
     DicomRejectReason reason)
     : base("Association rejected [result: {0}; source: {1}; reason: {2}]", result, source, reason)
 {
     RejectResult = result;
     RejectSource = source;
     RejectReason = reason;
 }
예제 #10
0
            /// <inheritdoc />
            public void OnReceiveAssociationReject(
                DicomRejectResult result,
                DicomRejectSource source,
                DicomRejectReason reason)
            {
                SetHasAssociationFlag(false);
                _client.AssociationRejected(_client, new AssociationRejectedEventArgs(result, source, reason));

                SetCompletionFlag(new DicomAssociationRejectedException(result, source, reason));
            }
 public DicomAssociationRejectedException(
     DicomRejectResult result,
     DicomRejectSource source,
     DicomRejectReason reason)
     : base("Association rejected [result: {0}; source: {1}; reason: {2}]", result, source, reason)
 {
     RejectResult = result;
     RejectSource = source;
     RejectReason = reason;
 }
예제 #12
0
        public static bool VerifyAssociation(IDicomServerContext context, AssociationParameters assoParams, 
            out DicomRejectResult result, out DicomRejectReason reason)
        {
            string calledAET = (assoParams.CalledAE ?? "").Trim();
            string callingAET = (assoParams.CallingAE ?? "").Trim();

            result = DicomRejectResult.Permanent;
            reason = DicomRejectReason.NoReasonGiven;

            return true;
        }
예제 #13
0
            /// <inheritdoc />
            public void OnReceiveAssociationReject(
                DicomRejectResult result,
                DicomRejectSource source,
                DicomRejectReason reason)
            {
                SetAssociationRequestedFlag(false);
                _client.AssociationRejected(_client, new AssociationRejectedEventArgs(result, source, reason));

                SetCompletionFlag(new DicomAssociationRejectedException(result, source, reason));

                //  tell awaiters association was released unsuccessfully.
                this.SetAssociationReleasedFlag(false);
            }
예제 #14
0
		public static bool VerifyAssociation(IDicomServerContext context, AssociationParameters assocParms, out DicomRejectResult result, out DicomRejectReason reason)
		{
			string calledTitle = (assocParms.CalledAE ?? "").Trim();
			string callingAE = (assocParms.CallingAE ?? "").Trim();

			result = DicomRejectResult.Permanent;
			reason = DicomRejectReason.NoReasonGiven;

		    var extendedConfiguration = LocalDicomServer.GetExtendedConfiguration();
            if (!extendedConfiguration.AllowUnknownCaller && ServerDirectory.GetRemoteServersByAETitle(callingAE).Count == 0)
			{
				reason = DicomRejectReason.CallingAENotRecognized;
			}
			else if (calledTitle != context.AETitle)
			{
				reason = DicomRejectReason.CalledAENotRecognized;
			}
			else
			{
				return true;
			}

			return false;
		}
예제 #15
0
파일: DicomClient.cs 프로젝트: GMZ/fo-dicom
            public void OnReceiveAssociationReject(
                DicomRejectResult result,
                DicomRejectSource source,
                DicomRejectReason reason)
            {
                if (_timer != null) _timer.Change(Timeout.Infinite, Timeout.Infinite);

                _client._exception = new DicomAssociationRejectedException(result, source, reason);
                _client._async.Set();
            }
예제 #16
0
파일: PDU.cs 프로젝트: imanabu/fo-dicom
 /// <summary>
 /// Initializes new A-ASSOCIATE-RJ
 /// </summary>
 /// <param name="rt">Rejection result</param>
 /// <param name="so">Rejection source</param>
 /// <param name="rn">Rejection reason</param>
 public AAssociateRJ(DicomRejectResult rt, DicomRejectSource so, DicomRejectReason rn)
 {
     _rt = rt;
     _so = so;
     _rn = rn;
 }
예제 #17
0
 public void Read(RawPDU raw)
 {
     raw.ReadByte("Reserved");
     _rt = (DicomRejectResult)raw.ReadByte("Result");
     _so = (DicomRejectSource)raw.ReadByte("Source");
     _rn = (DicomRejectReason)raw.ReadByte("Reason");
 }
 public abstract Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason);
예제 #19
0
 /// <summary>
 /// Called when [receive associate reject].
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="association">The association.</param>
 /// <param name="result">The result.</param>
 /// <param name="source">The source.</param>
 /// <param name="reason">The reason.</param>
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     FailureDescription =
         String.Format("Association Rejection when {0} connected to remote AE {1}:{2}", association.CallingAE,
                       association.CalledAE, association.RemoteEndPoint);
     LogAdapter.Logger.Warning(FailureDescription);
     StopRunningOperation(ScuOperationStatus.AssociationRejected);
 }
예제 #20
0
            public void OnReceiveAssociationReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
            {
                if (_timer != null)
                {
                    _timer.Change(Timeout.Infinite, Timeout.Infinite);
                }

                _client._exception = new DicomAssociationRejectedException(result, source, reason);
                _client._async.Set();
            }
예제 #21
0
 internal Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 => ExecuteWithinTransitionLock(() => State.OnReceiveAssociationRejectAsync(result, source, reason));
예제 #22
0
        public static bool VerifyAssociation(IDicomServerContext context, AssociationParameters assocParms, out DicomRejectResult result, out DicomRejectReason reason)
        {
            string calledTitle = (assocParms.CalledAE ?? "").Trim();
            string callingAE   = (assocParms.CallingAE ?? "").Trim();

            result = DicomRejectResult.Permanent;
            reason = DicomRejectReason.NoReasonGiven;

            var extendedConfiguration = LocalDicomServer.GetExtendedConfiguration();

            if (!extendedConfiguration.AllowUnknownCaller && ServerDirectory.GetRemoteServersByAETitle(callingAE).Count == 0)
            {
                reason = DicomRejectReason.CallingAENotRecognized;
            }
            else if (calledTitle != context.AETitle)
            {
                reason = DicomRejectReason.CalledAENotRecognized;
            }
            else
            {
                return(true);
            }

            return(false);
        }
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     Console.WriteLine("Association was rejected!");
     Platform.Log(LogLevel.Info, "Association was rejected!");
     Assoc_Accept_Reject = true;
 }
예제 #24
0
        protected override void OnReceiveAssociateReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
        {
            _handler.OnReceiveAssociateReject(this, _assoc as ClientAssociationParameters, result, source, reason);

            _closedOnError = true;
            CloseNetwork(System.Threading.Timeout.Infinite);
        }
예제 #25
0
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     Logger.LogInfo("Association Rejection when {0} connected to remote AE {1}", association.CallingAE, association.CalledAE);
     _dicomClient = null;
 }
예제 #26
0
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     Logger.LogInfo("Association Rejection when {0} connected to remote AE {1}", association.CallingAE, association.CalledAE);
     _verificationResult = VerificationResult.Failed;
     ProgressEvent.Set();
 }
예제 #27
0
 public Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) => Task.CompletedTask;
예제 #28
0
 public Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     return(DicomClient.OnReceiveAssociationRejectAsync(result, source, reason));
 }
예제 #29
0
        /// <summary>
        /// Method to send an association rejection.
        /// </summary>
        /// <param name="result">The </param>
        /// <param name="source"></param>
        /// <param name="reason"></param>
        public void SendAssociateReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
        {
            if (State != DicomAssociationState.Sta3_AwaitingLocalAAssociationResponsePrimative)
            {
                Platform.Log(LogLevel.Error, "Error attempting to send association reject at invalid time in association.");
                SendAssociateAbort(DicomAbortSource.ServiceProvider, DicomAbortReason.NotSpecified);
                throw new DicomNetworkException(
                    "Attempting to send association reject at invalid time in association, aborting");
            }
            var pdu = new AAssociateRJ(result, source, reason);

            EnqueuePdu(pdu.Write());

            State = DicomAssociationState.Sta13_AwaitingTransportConnectionClose;

            if (AssociationRejected != null)
                AssociationRejected(source, reason);
        }
예제 #30
0
		protected void SendAssociationReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) {
			Logger.Info("{0} -> Association reject [result: {1}; source: {2}; reason: {3}]", LogID, result, source, reason);
			SendPDU(new AAssociateRJ(result, source, reason));
		}
예제 #31
0
        /// <summary>
        /// Do the actual verification if an association is acceptable.
        /// </summary>
        /// <remarks>
        /// This method primarily checks the remote AE title to see if it is a valid device that can
        /// connect to the partition.
        /// </remarks>
        /// <param name="context">Generic parameter passed in, is a DicomScpParameters instance.</param>
        /// <param name="assocParms">The association parameters.</param>
        /// <param name="result">Output parameter with the DicomRejectResult for rejecting the association.</param>
        /// <param name="reason">Output parameter with the DicomRejectReason for rejecting the association.</param>
        /// <returns>true if the association should be accepted, false if it should be rejected.</returns>
        public static bool Verify(DicomScpContext context, ServerAssociationParameters assocParms, out DicomRejectResult result, out DicomRejectReason reason)
        {
            bool isNew;

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

            if (context.Device == null)
            {
                if (context.Partition.AcceptAnyDevice)
                {
                    reason = DicomRejectReason.NoReasonGiven;
                    result = DicomRejectResult.Permanent;
                    return(true);
                }

                reason = DicomRejectReason.CallingAENotRecognized;
                result = DicomRejectResult.Permanent;
                return(false);
            }

            if (context.Device.Enabled == false)
            {
                Platform.Log(LogLevel.Error,
                             "Rejecting association from {0} to {1}.  Device is disabled.",
                             assocParms.CallingAE, assocParms.CalledAE);

                reason = DicomRejectReason.CallingAENotRecognized;
                result = DicomRejectResult.Permanent;
                return(false);
            }

            reason = DicomRejectReason.NoReasonGiven;
            result = DicomRejectResult.Permanent;

            return(true);
        }
 public override Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     _dicomClient.Logger.Warn($"[{this}] Received association reject but we already have an active association!");
     return(CompletedTaskProvider.CompletedTask);
 }
예제 #33
0
 protected void SendAssociationReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     Logger.Info("{0} -> Association reject [result: {1}; source: {2}; reason: {3}]", LogID, result, source, reason);
     SendPDU(new AAssociateRJ(result, source, reason));
 }
예제 #34
0
 public void OnReceiveAssociationReject(
     DicomRejectResult result,
     DicomRejectSource source,
     DicomRejectReason reason)
 {
     this.SetComplete();
     throw new DicomAssociationRejectedException(result, source, reason);
 }
예제 #35
0
 public AAssociateRJ(DicomRejectResult rt, DicomRejectSource so, DicomRejectReason rn)
 {
     _rt = rt;
     _so = so;
     _rn = rn;
 }
예제 #36
0
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     Logger.LogInfo("Association Rejection when {0} connected to remote AE {1}", association.CallingAE, association.CalledAE);
     _dicomClient = null;
 }
예제 #37
0
 /// <summary>
 /// Send association reject response.
 /// </summary>
 /// <param name="result">Rejection result.</param>
 /// <param name="source">Rejection source.</param>
 /// <param name="reason">Rejection reason.</param>
 protected void SendAssociationReject(
     DicomRejectResult result,
     DicomRejectSource source,
     DicomRejectReason reason)
 {
     Logger.Info(
         "{logId} -> Association reject [result: {result}; source: {source}; reason: {reason}]",
         LogID,
         result,
         source,
         reason);
     this.SendPDUAsync(new AAssociateRJ(result, source, reason)).Wait();
 }
예제 #38
0
 /// <summary>
 /// Callback for handling association reject scenarios.
 /// </summary>
 /// <param name="result">Specification of rejection result.</param>
 /// <param name="source">Source of rejection.</param>
 /// <param name="reason">Detailed reason for rejection.</param>
 public void OnReceiveAssociationReject(
     DicomRejectResult result,
     DicomRejectSource source,
     DicomRejectReason reason)
 {
     this.client.associateNotifier.TrySetResult(false);
     SetComplete(new DicomAssociationRejectedException(result, source, reason));
 }
예제 #39
0
 public void OnReceiveAssociationReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     _client._exception = new DicomAssociationRejectedException(result, source, reason);
     _client._async.Set();
 }
예제 #40
0
		protected override void OnReceiveAssociateReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) {

            _handler.OnReceiveAssociateReject(this, _assoc as ClientAssociationParameters, result, source, reason);

            _closedOnError = true;
			CloseNetwork(System.Threading.Timeout.Infinite);
		}
예제 #41
0
 public Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     return(CompletedTaskProvider.CompletedTask);
 }
예제 #42
0
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     if (_type == TestTypes.AssociationReject)
     {
         Assert.IsTrue(source == DicomRejectSource.ServiceProviderACSE);
         Assert.IsTrue(result == DicomRejectResult.Permanent);
         Assert.IsTrue(reason == DicomRejectReason.NoReasonGiven);
         _threadStop.Set();
     }
     else
         Assert.Fail("Incorrectly received OnReceiveAssociateReject callback");
 }
예제 #43
0
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     Logger.LogInfo("Association Rejection when {0} connected to remote AE {1}", association.CallingAE, association.CalledAE);
     _verificationResult = VerificationResult.Failed;
     ProgressEvent.Set();
 }
예제 #44
0
파일: CFindSCU.cs 프로젝트: nhannd/Xian
        public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
        {

        }
예제 #45
0
 protected virtual void OnReceiveAssociateReject(DicomRejectResult result, DicomRejectSource source,
                                                 DicomRejectReason reason)
 {
     throw new Exception("The method or operation is not implemented.");
 }
예제 #46
0
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
     if (_type == TestTypes.AssociationReject)
     {
         Assert.IsTrue(source == DicomRejectSource.ServiceProviderACSE);
         Assert.IsTrue(result == DicomRejectResult.Permanent);
         Assert.IsTrue(reason == DicomRejectReason.NoReasonGiven);
         _threadStop.Set();
     }
     else
     {
         Assert.Fail("Incorrectly received OnReceiveAssociateReject callback");
     }
 }
예제 #47
0
 public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
 {
 }
예제 #48
0
        public override Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason)
        {
            _onAssociationRejectedTaskCompletionSource.TrySetResultAsynchronously(new DicomAssociationRejectedEvent(result, source, reason));

            return(CompletedTaskProvider.CompletedTask);
        }