00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef __DVPSMSG_H__
00035 #define __DVPSMSG_H__
00036
00037 #include "dcmtk/config/osconfig.h"
00038 #include "dcmtk/dcmdata/dctypes.h"
00039 #include "dcmtk/ofstd/ofstring.h"
00040
00041 class DcmTransportConnection;
00042
00046 class DVPSIPCMessage
00047 {
00048 public:
00049
00051 DVPSIPCMessage();
00052
00054 DVPSIPCMessage(const DVPSIPCMessage& copy);
00055
00057 virtual ~DVPSIPCMessage();
00058
00060 DVPSIPCMessage& operator=(const DVPSIPCMessage&);
00061
00065 void setMessageType(Uint32 msgtype) { messageType = msgtype; }
00066
00070 Uint32 getMessageType() { return messageType; }
00071
00075 void addStringToPayload(const char *str);
00076
00080 void addIntToPayload(Uint32 i);
00081
00087 OFBool extractStringFromPayload(OFString& str);
00088
00093 OFBool extractIntFromPayload(Uint32& i);
00094
00097 void rewindPayload();
00098
00101 void erasePayload();
00102
00107 OFBool send(DcmTransportConnection &connection);
00108
00115 OFBool receive(DcmTransportConnection &connection);
00116
00117
00118
00119 static const Uint32 OK;
00120 static const Uint32 requestApplicationID;
00121 static const Uint32 assignApplicationID;
00122 static const Uint32 applicationTerminates;
00123 static const Uint32 receivedUnencryptedDICOMConnection;
00124 static const Uint32 receivedEncryptedDICOMConnection;
00125 static const Uint32 connectionClosed;
00126 static const Uint32 connectionAborted;
00127 static const Uint32 requestedUnencryptedDICOMConnection;
00128 static const Uint32 requestedEncryptedDICOMConnection;
00129 static const Uint32 receivedDICOMObject;
00130 static const Uint32 sentDICOMObject;
00131
00132
00133 static const Uint32 statusOK;
00134 static const Uint32 statusWarning;
00135 static const Uint32 statusError;
00136
00137
00138 static const Uint32 clientOther;
00139 static const Uint32 clientStoreSCP;
00140 static const Uint32 clientStoreSCU;
00141 static const Uint32 clientPrintSCP;
00142 static const Uint32 clientPrintSCU;
00143 static const Uint32 clientQRSCP;
00144
00145 private:
00146
00150 void resizePayload(Uint32 i);
00151
00153 Uint32 messageType;
00154
00156 Uint32 payloadUsed;
00157
00159 Uint32 payloadAllocated;
00160
00162 Uint32 payloadReadOffset;
00163
00165 unsigned char *payload;
00166 };
00167
00168
00172 class DVPSIPCClient
00173 {
00174 public:
00175
00183 DVPSIPCClient(Uint32 clientType, const char *txt, int thePort, OFBool keepOpen);
00184
00186 virtual ~DVPSIPCClient();
00187
00191 void notifyApplicationTerminates(Uint32 status);
00192
00197 void notifyReceivedUnencryptedDICOMConnection(Uint32 status, const char *txt);
00198
00203 void notifyReceivedEncryptedDICOMConnection(Uint32 status, const char *txt);
00204
00208 void notifyConnectionClosed(Uint32 status);
00209
00214 void notifyConnectionAborted(Uint32 status, const char *txt);
00215
00220 void notifyRequestedUnencryptedDICOMConnection(Uint32 status, const char *txt);
00221
00226 void notifyRequestedEncryptedDICOMConnection(Uint32 status, const char *txt);
00227
00232 void notifyReceivedDICOMObject(Uint32 status, const char *txt);
00233
00238 void notifySentDICOMObject(Uint32 status, const char *txt);
00239
00244 OFBool isServerActive() { return serverActive; }
00245
00246 private:
00247
00249 DVPSIPCClient(const DVPSIPCClient& copy);
00250
00252 DVPSIPCClient& operator=(const DVPSIPCClient&);
00253
00256 void requestConnection();
00257
00264 OFBool performTransaction(DVPSIPCMessage& msg);
00265
00267 int port;
00268
00270 OFBool serverActive;
00271
00273 Uint32 applicationID;
00274
00276 OFBool keepConnectionOpen;
00277
00279 DcmTransportConnection *connection;
00280 };
00281
00282
00283 #endif
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304