DCMTK: DcmTCPConnection Class Reference

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
DcmTCPConnection Class Reference

this class represents a TCP/IP based transport connection. More...

Inheritance diagram for DcmTCPConnection:

## Public Member Functions
| DcmTCPConnection (DcmNativeSocketType openSocket)
| constructor.
virtual | ~DcmTCPConnection ()
| destructor
virtual OFCondition | serverSideHandshake ()
| performs server side handshake on established socket.
virtual OFCondition | clientSideHandshake ()
| performs client side handshake on established socket.
virtual OFCondition | renegotiate (const char *newSuite)
| performs a re-negotiation of the connection with different connection parameters.
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.
virtual ssize_t | write (void *buf, size_t nbyte)
| attempts to write nbyte bytes from the given buffer to the transport connection.
virtual void | close ()
| Closes the transport connection.
virtual void | closeTransportConnection ()
| Closes the transport connection directly.
virtual unsigned long | getPeerCertificateLength ()
| returns the size in bytes of the peer certificate of a secure connection.
virtual unsigned long | getPeerCertificate (void *buf, unsigned long bufLen)
| copies the peer certificate of a secure connection into a buffer specified by the caller.
virtual OFBool | networkDataAvailable (int timeout)
| checks if data is available to be read on the transport connection.
virtual OFBool | isTransparentConnection ()
| returns OFTrue if this connection is a transparent TCP connection, OFFalse if the connection is a secure connection.
virtual OFString & | dumpConnectionParameters (OFString &str)
| dump the characteristics of the current connection
Public Member Functions inherited from DcmTransportConnection
| DcmTransportConnection (DcmNativeSocketType openSocket)
| constructor.
virtual | ~DcmTransportConnection ()
| destructor
virtual void | setParentProcessMode ()
| this method must be called by the parent process after a fork() if the TLS connection is handled by the child process.
virtual OFBool | isParentProcessMode () const
| check if the connection has been set to parent process mode by a prior call to setParentProcessMode().
OFdeprecated void | dumpConnectionParameters (STD_NAMESPACE ostream &out)
| prints the characteristics of the current connection on the given output stream.

## Private Member Functions
| DcmTCPConnection (const DcmTCPConnection &)
| private undefined copy constructor
DcmTCPConnection & | operator= (const DcmTCPConnection &)
| private undefined assignment operator

## Additional Inherited Members
Static Public Member Functions inherited from DcmTransportConnection
static OFBool | selectReadableAssociation (DcmTransportConnection *connections[], int connCount, int timeout)
| indicates which of the specified transport connections is ready for reading.
Protected Member Functions inherited from DcmTransportConnection
DcmNativeSocketType | getSocket ()
| returns the socket file descriptor managed by this object.
void | setSocket (DcmNativeSocketType socket)
| set the socket file descriptor managed by this object.

## Detailed Description

this class represents a TCP/IP based transport connection.

## Constructor & Destructor Documentation

## ◆ DcmTCPConnection()

DcmTCPConnection::DcmTCPConnection | ( | DcmNativeSocketType | openSocket | ) |

constructor.

Parameters

  openSocket | TCP/IP socket to be used for the transport connection. the connection must already be established on socket level. This object takes over control of the socket.

Referenced by DcmTCPConnection(), and operator=().

## Member Function Documentation

## ◆ clientSideHandshake()

virtual OFCondition DcmTCPConnection::clientSideHandshake | ( |  | ) |
| virtual

performs client side handshake on established socket.

This function is used to establish a secure transport connection over the established TCP connection.

Returns
  EC_Normal if successful, an error code otherwise.

Implements DcmTransportConnection.

## ◆ close()

virtual void DcmTCPConnection::close | ( |  | ) |
| virtual

Closes the transport connection.

If a secure connection is used, a closure alert is sent before the connection is closed.

Implements DcmTransportConnection.

## ◆ closeTransportConnection()

virtual void DcmTCPConnection::closeTransportConnection | ( |  | ) |
| virtual

Closes the transport connection directly.

If a secure connection is used, a closure alert is NOT sent before the connection is closed.

Implements DcmTransportConnection.

## ◆ dumpConnectionParameters()

virtual OFString & DcmTCPConnection::dumpConnectionParameters | ( | OFString & | str | ) |
| virtual

dump the characteristics of the current connection

Parameters

  str | the string to dump into

Returns
  reference to string

Implements DcmTransportConnection.

## ◆ getPeerCertificate()

virtual unsigned long DcmTCPConnection::getPeerCertificate | ( | void * | buf,
|  | unsigned long | bufLen )
| virtual

copies the peer certificate of a secure connection into a buffer specified by the caller.

If the buffer is too small to hold the certificate, nothing is copied and zero is returned.

Parameters

  buf | buffer into which the certificate is written
  bufLen | size of the buffer in bytes

Returns
  number of bytes written, always less or equal bufLen.

Implements DcmTransportConnection.

## ◆ getPeerCertificateLength()

virtual unsigned long DcmTCPConnection::getPeerCertificateLength | ( |  | ) |
| virtual

returns the size in bytes of the peer certificate of a secure connection.

May return 0 if connection is transparent TCP/IP.

Returns
  peer certificate length in bytes

Implements DcmTransportConnection.

## ◆ networkDataAvailable()

virtual OFBool DcmTCPConnection::networkDataAvailable | ( | int | timeout | ) |
| virtual

checks if data is available to be read on the transport connection.

Parameters

  timeout | maximum number of seconds to wait if no data is available. If this parameter is 0, the function does not block.

Returns
  OFTrue if data is available, OFFalse otherwise.

Implements DcmTransportConnection.

## ◆ read()

virtual ssize_t DcmTCPConnection::read | ( | void * | buf,
|  | size_t | nbyte )
| virtual

attempts to read nbyte bytes from the transport connection and writes them into the given buffer.

Parameters

  buf | buffer
  nbyte | number of bytes to read

Returns
  number of bytes read, negative number if unsuccessful.

Implements DcmTransportConnection.

## ◆ renegotiate()

virtual OFCondition DcmTCPConnection::renegotiate | ( | const char * | newSuite | ) |
| virtual

performs a re-negotiation of the connection with different connection parameters.

Used to change the parameters of the secure transport connection.

Parameters

  newSuite | string identifying the ciphersuite to be negotiated.

Returns
  EC_Normal if successful, an error code otherwise.

Implements DcmTransportConnection.

## ◆ serverSideHandshake()

virtual OFCondition DcmTCPConnection::serverSideHandshake | ( |  | ) |
| virtual

performs server side handshake on established socket.

This function is used to establish a secure transport connection over the established TCP connection.

Returns
  EC_Normal if successful, an error code otherwise.

Implements DcmTransportConnection.

## ◆ write()

virtual ssize_t DcmTCPConnection::write | ( | void * | buf,
|  | size_t | nbyte )
| virtual

attempts to write nbyte bytes from the given buffer to the transport connection.

Parameters

  buf | buffer
  nbyte | number of bytes to write

Returns
  number of bytes written, negative number if unsuccessful.

Implements DcmTransportConnection.

The documentation for this class was generated from the following file:

- dcmnet/include/dcmtk/dcmnet/dcmtrans.h

Generated on Wed Apr 30 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2