1 /*
2  *
3  *  Copyright (C) 1996-2019, 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:  dcmwlm
15  *
16  *  Author:  Thomas Wilkens
17  *
18  *  Purpose: Class representing a console engine for basic worklist
19  *           management service class providers based on the file system.
20  *
21  */
22 
23 #ifndef WlmConsoleEngineFileSystem_h
24 #define WlmConsoleEngineFileSystem_h
25 
26 #include "dcmtk/config/osconfig.h"
27 #include "dcmtk/dcmnet/dimse.h"
28 
29 class WlmDataSource;
30 class OFConsoleApplication;
31 class OFCommandLine;
32 
33 /** This class encapsulates data structures and operations for a console application that
34  *  can act as a basic worklist management service class provider based on the file system.
35  */
36 class WlmConsoleEngineFileSystem
37 {
38   protected:
39     /// contains application's id string
40     char rcsid[200];
41     /// returned character set type
42     WlmReturnedCharacterSetType opt_returnedCharacterSet;
43     /// path to database files
44     OFString opt_dfPath;
45     /// path to store request files
46     OFString opt_rfPath;
47     /// format for request files if stored.
48     /// Several placeholders can be used by(denoted by #):<br>
49     ///   \#a: calling application entity title of the peer SCU<br>
50     ///   \#c: called application entity title (AE title of worklist SCP application)<br>
51     ///   \#i: process id of the worklist SCP application process handling the request<br>
52     ///   \#p: patient ID if present, otherwise empty string<br>
53     ///   \#t: timestamp in the format YYYYMMDDhhmmssffffff<br>
54     OFString opt_rfFormat;
55     /// port on which this application is listening
56     OFCmdUnsignedInt opt_port;
57     /// indicates if incoming associations shall be refused or not
58     OFBool opt_refuseAssociation;
59     /// indicates if incoming associations shall be refused if no implementation class uid is specified
60     OFBool opt_rejectWithoutImplementationUID;
61     /// indicates how many seconds the application is supposed to sleep before handling a find request
62     OFCmdUnsignedInt opt_sleepBeforeFindReq;
63     /// indicates how long the application shall sleep after a find
64     OFCmdUnsignedInt opt_sleepAfterFind;
65     /// indicates how long the application shall sleep during a find
66     OFCmdUnsignedInt opt_sleepDuringFind;
67     /// max PDU size
68     OFCmdUnsignedInt opt_maxPDU;
69     /// preferred network transfer syntax
70     E_TransferSyntax opt_networkTransferSyntax;
71     /// indicates if find shall fail on an invalid query or not
72     OFBool opt_failInvalidQuery;
73     /// indicates if this application is run in single process mode or not
74     OFBool opt_singleProcess;
75     /// indicates if this process is called as a child process, used by dcmnet
76     OFBool opt_forkedChild;
77     /// indicates how many associations can be accepted at the same time
78     int opt_maxAssociations;
79     /// indicates if an expansion of empty sequences in C-Find RQ messages shall take place or not
80     OFBool opt_noSequenceExpansion;
81     /// indicates if wl-files which are lacking return type 1 attributes or information in such attributes shall be rejected or not
82     OFBool opt_enableRejectionOfIncompleteWlFiles;
83     /// blocking mode for DIMSE operations
84     T_DIMSE_BlockingMode opt_blockMode;
85     /// timeout for DIMSE operations
86     int opt_dimse_timeout;
87     /// timeout for ACSE operations
88     int opt_acse_timeout;
89     /// instance of console application class (for handling command line arguments)
90     OFConsoleApplication *app;
91     /// instance of command line class (for handling command line arguments)
92     OFCommandLine *cmd;
93     /// number of command line arguments, needed for multiprocess mode on WIN32
94     int command_argc;
95     /// complete command line, needed for multiprocess mode on WIN32
96     char **command_argv;
97     /// data source which shall be queried on incoming C-Find RQ messages
98     WlmDataSource *dataSource;
99 
100       /** Protected undefined copy-constructor. Shall never be called.
101        *  @param Src Source object.
102        */
103     WlmConsoleEngineFileSystem( const WlmConsoleEngineFileSystem &Src );
104 
105       /** Protected undefined operator=. Shall never be called.
106        *  @param Src Source object.
107        *  @return Reference to this.
108        */
109     WlmConsoleEngineFileSystem &operator=( const WlmConsoleEngineFileSystem &Src );
110 
111   public:
112       /** constructor.
113        *  @param argc            Number of arguments that were passed to main.
114        *  @param argv            Arguments that were passed to main.
115        *  @param applicationName The name of this application.
116        *  @param dataSourcev     Object which provides access to the data source.
117        */
118     WlmConsoleEngineFileSystem( int argc, char *argv[], const char *applicationName, WlmDataSource *dataSourcev );
119 
120       /** destructor
121        */
122     ~WlmConsoleEngineFileSystem();
123 
124       /** Starts providing the implemented service for calling SCUs.
125        *  After having created an instance of this class, this function
126        *  shall be called from main.
127        *  @return Return value that is supposed to be returned from main().
128        */
129     int StartProvidingService();
130 };
131 
132 #endif
133