OFFIS DCMTK
Version 3.6.0
Main Page
Related Pages
Classes
Files
File List
File Members
dcmnet
include
dcmtk
dcmnet
dcmtrans.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, DcmTCPConnection
20
*
21
* Last Update: $Author: joergr $
22
* Update Date: $Date: 2010-10-14 13:17:22 $
23
* CVS/RCS Revision: $Revision: 1.11 $
24
* Status: $State: Exp $
25
*
26
* CVS/RCS Log at end of file
27
*
28
*/
29
30
#ifndef DCMTRANS_H
31
#define DCMTRANS_H
32
33
#include "dcmtk/config/osconfig.h"
/* make sure OS specific configuration is included first */
34
#include "dcmtk/ofstd/oftypes.h"
/* for OFBool */
35
#include "dcmtk/dcmnet/dcmlayer.h"
/* for DcmTransportLayerStatus */
36
#include "dcmtk/ofstd/ofstream.h"
/* for ostream */
37
38
#define INCLUDE_UNISTD
39
#include "dcmtk/ofstd/ofstdinc.h"
40
45
class
DcmTransportConnection
46
{
47
public
:
48
54
DcmTransportConnection
(
int
openSocket);
55
58
virtual
~DcmTransportConnection
();
59
65
virtual
DcmTransportLayerStatus
serverSideHandshake
() = 0;
66
72
virtual
DcmTransportLayerStatus
clientSideHandshake
() = 0;
73
80
virtual
DcmTransportLayerStatus
renegotiate
(
const
char
*newSuite) = 0;
81
88
virtual
ssize_t
read
(
void
*buf,
size_t
nbyte) = 0;
89
96
virtual
ssize_t
write
(
void
*buf,
size_t
nbyte) = 0;
97
102
virtual
void
close
() = 0;
103
108
virtual
unsigned
long
getPeerCertificateLength
() = 0;
109
110
/* copies the peer certificate of a secure connection into a buffer
111
* specified by the caller. If the buffer is too small to hold the
112
* certificate, nothing is copied and zero is returned.
113
* @param buf buffer into which the certificate is written
114
* @param bufLen size of the buffer in bytes
115
* @return number of bytes written, always less or equal bufLen.
116
*/
117
virtual
unsigned
long
getPeerCertificate(
void
*buf,
unsigned
long
bufLen) = 0;
118
125
virtual
OFBool
networkDataAvailable
(
int
timeout) = 0;
126
130
virtual
OFBool
isTransparentConnection
() = 0;
131
136
virtual
OFString
&
dumpConnectionParameters
(
OFString
& str) = 0;
137
143
void
dumpConnectionParameters
(STD_NAMESPACE ostream& out);
144
149
virtual
const
char
*
errorString
(DcmTransportLayerStatus code) = 0;
150
165
static
OFBool
selectReadableAssociation
(
DcmTransportConnection
*connections[],
int
connCount,
int
timeout);
166
167
protected
:
168
172
int
getSocket
() {
return
theSocket
; }
173
177
void
setSocket
(
int
socket) {
theSocket
= socket; }
178
179
private
:
180
182
DcmTransportConnection
(
const
DcmTransportConnection
&);
183
185
DcmTransportConnection
&
operator=
(
const
DcmTransportConnection
&);
186
203
static
OFBool
safeSelectReadableAssociation
(
DcmTransportConnection
*connections[],
int
connCount,
int
timeout);
204
221
static
OFBool
fastSelectReadableAssociation
(
DcmTransportConnection
*connections[],
int
connCount,
int
timeout);
222
224
int
theSocket
;
225
};
226
227
230
class
DcmTCPConnection
:
public
DcmTransportConnection
231
{
232
public
:
233
239
DcmTCPConnection
(
int
openSocket);
240
243
virtual
~DcmTCPConnection
();
244
250
virtual
DcmTransportLayerStatus
serverSideHandshake
();
251
257
virtual
DcmTransportLayerStatus
clientSideHandshake
();
258
265
virtual
DcmTransportLayerStatus
renegotiate
(
const
char
*newSuite);
266
273
virtual
ssize_t
read
(
void
*buf,
size_t
nbyte);
274
281
virtual
ssize_t
write
(
void
*buf,
size_t
nbyte);
282
287
virtual
void
close
();
288
293
virtual
unsigned
long
getPeerCertificateLength
();
294
295
/* copies the peer certificate of a secure connection into a buffer
296
* specified by the caller. If the buffer is too small to hold the
297
* certificate, nothing is copied and zero is returned.
298
* @param buf buffer into which the certificate is written
299
* @param bufLen size of the buffer in bytes
300
* @return number of bytes written, always less or equal bufLen.
301
*/
302
virtual
unsigned
long
getPeerCertificate(
void
*buf,
unsigned
long
bufLen);
303
309
virtual
OFBool
networkDataAvailable
(
int
timeout);
310
314
virtual
OFBool
isTransparentConnection
();
315
320
virtual
OFString
&
dumpConnectionParameters
(
OFString
& str);
321
326
virtual
const
char
*
errorString
(DcmTransportLayerStatus code);
327
328
private
:
329
331
DcmTCPConnection
(
const
DcmTCPConnection
&);
332
334
DcmTCPConnection
&
operator=
(
const
DcmTCPConnection
&);
335
336
};
337
338
#endif
339
340
/*
341
* $Log: dcmtrans.h,v $
342
* Revision 1.11 2010-10-14 13:17:22 joergr
343
* Updated copyright header. Added reference to COPYRIGHT file.
344
*
345
* Revision 1.10 2009-11-18 11:53:58 uli
346
* Switched to logging mechanism provided by the "new" oflog module.
347
*
348
* Revision 1.9 2009-01-29 11:39:44 joergr
349
* Fixed issue with missing invalidation of socket variable during close method.
350
* Please note that this is only required if the connection objects exists after
351
* the TCP/IP connection has been closed (which is currently not the case).
352
*
353
* Revision 1.8 2006/08/15 16:04:29 meichel
354
* Updated the code in module dcmnet to correctly compile when
355
* all standard C++ classes remain in namespace std.
356
*
357
* Revision 1.7 2005/12/08 16:02:18 meichel
358
* Changed include path schema for all DCMTK header files
359
*
360
* Revision 1.6 2004/08/03 11:42:43 meichel
361
* Headers libc.h and unistd.h are now included via ofstdinc.h
362
*
363
* Revision 1.5 2003/12/05 10:39:45 joergr
364
* Removed leading underscore characters from preprocessor symbols (reserved
365
* symbols).
366
*
367
* Revision 1.4 2003/07/04 13:27:15 meichel
368
* Added include for ofstream.h, to make sure ofstream is correctly defined
369
*
370
* Revision 1.3 2001/06/01 15:50:04 meichel
371
* Updated copyright header
372
*
373
* Revision 1.2 2000/10/10 12:06:53 meichel
374
* Updated transport layer error codes and routines for printing
375
* connection parameters.
376
*
377
* Revision 1.1 2000/08/10 14:50:53 meichel
378
* Added initial OpenSSL support.
379
*
380
*
381
*/
Generated on Thu Dec 20 2012 for
OFFIS DCMTK
Version 3.6.0 by
Doxygen
1.8.2