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: dcmnet 00019 * 00020 * Author: Marco Eichelberg 00021 * 00022 * Purpose: 00023 * classes: DcmTransportConnection 00024 * 00025 * Last Update: $Author: meichel $ 00026 * Update Date: $Date: 2005/12/08 16:05:39 $ 00027 * CVS/RCS Revision: $Revision: 1.6 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 #ifndef TLSTRANS_H 00035 #define TLSTRANS_H 00036 00037 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00038 #include "dcmtk/dcmnet/dcmtrans.h" /* for DcmTransportConnection */ 00039 #include "dcmtk/ofstd/ofstream.h" /* for ostream */ 00040 00041 #ifdef WITH_OPENSSL 00042 00043 BEGIN_EXTERN_C 00044 #include <openssl/ssl.h> 00045 END_EXTERN_C 00046 00047 00051 class DcmTLSConnection: public DcmTransportConnection 00052 { 00053 public: 00054 00062 DcmTLSConnection(int openSocket, SSL *newTLSConnection); 00063 00066 virtual ~DcmTLSConnection(); 00067 00073 virtual DcmTransportLayerStatus serverSideHandshake(); 00074 00080 virtual DcmTransportLayerStatus clientSideHandshake(); 00081 00088 virtual DcmTransportLayerStatus renegotiate(const char *newSuite); 00089 00096 virtual ssize_t read(void *buf, size_t nbyte); 00097 00104 virtual ssize_t write(void *buf, size_t nbyte); 00105 00110 virtual void close(); 00111 00115 virtual unsigned long getPeerCertificateLength(); 00116 00117 /* copies the peer certificate of a secure connection into a buffer 00118 * specified by the caller. If the buffer is too small to hold the 00119 * certificate, nothing is copied and zero is returned. 00120 * @param buf buffer into which the certificate is written 00121 * @param bufLen size of the buffer in bytes 00122 * @return number of bytes written, always less or equal bufLen. 00123 */ 00124 virtual unsigned long getPeerCertificate(void *buf, unsigned long bufLen); 00125 00131 virtual OFBool networkDataAvailable(int timeout); 00132 00136 virtual OFBool isTransparentConnection(); 00137 00142 virtual void dumpConnectionParameters(ostream &out); 00143 00148 virtual const char *errorString(DcmTransportLayerStatus code); 00149 00150 private: 00151 00153 DcmTLSConnection(const DcmTLSConnection&); 00154 00156 DcmTLSConnection& operator=(const DcmTLSConnection&); 00157 00159 SSL *tlsConnection; 00160 00162 unsigned long lastError; 00163 }; 00164 00165 #endif /* WITH_OPENSSL */ 00166 00167 #endif 00168 00169 /* 00170 * $Log: tlstrans.h,v $ 00171 * Revision 1.6 2005/12/08 16:05:39 meichel 00172 * Changed include path schema for all DCMTK header files 00173 * 00174 * Revision 1.5 2003/12/05 10:38:55 joergr 00175 * Removed leading underscore characters from preprocessor symbols (reserved 00176 * symbols). 00177 * 00178 * Revision 1.4 2003/07/04 13:28:32 meichel 00179 * Added include for ofstream.h, to make sure ofstream is correctly defined 00180 * 00181 * Revision 1.3 2001/06/01 15:51:12 meichel 00182 * Updated copyright header 00183 * 00184 * Revision 1.2 2000/10/10 12:13:32 meichel 00185 * Added routines for printing certificates and connection parameters. 00186 * 00187 * Revision 1.1 2000/08/10 14:50:27 meichel 00188 * Added initial OpenSSL support. 00189 * 00190 * 00191 */ 00192