DCMTK Version 3.6.8
OFFIS DICOM Toolkit
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. More...
 
virtual ~DcmThreadSCP ()
 Virtual destructor, frees internal memory.
 
virtual OFCondition run (T_ASC_Association *incomingAssoc)
 Handle an already established (on TCP/IP level) connection. More...
 
virtual DcmSharedSCPConfiggetSharedConfig ()
 Get access to the DcmSharedSCPConfig object. More...
 
virtual OFCondition setSharedConfig (const DcmSharedSCPConfig &config)
 Set the DcmSharedSCPConfig object to use for configuring this DcmSCP object. More...
 
- Public Member Functions inherited from DcmSCP
 DcmSCP ()
 Constructor. More...
 
virtual ~DcmSCP ()
 Virtual destructor, frees internal memory.
 
virtual OFCondition listen ()
 Starts providing the implemented services to SCUs. More...
 
virtual OFCondition openListenPort ()
 Alternative interface to providing the implemented services to SCUs. More...
 
virtual OFCondition acceptAssociations ()
 Alternative interface to providing the implemented services to SCUs. More...
 
OFCondition setEnableVerification (const OFString &profile="DEFAULT")
 Enables negotiation of the Verification SOP Class. More...
 
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. More...
 
void setPort (const Uint16 port)
 Set SCP's TCP/IP listening port. More...
 
void setAETitle (const OFString &aetitle)
 Set AE title of the server. More...
 
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. More...
 
virtual OFCondition loadAssociationCfgFile (const OFString &assocFile)
 Loads association configuration file. More...
 
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. More...
 
void forceAssociationRefuse (const OFBool doRefuse)
 Force every association request to be refused by SCP, no matter what the SCU is offering. More...
 
void setMaxReceivePDULength (const Uint32 maxRecPDU)
 Set maximum PDU size the SCP is able to receive. More...
 
void setConnectionBlockingMode (const DUL_BLOCKOPTIONS blockingMode)
 Set whether waiting for a TCP/IP connection should be blocking or non-blocking. More...
 
void setDIMSEBlockingMode (const T_DIMSE_BlockingMode blockingMode)
 Set whether DIMSE messaging should be blocking or non-blocking. More...
 
void setDIMSETimeout (const Uint32 dimseTimeout)
 Set the timeout to be waited for incoming DIMSE message packets. More...
 
void setACSETimeout (const Uint32 acseTimeout)
 Set the timeout used during ACSE messaging protocol. More...
 
void setConnectionTimeout (const Uint32 timeout)
 Set the timeout that should be waited for connection requests. More...
 
void setVerbosePCMode (const OFBool mode)
 Set whether to show presentation contexts in verbose or debug mode. More...
 
void setHostLookupEnabled (const OFBool mode)
 Enables or disables looking up the host name from a connecting system. More...
 
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. More...
 
void setAlwaysAcceptDefaultRole (const OFBool enabled)
 Option to always accept a default role as association acceptor. More...
 
Uint16 getPort () const
 Returns TCP/IP port number SCP listens for new connection requests. More...
 
const OFStringgetAETitle () const
 Returns SCP's own AE title. More...
 
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. More...
 
OFBool getRefuseAssociation () const
 Returns whether SCP should refuse any association request no matter what the SCU proposes. More...
 
Uint32 getMaxReceivePDULength () const
 Returns maximum PDU length configured to be received by SCP. More...
 
DUL_BLOCKOPTIONS getConnectionBlockingMode () const
 Returns whether receiving of TCP/IP connection requests is done in blocking or unblocking mode. More...
 
T_DIMSE_BlockingMode getDIMSEBlockingMode () const
 Returns whether receiving of DIMSE messages is done in blocking or unblocking mode. More...
 
Uint32 getDIMSETimeout () const
 Returns DIMSE timeout (only applicable in blocking mode) More...
 
Uint32 getACSETimeout () const
 Returns ACSE timeout. More...
 
Uint32 getConnectionTimeout () const
 Returns connection timeout. More...
 
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. More...
 
OFBool getHostLookupEnabled () const
 Returns whether a connecting system's host name is looked up. More...
 
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. More...
 
virtual DcmSCPConfiggetConfig ()
 Get access to the configuration of the SCP. More...
 
virtual OFCondition setConfig (const DcmSCPConfig &config)
 Set the DcmSCPConfig object to use for configuring this DcmSCP object. More...
 
OFBool isConnected () const
 Returns whether SCP is currently connected. More...
 
Uint16 numAssociations () const
 Returns number of associations currently running. More...
 
OFString getCalledAETitle () const
 Returns AE title the SCU used as called AE title in association request. More...
 
OFString getPeerAETitle () const
 Returns AE title (calling AE title) the SCU used for association request. More...
 
OFString getPeerIP () const
 Returns IP address of connected SCU. More...
 
Uint32 getPeerMaxPDULength () const
 Returns maximum PDU size the communication peer (i.e. the SCU) is able to receive. More...
 

Private Member Functions

 DcmThreadSCP (const DcmThreadSCP &src)
 Private undefined copy constructor. More...
 
DcmThreadSCPoperator= (const DcmThreadSCP &src)
 Private undefined assignment operator. More...
 

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. More...
 
virtual OFCondition abortAssociation ()
 Aborts the current association by sending an A-ABORT request to the SCU. More...
 
virtual OFCondition handleIncomingCommand (T_DIMSE_Message *incomingMsg, const DcmPresentationContextInfo &presInfo)
 Handle incoming command set and react accordingly, e.g. sending response via DIMSE_sendXXXResponse(). More...
 
virtual void notifyAssociationRequest (const T_ASC_Parameters &params, DcmSCPActionType &desiredAction)
 Overwrite this function to be notified about an incoming association request. More...
 
virtual OFBool checkCalledAETitleAccepted (const OFString &calledAE)
 Overwrite this function if called AE title should undergo custom checking. More...
 
virtual OFBool checkCallingAETitleAccepted (const OFString &callingAE)
 Overwrite this function if calling AE title should undergo checking. More...
 
virtual OFBool checkCallingHostAccepted (const OFString &hostOrIP)
 Overwrite this function if calling IP / host name should undergo checking. More...
 
virtual void notifyAssociationAcknowledge ()
 Overwrite this function to be notified about an incoming association request. More...
 
virtual void notifyReleaseRequest ()
 Overwrite this function to be notified about an incoming association release request. More...
 
virtual void notifyAbortRequest ()
 Overwrite this function to be notified about an incoming association abort request. More...
 
virtual void notifyAssociationTermination ()
 Overwrite this function to be notified when an association is terminated. More...
 
virtual void notifyConnectionTimeout ()
 Overwrite this function to be notified about a connection timeout in non-blocking mode (see setConnectionBlockingMode() and setConnectionTimeout() methods). More...
 
virtual void notifyDIMSEError (const OFCondition &cond)
 Overwrite this function to be notified when a DIMSE error occurs. More...
 
virtual void notifySENDProgress (const unsigned long byteCount)
 This function is called while sending DIMSE messages, i.e. on each PDV of a dataset. More...
 
virtual void notifyRECEIVEProgress (const unsigned long byteCount)
 This function is called while receiving DIMSE messages, i.e. on each PDV of a dataset. More...
 
virtual OFBool stopAfterCurrentAssociation ()
 This method can be used to return from the listen() loop in a controlled way. More...
 
virtual OFBool stopAfterConnectionTimeout ()
 This method can be used to return from the listen() loop in a controlled way. More...
 
virtual OFCondition handleECHORequest (T_DIMSE_C_EchoRQ &reqMessage, const T_ASC_PresentationContextID presID)
 Standard handler for Verification Service Class (DICOM Echo). More...
 
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. More...
 
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). More...
 
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). More...
 
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) More...
 
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) More...
 
virtual Uint16 checkSTORERequest (T_DIMSE_C_StoreRQ &reqMessage, DcmDataset *reqDataset)
 Check given C-STORE request and dataset for validity. More...
 
virtual OFCondition receiveFINDRequest (T_DIMSE_C_FindRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset)
 Receive C-FIND request. More...
 
virtual OFCondition handleFINDRequest (T_DIMSE_C_FindRQ &reqMessage, const T_ASC_PresentationContextID presID, DcmDataset *&reqDataset)
 Handle C-FIND request. More...
 
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. More...
 
virtual OFCondition checkForCANCEL (T_ASC_PresentationContextID presID, const Uint16 messageID)
 Check for C-CANCEL. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual Uint16 checkEVENTREPORTRequest (T_DIMSE_N_EventReportRQ &reqMessage, DcmDataset *reqDataset)
 Check given N-EVENT-REPORT request and dataset for validity. More...
 
virtual OFCondition waitForAssociationRQ (T_ASC_Network *network)
 This function takes care of receiving, negotiating and accepting/refusing an association request. More...
 
virtual OFCondition processAssociationRQ ()
 Actually process association request. More...
 
virtual OFCondition negotiateAssociation ()
 This function checks all presentation contexts proposed by the SCU whether they are supported or not. More...
 
virtual void refuseAssociation (const DcmRefuseReasonType reason)
 This function takes care of refusing an association request. More...
 
virtual void handleAssociation ()
 This function takes care of handling the other DICOM application's request. More...
 
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. More...
 
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. More...
 
OFCondition receiveDIMSEDataset (T_ASC_PresentationContextID *presID, DcmDataset **dataObject)
 Receive one dataset (of instance data) via network from another DICOM application. More...
 
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) More...
 
- Static Protected Member Functions inherited from DcmSCP
static DUL_PRESENTATIONCONTEXTfindPresentationContextID (LST_HEAD *head, T_ASC_PresentationContextID presentationContextID)
 Helper function to return presentation context information by given presentation context ID. More...
 
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. More...
 
static OFBool addStatusDetail (DcmDataset **statusDetail, const DcmElement *elem)
 Add given element to existing status detail object or create new one. More...
 
static void callbackSENDProgress (void *callbackContext, unsigned long byteCount)
 Callback function used for sending DIMSE messages. More...
 
static void callbackRECEIVEProgress (void *callbackContext, unsigned long byteCount)
 Callback function used for receiving DIMSE messages. More...
 

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.

◆ DcmThreadSCP() [2/2]

DcmThreadSCP::DcmThreadSCP ( const DcmThreadSCP src)
private

Private undefined copy constructor.

Shall never be called.

Parameters
srcSource object

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
srcSource object
Returns
Reference to this

◆ 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
incomingAssocthe 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
configSet 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:


Generated on Tue Dec 19 2023 for DCMTK Version 3.6.8 by Doxygen 1.9.4