private void StartListeners(ServerPartition part) { var parms = new DicomScpContext(part); //TODO support IPV6 var scp = new DicomScp <DicomScpContext>(parms, CreateVerify) { ListenPort = part.Port, AeTitle = part.AeTitle }; if (scp.Start(IPAddress.Any)) { _listenerList.Add(scp); LogAdapter.Logger.InfoWithFormat("Start listen on {0} for server partition {1}", part.Port, part.Description); } else { LogAdapter.Logger.InfoWithFormat("Unable to listen on {0} for server partition {1}", part.Port, part.Description); LogAdapter.Logger.InfoWithFormat("Unable to listen on {0} for server partition {1}", part.Port, part.Description); } }
/// <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); }
protected virtual bool CreateVerify(DicomScpContext context, ServerAssociationParameters assocParms, out DicomRejectResult result, out DicomRejectReason reason) { return(AssociationVerifier.Verify(context, assocParms, out result, out reason)); }