dcmpstat/include/dcmtk/dcmpstat/dvpsmsg.h

00001 /*
00002  *
00003  *  Copyright (C) 1998-2010, OFFIS e.V.
00004  *  All rights reserved.  See COPYRIGHT file for details.
00005  *
00006  *  This software and supporting documentation were developed by
00007  *
00008  *    OFFIS e.V.
00009  *    R&D Division Health
00010  *    Escherweg 2
00011  *    D-26121 Oldenburg, Germany
00012  *
00013  *
00014  *  Module: dcmpstat
00015  *
00016  *  Author: Marco Eichelberg
00017  *
00018  *  Purpose:
00019  *    classes: DVPSIPCMessage
00020  *
00021  *  Last Update:      $Author: joergr $
00022  *  Update Date:      $Date: 2010-10-14 13:16:36 $
00023  *  CVS/RCS Revision: $Revision: 1.7 $
00024  *  Status:           $State: Exp $
00025  *
00026  *  CVS/RCS Log at end of file
00027  *
00028  */
00029 
00030 #ifndef DVPSMSG_H
00031 #define DVPSMSG_H
00032 
00033 #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
00034 #include "dcmtk/dcmdata/dctypes.h"    /* for Uint32 */
00035 #include "dcmtk/ofstd/ofstring.h"     /* for class OFString */
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   // constants for message type
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   // message status constants
00129   static const Uint32 statusOK;      // OK
00130   static const Uint32 statusWarning; // warning
00131   static const Uint32 statusError;   // error
00132 
00133   // client type constants
00134   static const Uint32 clientOther;    // client is of unspecified type
00135   static const Uint32 clientStoreSCP; // client is Store SCP
00136   static const Uint32 clientStoreSCU; // client is Store SCU
00137   static const Uint32 clientPrintSCP; // client is Print SCP
00138   static const Uint32 clientPrintSCU; // client is Print SCU
00139   static const Uint32 clientQRSCP;    // client is Query/Retrieve (Find/Move/Get) SCP
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  *  $Log: dvpsmsg.h,v $
00283  *  Revision 1.7  2010-10-14 13:16:36  joergr
00284  *  Updated copyright header. Added reference to COPYRIGHT file.
00285  *
00286  *  Revision 1.6  2010-10-07 14:31:36  joergr
00287  *  Removed leading underscore characters from preprocessor symbols (reserved).
00288  *
00289  *  Revision 1.5  2005/12/08 16:03:52  meichel
00290  *  Changed include path schema for all DCMTK header files
00291  *
00292  *  Revision 1.4  2003/07/04 13:27:38  meichel
00293  *  Replaced forward declarations for OFString with explicit includes,
00294  *    needed when compiling with HAVE_STD_STRING
00295  *
00296  *  Revision 1.3  2001/06/01 15:50:18  meichel
00297  *  Updated copyright header
00298  *
00299  *  Revision 1.2  2000/11/08 18:38:15  meichel
00300  *  Updated dcmpstat IPC protocol for additional message parameters
00301  *
00302  *  Revision 1.1  2000/10/10 12:24:36  meichel
00303  *  Added extensions for IPC message communication
00304  *
00305  *
00306  */


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1