Helium
Functions
wolf.h File Reference

Functions for interfacing with WolfSSL. More...

#include <wolfssl/options.h>
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/ssl.h>
Include dependency graph for wolf.h:

Go to the source code of this file.

Functions

int he_wolf_dtls_read (WOLFSSL *ssl, char *buf, int sz, void *ctx)
 Callback function to handle WolfSSL read requests. More...
 
int he_wolf_dtls_write (WOLFSSL *ssl, char *buf, int sz, void *ctx)
 Callback function to handle WolfSSL write requests. More...
 
int he_internal_write_packet_header (he_conn_t *conn, he_wire_hdr_t *hdr)
 Write the packet header into the header buffer. More...
 
int he_wolf_tls_read (WOLFSSL *ssl, char *buf, int sz, void *ctx)
 Callback function to handle TLS WolfSSL read requests. More...
 
int he_wolf_tls_write (WOLFSSL *ssl, char *buf, int sz, void *ctx)
 

Detailed Description

Functions for interfacing with WolfSSL.

Function Documentation

int he_internal_write_packet_header ( he_conn_t conn,
he_wire_hdr_t hdr 
)

Write the packet header into the header buffer.

Parameters
connA pointer to a valid conn context
hdrA pointer to the header buffer to initialise
Returns
HE_SUCCESS Header has been initialised
HE_ERR_NULL_POINTER Either the conn or header pointers were NULL
int he_wolf_dtls_read ( WOLFSSL *  ssl,
char *  buf,
int  sz,
void *  ctx 
)

Callback function to handle WolfSSL read requests.

Parameters
sslA pointer to the WolfSSL session that this callback relates to
bufA pointer to the buffer the callback writes data to
szThe maximum size that can be written to the buffer
ctxA pointer to the Helium context that this callback relates to
Returns
int The length of the data copied to the buffer
WOLFSSL_CBIO_ERR_WANT_READ Tells WolfSSL that there's no more data available

Helium does not know about sockets and as such, neither can WolfSSL. Helium overrides the standard socket calls with its own callback functions.

This function simply copies data to WolfSSL's buffer and returns

Note
This function will be called twice per packet. This function will return WOLFSSL_CBIO_ERR_WANT_READ on the second call.
int he_wolf_dtls_write ( WOLFSSL *  ssl,
char *  buf,
int  sz,
void *  ctx 
)

Callback function to handle WolfSSL write requests.

Parameters
sslA pointer to the WolfSSL session that this callback relates to
bufA pointer to the buffer the callback reads data from
szThe size of the data to be read
ctxA pointer to the Helium context that this callback relates to
Returns
int The length of the data copied to the buffer

Helium does not know about sockets and as such, neither can WolfSSL. Helium overrides the standard socket calls with its own callback functions.

This function simply calls the user provided write callback

Note
The buffer is only valid until this function returns. As such the user provided write callback must copy the data from the buffer if it needs it to persist after that time.
int he_wolf_tls_read ( WOLFSSL *  ssl,
char *  buf,
int  sz,
void *  ctx 
)

Callback function to handle TLS WolfSSL read requests.

Parameters
sslA pointer to the WolfSSL session that this callback relates to
bufA pointer to the buffer the callback writes data to
szThe maximum size that can be written to the buffer
ctxA pointer to the Helium context that this callback relates to
Returns
int The length of the data copied to the buffer
WOLFSSL_CBIO_ERR_WANT_READ Tells WolfSSL that there's no more data available

Helium does not know about sockets and as such, neither can WolfSSL. Helium overrides the standard socket calls with its own callback functions.

This function simply copies data to WolfSSL's buffer and returns

Note
This function will be called twice per packet. This function will return WOLFSSL_CBIO_ERR_WANT_READ on the second call.