Go to the documentation of this file.
41 #define HE_MAX_WIRE_MTU 1500
42 #define HE_MAX_MTU 1350
43 #define HE_MAX_MTU_STR "1350"
46 #define HE_WIRE_MINIMUM_PROTOCOL_MAJOR_VERSION 1
47 #define HE_WIRE_MINIMUM_PROTOCOL_MINOR_VERSION 0
48 #define HE_WIRE_MAXIMUM_PROTOCOL_MAJOR_VERSION 1
49 #define HE_WIRE_MAXIMUM_PROTOCOL_MINOR_VERSION 2
53 #define HE_DEPRECATED(name) __attribute__((deprecated("use " #name " instead")))
54 #elif defined(_MSC_VER)
55 #define HE_DEPRECATED(name) __declspec(deprecated("use " #name " instead"))
59 #define HE_CONFIG_TEXT_FIELD_LENGTH 50
60 #define HE_MAX_IPV4_STRING_LENGTH 24
62 #define HE_MAX_HOSTNAME_LENGTH 255
287 HE_PMTUD_STATE_DISABLED = 0,
294 HE_PMTUD_STATE_BASE = 1,
298 HE_PMTUD_STATE_SEARCHING = 2,
304 HE_PMTUD_STATE_SEARCH_COMPLETE = 3,
311 HE_PMTUD_STATE_ERROR = 4,
329 typedef void *(*he_malloc_t)(
size_t size);
330 typedef void *(*he_calloc_t)(
size_t nmemb,
size_t size);
331 typedef void *(*he_realloc_t)(
void *ptr,
size_t size);
332 typedef void (*he_free_t)(
void *ptr);
494 uint16_t length,
void *context);
568 uint8_t major_version;
569 uint8_t minor_version;
571 uint8_t aggressive_mode;
581 static const uint64_t HE_PACKET_SESSION_REJECT = 0xFFFFFFFFFFFFFFFF;
582 static const uint64_t HE_PACKET_SESSION_EMPTY = 0x0000000000000000;
@ HE_ERR_INIT_FAILED
Initialisation failed - this is usually an issue with the SSL layer.
Definition: he.h:94
@ HE_ERR_SSL_BUFFER
The SSL layer ran out of buffers.
Definition: he.h:108
@ HE_ERR_CONF_OUTSIDE_WRITE_CB_NOT_SET
Outside write callback not set in config.
Definition: he.h:126
enum he_pmtud_state he_pmtud_state_t
Lightway Path MTU Discovery states.
@ HE_CONNECTION_PROTOCOL_NONE
Invalid Protocol.
Definition: he.h:268
@ HE_ERR_CONF_USERNAME_NOT_SET
Username not set in config.
Definition: he.h:114
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.
Definition: he.h:372
@ HE_ERR_REJECTED_SESSION
The server rejected or couldn't find our session.
Definition: he.h:156
@ HE_ERR_SSL_OUT_OF_MEMORY
The SSL layer was not able to allocate more memory.
Definition: he.h:104
struct he_client he_client_t
Data structure to hold all the state needed as a Helium client.
@ HE_ERR_SSL_ERROR_NONFATAL
An SSL error occurred on a D/TLS packet but it does not need to terminate the connection.
Definition: he.h:176
@ HE_PADDING_NONE
Tell Helium not to pad packets at all.
Definition: he.h:246
@ HE_AUTH_TYPE_TOKEN
Authenticate with token.
Definition: he.h:342
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.
Definition: he.h:507
@ HE_ERR_SERVER_GOODBYE
The client has received the goodbye message from server.
Definition: he.h:186
@ HE_STATE_DISCONNECTED
Definition: he.h:209
@ HE_ERR_SSL_ASN_INPUT
The SSL certificate is not in the correct format.
Definition: he.h:106
@ HE_ERR_EMPTY_STRING
This will be returned if trying to set a configuration parameter to an empty string.
Definition: he.h:74
@ HE_WANT_READ
Helium needs to read more data before it can continue.
Definition: he.h:122
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.
Definition: he.h:358
@ HE_ERR_EMPTY_PACKET
An empty packet was passed to the function. Either a NULL pointer or a length of zero.
Definition: he.h:86
Data structure to hold all the state needed as a Helium client.
Definition: he.h:322
The internal plugin API definitions.
@ HE_ERR_ACCESS_DENIED
The server rejected the login.
Definition: he.h:158
@ HE_ERR_UNKNOWN_SESSION
Inconsistent session received on server side.
Definition: he.h:174
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.
Definition: he.h:449
@ HE_ERR_NOT_CONNECTED
Helium is not connected.
Definition: he.h:132
@ HE_ERR_SERVER_DN_MISMATCH
Domain Name mismatch - supplied DN didn't match server certificate.
Definition: he.h:144
@ HE_EVENT_PONG
Server replied to a PING request (NAT Keepalive)
Definition: he.h:228
@ HE_CONNECTION_TIMED_OUT
The SSL Connection has failed due to timeout.
Definition: he.h:130
@ HE_ERR_CONF_CONFLICTING_AUTH_METHODS
Client has both username/password set AND authentication buffer set.
Definition: he.h:180
@ HE_EVENT_REJECTED_FRAGMENTED_PACKETS_SENT_BY_HOST
Definition: he.h:231
struct he_wire_hdr he_wire_hdr_t
The wire header format It is strongly discouraged to interact with this header structure,...
enum he_conn_state he_conn_state_t
Status codes for a Helium connection.
@ HE_ERR_ACCESS_DENIED_NO_AUTH_TOKEN_HANDLER
Server has received an auth_token message but does not have a handler configured.
Definition: he.h:190
he_pmtud_state
Lightway Path MTU Discovery states.
Definition: he.h:281
enum he_return_code he_return_code_t
All possible return codes for helium.
he_connection_protocol
Lightway can use different underlying protocols. This enum defines those protocols.
Definition: he.h:266
@ HE_CONNECTION_PROTOCOL_DTLS_1_3
DTLS 1.3.
Definition: he.h:274
@ HE_STATE_AUTHENTICATING
Connection has established a D/TLS session and is attempting to authenticate.
Definition: he.h:215
@ HE_ERR_INVALID_MTU_SIZE
MTU size was invalid.
Definition: he.h:152
@ HE_STATE_CONFIGURING
Configuring - config has been received and config callback will soon be made.
Definition: he.h:221
@ HE_ERR_CONF_CA_NOT_SET
CA not set in config.
Definition: he.h:118
@ HE_ERR_POINTER_WOULD_OVERFLOW
Pointer would overflow.
Definition: he.h:164
@ HE_ERR_NO_MEMORY
Could not allocate memory.
Definition: he.h:96
@ HE_EVENT_FIRST_MESSAGE_RECEIVED
First packet / message was passed to Helium (i.e. a server response)
Definition: he.h:226
@ HE_ERR_CONNECTION_WAS_CLOSED
The connection was closed.
Definition: he.h:136
@ HE_ERR_CONF_PASSWORD_NOT_SET
Password not set in config.
Definition: he.h:116
he_return_code
All possible return codes for helium.
Definition: he.h:68
enum he_padding_type he_padding_type_t
Helium supports numerous padding levels, from none to full. This enum defines which options can be ch...
@ HE_ERR_PACKET_TOO_LARGE
Packet provided was too large.
Definition: he.h:160
@ HE_ERR_INVALID_CONN_STATE
This will be returned if a function was called against a connection context that isn't in a good stat...
Definition: he.h:82
@ HE_CONNECTION_TYPE_STREAM
Stream mode (i.e. TCP)
Definition: he.h:260
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.
Definition: he.h:415
@ HE_SUCCESS
If the function call completed successfully, this will be returned.
Definition: he.h:70
@ HE_ERR_PLUGIN_DROP
A plugin requested that we drop the packet without further processing.
Definition: he.h:172
@ HE_ERR_ACCESS_DENIED_NO_AUTH_BUF_HANDLER
Server has received an auth_buf message but does not have a handler configured.
Definition: he.h:182
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.
Definition: he.h:528
@ HE_ERR_SECURE_RENEGOTIATION_ERROR
Error occurred during secure renegotiation.
Definition: he.h:196
@ HE_EVENT_SECURE_RENEGOTIATION_STARTED
Helium has started a secure renegotiation.
Definition: he.h:233
@ HE_ERR_CONF_AUTH_CB_NOT_SET
Auth callback not set on a server.
Definition: he.h:170
@ HE_EVENT_PENDING_SESSION_ACKNOWLEDGED
Pending Session Acknowledged.
Definition: he.h:237
@ HE_ERR_ACCESS_DENIED_NO_AUTH_USERPASS_HANDLER
Server has received an auth_userpass message but does not have a handler configured.
Definition: he.h:184
@ HE_ERR_SSL_BAD_FILETYPE
The SSL certificate is not in PEM format.
Definition: he.h:100
he_connection_type
Helium can operate in datagram or stream modes. This enum defines these two modes.
Definition: he.h:256
@ HE_ERR_BAD_PACKET
The packet was invalid (wrong length, bad type etc)
Definition: he.h:138
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.
Definition: he.h:493
@ HE_ERR_PMTUD_CALLBACKS_NOT_SET
PMTUD callbacks not set.
Definition: he.h:192
@ HE_ERR_NEVER_CONNECTED
Definition: he.h:150
he_padding_type
Helium supports numerous padding levels, from none to full. This enum defines which options can be ch...
Definition: he.h:244
#define HE_MAX_IPV4_STRING_LENGTH
Maximum size of an IPV4 String.
Definition: he.h:61
@ HE_ERR_SSL_ERROR
Generic issue with the SSL layer.
Definition: he.h:112
@ HE_STATE_NONE
Connection has yet to be initialised.
Definition: he.h:206
@ HE_ERR_INACTIVITY_TIMEOUT
Disconnect due to inactivity timeout.
Definition: he.h:162
@ HE_ERR_BAD_FRAGMENT
The fragment was invalid.
Definition: he.h:194
@ HE_ERR_CLEANUP_FAILED
Failed to clean up global state.
Definition: he.h:154
bool(* he_auth_cb_t)(he_conn_t *conn, char const *username, char const *password, void *context)
The prototype for the authentication callback.
Definition: he.h:463
@ HE_CONNECTION_TYPE_DATAGRAM
Datagram mode (i.e. UDP)
Definition: he.h:258
he_auth_type
Lightway can use different authentication types. This enum defines those types.
Definition: he.h:337
@ HE_STATE_DISCONNECTING
Connection is currently trying to cleanly disconnect from the server.
Definition: he.h:213
@ HE_ERR_INVALID_AUTH_TYPE
Invalid authentication type.
Definition: he.h:188
@ HE_ERR_INVALID_CONNECTION_TYPE
Connection type argument is not defined in he_connection_type_t.
Definition: he.h:166
@ HE_CONNECTION_PROTOCOL_DTLS_1_2
DTLS 1.2.
Definition: he.h:272
@ HE_ERR_FAILED
Generic issue.
Definition: he.h:142
@ HE_ERR_CANNOT_ENABLE_CH_FRAG
Unable to use ClientHello Fragment in D/TLS.
Definition: he.h:198
he_conn_state
Status codes for a Helium connection.
Definition: he.h:204
enum he_connection_type he_connection_type_t
Helium can operate in datagram or stream modes. This enum defines these two modes.
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.
Definition: he.h:478
The wire header format It is strongly discouraged to interact with this header structure,...
Definition: he.h:564
Definition: he_internal.h:92
@ HE_ERR_INCORRECT_PROTOCOL_VERSION
Protocol version for connection changed after creation.
Definition: he.h:178
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.
Definition: he.h:546
@ HE_ERR_SSL_CERT
Generic issue with the SSL certificate - the SSL layer did not provide further information.
Definition: he.h:110
Definition: he_internal.h:297
@ HE_EVENT_SECURE_RENEGOTIATION_COMPLETED
Helium has completed secure renegotiation.
Definition: he.h:235
@ HE_ERR_ZERO_SIZE
The length parameter was set to zero.
Definition: he.h:90
@ HE_ERR_CANNOT_VERIFY_SERVER_CERT
Definition: he.h:147
@ HE_CONNECTION_PROTOCOL_TLS_1_3
TLS 1.3.
Definition: he.h:270
enum he_auth_type he_auth_type_t
Lightway can use different authentication types. This enum defines those types.
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.
Definition: he.h:386
he_conn_event
Definition: he.h:224
@ HE_ERR_NOT_HE_PACKET
Packet provided does not have a Helium header.
Definition: he.h:98
@ HE_WANT_WRITE
Helium needs to write more data before it can continue.
Definition: he.h:124
@ HE_PADDING_FULL
Tell Helium to fully pad packets to the MTU, like IPSEC.
Definition: he.h:248
@ HE_ERR_STRING_TOO_LONG
This will be returned if a string parameter is too long to be stored.
Definition: he.h:72
@ HE_ERR_RNG_FAILURE
RNG Failure.
Definition: he.h:168
@ HE_AUTH_TYPE_CB
Authenticate with custom callback.
Definition: he.h:345
@ HE_STATE_ONLINE
Everything is done - we're online.
Definition: he.h:219
@ HE_ERR_CONNECT_FAILED
General connection failed error.
Definition: he.h:128
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.
Definition: he.h:427
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.
Definition: he.h:399
@ HE_STATE_CONNECTING
Connection is currently trying to establish a D/TLS session with the server.
Definition: he.h:211
@ HE_AUTH_TYPE_USERPASS
Authenticate with username and password.
Definition: he.h:339
@ HE_ERR_CALLBACK_FAILED
Callback failed.
Definition: he.h:140
@ HE_ERR_NEGATIVE_NUMBER
A negative value was given but only an unsigned value is acceptable.
Definition: he.h:92
Definition: he_internal.h:170
enum he_connection_protocol he_connection_protocol_t
Lightway can use different underlying protocols. This enum defines those protocols.
@ HE_PADDING_450
Tell Helium to round packets to the nearest 450 bytes.
Definition: he.h:250
@ HE_ERR_NULL_POINTER
A null pointer was passed as an argument.
Definition: he.h:84
@ HE_STATE_LINK_UP
TLS link is up.
Definition: he.h:217
@ HE_ERR_PACKET_TOO_SMALL
The packet passed to the function is too small to be valid.
Definition: he.h:88
@ HE_ERR_CONF_MTU_NOT_SET
MTU not set in config.
Definition: he.h:120
@ HE_ERR_UNSUPPORTED_PACKET_TYPE
Helium only supports IPv4 and IPv6.
Definition: he.h:134
@ HE_ERR_SSL_BAD_FILE
The SSL certificate is corrupt or missing.
Definition: he.h:102