/// <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; }
/// <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"); }
/// <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); }
/// <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; }
public void OnReceiveAssociationReject( DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) { this.SetComplete(); throw new DicomAssociationRejectedException(result, source, reason); }
/// <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)); }
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; }
/// <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 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; }
/// <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); }
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 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(); }
/// <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; }
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);
/// <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); }
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(); }
internal Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) => ExecuteWithinTransitionLock(() => State.OnReceiveAssociationRejectAsync(result, source, reason));
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; }
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); }
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; }
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(); }
public Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) => Task.CompletedTask;
public Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) { return(DicomClient.OnReceiveAssociationRejectAsync(result, source, reason)); }
/// <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); }
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)); }
/// <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); }
public AAssociateRJ(DicomRejectResult rt, DicomRejectSource so, DicomRejectReason rn) { _rt = rt; _so = so; _rn = rn; }
/// <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(); }
public void OnReceiveAssociationReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) { _client._exception = new DicomAssociationRejectedException(result, source, reason); _client._async.Set(); }
public Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) { return(CompletedTaskProvider.CompletedTask); }
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"); }
public void OnReceiveAssociateReject(DicomClient client, ClientAssociationParameters association, DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) { }
protected virtual void OnReceiveAssociateReject(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) { throw new Exception("The method or operation is not implemented."); }
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"); } }
public override Task OnReceiveAssociationRejectAsync(DicomRejectResult result, DicomRejectSource source, DicomRejectReason reason) { _onAssociationRejectedTaskCompletionSource.TrySetResultAsynchronously(new DicomAssociationRejectedEvent(result, source, reason)); return(CompletedTaskProvider.CompletedTask); }