Implemented by SSL adapter to handle a connection. More...

#include <Connection.h>

Inheritance diagram for Ssl::Connection:
Collaboration diagram for Ssl::Connection:

Public Member Functions

 Connection (Context &context, tcp_pcb *tcp)
 
virtual ~Connection ()
 
virtual bool isHandshakeDone () const =0
 Checks if the handshake has finished. More...
 
virtual int read (InputBuffer &input, uint8_t *&output)=0
 Reads encrypted information and decrypts it. More...
 
virtual int write (const uint8_t *data, size_t length)=0
 Converts and sends plaintext data. More...
 
virtual CipherSuite getCipherSuite () const =0
 Gets the cipher suite that was used. More...
 
virtual SessionId getSessionId () const =0
 Gets the current session id object. Should be called after handshake. More...
 
virtual const CertificategetCertificate () const =0
 Gets the certificate object. That object MUST be owned by the Connection implementation and should not be freed outside of it. More...
 
virtual void freeCertificate ()=0
 
size_t printTo (Print &p) const override
 For debugging. More...
 
int writeTcpData (uint8_t *data, size_t length)
 
virtual String getErrorString (int error) const =0
 Get string for error code. More...
 
virtual Alert getAlert (int error) const =0
 Get alert code from error. More...
 
- Public Member Functions inherited from Printable
virtual ~Printable ()
 

Public Attributes

Contextcontext
 

Protected Attributes

tcp_pcb * tcp
 

Detailed Description

Implemented by SSL adapter to handle a connection.

Returned int error codes are 0 for success, or < 0 for error.

The error codes themselves are implementation-specific. Use getErrorString() to obtain the message. SSL Alerts are also reported via error codes and can be obtained using a call to getAlert().

Constructor & Destructor Documentation

◆ Connection()

Ssl::Connection::Connection ( Context context,
tcp_pcb *  tcp 
)
inline

◆ ~Connection()

virtual Ssl::Connection::~Connection ( )
inlinevirtual

Member Function Documentation

◆ freeCertificate()

virtual void Ssl::Connection::freeCertificate ( )
pure virtual

◆ getAlert()

virtual Alert Ssl::Connection::getAlert ( int  error) const
pure virtual

Get alert code from error.

Parameters
error
Return values
AlertAlert::INVALID if not an alert

◆ getCertificate()

virtual const Certificate* Ssl::Connection::getCertificate ( ) const
pure virtual

Gets the certificate object. That object MUST be owned by the Connection implementation and should not be freed outside of it.

Return values
Certificate*Returns NULL if there is no certificate available

◆ getCipherSuite()

virtual CipherSuite Ssl::Connection::getCipherSuite ( ) const
pure virtual

Gets the cipher suite that was used.

Return values
CipherSuiteIDs as defined by SSL/TLS standard

◆ getErrorString()

virtual String Ssl::Connection::getErrorString ( int  error) const
pure virtual

Get string for error code.

◆ getSessionId()

virtual SessionId Ssl::Connection::getSessionId ( ) const
pure virtual

Gets the current session id object. Should be called after handshake.

Return values
SessionId

◆ isHandshakeDone()

virtual bool Ssl::Connection::isHandshakeDone ( ) const
pure virtual

Checks if the handshake has finished.

Return values
booltrue on success

◆ printTo()

size_t Ssl::Connection::printTo ( Print p) const
overridevirtual

For debugging.

Implements Printable.

◆ read()

virtual int Ssl::Connection::read ( InputBuffer input,
uint8_t *&  output 
)
pure virtual

Reads encrypted information and decrypts it.

Parameters
inputSource encrypted data
outputPointer to decrypted plaintext buffer
Return values
0: handshake is still in progress > 0 : there is decrypted data < 0 : error

◆ write()

virtual int Ssl::Connection::write ( const uint8_t data,
size_t  length 
)
pure virtual

Converts and sends plaintext data.

Parameters
data
length
Return values
intlength of the data that was actually written < 0 on error

◆ writeTcpData()

int Ssl::Connection::writeTcpData ( uint8_t data,
size_t  length 
)

Member Data Documentation

◆ context

Context& Ssl::Connection::context

◆ tcp

tcp_pcb* Ssl::Connection::tcp
protected

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