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 #ifndef DVPSMSG_H
00031 #define DVPSMSG_H
00032
00033 #include "dcmtk/config/osconfig.h"
00034 #include "dcmtk/dcmdata/dctypes.h"
00035 #include "dcmtk/ofstd/ofstring.h"
00036
00037 class DcmTransportConnection;
00038
00042 class DVPSIPCMessage
00043 {
00044 public:
00045
00047 DVPSIPCMessage();
00048
00050 DVPSIPCMessage(const DVPSIPCMessage& copy);
00051
00053 virtual ~DVPSIPCMessage();
00054
00056 DVPSIPCMessage& operator=(const DVPSIPCMessage&);
00057
00061 void setMessageType(Uint32 msgtype) { messageType = msgtype; }
00062
00066 Uint32 getMessageType() { return messageType; }
00067
00071 void addStringToPayload(const char *str);
00072
00076 void addIntToPayload(Uint32 i);
00077
00083 OFBool extractStringFromPayload(OFString& str);
00084
00089 OFBool extractIntFromPayload(Uint32& i);
00090
00093 void rewindPayload();
00094
00097 void erasePayload();
00098
00103 OFBool send(DcmTransportConnection &connection);
00104
00111 OFBool receive(DcmTransportConnection &connection);
00112
00113
00114
00115 static const Uint32 OK;
00116 static const Uint32 requestApplicationID;
00117 static const Uint32 assignApplicationID;
00118 static const Uint32 applicationTerminates;
00119 static const Uint32 receivedUnencryptedDICOMConnection;
00120 static const Uint32 receivedEncryptedDICOMConnection;
00121 static const Uint32 connectionClosed;
00122 static const Uint32 connectionAborted;
00123 static const Uint32 requestedUnencryptedDICOMConnection;
00124 static const Uint32 requestedEncryptedDICOMConnection;
00125 static const Uint32 receivedDICOMObject;
00126 static const Uint32 sentDICOMObject;
00127
00128
00129 static const Uint32 statusOK;
00130 static const Uint32 statusWarning;
00131 static const Uint32 statusError;
00132
00133
00134 static const Uint32 clientOther;
00135 static const Uint32 clientStoreSCP;
00136 static const Uint32 clientStoreSCU;
00137 static const Uint32 clientPrintSCP;
00138 static const Uint32 clientPrintSCU;
00139 static const Uint32 clientQRSCP;
00140
00141 private:
00142
00146 void resizePayload(Uint32 i);
00147
00149 Uint32 messageType;
00150
00152 Uint32 payloadUsed;
00153
00155 Uint32 payloadAllocated;
00156
00158 Uint32 payloadReadOffset;
00159
00161 unsigned char *payload;
00162 };
00163
00164
00168 class DVPSIPCClient
00169 {
00170 public:
00171
00179 DVPSIPCClient(Uint32 clientType, const char *txt, int thePort, OFBool keepOpen);
00180
00182 virtual ~DVPSIPCClient();
00183
00187 void notifyApplicationTerminates(Uint32 status);
00188
00193 void notifyReceivedUnencryptedDICOMConnection(Uint32 status, const char *txt);
00194
00199 void notifyReceivedEncryptedDICOMConnection(Uint32 status, const char *txt);
00200
00204 void notifyConnectionClosed(Uint32 status);
00205
00210 void notifyConnectionAborted(Uint32 status, const char *txt);
00211
00216 void notifyRequestedUnencryptedDICOMConnection(Uint32 status, const char *txt);
00217
00222 void notifyRequestedEncryptedDICOMConnection(Uint32 status, const char *txt);
00223
00228 void notifyReceivedDICOMObject(Uint32 status, const char *txt);
00229
00234 void notifySentDICOMObject(Uint32 status, const char *txt);
00235
00240 OFBool isServerActive() { return serverActive; }
00241
00242 private:
00243
00245 DVPSIPCClient(const DVPSIPCClient& copy);
00246
00248 DVPSIPCClient& operator=(const DVPSIPCClient&);
00249
00252 void requestConnection();
00253
00260 OFBool performTransaction(DVPSIPCMessage& msg);
00261
00263 int port;
00264
00266 OFBool serverActive;
00267
00269 Uint32 applicationID;
00270
00272 OFBool keepConnectionOpen;
00273
00275 DcmTransportConnection *connection;
00276 };
00277
00278
00279 #endif
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306