/usr/include/dcmtk/dcmpstat/dvpsmsg.h is in libdcmtk-dev 3.6.1~20160216-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | /*
*
* Copyright (C) 1998-2012, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmpstat
*
* Author: Marco Eichelberg
*
* Purpose:
* classes: DVPSIPCMessage
*
*/
#ifndef DVPSMSG_H
#define DVPSMSG_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmpstat/dpdefine.h"
#include "dcmtk/dcmdata/dctypes.h" /* for Uint32 */
#include "dcmtk/ofstd/ofstring.h" /* for class OFString */
class DcmTransportConnection;
/** class for IPC message exchange between different processes of the
* DICOMscope application
*/
class DCMTK_DCMPSTAT_EXPORT DVPSIPCMessage
{
public:
/// default constructor
DVPSIPCMessage();
/// copy constructor
DVPSIPCMessage(const DVPSIPCMessage& copy);
/// destructor
virtual ~DVPSIPCMessage();
/// copy assignment operator
DVPSIPCMessage& operator=(const DVPSIPCMessage&);
/** sets the message type
* @param msgtype new message type
*/
void setMessageType(Uint32 msgtype) { messageType = msgtype; }
/** returns the message type
* @return message type
*/
Uint32 getMessageType() { return messageType; }
/** adds a character string into the message payload.
* @param str zero terminated string, may be NULL (in which case an empty string is added)
*/
void addStringToPayload(const char *str);
/** adds an integer into the message payload.
* @param value to write
*/
void addIntToPayload(Uint32 i);
/** extracts a string from the message payload
* and copies it into the given str object.
* @param str string is written into this parameter
* @return OFTrue if successful, OFFalse otherwise
*/
OFBool extractStringFromPayload(OFString& str);
/** extracts an integer from the message payload.
* @param i integer is written into this parameter
* @return OFTrue if successful, OFFalse otherwise
*/
OFBool extractIntFromPayload(Uint32& i);
/** rewinds the read offset to the beginning of the message payload
*/
void rewindPayload();
/** removes all payload
*/
void erasePayload();
/** sends the current message over the given transport connection.
* @param connection transport connection to be used
* @return OFTrue if successful, OFFalse otherwise.
*/
OFBool send(DcmTransportConnection &connection);
/** receives a messages from the given transport connection
* and stores it in the current object, replacing any existing
* payload.
* @param connection transport connection to be used
* @return OFTrue if successful, OFFalse otherwise.
*/
OFBool receive(DcmTransportConnection &connection);
// constants for message type
static const Uint32 OK;
static const Uint32 requestApplicationID;
static const Uint32 assignApplicationID;
static const Uint32 applicationTerminates;
static const Uint32 receivedUnencryptedDICOMConnection;
static const Uint32 receivedEncryptedDICOMConnection;
static const Uint32 connectionClosed;
static const Uint32 connectionAborted;
static const Uint32 requestedUnencryptedDICOMConnection;
static const Uint32 requestedEncryptedDICOMConnection;
static const Uint32 receivedDICOMObject;
static const Uint32 sentDICOMObject;
// message status constants
static const Uint32 statusOK; // OK
static const Uint32 statusWarning; // warning
static const Uint32 statusError; // error
// client type constants
static const Uint32 clientOther; // client is of unspecified type
static const Uint32 clientStoreSCP; // client is Store SCP
static const Uint32 clientStoreSCU; // client is Store SCU
static const Uint32 clientPrintSCP; // client is Print SCP
static const Uint32 clientPrintSCU; // client is Print SCU
static const Uint32 clientQRSCP; // client is Query/Retrieve (Find/Move/Get) SCP
private:
/** resize payload if necessary such that at least i bytes can be written
* @param i number of bytes required in buffer
*/
void resizePayload(Uint32 i);
/// type of message
Uint32 messageType;
/// number of bytes actually used in payload
Uint32 payloadUsed;
/// number of bytes allocated in payload
Uint32 payloadAllocated;
/// read offset into payload in bytes
Uint32 payloadReadOffset;
/// pointer to raw payload data in big endian byte order
unsigned char *payload;
};
/** a client for IPC message exchange between different processes of the
* DICOMscope application
*/
class DCMTK_DCMPSTAT_EXPORT DVPSIPCClient
{
public:
/** constructor
* @param clientType type of client application, see constants defined in DVPSIPCMessage
* @param txt textual description of client application
* @param thePort TCP/IP port on which the server is listening
* @param keepOpen flag indicating whether the connection should be kept
* open all the time or should be opened/closed for each transaction.
*/
DVPSIPCClient(Uint32 clientType, const char *txt, int thePort, OFBool keepOpen);
/// destructor
virtual ~DVPSIPCClient();
/** sends ApplicationTerminates notification to server.
* @param Uint32 message status, see constants defined in DVPSIPCMessage
*/
void notifyApplicationTerminates(Uint32 status);
/** sends ReceivedUnencryptedDICOMConnection notification to server.
* @param Uint32 message status, see constants defined in DVPSIPCMessage
* @param txt textual description of notification for server
*/
void notifyReceivedUnencryptedDICOMConnection(Uint32 status, const char *txt);
/** sends ReceivedEncryptedDICOMConnection notification to server.
* @param Uint32 message status, see constants defined in DVPSIPCMessage
* @param txt textual description of notification for server
*/
void notifyReceivedEncryptedDICOMConnection(Uint32 status, const char *txt);
/** sends ConnectionClosed notification to server.
* @param Uint32 message status, see constants defined in DVPSIPCMessage
*/
void notifyConnectionClosed(Uint32 status);
/** sends ConnectionAborted notification to server.
* @param Uint32 message status, see constants defined in DVPSIPCMessage
* @param txt textual description of notification for server
*/
void notifyConnectionAborted(Uint32 status, const char *txt);
/** sends RequestedUnencryptedDICOMConnection notification to server.
* @param Uint32 message status, see constants defined in DVPSIPCMessage
* @param txt textual description of notification for server
*/
void notifyRequestedUnencryptedDICOMConnection(Uint32 status, const char *txt);
/** sends RequestedEncryptedDICOMConnection notification to server.
* @param Uint32 message status, see constants defined in DVPSIPCMessage
* @param txt textual description of notification for server
*/
void notifyRequestedEncryptedDICOMConnection(Uint32 status, const char *txt);
/** sends ReceivedDICOMObject notification to server.
* @param Uint32 message status, see constants defined in DVPSIPCMessage
* @param txt textual description of DICOM object
*/
void notifyReceivedDICOMObject(Uint32 status, const char *txt);
/** sends SentDICOMObject notification to server.
* @param Uint32 message status, see constants defined in DVPSIPCMessage
* @param txt textual description of DICOM object
*/
void notifySentDICOMObject(Uint32 status, const char *txt);
/** checks whether the message server has been found active
* upon creation of this object.
* @return OFTrue if server is active, OFFalse otherwise.
*/
OFBool isServerActive() { return serverActive; }
private:
/// private undefined copy constructor
DVPSIPCClient(const DVPSIPCClient& copy);
/// private undefined copy assignment operator
DVPSIPCClient& operator=(const DVPSIPCClient&);
/** request connection to server, store in 'connection' if successful.
*/
void requestConnection();
/** perform message transaction with server. If serverActive is false,
* no connection attempt is performed.
* @param msg contains message to be sent, overwritten with message
* received from server if successful
* @return OFTrue if successful, OFFalse otherwise
*/
OFBool performTransaction(DVPSIPCMessage& msg);
/// TCP/IP port number on which the server is listening
int port;
/// true if the first connection attempt has succeeded, false otherwise
OFBool serverActive;
/// application ID assigned by the server
Uint32 applicationID;
/// flag indicating whether we want to keep the connection open
OFBool keepConnectionOpen;
/// current transport connection
DcmTransportConnection *connection;
};
#endif
|