OFFIS DCMTK  Version 3.6.0
scu.h
1 /*
2  *
3  * Copyright (C) 2008-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmnet
15  *
16  * Author: Michael Onken
17  *
18  * Purpose: Base class for Service Class Users (SCUs)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:17:22 $
22  * CVS/RCS Revision: $Revision: 1.13 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef SCU_H
30 #define SCU_H
31 
32 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
33 
34 #include "dcmtk/dcmdata/dctk.h" /* Covers most common dcmdata classes */
35 #include "dcmtk/dcmnet/dcompat.h"
36 #include "dcmtk/dcmnet/dimse.h" /* DIMSE network layer */
37 #include "dcmtk/dcmnet/dcasccff.h" /* For reading a association config file */
38 #include "dcmtk/dcmnet/dcasccfg.h" /* For holding association cfg file infos */
39 
40 #ifdef WITH_ZLIB
41 #include <zlib.h> /* for zlibVersion() */
42 #endif
43 
44 
47 enum DcmCloseAssociationType
48 {
50  DCMSCU_RELEASE_ASSOCIATION,
52  DCMSCU_ABORT_ASSOCIATION,
54  DCMSCU_PEER_REQUESTED_RELEASE,
56  DCMSCU_PEER_ABORTED_ASSOCIATION
57 };
58 
59 
63 {
64 
65 public:
66 
68  FINDResponse();
69 
71  virtual ~FINDResponse();
72 
75 
76  // Mandatory response field
77  OFString m_affectedSOPClassUID;
78 
81 
83  Uint16 m_status;
84 };
85 
86 
90 {
91 
92 public:
93  FINDResponses();
94  virtual ~FINDResponses();
95  Uint32 numResults() const;
96  void add(FINDResponse *rsp);
97  OFListIterator(FINDResponse *) begin();
98  OFListIterator(FINDResponse *) end();
99 
100 private:
101  OFList<FINDResponse *> m_responses;
102 };
103 
110 class DcmSCU
111 {
112 
113 public:
114 
117  DcmSCU();
118 
121  virtual ~DcmSCU();
122 
129  OFCondition addPresentationContext(const OFString &abstractSyntax,
130  const OFList<OFString> &xferSyntaxes);
131 
135  virtual OFCondition initNetwork();
136 
143 
151  T_ASC_PresentationContextID findPresentationContextID(const OFString &abstractSyntax,
152  const OFString &transferSyntax);
153 
160  virtual OFCondition sendECHORequest(const T_ASC_PresentationContextID presID);
161 
190  virtual OFCondition sendSTORERequest(const T_ASC_PresentationContextID presID,
191  const OFString &dicomFile,
192  DcmDataset *dset,
193  DcmDataset *&rspCommandSet,
194  DcmDataset *&rspStatusDetail,
195  Uint16 &rspStatusCode);
196 
209  virtual OFCondition sendFINDRequest(T_ASC_PresentationContextID presID,
210  DcmDataset *queryKeys,
211  FINDResponses *responses);
212 
223  virtual OFCondition handleFINDResponse(Uint16 presContextID,
224  FINDResponse *response,
225  OFBool &waitForNextResponse);
226 
234  virtual OFCondition sendCANCELRequest(Uint16 presContextID);
235 
249  virtual OFCondition sendACTIONRequest(const T_ASC_PresentationContextID presID,
250  const OFString &sopInstanceUID,
251  const Uint16 actionTypeID,
252  DcmDataset *reqDataset,
253  Uint16 &rspStatusCode);
254 
265  virtual OFCondition handleEVENTREPORTRequest(DcmDataset *&reqDataset,
266  Uint16 &eventTypeID,
267  const int timeout = 0);
268 
272  virtual void closeAssociation(const DcmCloseAssociationType closeType);
273 
274  /* Set methods */
275 
279  void setMaxReceivePDULength(const unsigned long maxRecPDU);
280 
284  void setDIMSEBlockingMode(const T_DIMSE_BlockingMode blockingMode);
285 
289  void setAETitle(const OFString &myAETtitle);
290 
294  void setPeerHostName(const OFString &peerHostName);
295 
299  void setPeerAETitle(const OFString &peerAETitle);
300 
304  void setPeerPort(const Uint16 peerPort);
305 
311  void setDIMSETimeout(const Uint32 dimseTimeout);
312 
317  void setACSETimeout(const Uint32 acseTimeout);
318 
323  void setAssocConfigFileAndProfile(const OFString &filename,
324  const OFString &profile);
325 
330  void setVerbosePCMode(const OFBool mode);
331 
332  /* Get methods */
333 
337  OFBool isConnected() const;
338 
342  Uint32 getMaxReceivePDULength() const;
343 
347  T_DIMSE_BlockingMode getDIMSEBlockingMode() const;
348 
352  const OFString &getAETitle() const;
353 
357  const OFString &getPeerHostName() const;
358 
362  const OFString &getPeerAETitle() const;
363 
367  Uint16 getPeerPort() const;
368 
373  Uint32 getDIMSETimeout() const;
374 
379  Uint32 getACSETimeout() const;
380 
386  OFBool getVerbosePCMode() const;
387 
391  OFBool getTLSEnabled() const;
392 
393 protected:
394 
410  OFCondition sendDIMSEMessage(const T_ASC_PresentationContextID presID,
411  T_DIMSE_Message *msg,
412  DcmDataset *dataObject,
413  DIMSE_ProgressCallback callback,
414  void *callbackContext,
415  DcmDataset **commandSet = NULL);
416 
427  OFString &sopClassUID,
428  OFString &sopInstanceUID,
429  E_TransferSyntax &transferSyntax);
430 
431 
437 
459  OFCondition receiveDIMSECommand(T_ASC_PresentationContextID *presID,
460  T_DIMSE_Message *msg,
461  DcmDataset **statusDetail,
462  DcmDataset **commandSet = NULL,
463  const Uint32 timeout = 0);
464 
478  OFCondition receiveDIMSEDataset(T_ASC_PresentationContextID *presID,
479  DcmDataset **dataObject,
480  DIMSE_ProgressCallback callback,
481  void *callbackContext);
482 
491  void findPresentationContext(const T_ASC_PresentationContextID presID,
492  OFString &abstractSyntax,
493  OFString &transferSyntax);
494 
505  virtual Uint16 checkEVENTREPORTRequest(T_DIMSE_N_EventReportRQ &request,
506  DcmDataset *reqDataset);
507 
508 private:
509 
513  DcmSCU(const DcmSCU &src);
514 
519  DcmSCU &operator=(const DcmSCU &src);
520 
523 
526 
529 
532 
535 
543  };
544 
547 
550 
553 
556 
558  T_DIMSE_BlockingMode m_blockMode;
559 
562 
565 
568 
570  Uint16 m_peerPort;
571 
574 
577 
580 
584  Uint16 nextMessageID();
585 
586 };
587 
588 #endif // SCU_H
589 
590 
591 /*
592 ** CVS Log
593 ** $Log: scu.h,v $
594 ** Revision 1.13 2010-10-14 13:17:22 joergr
595 ** Updated copyright header. Added reference to COPYRIGHT file.
596 **
597 ** Revision 1.12 2010-10-07 12:54:07 joergr
598 ** Fixed minor Doxygen API documentation issues (added backslash in order to
599 ** avoid that the short description ends at the first period).
600 **
601 ** Revision 1.11 2010-06-24 09:21:54 joergr
602 ** Revised comment to make clear that the parameter "presID" shall never be 0
603 ** for the sendACTIONRequest() method.
604 **
605 ** Revision 1.10 2010-06-22 15:45:27 joergr
606 ** Introduced new enumeration type to be used for closeAssociation().
607 ** Further code cleanup. Renamed some methods, variables, types and so on.
608 **
609 ** Revision 1.9 2010-06-17 17:11:27 joergr
610 ** Added preliminary support for N-EVENT-REPORT to DcmSCU. Some further code
611 ** cleanups and enhancements. Renamed some methods. Revised documentation.
612 **
613 ** Revision 1.8 2010-06-09 16:09:01 joergr
614 ** Added preliminary support for N-ACTION to DcmSCU. Some further code cleanups
615 ** and enhancements.
616 **
617 ** Revision 1.7 2010-06-08 17:54:12 onken
618 ** Added C-FIND functionality to DcmSCU. Some code cleanups. Fixed
619 ** memory leak sometimes occuring during association configuration.
620 **
621 ** Revision 1.6 2010-04-29 16:13:28 onken
622 ** Made SCU class independent from dcmtls, i.e. outsourced TLS API. Added
623 ** direct API support for sending C-STORE requests. Further API changes and
624 ** some bugs fixed.
625 **
626 ** Revision 1.5 2009-12-21 17:00:32 onken
627 ** Fixed API documentation to keep doxygen quiet.
628 **
629 ** Revision 1.4 2009-12-21 15:33:55 onken
630 ** Added documentation and refactored / enhanced some code.
631 **
632 ** Revision 1.3 2009-12-17 09:12:10 onken
633 ** Fixed other scu and scp base class compile issues.
634 **
635 ** Revision 1.2 2009-12-17 09:05:15 onken
636 ** Fixed typo resulting in build failure.
637 **
638 ** Revision 1.1 2009-12-17 09:02:44 onken
639 ** Added base classes for SCU and SCP implementations.
640 **
641 ** Revision 1.2 2009-12-02 14:26:05 uli
642 ** Stop including dcdebug.h which was removed.
643 **
644 ** Revision 1.1 2008-09-29 13:51:52 onken
645 ** Initial checkin of module dcmppscu implementing an MPPS commandline client.
646 **
647 */
const OFString & getPeerHostName() const
Returns the SCP's (peer's) host name configured.
T_DIMSE_BlockingMode getDIMSEBlockingMode() const
Returns whether DIMSE messaging is configured to be blocking or unblocking.
virtual OFCondition sendECHORequest(const T_ASC_PresentationContextID presID)
This function sends a C-ECHO command via network to another DICOM application.
OFString m_assocConfigFilename
Configuration file for presentation contexts (optional)
Definition: scu.h:531
Uint16 m_messageIDRespondedTo
Mandatory response field.
Definition: scu.h:74
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.
Uint32 getMaxReceivePDULength() const
Returns maximum PDU length configured to be received by SCU.
virtual OFCondition sendCANCELRequest(Uint16 presContextID)
Send C-FIND-CANCEL and, therefore, ends the C-FIND session, i.e. no further responses will be handled...
virtual void closeAssociation(const DcmCloseAssociationType closeType)
Closes the association created by this SCU.
void setPeerPort(const Uint16 peerPort)
Set SCP's port number to connect to for association negotiation.
OFList< OFString > transferSyntaxes
List of Transfer Syntaxes for Presentation Context.
Definition: scu.h:542
Uint16 m_status
Mandatory Response Field.
Definition: scu.h:83
T_ASC_Network * m_net
The DICOM network the association is based on.
Definition: scu.h:525
virtual ~FINDResponse()
Destructor, cleans up internal memory (datasets if present)
OFCondition getDatasetInfo(DcmDataset *dataset, OFString &sopClassUID, OFString &sopInstanceUID, E_TransferSyntax &transferSyntax)
Returns SOP Class UID, SOP Instance UID and original transfer syntax for a given dataset.
const OFString & getAETitle() const
Returns the SCU's own configured AETitle.
DcmSCU & operator=(const DcmSCU &src)
Private undefined operator=.
void setMaxReceivePDULength(const unsigned long maxRecPDU)
Set maximum PDU length (to be received by SCU)
Class representing a bunch of FINDResponses from a single C-FIND session.
Definition: scu.h:89
T_ASC_Association * m_assoc
Associaton of this SCU. This class only handles 1 association at a time.
Definition: scu.h:522
T_DIMSE_Message * m_openDIMSERequest
The last DIMSE successfully sent, unresponded DIMSE request.
Definition: scu.h:552
OFBool getVerbosePCMode() const
Returns the verbose presentation context mode configured specifying whether details on the presentati...
void setDIMSEBlockingMode(const T_DIMSE_BlockingMode blockingMode)
Set whether to send in DIMSE blocking or non-blocking mode.
T_ASC_PresentationContextID findPresentationContextID(const OFString &abstractSyntax, const OFString &transferSyntax)
After negotiation association, this call returns the first usable presentation context given the desi...
DcmDataset * m_dataset
Conditional response field (NULL if absent)
Definition: scu.h:80
virtual Uint16 checkEVENTREPORTRequest(T_DIMSE_N_EventReportRQ &request, DcmDataset *reqDataset)
Check given N-EVENT-REPORT request and dataset for validity.
void findPresentationContext(const T_ASC_PresentationContextID presID, OFString &abstractSyntax, OFString &transferSyntax)
After negotiation association, this call returns the presentation context belonging to the given pres...
void setAETitle(const OFString &myAETtitle)
Set SCU's AETitle to be used in association negotiation.
factory class which creates transport layer connections.
Definition: dcmlayer.h:74
void setVerbosePCMode(const OFBool mode)
Set whether to show presentation contexts in verbose or debug mode.
void setPeerAETitle(const OFString &peerAETitle)
Set SCP's AETitle to talk to in association negotiation.
Uint32 getACSETimeout() const
Returns the timeout configured defining how long SCU will wait for messages during ACSE messaging (as...
OFString m_peerAETitle
AEtitle of remote application.
Definition: scu.h:567
OFString m_ourAETitle
AEtitle of this application.
Definition: scu.h:561
OFString m_assocConfigFile
Configuration file containing association parameters.
Definition: scu.h:549
virtual OFCondition handleEVENTREPORTRequest(DcmDataset *&reqDataset, Uint16 &eventTypeID, const int timeout=0)
Receives N-EVENT-REPORT request on the currently opened association and sends a corresponding respons...
void setDIMSETimeout(const Uint32 dimseTimeout)
Set timeout for receiving DIMSE messages.
T_DIMSE_BlockingMode m_blockMode
DIMSE blocking mode.
Definition: scu.h:558
Uint16 getPeerPort() const
Returns the SCP's (peer's) TCP/IP port configured.
Uint32 m_acseTimeout
ACSE timeout.
Definition: scu.h:576
OFBool getTLSEnabled() const
Returns whether SCU is configured to create a TLS connection with the SCP.
virtual ~DcmSCU()
Virtual destructor.
OFBool isConnected() const
Get current connection status.
FINDResponse()
Standard constructor.
OFList< DcmSCUPresContext > m_presContexts
List of presentation contexts that should be negotiated.
Definition: scu.h:546
virtual OFCondition sendFINDRequest(T_ASC_PresentationContextID presID, DcmDataset *queryKeys, FINDResponses *responses)
Sends a C-FIND Request on given presentation context and receives list of responses.
Class representing a single C-FIND response.
Definition: scu.h:62
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...
Uint16 nextMessageID()
Returns next available message ID free to be used by SCU.
void setAssocConfigFileAndProfile(const OFString &filename, const OFString &profile)
Set an association configuration file and profile to be used.
virtual OFCondition sendACTIONRequest(const T_ASC_PresentationContextID presID, const OFString &sopInstanceUID, const Uint16 actionTypeID, DcmDataset *reqDataset, Uint16 &rspStatusCode)
This function sends a N-ACTION request on the currently opened association and receives the correspon...
virtual OFCondition negotiateAssociation()
Negotiate association by using presentation contexts and parameters as defined by earlier function ca...
OFString m_peer
Peer hostname.
Definition: scu.h:564
OFCondition addPresentationContext(const OFString &abstractSyntax, const OFList< OFString > &xferSyntaxes)
Add presentation context to be used for association negotiation.
Defines presentation context, consisting of one abstract syntax name and a list of transfer syntaxes ...
Definition: scu.h:538
a class handling the DICOM dataset format (files without meta header)
Definition: dcdatset.h:46
DcmSCU()
Constructor, just initializes internal class members.
const OFString & getPeerAETitle() const
Returns the SCP's (peer's) AETitle configured.
Uint16 m_peerPort
Port of remote application entity.
Definition: scu.h:570
virtual OFCondition handleFINDResponse(Uint16 presContextID, FINDResponse *response, OFBool &waitForNextResponse)
This is the standard handler for C-FIND message responses: It just adds up all responses it receives ...
virtual OFCondition sendSTORERequest(const T_ASC_PresentationContextID presID, const OFString &dicomFile, DcmDataset *dset, DcmDataset *&rspCommandSet, DcmDataset *&rspStatusDetail, Uint16 &rspStatusCode)
This function sends a C-STORE request on the currently opened association and receives the correspond...
virtual OFCondition initNetwork()
Initialize network, i.e. prepare for association negotiation.
Base class for implementing DICOM Service Class User functionality.
Definition: scu.h:110
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
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.
T_ASC_Parameters * m_params
Association parameters.
Definition: scu.h:528
void setACSETimeout(const Uint32 acseTimeout)
Set timeout for receiving ACSE messages.
OFBool m_verbosePCMode
Verbose PC mode.
Definition: scu.h:579
Uint32 m_dimseTimeout
DIMSE timeout.
Definition: scu.h:573
Uint32 getDIMSETimeout() const
Returns the DIMSE timeout configured defining how long SCU will wait for DIMSE responses.
OFString abstractSyntaxName
Abstract Syntax Name of Presentation Context.
Definition: scu.h:540
OFCondition useSecureConnection(DcmTransportLayer *tlayer)
Tells DcmSCU to use a secure TLS connection described by the given TLS layer.
General purpose class for condition codes.
Definition: ofcond.h:305
void setPeerHostName(const OFString &peerHostName)
Set SCP's host (hostname or IP address) to talk to in association negotiation.
OFString m_assocConfigProfile
Profile in configuration file that should be used (optional)
Definition: scu.h:534
Uint32 m_maxReceivePDULength
Maximum PDU size.
Definition: scu.h:555


Generated on Wed Jan 4 2017 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.6