dcmtls/include/dcmtk/dcmtls/tlstrans.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: dcmnet
00015  *
00016  *  Author: Marco Eichelberg
00017  *
00018  *  Purpose:
00019  *    classes: DcmTransportConnection
00020  *
00021  *  Last Update:      $Author: joergr $
00022  *  Update Date:      $Date: 2010-10-14 13:17:27 $
00023  *  CVS/RCS Revision: $Revision: 1.9 $
00024  *  Status:           $State: Exp $
00025  *
00026  *  CVS/RCS Log at end of file
00027  *
00028  */
00029 
00030 #ifndef TLSTRANS_H
00031 #define TLSTRANS_H
00032 
00033 #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
00034 #include "dcmtk/dcmnet/dcmtrans.h"    /* for DcmTransportConnection */
00035 #include "dcmtk/ofstd/ofstream.h"    /* for ostream */
00036 
00037 #ifdef WITH_OPENSSL
00038 
00039 BEGIN_EXTERN_C
00040 #include <openssl/ssl.h>
00041 END_EXTERN_C
00042 
00043 
00047 class DcmTLSConnection: public DcmTransportConnection
00048 {
00049 public:
00050 
00058   DcmTLSConnection(int openSocket, SSL *newTLSConnection);
00059 
00062   virtual ~DcmTLSConnection();
00063 
00069   virtual DcmTransportLayerStatus serverSideHandshake();
00070 
00076   virtual DcmTransportLayerStatus clientSideHandshake();
00077 
00084   virtual DcmTransportLayerStatus renegotiate(const char *newSuite);
00085 
00092   virtual ssize_t read(void *buf, size_t nbyte);
00093 
00100   virtual ssize_t write(void *buf, size_t nbyte);
00101 
00106   virtual void close();
00107 
00111   virtual unsigned long getPeerCertificateLength();
00112 
00113   /* copies the peer certificate of a secure connection into a buffer
00114    * specified by the caller. If the buffer is too small to hold the
00115    * certificate, nothing is copied and zero is returned.
00116    * @param buf buffer into which the certificate is written
00117    * @param bufLen size of the buffer in bytes
00118    * @return number of bytes written, always less or equal bufLen.
00119    */
00120   virtual unsigned long getPeerCertificate(void *buf, unsigned long bufLen);
00121 
00127   virtual OFBool networkDataAvailable(int timeout);
00128 
00132   virtual OFBool isTransparentConnection();
00133 
00138   virtual OFString& dumpConnectionParameters(OFString& str);
00139 
00144   virtual const char *errorString(DcmTransportLayerStatus code);
00145 
00146 private:
00147 
00149   DcmTLSConnection(const DcmTLSConnection&);
00150 
00152   DcmTLSConnection& operator=(const DcmTLSConnection&);
00153 
00155   SSL *tlsConnection;
00156 
00158   unsigned long lastError;
00159 };
00160 
00161 #endif /* WITH_OPENSSL */
00162 
00163 #endif
00164 
00165 /*
00166  *  $Log: tlstrans.h,v $
00167  *  Revision 1.9  2010-10-14 13:17:27  joergr
00168  *  Updated copyright header. Added reference to COPYRIGHT file.
00169  *
00170  *  Revision 1.8  2009-11-18 12:11:19  uli
00171  *  Switched to logging mechanism provided by the "new" oflog module.
00172  *
00173  *  Revision 1.7  2006-08-15 16:02:55  meichel
00174  *  Updated the code in module dcmtls to correctly compile when
00175  *    all standard C++ classes remain in namespace std.
00176  *
00177  *  Revision 1.6  2005/12/08 16:05:39  meichel
00178  *  Changed include path schema for all DCMTK header files
00179  *
00180  *  Revision 1.5  2003/12/05 10:38:55  joergr
00181  *  Removed leading underscore characters from preprocessor symbols (reserved
00182  *  symbols).
00183  *
00184  *  Revision 1.4  2003/07/04 13:28:32  meichel
00185  *  Added include for ofstream.h, to make sure ofstream is correctly defined
00186  *
00187  *  Revision 1.3  2001/06/01 15:51:12  meichel
00188  *  Updated copyright header
00189  *
00190  *  Revision 1.2  2000/10/10 12:13:32  meichel
00191  *  Added routines for printing certificates and connection parameters.
00192  *
00193  *  Revision 1.1  2000/08/10 14:50:27  meichel
00194  *  Added initial OpenSSL support.
00195  *
00196  *
00197  */
00198 


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