Unigine::SSLSocket Class
Header: | #include <UnigineSSLSocket.h> |
Inherits from: | Socket |
SSLSocket Class
Enums
SSL_HANDSHAKE#
SSL_CTX_METHOD#
LOADER_TYPE#
Name | Description |
---|---|
LOADER_TYPE_RSA_KEY = 3 | RSA key. |
LOADER_TYPE_X509_CERT = 1 | Self-signed X.509 certificate. |
LOADER_TYPE_X509_CACERT = 2 | X.509 certificate issued by a Certification Agency. |
Members
SSLSocket ( ) #
Constructor. Creates a new SSL socket with default parameters (TLS).SSLSocket ( Socket::SOCKET_TYPE socket_type, SSLSocket::SSL_CTX_METHOD ssl_method ) #
Constructor. Creates a new SSL socket with the specified parameters.Arguments
- Socket::SOCKET_TYPE socket_type - SSL socket type.
- SSLSocket::SSL_CTX_METHOD ssl_method - SSL connection method to be used.
void close ( ) #
Closes the socket.bool accept ( const Ptr<Socket> & socket ) #
Accepts a connection on the socket.Arguments
Return value
true if the connection is accepted; otherwise, fals.bool connect ( ) #
Initiates a connection on the socket.Return value
true if the connection is initialized; otherwise, false.bool load ( SSLSocket::LOADER_TYPE loader_type, const char * path ) #
Loads a certificate from the file.Arguments
- SSLSocket::LOADER_TYPE loader_type - Certificate type, one of the LOADER_TYPE values.
- const char * path - Path to a certificate file.
Return value
true if the certificate is loaded successfully, otherwise false.bool parse ( SSLSocket::LOADER_TYPE loader_type, const char * data ) #
Parses a specified certificate.Arguments
- SSLSocket::LOADER_TYPE loader_type - Certificate type, one of the LOADER_TYPE values.
- const char * data - Certificate data.
Return value
true if the certificate is parsed successfully, otherwise false.SSLSocket::SSL_HANDSHAKE handshake ( ) #
Starts a handshake and returns the result.Return value
Handshake status.bool isAvailable ( ) const#
Checks if the socket has been established, but not opened.Return value
true if the socket is available; otherwise, false.bool isCertificateVerified ( ) const#
Returns a value indicating if SSL certificate for the socket is successfully verified.Return value
true if SSL certificate for the socket is successfully verified; otherwise, false.int pending ( ) const#
Returns the number of bytes available for immediate retrieval without reading from the socket object. This function is essential if you work with event loops.Return value
Number of bytes.size_t read ( void * ptr, size_t size, size_t nmemb ) const#
Reads the specified number of blocks of the specified size from the SSL connection to the specified destination buffer.Arguments
- void * ptr - Pointer to the destination buffer to which the data is to be read.
- size_t size - Size of a message block in bytes.
- size_t nmemb - Number of message blocks to read from the SSL connection.
Return value
Number of bytes actually read.size_t write ( const void * ptr, size_t size, size_t nmemb ) const#
Writes the specified number of blocks of the specified size from the specified source buffer to the SSL connection.Arguments
- const void * ptr - Pointer to the source buffer from which the data is to be written.
- size_t size - Size of a message block in bytes.
- size_t nmemb - Number of message blocks to be written to the SSL connection.
Return value
Number of bytes actually written.size_t peek ( void * ptr, size_t size, size_t nmemb ) const#
Reads the specified number of blocks of the specified size from the SSL connection to the specified destination buffer. This method is identical to read except no bytes are actually removed from the underlying BIO during the read, so that a subsequent call to read will yield at least the same bytes.Arguments
- void * ptr - Pointer to the destination buffer to which the data is to be read.
- size_t size - Size of a message block in bytes.
- size_t nmemb - Number of message blocks to be written to the SSL connection.
Return value
Number of bytes actually written.Last update:
2023-11-30
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)