![]() |
TSDuck v3.46-4930
MPEG Transport Stream Toolkit
|
#include <tsTLSContext.h>


Public Member Functions | |
| TLSContext (Report *report) | |
| TLSContext (ReporterBase *delegate) | |
| virtual | ~TLSContext () override |
| bool | eof () const |
| size_t | getDataSizeToSend () const |
| bool | getDataToSend (ByteBlock &tls_data) |
| bool | initClient (const TLSConnectionBase ¶ms) |
| bool | initServer (void *cert) |
| bool | initShutdown (bool silent) |
| bool | muteReport (bool mute) |
| bool | needReceive () const |
| bool | needSend () const |
| bool | provideClearData (const void *data, size_t size, size_t &ret_size) |
| bool | provideReceivedData (const void *data, size_t size, size_t &ret_size, ByteBlock &clear_data) |
| virtual Report & | report () const override |
| void | reset () |
| bool | serverSide () const |
| Report * | setReport (Report *report) |
| ReporterBase * | setReport (ReporterBase *delegate) |
| bool | shutdowning () const |
Static Public Member Functions | |
| static UString | GetLibraryVersion () |
| static int | SilentLevel (bool silent, int default_severity=Severity::Error) |
Context of a TLS connection. This is state machine working on pure data, non-blocking, without network access.
|
explicit |
Constructor.
| [in] | report | Where to report errors. The report object must remain valid as long as this object exists or setReport() is used with another Report object. If report is null, log messages are discarded. |
|
explicit |
Constructor.
| [in] | delegate | Use the report of another ReporterBase. If delegate is null, log messages are discarded. |
|
overridevirtual |
Destructor.
| void ts::TLSContext::reset | ( | ) |
Clear the context, free all resources.
| bool ts::TLSContext::initClient | ( | const TLSConnectionBase & | params | ) |
Initialize the client side of a connection.
| [in] | params | TLS connection parameters. |
| bool ts::TLSContext::initServer | ( | void * | cert | ) |
Initialize the server side of a connection.
| [in] | cert | Pointer to server certificate.
|
|
inline |
Check if this is the server-side of the TLS connection.
| bool ts::TLSContext::provideClearData | ( | const void * | data, |
| size_t | size, | ||
| size_t & | ret_size ) |
Send clear user data over the TLS connection. Most of the time, this results in a TLS protocol packet to be sent. If the user data are too long, only some of them can be sent in the next TLS protocol packet.
| [in] | data | Address of the clear user message to sent. |
| [in] | size | Size in bytes of the clear user message to sent. |
| [out] | ret_size | Size of data which where consumed. If ret_size is less than size, the rest shall be submitted later. |
|
inline |
Check if some TLS protocol data must be sent. The application must send the corresponding data and then call sendCompleted().
| size_t ts::TLSContext::getDataSizeToSend | ( | ) | const |
Get the size in bytes of TLS protocol data which are ready to send.
| bool ts::TLSContext::getDataToSend | ( | ByteBlock & | tls_data | ) |
Get TLS protocol data to send.
| [in,out] | tls_data | Binary data to send over the wire are appended into tls_data. |
|
inline |
Check if more TLS protocol data must be received in order to continue.
| bool ts::TLSContext::provideReceivedData | ( | const void * | data, |
| size_t | size, | ||
| size_t & | ret_size, | ||
| ByteBlock & | clear_data ) |
Provide received TLS protocol data, collect clear data. If the received data are too long, only some of them can be processed. In that case, it is possible that some data must be sent before accepting the rest of the received data.
| [in] | data | Address of the received data. |
| [in] | size | Size in bytes of the received data. |
| [out] | ret_size | Size of data which where consumed. If ret_size is less than size, the rest shall be submitted later. |
| [in,out] | clear_data | If any clear user data were extracted from the TLS protocol data, they are appended into clear_data. |
|
inline |
Check if the input TLS stream is terminated (peer shutdown).
| bool ts::TLSContext::initShutdown | ( | bool | silent | ) |
Generate a shutdown message to send to the peer.
| [in] | silent | If true, do not report errors through the logger. This is typically useful when the socket is in some error condition and closing it is necessary although it may generate additional meaningless errors. |
|
inline |
Check if a TLS shutdown was generated.
|
static |
Get the version of the underlying SSL/TLS library.
|
overridevirtualinherited |
Access the Report which is associated with this object. Can be called from another thread only if the Report object is thread-safe.
Implements ts::ReporterInterface.
Associate this object with another Report to log errors.
| [in] | report | Where to report errors. The report object must remain valid as long as this object exists or setReport() is used with another Report object. If report is null, log messages are discarded. |
|
inherited |
Associate this object with another ReporterBase to log errors.
| [in] | delegate | Use the report of another ReporterBase. If delegate is null, the previous explicit Report is used.. |
|
inherited |
Temporarily mute the associated report.
| [in] | mute | It true, report() will return a null report (log messages are discarded), until muteReport() is invoked again with mute set to false. |
|
inlinestaticinherited |
Compute a log severity level from a "silent" parameter. Some subclass methods have a "silent" parameter to avoid reporting errors which may be insignificant, typically when closing a device after an error, in which case the close operation may produce other errors if the previous error left the device in an inconsistent state. While those errors should not be displayed as errors, we still display them at debug level.
| [in] | silent | If true, do not report errors, report debug messages instead. |
| [in] | default_severity | Default severity, in non-silent mode (error by default). |