Helium
Data Structures | Macros | Typedefs | Enumerations
he.h File Reference

Core public header file for libhelium. More...

#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "he_plugin.h"
Include dependency graph for he.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  he_client
 Data structure to hold all the state needed as a Helium client. More...
 
struct  he_network_config_ipv4
 
struct  he_wire_hdr
 The wire header format It is strongly discouraged to interact with this header structure, however, it is provided for specific use cases (such as a server rejecting a session, where by definition we don't have a connection object). More...
 

Macros

#define HE_MAX_WIRE_MTU   1500
 Default MTU sizes.
 
#define HE_MAX_MTU   1350
 
#define HE_MAX_MTU_STR   "1350"
 
#define HE_WIRE_MINIMUM_PROTOCOL_MAJOR_VERSION   1
 Default minimum and maximum wire protocol versions.
 
#define HE_WIRE_MINIMUM_PROTOCOL_MINOR_VERSION   0
 
#define HE_WIRE_MAXIMUM_PROTOCOL_MAJOR_VERSION   1
 
#define HE_WIRE_MAXIMUM_PROTOCOL_MINOR_VERSION   2
 
#define HE_CONFIG_TEXT_FIELD_LENGTH   50
 Helpful deprecation macro. More...
 
#define HE_MAX_IPV4_STRING_LENGTH   24
 Maximum size of an IPV4 String.
 
#define HE_MAX_HOSTNAME_LENGTH   255
 Maximum size of a hostname.
 

Typedefs

typedef enum he_return_code he_return_code_t
 All possible return codes for helium.
 
typedef enum he_conn_state he_conn_state_t
 Status codes for a Helium connection.
 
typedef enum he_conn_event he_conn_event_t
 
typedef enum he_padding_type he_padding_type_t
 Helium supports numerous padding levels, from none to full. This enum defines which options can be chosen.
 
typedef enum he_connection_type he_connection_type_t
 Helium can operate in datagram or stream modes. This enum defines these two modes.
 
typedef enum he_connection_protocol he_connection_protocol_t
 Lightway can use different underlying protocols. This enum defines those protocols.
 
typedef enum he_pmtud_state he_pmtud_state_t
 Lightway Path MTU Discovery states. More...
 
typedef struct he_ssl_ctx he_ssl_ctx_t
 
typedef struct he_conn he_conn_t
 
typedef struct he_plugin_chain he_plugin_chain_t
 
typedef struct he_network_config_ipv4 he_network_config_ipv4_t
 
typedef struct he_client he_client_t
 Data structure to hold all the state needed as a Helium client.
 
typedef void *(* he_malloc_t) (size_t size)
 
typedef void *(* he_calloc_t) (size_t nmemb, size_t size)
 
typedef void *(* he_realloc_t) (void *ptr, size_t size)
 
typedef void(* he_free_t) (void *ptr)
 
typedef enum he_auth_type he_auth_type_t
 Lightway can use different authentication types. This enum defines those types.
 
typedef he_return_code_t(* he_state_change_cb_t) (he_conn_t *conn, he_conn_state_t new_state, void *context)
 The prototype for the state callback function. More...
 
typedef he_return_code_t(* he_inside_write_cb_t) (he_conn_t *conn, uint8_t *packet, size_t length, void *context)
 The prototype for the inside write callback function. More...
 
typedef he_return_code_t(* he_outside_write_cb_t) (he_conn_t *conn, uint8_t *packet, size_t length, void *context)
 The prototype for the outside write callback function. More...
 
typedef he_return_code_t(* he_network_config_ipv4_cb_t) (he_conn_t *conn, he_network_config_ipv4_t *config, void *context)
 The prototype for the network config callback function. More...
 
typedef he_return_code_t(* he_server_config_cb_t) (he_conn_t *conn, uint8_t *buffer, size_t length, void *context)
 The prototype for the server config callback function. More...
 
typedef he_return_code_t(* he_event_cb_t) (he_conn_t *conn, he_conn_event_t event, void *context)
 The prototype for the event callback function. More...
 
typedef he_return_code_t(* he_nudge_time_cb_t) (he_conn_t *conn, int timeout, void *context)
 The prototype for the nudge time callback function. More...
 
typedef bool(* he_auth_cb_t) (he_conn_t *conn, char const *username, char const *password, void *context)
 The prototype for the authentication callback. More...
 
typedef bool(* he_auth_token_cb_t) (he_conn_t *conn, const uint8_t *token, size_t len, void *context)
 The prototype for the authentication token callback. More...
 
typedef bool(* he_auth_buf_cb_t) (he_conn_t *conn, uint8_t auth_type, uint8_t *buffer, uint16_t length, void *context)
 The prototype for the authentication buffer callback. More...
 
typedef he_return_code_t(* he_populate_network_config_ipv4_cb_t) (he_conn_t *conn, he_network_config_ipv4_t *config, void *context)
 The prototype for the population of the network config. More...
 
typedef he_return_code_t(* he_pmtud_time_cb_t) (he_conn_t *conn, int timeout, void *context)
 The prototype for the Path MTU Discovery (PMTUD) time callback function. More...
 
typedef he_return_code_t(* he_pmtud_state_change_cb_t) (he_conn_t *conn, he_pmtud_state_t state, void *context)
 The prototype for Lightway PMTUD state callback function. More...
 
typedef struct he_wire_hdr he_wire_hdr_t
 The wire header format It is strongly discouraged to interact with this header structure, however, it is provided for specific use cases (such as a server rejecting a session, where by definition we don't have a connection object).
 

Enumerations

enum  he_return_code {
  HE_SUCCESS = 0, HE_ERR_STRING_TOO_LONG = -1, HE_ERR_EMPTY_STRING = -2, HE_ERR_INVALID_CONN_STATE = -3,
  HE_ERR_NULL_POINTER = -4, HE_ERR_EMPTY_PACKET = -5, HE_ERR_PACKET_TOO_SMALL = -6, HE_ERR_ZERO_SIZE = -7,
  HE_ERR_NEGATIVE_NUMBER = -8, HE_ERR_INIT_FAILED = -9, HE_ERR_NO_MEMORY = -10, HE_ERR_NOT_HE_PACKET = -11,
  HE_ERR_SSL_BAD_FILETYPE = -12, HE_ERR_SSL_BAD_FILE = -13, HE_ERR_SSL_OUT_OF_MEMORY = -14, HE_ERR_SSL_ASN_INPUT = -15,
  HE_ERR_SSL_BUFFER = -16, HE_ERR_SSL_CERT = -17, HE_ERR_SSL_ERROR = -18, HE_ERR_CONF_USERNAME_NOT_SET = -19,
  HE_ERR_CONF_PASSWORD_NOT_SET = -20, HE_ERR_CONF_CA_NOT_SET = -21, HE_ERR_CONF_MTU_NOT_SET = -22, HE_WANT_READ = -23,
  HE_WANT_WRITE = -24, HE_ERR_CONF_OUTSIDE_WRITE_CB_NOT_SET = -25, HE_ERR_CONNECT_FAILED = -26, HE_CONNECTION_TIMED_OUT = -27,
  HE_ERR_NOT_CONNECTED = -28, HE_ERR_UNSUPPORTED_PACKET_TYPE = -29, HE_ERR_CONNECTION_WAS_CLOSED = -30, HE_ERR_BAD_PACKET = -31,
  HE_ERR_CALLBACK_FAILED = -32, HE_ERR_FAILED = -33, HE_ERR_SERVER_DN_MISMATCH = -34, HE_ERR_CANNOT_VERIFY_SERVER_CERT = -35,
  HE_ERR_NEVER_CONNECTED = -36, HE_ERR_INVALID_MTU_SIZE = -37, HE_ERR_CLEANUP_FAILED = -38, HE_ERR_REJECTED_SESSION = -39,
  HE_ERR_ACCESS_DENIED = -40, HE_ERR_PACKET_TOO_LARGE = -41, HE_ERR_INACTIVITY_TIMEOUT = -42, HE_ERR_POINTER_WOULD_OVERFLOW = -43,
  HE_ERR_INVALID_CONNECTION_TYPE = -46, HE_ERR_RNG_FAILURE = -47, HE_ERR_CONF_AUTH_CB_NOT_SET = -48, HE_ERR_PLUGIN_DROP = -49,
  HE_ERR_UNKNOWN_SESSION = -50, HE_ERR_SSL_ERROR_NONFATAL = -51, HE_ERR_INCORRECT_PROTOCOL_VERSION = -52, HE_ERR_CONF_CONFLICTING_AUTH_METHODS = -53,
  HE_ERR_ACCESS_DENIED_NO_AUTH_BUF_HANDLER = -54, HE_ERR_ACCESS_DENIED_NO_AUTH_USERPASS_HANDLER = -55, HE_ERR_SERVER_GOODBYE = -56, HE_ERR_INVALID_AUTH_TYPE = -57,
  HE_ERR_ACCESS_DENIED_NO_AUTH_TOKEN_HANDLER = -58, HE_ERR_PMTUD_CALLBACKS_NOT_SET = -59, HE_ERR_BAD_FRAGMENT = -60, HE_ERR_SECURE_RENEGOTIATION_ERROR = -61,
  HE_ERR_CANNOT_ENABLE_CH_FRAG = -62
}
 All possible return codes for helium. More...
 
enum  he_conn_state {
  HE_STATE_NONE = 0, HE_STATE_DISCONNECTED = 1, HE_STATE_CONNECTING = 2, HE_STATE_DISCONNECTING = 4,
  HE_STATE_AUTHENTICATING = 5, HE_STATE_LINK_UP = 6, HE_STATE_ONLINE = 7, HE_STATE_CONFIGURING = 8
}
 Status codes for a Helium connection. More...
 
enum  he_conn_event {
  HE_EVENT_FIRST_MESSAGE_RECEIVED = 1, HE_EVENT_PONG = 2, HE_EVENT_REJECTED_FRAGMENTED_PACKETS_SENT_BY_HOST = 3, HE_EVENT_SECURE_RENEGOTIATION_STARTED = 4,
  HE_EVENT_SECURE_RENEGOTIATION_COMPLETED = 5, HE_EVENT_PENDING_SESSION_ACKNOWLEDGED = 6
}
 
enum  he_padding_type { HE_PADDING_NONE = 0, HE_PADDING_FULL = 1, HE_PADDING_450 = 2 }
 Helium supports numerous padding levels, from none to full. This enum defines which options can be chosen. More...
 
enum  he_connection_type { HE_CONNECTION_TYPE_DATAGRAM = 0, HE_CONNECTION_TYPE_STREAM = 1 }
 Helium can operate in datagram or stream modes. This enum defines these two modes. More...
 
enum  he_connection_protocol { HE_CONNECTION_PROTOCOL_NONE = 0, HE_CONNECTION_PROTOCOL_TLS_1_3 = 1, HE_CONNECTION_PROTOCOL_DTLS_1_2 = 2, HE_CONNECTION_PROTOCOL_DTLS_1_3 = 3 }
 Lightway can use different underlying protocols. This enum defines those protocols. More...
 
enum  he_pmtud_state {
  HE_PMTUD_STATE_DISABLED = 0, HE_PMTUD_STATE_BASE = 1, HE_PMTUD_STATE_SEARCHING = 2, HE_PMTUD_STATE_SEARCH_COMPLETE = 3,
  HE_PMTUD_STATE_ERROR = 4
}
 Lightway Path MTU Discovery states. More...
 
enum  he_auth_type { HE_AUTH_TYPE_USERPASS = 1, HE_AUTH_TYPE_TOKEN = 2, HE_AUTH_TYPE_CB = 23 }
 Lightway can use different authentication types. This enum defines those types. More...
 

Detailed Description

Core public header file for libhelium.

Lightway Core Copyright (C) 2021 Express VPN International Ltd.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

This file includes common type definitions and useful constants for ensuring consistency across the code files for libhelium. It should be included by every header file.

Macro Definition Documentation

◆ HE_CONFIG_TEXT_FIELD_LENGTH

#define HE_CONFIG_TEXT_FIELD_LENGTH   50

Helpful deprecation macro.

Maximum size of a text based config option.

Typedef Documentation

◆ he_auth_buf_cb_t

typedef bool(* he_auth_buf_cb_t) (he_conn_t *conn, uint8_t auth_type, uint8_t *buffer, uint16_t length, void *context)

The prototype for the authentication buffer callback.

Parameters
connA pointer to the connection that triggered this callback
auth_typethe authentication type
bufferAn opaque buffer object
lengthThe length of the buffer parameter
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

The host is expected to interpret this buffer and return whether it considers this connection authenticated.

◆ he_auth_cb_t

typedef bool(* he_auth_cb_t) (he_conn_t *conn, char const *username, char const *password, void *context)

The prototype for the authentication callback.

Parameters
connA pointer to the connection that triggered this callback
usernameA pointer to the username
passwordA pointer to the password
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

The host is expected to return whether this username and password is valid for the connection. Note that username and password are not guaranteed to be null terminated, but will be less than or equal in length to HE_CONFIG_TEXT_FIELD_LENGTH.

◆ he_auth_token_cb_t

typedef bool(* he_auth_token_cb_t) (he_conn_t *conn, const uint8_t *token, size_t len, void *context)

The prototype for the authentication token callback.

Parameters
connA pointer to the connection that triggered this callback
tokenA pointer to buffer containing the auth token
lenLength of the token in bytes
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

The host is expected to return whether this auth token is valid for the connection. Note that the token is not guaranteed to be null terminated, but will be less than in length to HE_MAX_MTU.

◆ he_event_cb_t

typedef he_return_code_t(* he_event_cb_t) (he_conn_t *conn, he_conn_event_t event, void *context)

The prototype for the event callback function.

Parameters
connA pointer to the connection that triggered this callback
eventThe event to trigger
contextA pointer to the user defined context

Whenever Helium generates an event, this function will be called.

◆ he_inside_write_cb_t

typedef he_return_code_t(* he_inside_write_cb_t) (he_conn_t *conn, uint8_t *packet, size_t length, void *context)

The prototype for the inside write callback function.

Parameters
connA pointer to the connection that triggered this callback
packetA pointer to the packet data
lengthThe length of the entire packet in bytes
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

Whenever Helium needs to do an inside write this function will be called. On Linux this would usually be writing decrypted packets to a tun device.

◆ he_network_config_ipv4_cb_t

typedef he_return_code_t(* he_network_config_ipv4_cb_t) (he_conn_t *conn, he_network_config_ipv4_t *config, void *context)

The prototype for the network config callback function.

Parameters
connA pointer to the connection that triggered this callback
configThe network config data such as local IP, peer IP, DNS IP and MTU
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

When network configuration data is sent to Helium from the server, this callback will be triggered to allow to host application to configure its network accordingly.

◆ he_nudge_time_cb_t

typedef he_return_code_t(* he_nudge_time_cb_t) (he_conn_t *conn, int timeout, void *context)

The prototype for the nudge time callback function.

Parameters
connA pointer to the connection that triggered this callback
timeoutThe number of milliseconds to wait before nudging Helium
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer
he_conn_get_nudge_time

Helium uses D/TLS which needs to be able to resend certain messages if they are not received in time. As Helium does not have its own threads or timers, it is up to the host application to tell Helium when a certain amount of time has passed. Because D/TLS implements exponential back off, the amount of waiting time can change after every read.

To avoid the host application having to remember to ask Helium after every read with he_conn_get_nudge_time(), the host application can register this callback instead.

Note
Any pending timers should be reset with the value provided in the callback and there should only ever be one timer per connection context. Whilst excessive nudging won't cause Helium to misbehave, it will create unnecessary load.

◆ he_outside_write_cb_t

typedef he_return_code_t(* he_outside_write_cb_t) (he_conn_t *conn, uint8_t *packet, size_t length, void *context)

The prototype for the outside write callback function.

Parameters
connA pointer to the connection that triggered this callback
packetA pointer to the packet data
lengthThe length of the entire packet in bytes
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

Whenever Helium needs to do an outside write this function will be called. On Linux this would usually be writing to a UDP socket to send encrypted data over the Internet.

◆ he_pmtud_state_change_cb_t

typedef he_return_code_t(* he_pmtud_state_change_cb_t) (he_conn_t *conn, he_pmtud_state_t state, void *context)

The prototype for Lightway PMTUD state callback function.

Parameters
connA pointer to the connection that triggered this callback
stateThe state that Lightway PMTUD has just entered
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

Whenever Lightway PMTUD changes state, this function will be called. This callback is mostly for informational only, there's no hard expectation for the callback to do anything. However, this callback may be useful for certain application logic which is triggered by the state changes.

The host application must register this callback to enable Path MTU discovery.

See also
RFC 8899 for more information about PMTUD state machines.

◆ he_pmtud_state_t

Lightway Path MTU Discovery states.

See also
RFC 8899 and RFC 4821

◆ he_pmtud_time_cb_t

typedef he_return_code_t(* he_pmtud_time_cb_t) (he_conn_t *conn, int timeout, void *context)

The prototype for the Path MTU Discovery (PMTUD) time callback function.

Parameters
connA pointer to the connection that triggered this callback
timeoutThe number of milliseconds to wait before calling the he_conn_pmtud_probe_timeout function. If the timeout value is 0, the host application should cancel the timer.
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

Lightway Path MTU Discovery needs to be able to resend probe messages if they are not received in time. As Lightway Core does not have its own threads or timers, it is up to the host application to tell Lightway Core when a certain amount of time has passed.

The host application must register this callback to enable Path MTU discovery.

Note
Any pending timers should be reset with the value provided in the callback and there should only ever be one timer per connection context.

◆ he_populate_network_config_ipv4_cb_t

typedef he_return_code_t(* he_populate_network_config_ipv4_cb_t) (he_conn_t *conn, he_network_config_ipv4_t *config, void *context)

The prototype for the population of the network config.

Parameters
connA pointer to the connection that triggered this callback
[out]configA valid pointer to a network_config_ipv4_t, to be populated by the host
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

The host is expected to populate the provided he_network_config_ipv4_t* object with the correct values so that the client can successfully connect.

◆ he_server_config_cb_t

typedef he_return_code_t(* he_server_config_cb_t) (he_conn_t *conn, uint8_t *buffer, size_t length, void *context)

The prototype for the server config callback function.

Parameters
connA pointer to the connection that triggered this callback
bufferA pointer to the buffer containing the server configuration data
lengthThe length of the buffer in bytes
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

Whenever the client receives the server configuration data (pushed by the Helium server), this callback will be triggered. The host application is responsible for parsing the data using implementation specific format.

◆ he_state_change_cb_t

typedef he_return_code_t(* he_state_change_cb_t) (he_conn_t *conn, he_conn_state_t new_state, void *context)

The prototype for the state callback function.

Parameters
connA pointer to the connection that triggered this callback
new_stateThe state that the context has just entered
contextA pointer to the user defined context
See also
he_conn_set_context Sets the value of the context pointer

Whenever Helium changes state, this function will be called.

Enumeration Type Documentation

◆ he_auth_type

Lightway can use different authentication types. This enum defines those types.

Enumerator
HE_AUTH_TYPE_USERPASS 

Authenticate with username and password.

HE_AUTH_TYPE_TOKEN 

Authenticate with token.

HE_AUTH_TYPE_CB 

Authenticate with custom callback.

◆ he_conn_event

Enumerator
HE_EVENT_FIRST_MESSAGE_RECEIVED 

First packet / message was passed to Helium (i.e. a server response)

HE_EVENT_PONG 

Server replied to a PING request (NAT Keepalive)

HE_EVENT_REJECTED_FRAGMENTED_PACKETS_SENT_BY_HOST 

Connection tried to send fragmented packets which were rejected as they are not supported by Helium

HE_EVENT_SECURE_RENEGOTIATION_STARTED 

Helium has started a secure renegotiation.

HE_EVENT_SECURE_RENEGOTIATION_COMPLETED 

Helium has completed secure renegotiation.

HE_EVENT_PENDING_SESSION_ACKNOWLEDGED 

Pending Session Acknowledged.

◆ he_conn_state

Status codes for a Helium connection.

Enumerator
HE_STATE_NONE 

Connection has yet to be initialised.

HE_STATE_DISCONNECTED 

Connection is in a disconnected state. Any resources used for the connection have been released.

HE_STATE_CONNECTING 

Connection is currently trying to establish a D/TLS session with the server.

HE_STATE_DISCONNECTING 

Connection is currently trying to cleanly disconnect from the server.

HE_STATE_AUTHENTICATING 

Connection has established a D/TLS session and is attempting to authenticate.

HE_STATE_LINK_UP 

TLS link is up.

HE_STATE_ONLINE 

Everything is done - we're online.

HE_STATE_CONFIGURING 

Configuring - config has been received and config callback will soon be made.

◆ he_connection_protocol

Lightway can use different underlying protocols. This enum defines those protocols.

Enumerator
HE_CONNECTION_PROTOCOL_NONE 

Invalid Protocol.

HE_CONNECTION_PROTOCOL_TLS_1_3 

TLS 1.3.

HE_CONNECTION_PROTOCOL_DTLS_1_2 

DTLS 1.2.

HE_CONNECTION_PROTOCOL_DTLS_1_3 

DTLS 1.3.

◆ he_connection_type

Helium can operate in datagram or stream modes. This enum defines these two modes.

Enumerator
HE_CONNECTION_TYPE_DATAGRAM 

Datagram mode (i.e. UDP)

HE_CONNECTION_TYPE_STREAM 

Stream mode (i.e. TCP)

◆ he_padding_type

Helium supports numerous padding levels, from none to full. This enum defines which options can be chosen.

Enumerator
HE_PADDING_NONE 

Tell Helium not to pad packets at all.

HE_PADDING_FULL 

Tell Helium to fully pad packets to the MTU, like IPSEC.

HE_PADDING_450 

Tell Helium to round packets to the nearest 450 bytes.

◆ he_pmtud_state

Lightway Path MTU Discovery states.

See also
RFC 8899 and RFC 4821

◆ he_return_code

All possible return codes for helium.

Enumerator
HE_SUCCESS 

If the function call completed successfully, this will be returned.

HE_ERR_STRING_TOO_LONG 

This will be returned if a string parameter is too long to be stored.

HE_ERR_EMPTY_STRING 

This will be returned if trying to set a configuration parameter to an empty string.

HE_ERR_INVALID_CONN_STATE 

This will be returned if a function was called against a connection context that isn't in a good state.

For example this could happened when calling he_conn_connect_client() on an already connected context.

HE_ERR_NULL_POINTER 

A null pointer was passed as an argument.

HE_ERR_EMPTY_PACKET 

An empty packet was passed to the function. Either a NULL pointer or a length of zero.

HE_ERR_PACKET_TOO_SMALL 

The packet passed to the function is too small to be valid.

HE_ERR_ZERO_SIZE 

The length parameter was set to zero.

HE_ERR_NEGATIVE_NUMBER 

A negative value was given but only an unsigned value is acceptable.

HE_ERR_INIT_FAILED 

Initialisation failed - this is usually an issue with the SSL layer.

HE_ERR_NO_MEMORY 

Could not allocate memory.

HE_ERR_NOT_HE_PACKET 

Packet provided does not have a Helium header.

HE_ERR_SSL_BAD_FILETYPE 

The SSL certificate is not in PEM format.

HE_ERR_SSL_BAD_FILE 

The SSL certificate is corrupt or missing.

HE_ERR_SSL_OUT_OF_MEMORY 

The SSL layer was not able to allocate more memory.

HE_ERR_SSL_ASN_INPUT 

The SSL certificate is not in the correct format.

HE_ERR_SSL_BUFFER 

The SSL layer ran out of buffers.

HE_ERR_SSL_CERT 

Generic issue with the SSL certificate - the SSL layer did not provide further information.

HE_ERR_SSL_ERROR 

Generic issue with the SSL layer.

HE_ERR_CONF_USERNAME_NOT_SET 

Username not set in config.

HE_ERR_CONF_PASSWORD_NOT_SET 

Password not set in config.

HE_ERR_CONF_CA_NOT_SET 

CA not set in config.

HE_ERR_CONF_MTU_NOT_SET 

MTU not set in config.

HE_WANT_READ 

Helium needs to read more data before it can continue.

HE_WANT_WRITE 

Helium needs to write more data before it can continue.

HE_ERR_CONF_OUTSIDE_WRITE_CB_NOT_SET 

Outside write callback not set in config.

HE_ERR_CONNECT_FAILED 

General connection failed error.

HE_CONNECTION_TIMED_OUT 

The SSL Connection has failed due to timeout.

HE_ERR_NOT_CONNECTED 

Helium is not connected.

HE_ERR_UNSUPPORTED_PACKET_TYPE 

Helium only supports IPv4 and IPv6.

HE_ERR_CONNECTION_WAS_CLOSED 

The connection was closed.

HE_ERR_BAD_PACKET 

The packet was invalid (wrong length, bad type etc)

HE_ERR_CALLBACK_FAILED 

Callback failed.

HE_ERR_FAILED 

Generic issue.

HE_ERR_SERVER_DN_MISMATCH 

Domain Name mismatch - supplied DN didn't match server certificate.

HE_ERR_CANNOT_VERIFY_SERVER_CERT 

Unable to verify the server certificate. Usually bad CA chain but could be caused by other weird issues

HE_ERR_NEVER_CONNECTED 

Attempted to call disconnect before connect. If this error is received, the state can be safely destroyed

HE_ERR_INVALID_MTU_SIZE 

MTU size was invalid.

HE_ERR_CLEANUP_FAILED 

Failed to clean up global state.

HE_ERR_REJECTED_SESSION 

The server rejected or couldn't find our session.

HE_ERR_ACCESS_DENIED 

The server rejected the login.

HE_ERR_PACKET_TOO_LARGE 

Packet provided was too large.

HE_ERR_INACTIVITY_TIMEOUT 

Disconnect due to inactivity timeout.

HE_ERR_POINTER_WOULD_OVERFLOW 

Pointer would overflow.

HE_ERR_INVALID_CONNECTION_TYPE 

Connection type argument is not defined in he_connection_type_t.

HE_ERR_RNG_FAILURE 

RNG Failure.

HE_ERR_CONF_AUTH_CB_NOT_SET 

Auth callback not set on a server.

HE_ERR_PLUGIN_DROP 

A plugin requested that we drop the packet without further processing.

HE_ERR_UNKNOWN_SESSION 

Inconsistent session received on server side.

HE_ERR_SSL_ERROR_NONFATAL 

An SSL error occurred on a D/TLS packet but it does not need to terminate the connection.

HE_ERR_INCORRECT_PROTOCOL_VERSION 

Protocol version for connection changed after creation.

HE_ERR_CONF_CONFLICTING_AUTH_METHODS 

Client has both username/password set AND authentication buffer set.

HE_ERR_ACCESS_DENIED_NO_AUTH_BUF_HANDLER 

Server has received an auth_buf message but does not have a handler configured.

HE_ERR_ACCESS_DENIED_NO_AUTH_USERPASS_HANDLER 

Server has received an auth_userpass message but does not have a handler configured.

HE_ERR_SERVER_GOODBYE 

The client has received the goodbye message from server.

HE_ERR_INVALID_AUTH_TYPE 

Invalid authentication type.

HE_ERR_ACCESS_DENIED_NO_AUTH_TOKEN_HANDLER 

Server has received an auth_token message but does not have a handler configured.

HE_ERR_PMTUD_CALLBACKS_NOT_SET 

PMTUD callbacks not set.

HE_ERR_BAD_FRAGMENT 

The fragment was invalid.

HE_ERR_SECURE_RENEGOTIATION_ERROR 

Error occurred during secure renegotiation.

HE_ERR_CANNOT_ENABLE_CH_FRAG 

Unable to use ClientHello Fragment in D/TLS.