Struct esp_idf_svc::tls::EspAsyncTls
source · pub struct EspAsyncTls<S>(/* private fields */)
where
S: PollableSocket;
Implementations§
source§impl<S> EspAsyncTls<S>where
S: PollableSocket,
impl<S> EspAsyncTls<S>where
S: PollableSocket,
sourcepub fn adopt(socket: S) -> Result<Self, EspError>
pub fn adopt(socket: S) -> Result<Self, EspError>
Create a new AsyncEspTls
instance adopting the supplied socket.
The socket should be in a connected state.
§Errors
ESP_ERR_NO_MEM
if not enough memory to create the TLS connection
sourcepub async fn negotiate(
&mut self,
hostname: &str,
cfg: &Config<'_>,
) -> Result<CompletedHandshake, EspError>
pub async fn negotiate( &mut self, hostname: &str, cfg: &Config<'_>, ) -> Result<CompletedHandshake, EspError>
Establish a TLS/SSL connection using the adopted socket.
§Errors
ESP_ERR_INVALID_SIZE
ifcfg.alpn_protos
exceeds 9 elements or avg 10 bytes/ALPNESP_FAIL
if connection could not be established
sourcepub async fn read(&self, buf: &mut [u8]) -> Result<usize, EspError>
pub async fn read(&self, buf: &mut [u8]) -> Result<usize, EspError>
Read in the supplied buffer. Returns the number of bytes read.
sourcepub async fn write(&self, buf: &[u8]) -> Result<usize, EspError>
pub async fn write(&self, buf: &[u8]) -> Result<usize, EspError>
Write the supplied buffer. Returns the number of bytes written.
pub async fn write_all(&self, buf: &[u8]) -> Result<(), EspError>
pub fn context_handle(&self) -> *mut esp_tls
Trait Implementations§
source§impl<S> ErrorType for EspAsyncTls<S>where
S: PollableSocket,
impl<S> ErrorType for EspAsyncTls<S>where
S: PollableSocket,
§type Error = EspIOError
type Error = EspIOError
Error type of all the IO operations on this type.
source§impl<S> Read for EspAsyncTls<S>where
S: PollableSocket,
impl<S> Read for EspAsyncTls<S>where
S: PollableSocket,
source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf
. Read moresource§impl<S> Write for EspAsyncTls<S>where
S: PollableSocket,
impl<S> Write for EspAsyncTls<S>where
S: PollableSocket,
source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more