OFFIS DCMTK  Version 3.6.0
scp.h
1 /*
2  *
3  * Copyright (C) 2009-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: General SCP class that can be used to implement derived SCP
19  * applications.
20  *
21  * Last Update: $Author: joergr $
22  * Update Date: $Date: 2010-10-14 13:17:22 $
23  * CVS/RCS Revision: $Revision: 1.9 $
24  * Status: $State: Exp $
25  *
26  * CVS/RCS Log at end of file
27  *
28  */
29 
30 #ifndef SCP_H
31 #define SCP_H
32 
33 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
34 
35 #include "dcmtk/oflog/oflog.h"
36 #include "dcmtk/dcmdata/dctk.h" /* Covers most common dcmdata classes */
37 #include "dcmtk/dcmnet/dimse.h" /* DIMSE network layer */
38 #include "dcmtk/dcmnet/dcasccff.h" /* For reading a association config file */
39 #include "dcmtk/dcmnet/dcasccfg.h" /* For holding association cfg file infos */
40 
41 #ifdef WITH_ZLIB
42 #include <zlib.h> /* for zlibVersion() */
43 #endif
44 
45 #ifdef WITH_OPENSSL
46 #include "dcmtk/dcmtls/tlstrans.h"
47 #include "dcmtk/dcmtls/tlslayer.h"
48 #endif
49 
50 
54 {
56  DIC_NODENAME peerName;
60  DIC_AE calledAETitle;
62  int processId;
64  time_t startTime;
67 };
68 
72 enum DcmSCPActionType
73 {
75  DCMSCP_ACTION_UNDEFINED,
77  DCMSCP_ACTION_REFUSE_ASSOCIATION
78 };
79 
82 enum DcmRefuseReasonType
83 {
85  DCMSCP_TOO_MANY_ASSOCIATIONS,
87  DCMSCP_CANNOT_FORK,
89  DCMSCP_BAD_APPLICATION_CONTEXT_NAME,
91  DCMSCP_BAD_APPLICATION_ENTITY_SERVICE,
93  DCMSCP_FORCED,
95  DCMSCP_NO_IMPLEMENTATION_CLASS_UID,
97  DCMSCP_NO_PRESENTATION_CONTEXTS,
99  DCMSCP_INTERNAL_ERROR
100 };
101 
107 {
118  // Fields "reserved" and "result" not included from DUL_PRESENTATIONCONTEXT
119 };
120 
121 
130 class DcmSCP
131 {
132 
133 public:
134 
137  DcmSCP();
138 
141  virtual ~DcmSCP();
142 
143 #ifdef _WIN32
144 
148  OFCondition markAsForkedChild();
149 #endif
150 
155  virtual OFCondition listen();
156 
157 
158  /* ************************************************************* */
159  /* Set methods for configuring SCP behaviour */
160  /* ************************************************************* */
161 
172  virtual OFCondition addPresentationContext(const OFString &abstractSyntax,
173  const OFList<OFString> xferSyntaxes,
174  const T_ASC_SC_ROLE role = ASC_SC_ROLE_DEFAULT,
175  const OFString &profile = "DEFAULT");
176 
181  void setPort(const Uint16 port);
182 
188  void setAETitle(const OFString &aetitle);
189 
196  void setRespondWithCalledAETitle(const OFBool useCalled);
197 
203  virtual OFCondition loadAssociationCfgFile(const OFString &assocFile);
204 
212  virtual OFCondition setAndCheckAssociationProfile(const OFString &profileName);
213 
219  void forceAssociationRefuse(const OFBool doRefuse);
220 
225  void setMaxReceivePDULength(const Uint32 maxRecPDU);
226 
238  OFCondition enableMultiProcessMode(int argc = 0,
239  char *argv[] = NULL);
240 
245  void setMaxAssociations(const Uint16 maxAssocs);
246 
256  void setDIMSEBlockingMode(const T_DIMSE_BlockingMode blockingMode);
257 
262  void setDIMSETimeout(const Uint32 dimseTimeout);
263 
267  void setACSETimeout(const Uint32 acseTimeout);
268 
273  void setVerbosePCMode(const OFBool mode);
274 
275  /* Get methods for SCP settings */
276 
280  Uint16 getPort() const;
281 
286  const OFString &getAETitle() const;
287 
292  OFBool getRespondWithCalledAETitle() const;
293 
297  OFBool getRefuseAssociation() const;
298 
302  Uint32 getMaxReceivePDULength() const;
303 
307  OFBool getSingleProcess() const;
308 
316  Uint16 getMaxAssociations() const;
317 
321  T_DIMSE_BlockingMode getDIMSEBlockingMode() const;
322 
326  Uint32 getDIMSETimeout() const;
327 
331  Uint32 getACSETimeout() const;
332 
338  OFBool getVerbosePCMode() const;
339 
340  /* Get information about current association */
341 
347  OFBool isConnected() const;
348 
353  Uint16 numAssociations() const;
354 
359  OFString getCalledAETitle() const;
360 
364  OFString getPeerAETitle() const;
365 
369  OFString getPeerIP() const;
370 
375  Uint32 getPeerMaxPDULength() const;
376 
377 
378 protected:
379 
380  /* ***********************************************************************
381  * Functions particularly interesting for overwriting in derived classes
382  * ***********************************************************************
383  */
384 
393  const DcmPresentationContextInfo &presContextInfo);
394 
399  virtual void notifyAssociationRequest(const T_ASC_Parameters &params,
400  DcmSCPActionType &desiredAction);
401 
405  virtual void notifyAssociationAcknowledge();
406 
410  virtual void notifyReleaseRequest();
411 
415  virtual void notifyAbortRequest();
416 
420  virtual void notifyAssociationTermination();
421 
426  virtual void notifyDIMSEError(const OFCondition &cond);
427 
433  virtual OFBool stopAfterCurrentAssociation();
434 
442  virtual OFCondition sendSTOREResponse(T_ASC_PresentationContextID presID,
443  T_DIMSE_C_StoreRQ &reqMessage,
444  T_DIMSE_C_StoreRSP &rspMessage,
445  DcmDataset *statusDetail);
446 
454  virtual OFCondition handleECHORequest(T_DIMSE_C_EchoRQ &reqMessage,
455  T_ASC_PresentationContextID presID);
456 
468  T_ASC_PresentationContextID presID,
469  DcmDataset *&reqDataset,
470  Uint16 &eventTypeID);
471 
482  virtual Uint16 checkEVENTREPORTRequest(T_DIMSE_N_EventReportRQ &reqMessage,
483  DcmDataset *reqDataset);
484 
495  virtual OFBool calledAETitleAccepted(const OFString &callingAE,
496  const OFString &calledAE);
497 
498 
499  /* *********************************************************************
500  * Further functions and member variables
501  * *********************************************************************
502  */
503 
512  virtual OFCondition waitForAssociation(T_ASC_Network *network);
513 
519  virtual void cleanChildren();
520 
529 
534  virtual void addProcessToTable(int pid);
535 
542  virtual void removeProcessFromTable(int pid);
543 
548  virtual void refuseAssociation(DcmRefuseReasonType reason);
549 
553  virtual void handleAssociation();
554 
570  OFCondition sendDIMSEMessage(const T_ASC_PresentationContextID presID,
571  T_DIMSE_Message *msg,
572  DcmDataset *dataObject,
573  DIMSE_ProgressCallback callback,
574  void *callbackContext,
575  DcmDataset **commandSet = NULL);
576 
598  OFCondition receiveDIMSECommand(T_ASC_PresentationContextID *presID,
599  T_DIMSE_Message *msg,
600  DcmDataset **statusDetail,
601  DcmDataset **commandSet = NULL,
602  const Uint32 timeout = 0);
603 
617  OFCondition receiveDIMSEDataset(T_ASC_PresentationContextID *presID,
618  DcmDataset **dataObject,
619  DIMSE_ProgressCallback callback,
620  void *callbackContext);
621 
622 private:
623 
627  DcmSCP(const DcmSCP &src);
628 
633  DcmSCP &operator=(const DcmSCP &src);
634 
637 
641 
645 
647  Uint16 m_port;
648 
654 
658 
662 
672 
676 
677 #ifdef _WIN32
678 
679  int m_cmd_argc;
680 
682  char **m_cmd_argv;
683 #endif
684 
689 
695  T_DIMSE_BlockingMode m_blockMode;
696 
700 
704 
708 
712 
716 
720 
721 };
722 
723 #endif // SCP_H
724 
725 
726 /*
727  * CVS/RCS Log:
728  * $Log: scp.h,v $
729  * Revision 1.9 2010-10-14 13:17:22 joergr
730  * Updated copyright header. Added reference to COPYRIGHT file.
731  *
732  * Revision 1.8 2010-10-07 12:54:07 joergr
733  * Fixed minor Doxygen API documentation issues (added backslash in order to
734  * avoid that the short description ends at the first period).
735  *
736  * Revision 1.7 2010-06-22 15:44:55 joergr
737  * Added support for handling N-EVENT-REPORT request.
738  * Added support for stopping after the current association is finished.
739  * Further code cleanup. Renamed some methods, variables, types and so on.
740  *
741  * Revision 1.6 2010-06-18 14:50:33 joergr
742  * Added support for the SCP/SCU role selection negotiation.
743  *
744  * Revision 1.5 2010-06-17 17:06:30 joergr
745  * Aligned SCP class with existing SCU class. Some further code cleanups.
746  * Changed default profile from "Default" to "DEFAULT". Revised documentation.
747  *
748  * Revision 1.4 2010-04-29 16:14:59 onken
749  * Added function for responding to storage requests to SCP class.
750  *
751  * Revision 1.3 2009-12-21 17:00:32 onken
752  * Fixed API documentation to keep doxygen quiet.
753  *
754  * Revision 1.1 2009-12-17 09:02:43 onken
755  * Added base classes for SCU and SCP implementations.
756  *
757  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2