Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
symbian::api::connectivity::TlsStream Class Reference

Worker-owned TLS transport for outbound HTTP and inbound sessions. More...

#include <cpp/symbian/api/include/symbian/api/connectivity/tls_stream.h>

Inheritance diagram for symbian::api::connectivity::TlsStream:
[legend]

Classes

struct  Impl
 

Public Member Functions

 TlsStream (TlsStream &&other) noexcept
 
TlsStream & operator= (TlsStream &&other) noexcept
 
 TlsStream (const TlsStream &)=delete
 
TlsStream & operator= (const TlsStream &)=delete
 
 ~TlsStream ()
 
absl::Status SetAlpnProtocol (std::string_view protocol)
 Select the sole server ALPN protocol before Accept.
 
std::string_view negotiated_version () const
 
std::string_view negotiated_protocol () const
 
void Close () override
 
absl::Status Accept (TcpClient &&client, absl::Time deadline=absl::InfiniteFuture())
 Complete TLS 1.2/1.3 handshake by an absolute deadline.
 
absl::StatusOr< std::size_t > Read (std::span< std::uint8_t > bytes, absl::Time deadline=absl::InfiniteFuture()) override
 Receive application data into at most 32 KiB.
 
absl::Status Write (std::span< const std::uint8_t > bytes, absl::Time deadline=absl::InfiniteFuture()) override
 Send at most 32 KiB of application data.
 
void CloseSession ()
 Close the current stream and reset its TLS state.
 
bool connected () const
 
- Public Member Functions inherited from symbian::net::ByteStream
virtual ~ByteStream ()=default
 

Static Public Member Functions

static absl::StatusOr< TlsStream > Create (std::string_view server_certificate, std::string_view server_private_key, std::string_view client_ca_bundle, TlsVersion version)
 Configure identity, trust roots and one TLS protocol version.
 
static absl::StatusOr< TlsStream > Connect (TcpClient client, std::string_view hostname, std::string_view ca_bundle, TlsVersion version, std::string_view alpn="http/1.1", absl::Time deadline=absl::InfiniteFuture())
 Authenticate an outbound peer using explicit roots and hostname.
 

Detailed Description

Worker-owned TLS transport for outbound HTTP and inbound sessions.

Connect verifies the server certificate chain and hostname, sends SNI and negotiates one selected ALPN protocol. Create/Accept configure an inbound server that requires a verified client certificate. Both paths share the same Mbed TLS state, entropy, native socket BIO and deadline handling. The caller supplies PEM roots/identities and an accepted hardware entropy adapter; the SDK supplies no default roots or identity.

Read returns zero only for authenticated close_notify; a bare transport EOF is a truncation error. Read/Write cancel and drain native socket requests on deadline. Calls and destruction stay on the socket's owning worker, outside active scheduler callbacks. CloseSession cancels by closing the socket, without a blocking close alert. Inbound state may then Accept another peer.

Constructor & Destructor Documentation

◆ TlsStream() [1/2]

symbian::api::connectivity::TlsStream::TlsStream ( TlsStream &&  other)
noexcept

◆ TlsStream() [2/2]

symbian::api::connectivity::TlsStream::TlsStream ( const TlsStream &  )
delete

◆ ~TlsStream()

symbian::api::connectivity::TlsStream::~TlsStream ( )

Member Function Documentation

◆ Accept()

absl::Status symbian::api::connectivity::TlsStream::Accept ( TcpClient &&  client,
absl::Time  deadline = absl::InfiniteFuture() 
)

Complete TLS 1.2/1.3 handshake by an absolute deadline.

◆ Close()

void symbian::api::connectivity::TlsStream::Close ( )
inlineoverridevirtual

◆ CloseSession()

void symbian::api::connectivity::TlsStream::CloseSession ( )

Close the current stream and reset its TLS state.

◆ Connect()

absl::StatusOr< TlsStream > symbian::api::connectivity::TlsStream::Connect ( TcpClient  client,
std::string_view  hostname,
std::string_view  ca_bundle,
TlsVersion  version,
std::string_view  alpn = "http/1.1",
absl::Time  deadline = absl::InfiniteFuture() 
)
static

Authenticate an outbound peer using explicit roots and hostname.

Select one protocol version and ALPN protocol. No verification bypass or system trust store is provided. Uses the same native BIO as server Accept.

◆ connected()

bool symbian::api::connectivity::TlsStream::connected ( ) const

◆ Create()

absl::StatusOr< TlsStream > symbian::api::connectivity::TlsStream::Create ( std::string_view  server_certificate,
std::string_view  server_private_key,
std::string_view  client_ca_bundle,
TlsVersion  version 
)
static

Configure identity, trust roots and one TLS protocol version.

The vendored Mbed TLS server cannot negotiate a hybrid 1.2/1.3 profile. Select the version explicitly; both are authenticated by the same policy.

◆ negotiated_protocol()

std::string_view symbian::api::connectivity::TlsStream::negotiated_protocol ( ) const

◆ negotiated_version()

std::string_view symbian::api::connectivity::TlsStream::negotiated_version ( ) const

◆ operator=() [1/2]

TlsStream & symbian::api::connectivity::TlsStream::operator= ( const TlsStream &  )
delete

◆ operator=() [2/2]

TlsStream & symbian::api::connectivity::TlsStream::operator= ( TlsStream &&  other)
noexcept

◆ Read()

absl::StatusOr< std::size_t > symbian::api::connectivity::TlsStream::Read ( std::span< std::uint8_t >  bytes,
absl::Time  deadline = absl::InfiniteFuture() 
)
overridevirtual

Receive application data into at most 32 KiB.

Implements symbian::net::ByteStream.

◆ SetAlpnProtocol()

absl::Status symbian::api::connectivity::TlsStream::SetAlpnProtocol ( std::string_view  protocol)

Select the sole server ALPN protocol before Accept.

◆ Write()

absl::Status symbian::api::connectivity::TlsStream::Write ( std::span< const std::uint8_t >  bytes,
absl::Time  deadline = absl::InfiniteFuture() 
)
overridevirtual

Send at most 32 KiB of application data.

Implements symbian::net::ByteStream.


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