OFFIS DCMTK  Version 3.6.0
dvpsmsg.h
1 /*
2  *
3  * Copyright (C) 1998-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: dcmpstat
15  *
16  * Author: Marco Eichelberg
17  *
18  * Purpose:
19  * classes: DVPSIPCMessage
20  *
21  * Last Update: $Author: joergr $
22  * Update Date: $Date: 2010-10-14 13:16:36 $
23  * CVS/RCS Revision: $Revision: 1.7 $
24  * Status: $State: Exp $
25  *
26  * CVS/RCS Log at end of file
27  *
28  */
29 
30 #ifndef DVPSMSG_H
31 #define DVPSMSG_H
32 
33 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
34 #include "dcmtk/dcmdata/dctypes.h" /* for Uint32 */
35 #include "dcmtk/ofstd/ofstring.h" /* for class OFString */
36 
38 
43 {
44 public:
45 
48 
50  DVPSIPCMessage(const DVPSIPCMessage& copy);
51 
53  virtual ~DVPSIPCMessage();
54 
57 
61  void setMessageType(Uint32 msgtype) { messageType = msgtype; }
62 
66  Uint32 getMessageType() { return messageType; }
67 
71  void addStringToPayload(const char *str);
72 
76  void addIntToPayload(Uint32 i);
77 
84 
89  OFBool extractIntFromPayload(Uint32& i);
90 
93  void rewindPayload();
94 
97  void erasePayload();
98 
103  OFBool send(DcmTransportConnection &connection);
104 
111  OFBool receive(DcmTransportConnection &connection);
112 
113 
114  // constants for message type
115  static const Uint32 OK;
116  static const Uint32 requestApplicationID;
117  static const Uint32 assignApplicationID;
118  static const Uint32 applicationTerminates;
119  static const Uint32 receivedUnencryptedDICOMConnection;
120  static const Uint32 receivedEncryptedDICOMConnection;
121  static const Uint32 connectionClosed;
122  static const Uint32 connectionAborted;
123  static const Uint32 requestedUnencryptedDICOMConnection;
124  static const Uint32 requestedEncryptedDICOMConnection;
125  static const Uint32 receivedDICOMObject;
126  static const Uint32 sentDICOMObject;
127 
128  // message status constants
129  static const Uint32 statusOK; // OK
130  static const Uint32 statusWarning; // warning
131  static const Uint32 statusError; // error
132 
133  // client type constants
134  static const Uint32 clientOther; // client is of unspecified type
135  static const Uint32 clientStoreSCP; // client is Store SCP
136  static const Uint32 clientStoreSCU; // client is Store SCU
137  static const Uint32 clientPrintSCP; // client is Print SCP
138  static const Uint32 clientPrintSCU; // client is Print SCU
139  static const Uint32 clientQRSCP; // client is Query/Retrieve (Find/Move/Get) SCP
140 
141 private:
142 
146  void resizePayload(Uint32 i);
147 
149  Uint32 messageType;
150 
152  Uint32 payloadUsed;
153 
156 
159 
161  unsigned char *payload;
162 };
163 
164 
169 {
170 public:
171 
179  DVPSIPCClient(Uint32 clientType, const char *txt, int thePort, OFBool keepOpen);
180 
182  virtual ~DVPSIPCClient();
183 
187  void notifyApplicationTerminates(Uint32 status);
188 
193  void notifyReceivedUnencryptedDICOMConnection(Uint32 status, const char *txt);
194 
199  void notifyReceivedEncryptedDICOMConnection(Uint32 status, const char *txt);
200 
204  void notifyConnectionClosed(Uint32 status);
205 
210  void notifyConnectionAborted(Uint32 status, const char *txt);
211 
216  void notifyRequestedUnencryptedDICOMConnection(Uint32 status, const char *txt);
217 
222  void notifyRequestedEncryptedDICOMConnection(Uint32 status, const char *txt);
223 
228  void notifyReceivedDICOMObject(Uint32 status, const char *txt);
229 
234  void notifySentDICOMObject(Uint32 status, const char *txt);
235 
240  OFBool isServerActive() { return serverActive; }
241 
242 private:
243 
245  DVPSIPCClient(const DVPSIPCClient& copy);
246 
249 
252  void requestConnection();
253 
260  OFBool performTransaction(DVPSIPCMessage& msg);
261 
263  int port;
264 
266  OFBool serverActive;
267 
270 
273 
276 };
277 
278 
279 #endif
280 
281 /*
282  * $Log: dvpsmsg.h,v $
283  * Revision 1.7 2010-10-14 13:16:36 joergr
284  * Updated copyright header. Added reference to COPYRIGHT file.
285  *
286  * Revision 1.6 2010-10-07 14:31:36 joergr
287  * Removed leading underscore characters from preprocessor symbols (reserved).
288  *
289  * Revision 1.5 2005/12/08 16:03:52 meichel
290  * Changed include path schema for all DCMTK header files
291  *
292  * Revision 1.4 2003/07/04 13:27:38 meichel
293  * Replaced forward declarations for OFString with explicit includes,
294  * needed when compiling with HAVE_STD_STRING
295  *
296  * Revision 1.3 2001/06/01 15:50:18 meichel
297  * Updated copyright header
298  *
299  * Revision 1.2 2000/11/08 18:38:15 meichel
300  * Updated dcmpstat IPC protocol for additional message parameters
301  *
302  * Revision 1.1 2000/10/10 12:24:36 meichel
303  * Added extensions for IPC message communication
304  *
305  *
306  */
Uint32 payloadAllocated
number of bytes allocated in payload
Definition: dvpsmsg.h:155
void notifyReceivedUnencryptedDICOMConnection(Uint32 status, const char *txt)
sends ReceivedUnencryptedDICOMConnection notification to server.
Uint32 payloadReadOffset
read offset into payload in bytes
Definition: dvpsmsg.h:158
OFBool receive(DcmTransportConnection &connection)
receives a messages from the given transport connection and stores it in the current object...
DVPSIPCClient & operator=(const DVPSIPCClient &)
private undefined copy assignment operator
unsigned char * payload
pointer to raw payload data in big endian byte order
Definition: dvpsmsg.h:161
OFBool performTransaction(DVPSIPCMessage &msg)
perform message transaction with server.
void addStringToPayload(const char *str)
adds a character string into the message payload.
this class represents a TCP/IP based transport connection which can be a transparent TCP/IP socket co...
Definition: dcmtrans.h:45
void setMessageType(Uint32 msgtype)
sets the message type
Definition: dvpsmsg.h:61
virtual ~DVPSIPCMessage()
destructor
class for IPC message exchange between different processes of the DICOMscope application ...
Definition: dvpsmsg.h:42
Uint32 messageType
type of message
Definition: dvpsmsg.h:149
void notifyReceivedEncryptedDICOMConnection(Uint32 status, const char *txt)
sends ReceivedEncryptedDICOMConnection notification to server.
DVPSIPCMessage & operator=(const DVPSIPCMessage &)
copy assignment operator
OFBool keepConnectionOpen
flag indicating whether we want to keep the connection open
Definition: dvpsmsg.h:272
void notifySentDICOMObject(Uint32 status, const char *txt)
sends SentDICOMObject notification to server.
void erasePayload()
removes all payload
OFBool send(DcmTransportConnection &connection)
sends the current message over the given transport connection.
Uint32 payloadUsed
number of bytes actually used in payload
Definition: dvpsmsg.h:152
DcmTransportConnection * connection
current transport connection
Definition: dvpsmsg.h:275
void notifyReceivedDICOMObject(Uint32 status, const char *txt)
sends ReceivedDICOMObject notification to server.
void addIntToPayload(Uint32 i)
adds an integer into the message payload.
OFBool serverActive
true if the first connection attempt has succeeded, false otherwise
Definition: dvpsmsg.h:266
virtual ~DVPSIPCClient()
destructor
Uint32 applicationID
application ID assigned by the server
Definition: dvpsmsg.h:269
OFBool extractStringFromPayload(OFString &str)
extracts a string from the message payload and copies it into the given str object.
int port
TCP/IP port number on which the server is listening.
Definition: dvpsmsg.h:263
void notifyConnectionAborted(Uint32 status, const char *txt)
sends ConnectionAborted notification to server.
OFBool isServerActive()
checks whether the message server has been found active upon creation of this object.
Definition: dvpsmsg.h:240
Uint32 getMessageType()
returns the message type
Definition: dvpsmsg.h:66
void notifyRequestedUnencryptedDICOMConnection(Uint32 status, const char *txt)
sends RequestedUnencryptedDICOMConnection notification to server.
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
DVPSIPCClient(Uint32 clientType, const char *txt, int thePort, OFBool keepOpen)
constructor
void rewindPayload()
rewinds the read offset to the beginning of the message payload
a client for IPC message exchange between different processes of the DICOMscope application ...
Definition: dvpsmsg.h:168
OFBool extractIntFromPayload(Uint32 &i)
extracts an integer from the message payload.
void notifyApplicationTerminates(Uint32 status)
sends ApplicationTerminates notification to server.
void resizePayload(Uint32 i)
resize payload if necessary such that at least i bytes can be written
void notifyConnectionClosed(Uint32 status)
sends ConnectionClosed notification to server.
void requestConnection()
request connection to server, store in 'connection' if successful.
DVPSIPCMessage()
default constructor
void notifyRequestedEncryptedDICOMConnection(Uint32 status, const char *txt)
sends RequestedEncryptedDICOMConnection notification to server.


Generated on Wed Dec 28 2016 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.8