DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
DcmThreadSCP Class Reference

Base class for implementing a DICOM Service Class Provider (SCP) that can serve as a worker in a thread pool, by offering functionality to run an association from an already accepted TCP/IP connection. More...

Inheritance diagram for DcmThreadSCP:

## Public Member Functions
| DcmThreadSCP ()
| Constructor.
virtual | ~DcmThreadSCP ()
| Virtual destructor, frees internal memory.
virtual OFCondition | run (T_ASC_Association *incomingAssoc)
| Handle an already established (on TCP/IP level) connection.
virtual DcmSharedSCPConfig & | getSharedConfig ()
| Get access to the DcmSharedSCPConfig object.
virtual OFCondition | setSharedConfig (const DcmSharedSCPConfig &config)
| Set the DcmSharedSCPConfig object to use for configuring this DcmSCP object.
Public Member Functions inherited from DcmSCP
| DcmSCP ()
| Constructor.
virtual | ~DcmSCP ()
| Virtual destructor, frees internal memory.
virtual OFCondition | listen ()
| Starts providing the implemented services to SCUs.
virtual OFCondition | openListenPort ()
| Alternative interface to providing the implemented services to SCUs.
virtual OFCondition | acceptAssociations ()
| Alternative interface to providing the implemented services to SCUs.
OFCondition | setEnableVerification (const OFString &profile="DEFAULT")
| Enables negotiation of the Verification SOP Class.
virtual OFCondition | addPresentationContext (const OFString &abstractSyntax, const OFList< OFString > &xferSyntaxes, const T_ASC_SC_ROLE requestorRole=ASC_SC_ROLE_DEFAULT, const OFString &profile="DEFAULT")
| Add abstract syntax to presentation contexts the SCP is able to negotiate with SCUs.
void | setPort (const Uint16 port)
| Set SCP's TCP/IP listening port.
void | setAETitle (const OFString &aetitle)
| Set AE title of the server.
void | setRespondWithCalledAETitle (const OFBool useCalled)
| Set SCP to use the called AE title from the SCU request for the response, i.e. the SCP will always respond with setting it's own name to the one the SCU used for calling.
virtual OFCondition | loadAssociationCfgFile (const OFString &assocFile)
| Loads association configuration file.
virtual OFCondition | setAndCheckAssociationProfile (const OFString &profileName)
| If an association profile should be selected, either by loading an association configuration file or using the addPresentationContext() function, one of those can be selected and checked for validity using this method.
void | forceAssociationRefuse (const OFBool doRefuse)
| Force every association request to be refused by SCP, no matter what the SCU is offering.
void | setMaxReceivePDULength (const Uint32 maxRecPDU)
| Set maximum PDU size the SCP is able to receive.
void | setConnectionBlockingMode (const DUL_BLOCKOPTIONS blockingMode)
| Set whether waiting for a TCP/IP connection should be blocking or non-blocking.
void | setDIMSEBlockingMode (const T_DIMSE_BlockingMode blockingMode)
| Set whether DIMSE messaging should be blocking or non-blocking.
void | setDIMSETimeout (const Uint32 dimseTimeout)
| Set the timeout to be waited for incoming DIMSE message packets.
void | setACSETimeout (const Uint32 acseTimeout)
| Set the timeout used during ACSE messaging protocol.
void | setConnectionTimeout (const Uint32 timeout)
| Set the timeout that should be waited for connection requests.
void | setVerbosePCMode (const OFBool mode)
| Set whether to show presentation contexts in verbose or debug mode.
void | setHostLookupEnabled (const OFBool mode)
| Enables or disables looking up the host name from a connecting system.
void | setProgressNotificationMode (const OFBool mode)
| Set the mode that specifies whether the progress of sending and receiving DIMSE messages is notified by calling notifySENDProgress() and notifyRECEIVEProgress(), respectively.
void | setAlwaysAcceptDefaultRole (const OFBool enabled)
| Option to always accept a default role as association acceptor.
Uint16 | getPort () const
| Returns TCP/IP port number SCP listens for new connection requests.
const OFString & | getAETitle () const
| Returns SCP's own AE title.
OFBool | getRespondWithCalledAETitle () const
| Returns whether SCP uses the called AE title from SCU requests to respond to connection requests instead of a configured AE title.
OFBool | getRefuseAssociation () const
| Returns whether SCP should refuse any association request no matter what the SCU proposes.
Uint32 | getMaxReceivePDULength () const
| Returns maximum PDU length configured to be received by SCP.
DUL_BLOCKOPTIONS | getConnectionBlockingMode () const
| Returns whether receiving of TCP/IP connection requests is done in blocking or unblocking mode.
T_DIMSE_BlockingMode | getDIMSEBlockingMode () const
| Returns whether receiving of DIMSE messages is done in blocking or unblocking mode.
Uint32 | getDIMSETimeout () const
| Returns DIMSE timeout (only applicable in blocking mode)
Uint32 | getACSETimeout () const
| Returns ACSE timeout.
Uint32 | getConnectionTimeout () const
| Returns connection timeout.
OFBool | getVerbosePCMode () const
| Returns the verbose presentation context mode configured specifying whether details on the presentation contexts (negotiated during association setup) should be shown in verbose or debug mode.
OFBool | getHostLookupEnabled () const
| Returns whether a connecting system's host name is looked up.
OFBool | getProgressNotificationMode () const
| Returns the mode that specifies whether the progress of sending and receiving DIMSE messages is notified by calling notifySENDProgress() and notifyRECEIVEProgress(), respectively.
virtual DcmSCPConfig & | getConfig ()
| Get access to the configuration of the SCP.
virtual OFCondition | setConfig (const DcmSCPConfig &config)
| Set the DcmSCPConfig object to use for configuring this DcmSCP object.
OFBool | isConnected () const
| Returns whether SCP is currently connected.
Uint16 | numAssociations () const
| Returns number of associations currently running.
OFString | getCalledAETitle () const
| Returns AE title the SCU used as called AE title in association request.
OFString | getPeerAETitle () const
| Returns AE title (calling AE title) the SCU used for association request.
OFString | getPeerIP () const
| Returns IP address of connected SCU.
Uint32 | getPeerMaxPDULength () const
| Returns maximum PDU size the communication peer (i.e. the SCU) is able to receive.

## Private Member Functions
| DcmThreadSCP (const DcmThreadSCP &src)
| Private undefined copy constructor.
DcmThreadSCP & | operator= (const DcmThreadSCP &src)
| Private undefined assignment operator.

## Additional Inherited Members
Protected Member Functions inherited from DcmSCP
void | findPresentationContext (const T_ASC_PresentationContextID presID, OFString &abstractSyntax, OFString &transferSyntax)
| This call returns the presentation context belonging to the given presentation context ID.
virtual OFCondition | abortAssociation ()
| Aborts the current association by sending an A-ABORT request to the SCU.
virtual OFCondition | handleIncomingCommand (T_DIMSE_Message *incomingMsg, const DcmPresentationContextInfo &presInfo)
| Handle incoming command set and react accordingly, e.g. sending response via DIMSE_sendXXXResponse().
virtual void | notifyAssociationRequest (const T_ASC_Parameters &params, DcmSCPActionType &desiredAction)
| Overwrite this function to be notified about an incoming association request.
virtual OFBool | checkCalledAETitleAccepted (const OFString &calledAE)
| Overwrite this function if called AE title should undergo custom checking.
virtual OFBool | checkCallingAETitleAccepted (const OFString &callingAE)
| Overwrite this function if calling AE title should undergo checking.
virtual OFBool | checkCallingHostAccepted (const OFString &hostOrIP)
| Overwrite this function if calling IP / host name should undergo checking.
virtual void | notifyAssociationAcknowledge ()
| Overwrite this function to be notified about an incoming association request.
virtual void | notifyReleaseRequest ()
| Overwrite this function to be notified about an incoming association release request.
virtual void | notifyAbortRequest ()
| Overwrite this function to be notified about an incoming association abort request.
virtual void | notifyAssociationTermination ()
| Overwrite this function to be notified when an association is terminated.
virtual void | notifyConnectionTimeout ()
| Overwrite this function to be notified about a connection timeout in non-blocking mode (see setConnectionBlockingMode() and setConnectionTimeout() methods).
virtual void | notifyDIMSEError (const OFCondition &cond)
| Overwrite this function to be notified when a DIMSE error occurs.
virtual void | notifySENDProgress (const unsigned long byteCount)
| This function is called while sending DIMSE messages, i.e. on each PDV of a dataset.
virtual void | notifyRECEIVEProgress (const unsigned long byteCount)
| This function is called while receiving DIMSE messages, i.e. on each PDV of a dataset.
virtual OFBool | stopAfterCurrentAssociation ()
| This method can be used to return from the listen() loop in a controlled way.
virtual OFBool | stopAfterConnectionTimeout ()
| This method can be used to return from the listen() loop in a controlled way.
virtual OFCondition | handleECHORequest (T_DIMSE_C_EchoRQ &reqMessage, const T_ASC_PresentationContextID presID)
| Standard handler for Verification Service Class (DICOM Echo).
virtual OFCondition | handleSTORERequest (T_DIMSE_C_StoreRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset)
| Receive C-STORE request on the currently opened association, store the accompanying dataset in memory and send a corresponding response.
virtual OFCondition | receiveSTORERequest (T_DIMSE_C_StoreRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset)
| Receive C-STORE request (and store accompanying dataset in memory).
virtual OFCondition | receiveSTORERequest (T_DIMSE_C_StoreRQ &reqMessage, const T_ASC_PresentationContextID presID, const OFString &filename)
| Receive C-STORE request (and store accompanying dataset directly to file).
virtual OFCondition | sendSTOREResponse (const T_ASC_PresentationContextID presID, const T_DIMSE_C_StoreRQ &reqMessage, const Uint16 rspStatusCode)
| Respond to the C-STORE request (with details from the request message)
virtual OFCondition | sendSTOREResponse (const T_ASC_PresentationContextID presID, const Uint16 messageID, const OFString &sopClassUID, const OFString &sopInstanceUID, const Uint16 rspStatusCode, DcmDataset *statusDetail=NULL)
| Respond to the C-STORE request (with given details)
virtual Uint16 | checkSTORERequest (T_DIMSE_C_StoreRQ &reqMessage, DcmDataset *reqDataset)
| Check given C-STORE request and dataset for validity.
virtual OFCondition | receiveFINDRequest (T_DIMSE_C_FindRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset)
| Receive C-FIND request.
virtual OFCondition | handleFINDRequest (T_DIMSE_C_FindRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset)
| Handle C-FIND request.
virtual OFCondition | sendFINDResponse (const T_ASC_PresentationContextID presID, const Uint16 messageID, const OFString &sopClassUID, DcmDataset *rspDataset, const Uint16 rspStatusCode, DcmDataset *statusDetail=NULL)
| Respond to the C-FIND request.
virtual OFCondition | checkForCANCEL (T_ASC_PresentationContextID presID, const Uint16 messageID)
| Check for C-CANCEL.
virtual OFCondition | receiveMOVERequest (T_DIMSE_C_MoveRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset, OFString &moveDest)
| Receive C-MOVE request on the currently active association.
virtual OFCondition | handleMOVERequest (T_DIMSE_C_MoveRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset, OFString &moveDest)
| Receive C-MOVE request on the currently active association.
virtual OFCondition | sendMOVEResponse (const T_ASC_PresentationContextID presID, const Uint16 messageID, const OFString &sopClassUID, DcmDataset *rspDataset, const Uint16 rspStatusCode, DcmDataset *statusDetail=NULL, const Uint16 numRemain=0, const Uint16 numComplete=0, const Uint16 numFail=0, const Uint16 numWarn=0)
| Respond to the C-MOVE request.
virtual OFCondition | receiveACTIONRequest (T_DIMSE_N_ActionRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset, Uint16 &actionTypeID)
| Receive N-ACTION request on the currently opened association.
virtual OFCondition | handleACTIONRequest (T_DIMSE_N_ActionRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset, Uint16 &actionTypeID)
| Receive N-ACTION request on the currently opened association.
virtual OFCondition | sendACTIONResponse (const T_ASC_PresentationContextID presID, const Uint16 messageID, const OFString &sopClassUID, const OFString &sopInstanceUID, const Uint16 rspStatusCode)
| Respond to the N-ACTION request.
virtual OFCondition | handleEVENTREPORTRequest (T_DIMSE_N_EventReportRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset, Uint16 &eventTypeID)
| Receive N-EVENT-REPORT request on the currently opened association and send a corresponding response.
virtual OFCondition | sendEVENTREPORTRequest (const T_ASC_PresentationContextID presID, const OFString &sopInstanceUID, const Uint16 messageID, const Uint16 eventTypeID, DcmDataset *reqDataset, Uint16 &rspStatusCode)
| Send N-EVENT-REPORT request on the current association and receive a corresponding response.
virtual Uint16 | checkEVENTREPORTRequest (T_DIMSE_N_EventReportRQ &reqMessage, DcmDataset *reqDataset)
| Check given N-EVENT-REPORT request and dataset for validity.
virtual OFCondition | waitForAssociationRQ (T_ASC_Network *network)
| This function takes care of receiving, negotiating and accepting/refusing an association request.
virtual OFCondition | processAssociationRQ ()
| Actually process association request.
virtual OFCondition | negotiateAssociation ()
| This function checks all presentation contexts proposed by the SCU whether they are supported or not.
virtual void | refuseAssociation (const DcmRefuseReasonType reason)
| This function takes care of refusing an association request.
virtual void | handleAssociation ()
| This function takes care of handling the other DICOM application's request.
OFCondition | sendDIMSEMessage (const T_ASC_PresentationContextID presID, T_DIMSE_Message *message, DcmDataset *dataObject, DcmDataset *statusDetail=NULL, DcmDataset **commandSet=NULL)
| Send a DIMSE command and possibly also a dataset from a data object via network to another DICOM application.
OFCondition | receiveDIMSECommand (T_ASC_PresentationContextID *presID, T_DIMSE_Message *message, DcmDataset **statusDetail, DcmDataset **commandSet=NULL, const Uint32 timeout=0)
| Receive DIMSE command (excluding dataset!) over the currently open association.
OFCondition | receiveDIMSEDataset (T_ASC_PresentationContextID *presID, DcmDataset **dataObject)
| Receive one dataset (of instance data) via network from another DICOM application.
OFCondition | receiveSTORERequestDataset (T_ASC_PresentationContextID *presID, T_DIMSE_C_StoreRQ &reqMessage, const OFString &filename)
| Receive one C-STORE request dataset via network from another DICOM application and store it directly to file (i.e. exactly as received without any conversions)
Static Protected Member Functions inherited from DcmSCP
static DUL_PRESENTATIONCONTEXT * | findPresentationContextID (LST_HEAD *head, T_ASC_PresentationContextID presentationContextID)
| Helper function to return presentation context information by given presentation context ID.
static OFBool | getPresentationContextInfo (const T_ASC_Association *assoc, const Uint8 presID, DcmPresentationContextInfo &presInfo)
| Helper function to return presentation context information by given presentation context ID.
static OFBool | addStatusDetail (DcmDataset **statusDetail, const DcmElement *elem)
| Add given element to existing status detail object or create new one.
static void | callbackSENDProgress (void *callbackContext, unsigned long byteCount)
| Callback function used for sending DIMSE messages.
static void | callbackRECEIVEProgress (void *callbackContext, unsigned long byteCount)
| Callback function used for receiving DIMSE messages.

## Detailed Description

Base class for implementing a DICOM Service Class Provider (SCP) that can serve as a worker in a thread pool, by offering functionality to run an association from an already accepted TCP/IP connection.

Warning
  This class is EXPERIMENTAL. Be careful to use it in production environment.

## Constructor & Destructor Documentation

## ◆ DcmThreadSCP() [1/2]

DcmThreadSCP::DcmThreadSCP | ( |  | ) |

Constructor.

Initializes internal member variables.

Referenced by DcmThreadSCP(), and operator=().

## ◆ DcmThreadSCP() [2/2]

DcmThreadSCP::DcmThreadSCP | ( | const DcmThreadSCP & | src | ) |
| private

Private undefined copy constructor.

Shall never be called.

Parameters

  src | Source object

References DcmThreadSCP().

## Member Function Documentation

## ◆ getSharedConfig()

virtual DcmSharedSCPConfig & DcmThreadSCP::getSharedConfig | ( |  | ) |
| virtual

Get access to the DcmSharedSCPConfig object.

The shared configuration can be used to provide other SCPs with the same configuration without the need to copy it.

Returns
  a reference to the DcmSharedSCPConfig object used by this DcmSCP object.

## ◆ operator=()

DcmThreadSCP & DcmThreadSCP::operator= | ( | const DcmThreadSCP & | src | ) |
| private

Private undefined assignment operator.

Shall never be called.

Parameters

  src | Source object

Returns
  Reference to this

References DcmThreadSCP().

## ◆ run()

virtual OFCondition DcmThreadSCP::run | ( | T_ASC_Association * | incomingAssoc | ) |
| virtual

Handle an already established (on TCP/IP level) connection.

This function is used when in a thread pool context where a central thread receives TCP/IP connections and starts a DcmSCP worker in order to handle the rest of the connection (DICOM negotiation and DIMSE messaging).

Parameters

  incomingAssoc | the association of the connection.

Returns
  If listening fails, e.g. because the given association is not valid or any serious network error occurs, an error is reported. In all other cases, e.g. no presentation contexts could be negotiated with the requesting SCU, then EC_Normal is returned.

## ◆ setSharedConfig()

virtual OFCondition DcmThreadSCP::setSharedConfig | ( | const DcmSharedSCPConfig & | config | ) |
| virtual

Set the DcmSharedSCPConfig object to use for configuring this DcmSCP object.

Parameters

  config | Set the shared configuration to be used (no deep copy is performed).

Returns
  EC_Normal if configuration can be used, error code otherwise.

The documentation for this class was generated from the following file:

- dcmnet/include/dcmtk/dcmnet/scpthrd.h

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2