/// <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; }
private void StartListeners(ServerPartition part) { var parms = new DicomScpContext(part); //TODO support IPV6 var scp = new DicomScp<DicomScpContext>(parms, AssociationVerifier.Verify) { ListenPort = part.Port, AeTitle = part.AeTitle }; if (scp.Start(IPAddress.Any)) { _listenerList.Add(scp); Platform.Log(LogLevel.Info, "Start listen on {0} for server partition {1}", part.Port, part.Description); } else { Platform.Log(LogLevel.Error, "Unable to listen on {0} for server partition {1}", part.Port, part.Description); Platform.Log(LogLevel.Error, "Partition {0} will not accept any DICOM associations", part.Description); } }