33 #include "dcmtk/config/osconfig.h"
35 #include "dcmtk/oflog/oflog.h"
36 #include "dcmtk/dcmdata/dctk.h"
37 #include "dcmtk/dcmnet/dimse.h"
38 #include "dcmtk/dcmnet/dcasccff.h"
39 #include "dcmtk/dcmnet/dcasccfg.h"
46 #include "dcmtk/dcmtls/tlstrans.h"
47 #include "dcmtk/dcmtls/tlslayer.h"
75 DCMSCP_ACTION_UNDEFINED,
77 DCMSCP_ACTION_REFUSE_ASSOCIATION
82 enum DcmRefuseReasonType
85 DCMSCP_TOO_MANY_ASSOCIATIONS,
89 DCMSCP_BAD_APPLICATION_CONTEXT_NAME,
91 DCMSCP_BAD_APPLICATION_ENTITY_SERVICE,
95 DCMSCP_NO_IMPLEMENTATION_CLASS_UID,
97 DCMSCP_NO_PRESENTATION_CONTEXTS,
174 const T_ASC_SC_ROLE role = ASC_SC_ROLE_DEFAULT,
175 const OFString &profile =
"DEFAULT");
181 void setPort(
const Uint16 port);
239 char *argv[] = NULL);
400 DcmSCPActionType &desiredAction);
455 T_ASC_PresentationContextID presID);
468 T_ASC_PresentationContextID presID,
470 Uint16 &eventTypeID);
573 DIMSE_ProgressCallback callback,
574 void *callbackContext,
602 const Uint32 timeout = 0);
619 DIMSE_ProgressCallback callback,
620 void *callbackContext);
time_t startTime
Start time.
OFString acceptedTransferSyntax
Transfer Syntax accepted for this Presentation Context (UID)
OFBool getRespondWithCalledAETitle() const
Returns whether SCP uses the called AE Title from SCU requests to respond to connection requests inst...
const OFString & getAETitle() const
Returns SCP's own AE title.
Uint32 m_maxReceivePDULength
Maximum PDU size the SCP is able to receive.
Uint8 proposedSCRole
SCP role as proposed from SCU.
virtual void notifyAbortRequest()
Overwrite this function to be notified about an incoming association abort request.
virtual OFCondition addPresentationContext(const OFString &abstractSyntax, const OFList< OFString > xferSyntaxes, const T_ASC_SC_ROLE role=ASC_SC_ROLE_DEFAULT, const OFString &profile="DEFAULT")
Add abstract syntax to presentation contexts the SCP is able to negotiate with SCUs.
void setAETitle(const OFString &aetitle)
Set AETitle of the server.
Uint8 presentationContextID
Presentation Context ID as proposed by SCU.
virtual OFBool stopAfterCurrentAssociation()
Overwrite this function to change the behavior of the listen() method.
OFCondition receiveDIMSECommand(T_ASC_PresentationContextID *presID, T_DIMSE_Message *msg, DcmDataset **statusDetail, DcmDataset **commandSet=NULL, const Uint32 timeout=0)
Receive DIMSE command (excluding dataset!) over the currently open association.
OFBool getRefuseAssociation() const
Returns whether SCP should refuse any association request no matter what the SCU proposes.
T_DIMSE_BlockingMode m_blockMode
Blocking mode for DIMSE operations.
virtual void addProcessToTable(int pid)
This function adds a process to the table that stores process information (only relevant for multi-pr...
Base class for implementing a DICOM Service Class Provider (SCP).
OFString m_aetitle
AETitle to be used for responding to SCU (default: DCMTK_SCP).
Uint32 getPeerMaxPDULength() const
Returns maximum PDU size the communication peer (i.e. the SCU) is able to receive.
void setACSETimeout(const Uint32 acseTimeout)
Set the timeout used during ACSE messaging protocol.
DcmSCP & operator=(const DcmSCP &src)
Private undefined assignment operator.
virtual OFCondition handleEVENTREPORTRequest(T_DIMSE_N_EventReportRQ &reqMessage, T_ASC_PresentationContextID presID, DcmDataset *&reqDataset, Uint16 &eventTypeID)
Receives N-EVENT-REPORT request on the currently opened association and sends a corresponding respons...
OFBool m_forkedChild
Indicates, that this process was spawn as child from a parent process needed for multiprocess mode un...
this class maintains a list of association negotiation profiles that can be addressed by symbolic key...
DIC_AE calledAETitle
Called AE title.
virtual OFCondition negotiateAssociation()
This function checks all presentation contexts proposed by the SCU whether they are supported or not...
virtual void cleanChildren()
This function takes care of removing items referring to (terminated) subprocess from the table which ...
virtual OFCondition handleIncomingCommand(T_DIMSE_Message *incomingMsg, const DcmPresentationContextInfo &presContextInfo)
Handle incoming command set and react accordingly, e.g. sending response via DIMSE_sendXXXResponse()...
void setRespondWithCalledAETitle(const OFBool useCalled)
Set SCP to use the called AETitle from the SCU request for the response, i.e. the SCP will always res...
OFBool getSingleProcess() const
Returns whether SCP is running in single or multi-process mode.
Uint16 m_port
Port on which the SCP is listening for association requests. The default port is 104.
void setMaxAssociations(const Uint16 maxAssocs)
Set number of maximum simultanous associations.
DcmAssociationConfiguration * m_assocConfig
Association configuration.
OFBool isConnected() const
Returns whether SCP is currently connected.
virtual OFBool calledAETitleAccepted(const OFString &callingAE, const OFString &calledAE)
Function that checks for each association request, whether the combination of calling and called AE t...
OFList< DcmProcessSlotType * > m_processTable
Table of processes for non-single process mode.
Uint16 m_maxAssociations
Maximum number of association for multi-process mode.
DIC_AE callingAETitle
Calling AE title.
OFString m_assocCfgProfileName
Profile in association configuration that should be used.
Structure representing single process in multi-process mode.
virtual void notifyReleaseRequest()
Overwrite this function to be notified about an incoming association release request.
virtual OFCondition waitForAssociation(T_ASC_Network *network)
This function takes care of receiving, negotiating and accepting/refusing an association request...
Uint32 getDIMSETimeout() const
Returns DIMSE timeout (only applicable in blocking mode)
OFCondition receiveDIMSEDataset(T_ASC_PresentationContextID *presID, DcmDataset **dataObject, DIMSE_ProgressCallback callback, void *callbackContext)
Receives one dataset (of instance data) via network from another DICOM application.
void forceAssociationRefuse(const OFBool doRefuse)
Force every association request to be refused by SCP, no matter what the SCU is offering.
void setDIMSETimeout(const Uint32 dimseTimeout)
Set the timeout to be waited for incoming DIMSE message packets.
virtual OFCondition handleECHORequest(T_DIMSE_C_EchoRQ &reqMessage, T_ASC_PresentationContextID presID)
Standard handler for Verification Service Class (DICOM Echo).
OFBool m_respondWithCalledAETitle
If set, the AE Title as received in the request (called AE Title) is used in response (default: OFTru...
Uint16 getPort() const
Returns TCP/IP port number SCP listens for new connection requests.
virtual void removeProcessFromTable(int pid)
This function removes one particular item from the table which stores all subprocess information...
virtual void notifyDIMSEError(const OFCondition &cond)
Overwrite this function to be notified when an association is terminated.
OFBool m_refuseAssociation
Indicates if the application shall refuse any association attempt regardless of what the SCU proposes...
OFBool m_singleProcess
Indicates if SCP is run in single process mode or not.
OFBool m_verbosePCMode
Verbose PC mode.
OFString getPeerIP() const
Returns IP address of connected SCU.
DIC_NODENAME peerName
Name of peer.
Uint16 getMaxAssociations() const
Returns number of maximum simultanous connections permitted.
void setMaxReceivePDULength(const Uint32 maxRecPDU)
Set maximum PDU size the SCP is able to receive.
T_ASC_Association * m_assoc
Current association run by this SCP.
a class handling the DICOM dataset format (files without meta header)
OFBool getVerbosePCMode() const
Returns the verbose presentation context mode configured specifying whether details on the presentati...
void setPort(const Uint16 port)
Set SCP's TCP/IP listening port.
virtual void notifyAssociationRequest(const T_ASC_Parameters ¶ms, DcmSCPActionType &desiredAction)
Overwrite this function to be notified about an incoming association request.
virtual OFCondition setAndCheckAssociationProfile(const OFString &profileName)
If an association profile should be selected, either by loading an associaton configuration file or u...
virtual Uint16 checkEVENTREPORTRequest(T_DIMSE_N_EventReportRQ &reqMessage, DcmDataset *reqDataset)
Check given N-EVENT-REPORT request and dataset for validity.
void setDIMSEBlockingMode(const T_DIMSE_BlockingMode blockingMode)
Set whether DIMSE messaging should be blocking or non-blocking.
T_DIMSE_BlockingMode getDIMSEBlockingMode() const
Returns whether receiving of DIMSE messages is done in blocking or unblocking mode.
Uint8 acceptedSCRole
Role acccepted by SCP for this Presentation Context.
virtual void notifyAssociationAcknowledge()
Overwrite this function to be notified about an incoming association request.
void dropAndDestroyAssociation()
Drops association and clears internal structures to free memory.
virtual ~DcmSCP()
Virtual destructor, frees internal memory.
OFBool hasStorageAbility
Indicator if process has storage ability.
virtual void handleAssociation()
This function takes care of handling the other DICOM application's request.
Uint16 numAssociations() const
Returns number of associations currently running.
virtual void notifyAssociationTermination()
Overwrite this function to be notified when an association is terminated.
virtual OFCondition sendSTOREResponse(T_ASC_PresentationContextID presID, T_DIMSE_C_StoreRQ &reqMessage, T_DIMSE_C_StoreRSP &rspMessage, DcmDataset *statusDetail)
Respond to storage request.
OFString getCalledAETitle() const
Returns AE Title the SCU used as called AE Title in associaton request.
virtual OFCondition loadAssociationCfgFile(const OFString &assocFile)
Loads association configuration file.
OFCondition enableMultiProcessMode(int argc=0, char *argv[]=NULL)
Enable multi-process mode for SCP.
void setVerbosePCMode(const OFBool mode)
Set whether to show presentation contexts in verbose or debug mode.
a simple string class that implements a subset of std::string.
Uint32 getMaxReceivePDULength() const
Returns maximum PDU length configured to be received by SCP.
OFString abstractSyntax
Abstract Syntax name (UID) as proposed by SCU.
OFCondition sendDIMSEMessage(const T_ASC_PresentationContextID presID, T_DIMSE_Message *msg, DcmDataset *dataObject, DIMSE_ProgressCallback callback, void *callbackContext, DcmDataset **commandSet=NULL)
Sends a DIMSE command and possibly also a dataset from a data object via network to another DICOM app...
Uint32 m_acseTimeout
Timeout for ACSE operations in seconds.
Uint32 m_dimseTimeout
Timeout for DIMSE operations in seconds.
virtual void refuseAssociation(DcmRefuseReasonType reason)
This function takes care of refusing an assocation request.
OFString getPeerAETitle() const
Returns AE Title (calling AE Title) the SCU used for association request.
Uint32 getACSETimeout() const
Returns ACSE timeout.
virtual OFCondition listen()
Starts providing the implemented services to SCUs.
General purpose class for condition codes.
Structure representing a single Presentation Context.