OFFIS DCMTK  Version 3.6.0
tlstrans.h
1 /*
2  *
3  * Copyright (C) 1998-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmnet
15  *
16  * Author: Marco Eichelberg
17  *
18  * Purpose:
19  * classes: DcmTransportConnection
20  *
21  * Last Update: $Author: joergr $
22  * Update Date: $Date: 2010-10-14 13:17:27 $
23  * CVS/RCS Revision: $Revision: 1.9 $
24  * Status: $State: Exp $
25  *
26  * CVS/RCS Log at end of file
27  *
28  */
29 
30 #ifndef TLSTRANS_H
31 #define TLSTRANS_H
32 
33 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
34 #include "dcmtk/dcmnet/dcmtrans.h" /* for DcmTransportConnection */
35 #include "dcmtk/ofstd/ofstream.h" /* for ostream */
36 
37 #ifdef WITH_OPENSSL
38 
39 BEGIN_EXTERN_C
40 #include <openssl/ssl.h>
41 END_EXTERN_C
42 
43 
48 {
49 public:
50 
58  DcmTLSConnection(int openSocket, SSL *newTLSConnection);
59 
62  virtual ~DcmTLSConnection();
63 
69  virtual DcmTransportLayerStatus serverSideHandshake();
70 
76  virtual DcmTransportLayerStatus clientSideHandshake();
77 
84  virtual DcmTransportLayerStatus renegotiate(const char *newSuite);
85 
92  virtual ssize_t read(void *buf, size_t nbyte);
93 
100  virtual ssize_t write(void *buf, size_t nbyte);
101 
106  virtual void close();
107 
111  virtual unsigned long getPeerCertificateLength();
112 
113  /* copies the peer certificate of a secure connection into a buffer
114  * specified by the caller. If the buffer is too small to hold the
115  * certificate, nothing is copied and zero is returned.
116  * @param buf buffer into which the certificate is written
117  * @param bufLen size of the buffer in bytes
118  * @return number of bytes written, always less or equal bufLen.
119  */
120  virtual unsigned long getPeerCertificate(void *buf, unsigned long bufLen);
121 
127  virtual OFBool networkDataAvailable(int timeout);
128 
132  virtual OFBool isTransparentConnection();
133 
139 
144  virtual const char *errorString(DcmTransportLayerStatus code);
145 
146 private:
147 
150 
153 
156 
158  unsigned long lastError;
159 };
160 
161 #endif /* WITH_OPENSSL */
162 
163 #endif
164 
165 /*
166  * $Log: tlstrans.h,v $
167  * Revision 1.9 2010-10-14 13:17:27 joergr
168  * Updated copyright header. Added reference to COPYRIGHT file.
169  *
170  * Revision 1.8 2009-11-18 12:11:19 uli
171  * Switched to logging mechanism provided by the "new" oflog module.
172  *
173  * Revision 1.7 2006-08-15 16:02:55 meichel
174  * Updated the code in module dcmtls to correctly compile when
175  * all standard C++ classes remain in namespace std.
176  *
177  * Revision 1.6 2005/12/08 16:05:39 meichel
178  * Changed include path schema for all DCMTK header files
179  *
180  * Revision 1.5 2003/12/05 10:38:55 joergr
181  * Removed leading underscore characters from preprocessor symbols (reserved
182  * symbols).
183  *
184  * Revision 1.4 2003/07/04 13:28:32 meichel
185  * Added include for ofstream.h, to make sure ofstream is correctly defined
186  *
187  * Revision 1.3 2001/06/01 15:51:12 meichel
188  * Updated copyright header
189  *
190  * Revision 1.2 2000/10/10 12:13:32 meichel
191  * Added routines for printing certificates and connection parameters.
192  *
193  * Revision 1.1 2000/08/10 14:50:27 meichel
194  * Added initial OpenSSL support.
195  *
196  *
197  */
198 
virtual OFBool networkDataAvailable(int timeout)
checks if data is available to be read on the transport connection.
this class represents a TLS (Transport Layer Security) V1 based secure transport connection.
Definition: tlstrans.h:47
SSL * tlsConnection
pointer to the TLS connection structure used by the OpenSSL library
Definition: tlstrans.h:155
virtual OFString & dumpConnectionParameters(OFString &str)
dump the characteristics of the current connection
this class represents a TCP/IP based transport connection which can be a transparent TCP/IP socket co...
Definition: dcmtrans.h:45
DcmTLSConnection & operator=(const DcmTLSConnection &)
private undefined assignment operator
DcmTLSConnection(int openSocket, SSL *newTLSConnection)
constructor.
virtual DcmTransportLayerStatus clientSideHandshake()
performs client side handshake on established socket.
virtual unsigned long getPeerCertificateLength()
returns the size in bytes of the peer certificate of a secure connection.
virtual OFBool isTransparentConnection()
returns OFTrue if this connection is a transparent TCP connection, OFFalse if the connection is a sec...
virtual void close()
Closes the transport connection.
virtual DcmTransportLayerStatus renegotiate(const char *newSuite)
performs a re-negotiation of the connection with different connection parameters. ...
virtual ssize_t write(void *buf, size_t nbyte)
attempts to write nbyte bytes from the given buffer to the transport connection.
unsigned long lastError
last error code returned by the OpenSSL library
Definition: tlstrans.h:158
virtual const char * errorString(DcmTransportLayerStatus code)
returns an error string for a given error code.
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
virtual ~DcmTLSConnection()
destructor
virtual DcmTransportLayerStatus serverSideHandshake()
performs server side handshake on established socket.
virtual ssize_t read(void *buf, size_t nbyte)
attempts to read nbyte bytes from the transport connection and writes them into the given buffer...


Generated on Sun Aug 23 2015 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.9.1