public static void BeginInstancesTransferAuditLogger(List<StorageInstance> instances, AssociationParameters parms) { Dictionary<string, AuditPatientParticipantObject> list = new Dictionary<string, AuditPatientParticipantObject>(); foreach (StorageInstance instance in instances) { string key = instance.PatientId + instance.PatientsName; if (!list.ContainsKey(key)) { AuditPatientParticipantObject patient = new AuditPatientParticipantObject(instance.PatientsName, instance.PatientId); list.Add(key, patient); } } foreach (AuditPatientParticipantObject patient in list.Values) { // Audit Log BeginTransferringDicomInstancesAuditHelper audit = new BeginTransferringDicomInstancesAuditHelper(ServerPlatform.AuditSource, EventIdentificationContentsEventOutcomeIndicator.Success, parms, patient); foreach (StorageInstance instance in instances) { if (patient.PatientId.Equals(instance.PatientId) && patient.PatientsName.Equals(instance.PatientsName)) { audit.AddStorageInstance(instance); } } ServerAuditHelper.LogAuditMessage(audit); } }
protected AssociationParameters(AssociationParameters parameters) { DisableNagle = NetworkSettings.Default.DisableNagle; RemoteMaxOperationsPerformed = 1; RemoteMaxOperationsInvoked = 1; TotalDimseReceived = 0; TotalBytesSent = 0; TotalBytesRead = 0; ApplicationContextName = parameters.ApplicationContextName; CalledAE = parameters.CalledAE; CallingAE = parameters.CallingAE; ImplementationClass = parameters.ImplementationClass; ImplementationVersion = parameters.ImplementationVersion; LocalEndPoint = parameters.LocalEndPoint; LocalMaximumPduLength = parameters.LocalMaximumPduLength; RemoteMaximumPduLength = parameters.RemoteMaximumPduLength; ReadTimeout = parameters.ReadTimeout; ReceiveBufferSize = parameters.ReceiveBufferSize; RemoteEndPoint = parameters.RemoteEndPoint; SendBufferSize = parameters.SendBufferSize; WriteTimeout = parameters.WriteTimeout; ConnectTimeout = parameters.ConnectTimeout; foreach (byte id in parameters._presContexts.Keys) { AddPresentationContext(id, parameters._presContexts[id].AbstractSyntax); foreach (TransferSyntax ts in parameters._presContexts[id].GetTransfers()) { AddTransferSyntax(id, ts); } SetRoleSelect(id, parameters._presContexts[id].GetRoleSelect()); } }
/// <summary> /// Connection to a remote DICOM application via TLS. /// </summary> /// <param name="assoc"></param> /// <param name="handler"></param> /// <returns></returns> public static DicomClient ConnectTLS(AssociationParameters assoc, IDicomClientHandler handler) { DicomClient client = new DicomClient(assoc, handler); client.ConnectTLS(); return(client); }
protected AssociationParameters(AssociationParameters parameters) { _appCtxNm = parameters._appCtxNm; _calledAe = parameters._calledAe; _callingAe = parameters._callingAe; _implClass = parameters._implClass; _implVersion = parameters._implVersion; _localEndPoint = parameters._localEndPoint; _localMaxPduLength = parameters._localMaxPduLength; _remoteMaxPduLength = parameters._remoteMaxPduLength; _readTimeout = parameters._readTimeout; _receiveBufferSize = parameters._receiveBufferSize; _remoteEndPoint = parameters._remoteEndPoint; _sendBufferSize = parameters._sendBufferSize; _writeTimeout = parameters._writeTimeout; _connectTimeout = parameters._connectTimeout; foreach (byte id in parameters._presContexts.Keys) { AddPresentationContext(id, parameters._presContexts[id].AbstractSyntax); foreach (TransferSyntax ts in parameters._presContexts[id].GetTransfers()) { AddTransferSyntax(id, ts); } SetRoleSelect(id, parameters._presContexts[id].GetRoleSelect()); } }
private static string GetRemoteHostName(AssociationParameters association) { string remoteHostName = null; try { if (association.RemoteEndPoint != null) { try { IPHostEntry entry = Dns.GetHostEntry(association.RemoteEndPoint.Address); remoteHostName = entry.HostName; } catch { remoteHostName = association.RemoteEndPoint.Address.ToString(); } } } catch (Exception e) { remoteHostName = null; Platform.Log(LogLevel.Warn, e, "Unable to resolve remote host name for auditing."); } return remoteHostName; }
/// <summary> /// Converts a <see cref="DicomMessage"/> instance into a <see cref="DicomFile"/>. /// </summary> /// <remarks>This routine sets the Source AE title, </remarks> /// <param name="message"></param> /// <param name="filename"></param> /// <param name="assocParms"></param> /// <returns></returns> protected static DicomFile ConvertToDicomFile(DicomMessage message, string filename, AssociationParameters assocParms) { // This routine sets some of the group 0x0002 elements. DicomFile file = new DicomFile(message, filename); file.SourceApplicationEntityTitle = assocParms.CallingAE; file.TransferSyntax = message.TransferSyntax; return file; }
private static bool NegotiateAssociation(AssociationParameters cp, ServerAssociationParameters sp) { foreach (DicomPresContext clientContext in cp.GetPresentationContexts()) { TransferSyntax selectedSyntax = null; foreach (DicomPresContext serverContext in sp.GetPresentationContexts()) { if (clientContext.AbstractSyntax.Uid.Equals(serverContext.AbstractSyntax.Uid)) { foreach (TransferSyntax ts in serverContext.GetTransfers()) { if (clientContext.HasTransfer(ts)) { selectedSyntax = ts; break; } } } if (selectedSyntax != null) { break; } } if (selectedSyntax != null) { clientContext.ClearTransfers(); clientContext.AddTransfer(selectedSyntax); clientContext.SetResult(DicomPresContextResult.Accept); } else { // No contexts accepted, set if abstract or transfer syntax reject clientContext.SetResult(0 == sp.FindAbstractSyntax(clientContext.AbstractSyntax) ? DicomPresContextResult.RejectAbstractSyntaxNotSupported : DicomPresContextResult.RejectTransferSyntaxesNotSupported); } } bool anyValidContexts = false; foreach (DicomPresContext clientContext in cp.GetPresentationContexts()) { if (clientContext.Result == DicomPresContextResult.Accept) { anyValidContexts = true; break; } } if (anyValidContexts == false) { return(false); } return(true); }
private DicomClient(AssociationParameters assoc, IDicomClientHandler handler) { _remoteEndPoint = assoc.RemoteEndPoint; _socket = null; _network = null; _closedEvent = null; _timeout = 10; _handler = handler; _assoc = assoc; }
protected override void OnReceiveAssociateAccept(AssociationParameters association) { try { _handler.OnReceiveAssociateAccept(this, association as ClientAssociationParameters); } catch (Exception e) { OnUserException(e, "Unexpected exception on OnReceiveAssociateAccept"); } }
public QueryAuditHelper(DicomAuditSource auditSource, EventIdentificationTypeEventOutcomeIndicator outcome, AssociationParameters parms) : base("Query") { AuditMessage.EventIdentification = new EventIdentificationType(); AuditMessage.EventIdentification.EventID = CodedValueType.Query; AuditMessage.EventIdentification.EventActionCode = EventIdentificationTypeEventActionCode.E; AuditMessage.EventIdentification.EventActionCodeSpecified = true; AuditMessage.EventIdentification.EventDateTime = Platform.Time.ToUniversalTime(); AuditMessage.EventIdentification.EventOutcomeIndicator = outcome; InternalAddActiveDicomParticipant(parms); InternalAddAuditSource(auditSource); }
/// <summary> /// Constructor. /// </summary> public DicomInstancesTransferredAuditHelper(DicomAuditSource auditSource, EventIdentificationTypeEventOutcomeIndicator outcome, EventIdentificationTypeEventActionCode action, AssociationParameters parms) : base("DicomInstancesTransferred") { AuditMessage.EventIdentification = new EventIdentificationType(); AuditMessage.EventIdentification.EventID = CodedValueType.DICOMInstancesTransferred; AuditMessage.EventIdentification.EventActionCode = action; AuditMessage.EventIdentification.EventActionCodeSpecified = true; AuditMessage.EventIdentification.EventDateTime = Platform.Time.ToUniversalTime(); AuditMessage.EventIdentification.EventOutcomeIndicator = outcome; InternalAddActiveDicomParticipant(parms); InternalAddAuditSource(auditSource); }
public BeginTransferringDicomInstancesAuditHelper(DicomAuditSource auditSource, EventIdentificationContentsEventOutcomeIndicator outcome, AssociationParameters parms, AuditPatientParticipantObject patient) : base("BeginTransferringDicomInstances") { AuditMessage.EventIdentification = new EventIdentificationContents(); AuditMessage.EventIdentification.EventID = EventID.BeginTransferringDICOMInstances; AuditMessage.EventIdentification.EventActionCode = EventIdentificationContentsEventActionCode.E; AuditMessage.EventIdentification.EventActionCodeSpecified = true; AuditMessage.EventIdentification.EventDateTime = Platform.Time.ToUniversalTime(); AuditMessage.EventIdentification.EventOutcomeIndicator = outcome; InternalAddAuditSource(auditSource); InternalAddActiveDicomParticipant(parms); InternalAddParticipantObject(patient.PatientId + patient.PatientsName, patient); }
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 AAssociateAC(AssociationParameters assoc) { _assoc = assoc; }
/// <summary> /// Event handlers called when association has been established. /// </summary> /// <param name="assoc">The association</param> protected void OnAssociationEstablished(AssociationParameters assoc) { if (_assocStats == null) _assocStats = new TransmissionStatistics(string.Format("DICOM association from {0} [{1}:{2}] to {3}", assoc.CallingAE, assoc.RemoteEndPoint.Address, assoc.RemoteEndPoint.Port, assoc.CalledAE)); // start recording _assocStats.Begin(); }
/// <summary> /// Event handler called while a DICOM message has been sent. /// </summary> /// <param name="assoc">The association</param> /// <param name="dcmMsg">The request DICOM message sent</param> private void OnDicomMessageSent( AssociationParameters assoc, DicomMessage dcmMsg) { if (_assocStats == null) return; // update the association stats _assocStats.IncomingBytes = assoc.TotalBytesRead; _assocStats.OutgoingBytes = assoc.TotalBytesSent; _assocStats.OutgoingMessages++; }
/// <summary> /// Event handler called when an association has been aborted. /// </summary> /// <param name="assoc">The aborted association</param> /// <param name="reason">The abort reason</param> protected void OnAssociationAborted(AssociationParameters assoc, DicomAbortReason reason) { if (_assocStats == null) return; // update the association statistics _assocStats.IncomingBytes = assoc.TotalBytesRead; _assocStats.OutgoingBytes = assoc.TotalBytesSent; // signal stop recording.. the statistic object will fill out whatever // it needs at this point based on what we have set _assocStats.End(); }
/// <summary> /// Event handler called when an association has been released. /// </summary> /// <param name="assoc">The association</param> protected void OnAssociationReleased(AssociationParameters assoc) { if (_assocStats == null) return; // update the association statistics _assocStats.IncomingBytes = assoc.TotalBytesRead; _assocStats.OutgoingBytes = assoc.TotalBytesSent; // signal stop recording.. the statistic object will fill out whatever // it needs at this point based on what we have set _assocStats.End(); if (_logInformation) StatisticsLogger.Log(LogLevel.Info, _assocStats); }
public QueryAuditHelper(DicomAuditSource auditSource, EventIdentificationContentsEventOutcomeIndicator outcome, AssociationParameters parms, string sopClassUid, DicomAttributeCollection msg) : base("Query") { AuditMessage.EventIdentification = new EventIdentificationContents() { EventID = EventID.Query, EventActionCode = EventIdentificationContentsEventActionCode.E, EventActionCodeSpecified = true, EventDateTime = Platform.Time.ToUniversalTime(), EventOutcomeIndicator = outcome }; InternalAddActiveDicomParticipant(parms); InternalAddAuditSource(auditSource); AuditQueryMessageParticipantObject o = new AuditQueryMessageParticipantObject(sopClassUid, msg); InternalAddParticipantObject("Query", o); }
/// <summary> /// Lookup the device entity in the database corresponding to the remote AE of the association. /// </summary> /// <param name="partition">The partition to look up the devices</param> /// <param name="association">The association</param> /// <param name="isNew">Indicates whether the device returned is created by the call.</param> /// <returns>The device record corresponding to the called AE of the association</returns> static public Device LookupDevice(ServerPartition partition, AssociationParameters association, out bool isNew) { isNew = false; Device device = null; using ( IUpdateContext updateContext = PersistentStoreRegistry.GetDefaultStore().OpenUpdateContext(UpdateContextSyncMode.Flush)) { var queryDevice = updateContext.GetBroker<IDeviceEntityBroker>(); // Setup the select parameters. var queryParameters = new DeviceSelectCriteria(); queryParameters.AeTitle.EqualTo(association.CallingAE); queryParameters.ServerPartitionKey.EqualTo(partition.GetKey()); var devices = queryDevice.Find(queryParameters); foreach (var d in devices) { if (string.Compare(d.AeTitle,association.CallingAE,false,CultureInfo.InvariantCulture) == 0) { device = d; break; } } if (device == null) { if (!partition.AcceptAnyDevice) { return null; } if (partition.AutoInsertDevice) { // Auto-insert a new entry in the table. var updateColumns = new DeviceUpdateColumns { AeTitle = association.CallingAE, Enabled = true, Description = String.Format("AE: {0}", association.CallingAE), Dhcp = false, IpAddress = association.RemoteEndPoint.Address.ToString(), ServerPartitionKey = partition.GetKey(), Port = partition.DefaultRemotePort, AllowQuery = true, AllowRetrieve = true, AllowStorage = true, ThrottleMaxConnections = ImageServerCommonConfiguration.Device.MaxConnections, DeviceTypeEnum = DeviceTypeEnum.Workstation }; var insert = updateContext.GetBroker<IDeviceEntityBroker>(); device = insert.Insert(updateColumns); updateContext.Commit(); isNew = true; } } if (device != null) { // For DHCP devices, we always update the remote ip address, if its changed from what is in the DB. if (device.Dhcp && !association.RemoteEndPoint.Address.ToString().Equals(device.IpAddress)) { var updateColumns = new DeviceUpdateColumns { IpAddress = association.RemoteEndPoint.Address.ToString(), LastAccessedTime = Platform.Time }; var update = updateContext.GetBroker<IDeviceEntityBroker>(); if (!update.Update(device.GetKey(), updateColumns)) Platform.Log(LogLevel.Error, "Unable to update IP Address for DHCP device {0} on partition '{1}'", device.AeTitle, partition.Description); else updateContext.Commit(); } else if (!isNew) { var updateColumns = new DeviceUpdateColumns {LastAccessedTime = Platform.Time}; var update = updateContext.GetBroker<IDeviceEntityBroker>(); if (!update.Update(device.GetKey(), updateColumns)) Platform.Log(LogLevel.Error, "Unable to update LastAccessedTime device {0} on partition '{1}'", device.AeTitle, partition.Description); else updateContext.Commit(); } } } return device; }
/// <summary> /// Connection to a remote DICOM application via TLS. /// </summary> /// <param name="assoc"></param> /// <param name="handler"></param> /// <returns></returns> public static DicomClient ConnectTLS(AssociationParameters assoc, IDicomClientHandler handler) { DicomClient client = new DicomClient(assoc, handler); client.ConnectTLS(); return client; }
protected override DicomPresContextResult OnVerifyAssociation(AssociationParameters association, byte pcid) { if (Device == null) return DicomPresContextResult.Accept; if (!Device.AllowStorage) { return DicomPresContextResult.RejectUser; } if (Device.AcceptKOPR) { DicomPresContext context = association.GetPresentationContext(pcid); if (context.AbstractSyntax.Equals(SopClass.KeyObjectSelectionDocumentStorage) ||context.AbstractSyntax.Equals(SopClass.GrayscaleSoftcopyPresentationStateStorageSopClass) ||context.AbstractSyntax.Equals(SopClass.BlendingSoftcopyPresentationStateStorageSopClass) ||context.AbstractSyntax.Equals(SopClass.ColorSoftcopyPresentationStateStorageSopClass) ||context.AbstractSyntax.Equals(SopClass.PseudoColorSoftcopyPresentationStateStorageSopClass)) return DicomPresContextResult.Accept; return DicomPresContextResult.RejectUser; } return DicomPresContextResult.Accept; }
/// <summary> /// Method used to send an association request. /// </summary> /// <param name="associate">The parameters used in the association request.</param> public void SendAssociateRequest(AssociationParameters associate) { _assoc = associate; var pdu = new AAssociateRQ(_assoc); State = DicomAssociationState.Sta5_AwaitingAAssociationACOrReject; EnqueuePdu(pdu.Write()); }
private bool ProcessRawPDU(RawPDU raw) { try { switch (raw.Type) { case 0x01: { _assoc = new ServerAssociationParameters(); var pdu = new AAssociateRQ(_assoc); pdu.Read(raw); State = DicomAssociationState.Sta3_AwaitingLocalAAssociationResponsePrimative; OnReceiveAssociateRequest(_assoc as ServerAssociationParameters); if (State != DicomAssociationState.Sta13_AwaitingTransportConnectionClose && State != DicomAssociationState.Sta6_AssociationEstablished) { Platform.Log(LogLevel.Error, "Association incorrectly not accepted or rejected, aborting."); return false; } //if derived class call SendAssociateAccept, it has fired this event //if (AssociationEstablished != null) // AssociationEstablished(_assoc); return true; } case 0x02: { var pdu = new AAssociateAC(_assoc); pdu.Read(raw); State = DicomAssociationState.Sta6_AssociationEstablished; OnReceiveAssociateAccept(_assoc); if (AssociationEstablished != null) AssociationEstablished(_assoc); return true; } case 0x03: { var pdu = new AAssociateRJ(); pdu.Read(raw); State = DicomAssociationState.Sta13_AwaitingTransportConnectionClose; if (AssociationRejected != null) AssociationRejected(pdu.Source, pdu.Reason); OnReceiveAssociateReject(pdu.Result, pdu.Source, pdu.Reason); return true; } case 0x04: { var pdu = new PDataTF(); pdu.Read(raw); return ProcessPDataTF(pdu); } case 0x05: { var pdu = new AReleaseRQ(); pdu.Read(raw); State = DicomAssociationState.Sta8_AwaitingAReleaseRPLocalUser; OnReceiveReleaseRequest(); return true; } case 0x06: { var pdu = new AReleaseRP(); pdu.Read(raw); State = DicomAssociationState.Sta13_AwaitingTransportConnectionClose; if (AssociationReleased != null) AssociationReleased(_assoc); OnReceiveReleaseResponse(); return true; } case 0x07: { var pdu = new AAbort(); pdu.Read(raw); State = DicomAssociationState.Sta1_Idle; if (AssociationAborted != null) AssociationAborted(_assoc, pdu.Reason); OnReceiveAbort(pdu.Source, pdu.Reason); return true; } case 0xFF: { Platform.Log(LogLevel.Error, "Unexpected PDU type: 0xFF. Potential parsing error."); return false; } default: throw new DicomNetworkException("Unknown PDU type"); } } catch (Exception e) { OnNetworkError(e, true); if (NetworkError != null) NetworkError(e); Platform.Log(LogLevel.Error, e, "Unexpected exception when processing PDU."); return false; } }
protected AssociationParameters(AssociationParameters parameters) { _appCtxNm = parameters._appCtxNm; _calledAe = parameters._calledAe; _callingAe = parameters._callingAe; _implClass = parameters._implClass; _implVersion = parameters._implVersion; _localEndPoint = parameters._localEndPoint; _localMaxPduLength = parameters._localMaxPduLength; _remoteMaxPduLength = parameters._remoteMaxPduLength; _readTimeout = parameters._readTimeout; _receiveBufferSize = parameters._receiveBufferSize; _remoteEndPoint = parameters._remoteEndPoint; _sendBufferSize = parameters._sendBufferSize; _writeTimeout = parameters._writeTimeout; _connectTimeout = parameters._connectTimeout; foreach (byte id in parameters._presContexts.Keys) { AddPresentationContext(id,parameters._presContexts[id].AbstractSyntax); foreach (TransferSyntax ts in parameters._presContexts[id].GetTransfers()) { AddTransferSyntax(id,ts); } SetRoleSelect(id, parameters._presContexts[id].GetRoleSelect()); } }
private void scu_NetworkError(object sender, AssociationParameters e) { MessageBox.Show("A network error has occurred"); }
protected void InternalAddActiveDicomParticipant(AssociationParameters parms) { if (parms is ClientAssociationParameters) { _participantList.Add( new AuditMessageActiveParticipant(CodedValueType.Source, "AETITLE=" + parms.CallingAE, null, null, parms.LocalEndPoint.Address.ToString(), NetworkAccessPointTypeEnum.IpAddress, null)); _participantList.Add( new AuditMessageActiveParticipant(CodedValueType.Destination, "AETITLE=" + parms.CalledAE, null, null, parms.RemoteEndPoint.Address.ToString(), NetworkAccessPointTypeEnum.IpAddress, null)); } else { _participantList.Add( new AuditMessageActiveParticipant(CodedValueType.Source, "AETITLE=" + parms.CallingAE, null, null, parms.RemoteEndPoint.Address.ToString(), NetworkAccessPointTypeEnum.IpAddress, null)); _participantList.Add( new AuditMessageActiveParticipant(CodedValueType.Destination, "AETITLE=" + parms.CalledAE, null,null, parms.LocalEndPoint.Address.ToString(), NetworkAccessPointTypeEnum.IpAddress, null)); } }
private static bool NegotiateAssociation(AssociationParameters cp, ServerAssociationParameters sp) { foreach (DicomPresContext clientContext in cp.GetPresentationContexts()) { TransferSyntax selectedSyntax = null; foreach (DicomPresContext serverContext in sp.GetPresentationContexts()) { if (clientContext.AbstractSyntax.Uid.Equals(serverContext.AbstractSyntax.Uid)) { foreach (TransferSyntax ts in serverContext.GetTransfers()) { if (clientContext.HasTransfer(ts)) { selectedSyntax = ts; break; } } } if (selectedSyntax != null) break; } if (selectedSyntax != null) { clientContext.ClearTransfers(); clientContext.AddTransfer(selectedSyntax); clientContext.SetResult(DicomPresContextResult.Accept); } else { // No contexts accepted, set if abstract or transfer syntax reject clientContext.SetResult(0 == sp.FindAbstractSyntax(clientContext.AbstractSyntax) ? DicomPresContextResult.RejectAbstractSyntaxNotSupported : DicomPresContextResult.RejectTransferSyntaxesNotSupported); } } bool anyValidContexts = false; foreach (DicomPresContext clientContext in cp.GetPresentationContexts()) { if (clientContext.Result == DicomPresContextResult.Accept) { anyValidContexts = true; break; } } if (anyValidContexts == false) { return false; } return true; }
protected AssociationParameters(AssociationParameters parameters) { DisableNagle = NetworkSettings.Default.DisableNagle; RemoteMaxOperationsPerformed = 1; RemoteMaxOperationsInvoked = 1; TotalDimseReceived = 0; TotalBytesSent = 0; TotalBytesRead = 0; ApplicationContextName = parameters.ApplicationContextName; CalledAE = parameters.CalledAE; CallingAE = parameters.CallingAE; ImplementationClass = parameters.ImplementationClass; ImplementationVersion = parameters.ImplementationVersion; LocalEndPoint = parameters.LocalEndPoint; LocalMaximumPduLength = parameters.LocalMaximumPduLength; RemoteMaximumPduLength = parameters.RemoteMaximumPduLength; ReadTimeout = parameters.ReadTimeout; ReceiveBufferSize = parameters.ReceiveBufferSize; RemoteEndPoint = parameters.RemoteEndPoint; SendBufferSize = parameters.SendBufferSize; WriteTimeout = parameters.WriteTimeout; ConnectTimeout = parameters.ConnectTimeout; foreach (byte id in parameters._presContexts.Keys) { AddPresentationContext(id,parameters._presContexts[id].AbstractSyntax); foreach (TransferSyntax ts in parameters._presContexts[id].GetTransfers()) { AddTransferSyntax(id,ts); } SetRoleSelect(id, parameters._presContexts[id].GetRoleSelect()); } }
protected virtual void OnReceiveAssociateAccept(AssociationParameters association) { }
/// <summary> /// Helper method for logging audit information. /// </summary> /// <param name="parms"></param> /// <param name="outcome"></param> /// <param name="msg">The query message to be audited</param> private static void AuditLog(AssociationParameters parms, EventIdentificationContentsEventOutcomeIndicator outcome, DicomMessage msg) { try { var helper = new QueryAuditHelper(ServerPlatform.AuditSource, outcome, parms, msg.AffectedSopClassUid, msg.DataSet); ServerPlatform.LogAuditMessage(helper); } catch (Exception e) { Platform.Log(LogLevel.Warn, "Unexpected exception logging DICOM Query audit message: {0}", e.Message); } }
/// <summary> /// Method to send an association accept. /// </summary> /// <param name="associate">The parameters to use for the association accept.</param> public void SendAssociateAccept(AssociationParameters associate) { if (State != DicomAssociationState.Sta3_AwaitingLocalAAssociationResponsePrimative) { Platform.Log(LogLevel.Error, "Error attempting to send association accept at invalid time in association."); SendAssociateAbort(DicomAbortSource.ServiceProvider, DicomAbortReason.NotSpecified); throw new DicomNetworkException( "Attempting to send association accept at invalid time in association, aborting"); } var pdu = new AAssociateAC(_assoc); EnqueuePdu(pdu.Write()); State = DicomAssociationState.Sta6_AssociationEstablished; if (AssociationEstablished != null) AssociationEstablished(_assoc); }
protected override DicomPresContextResult OnVerifyAssociation(AssociationParameters association, byte pcid) { if (!Device.AllowQuery) { return DicomPresContextResult.RejectUser; } return DicomPresContextResult.Accept; }