00001 /* 00002 * 00003 * Copyright (C) 1998-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: dcmpstat 00019 * 00020 * Author: Marco Eichelberg 00021 * 00022 * Purpose: 00023 * classes: DVPSIPCMessage 00024 * 00025 * Last Update: $Author: meichel $ 00026 * Update Date: $Date: 2005/12/08 16:03:52 $ 00027 * CVS/RCS Revision: $Revision: 1.5 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 #ifndef __DVPSMSG_H__ 00035 #define __DVPSMSG_H__ 00036 00037 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00038 #include "dcmtk/dcmdata/dctypes.h" /* for Uint32 */ 00039 #include "dcmtk/ofstd/ofstring.h" /* for class OFString */ 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 // constants for message type 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 // message status constants 00133 static const Uint32 statusOK; // OK 00134 static const Uint32 statusWarning; // warning 00135 static const Uint32 statusError; // error 00136 00137 // client type constants 00138 static const Uint32 clientOther; // client is of unspecified type 00139 static const Uint32 clientStoreSCP; // client is Store SCP 00140 static const Uint32 clientStoreSCU; // client is Store SCU 00141 static const Uint32 clientPrintSCP; // client is Print SCP 00142 static const Uint32 clientPrintSCU; // client is Print SCU 00143 static const Uint32 clientQRSCP; // client is Query/Retrieve (Find/Move/Get) SCP 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 * $Log: dvpsmsg.h,v $ 00287 * Revision 1.5 2005/12/08 16:03:52 meichel 00288 * Changed include path schema for all DCMTK header files 00289 * 00290 * Revision 1.4 2003/07/04 13:27:38 meichel 00291 * Replaced forward declarations for OFString with explicit includes, 00292 * needed when compiling with HAVE_STD_STRING 00293 * 00294 * Revision 1.3 2001/06/01 15:50:18 meichel 00295 * Updated copyright header 00296 * 00297 * Revision 1.2 2000/11/08 18:38:15 meichel 00298 * Updated dcmpstat IPC protocol for additional message parameters 00299 * 00300 * Revision 1.1 2000/10/10 12:24:36 meichel 00301 * Added extensions for IPC message communication 00302 * 00303 * 00304 */