106 "The size of the Client Config struct must be exactly 22 B");
151 "The size of the Client Group Config struct must be exactly 12 B");
213 "The size of the Client Group state struct must be exactly 64 B");
383 const uint8_t* userData,
420 const uint8_t* userData,
479 const uint8_t* receivedPdu,
480 size_t receivedPduLen,
General public definitions used used by both the Hazelnet Server and Client.
uint32_t hzl_Timestamp_t
Opaque timestamp (timer, rolling counter) with milliseconds accuracy.
Definition: hzl.h:492
#define HZL_LTK_LEN
Length of the Long Term Key in bytes.
Definition: hzl.h:137
uint8_t hzl_Sid_t
Source Identifier data type.
Definition: hzl.h:465
uint32_t hzl_CanId_t
CAN message identifier data type, able to hold both 11- or 29-bits values.
Definition: hzl.h:471
uint8_t hzl_Gid_t
Group Identifier data type.
Definition: hzl.h:462
#define HZL_API
Identifier of the public library API functions.
Definition: hzl.h:122
uint32_t hzl_CtrNonce_t
Counter Nonce data type.
Definition: hzl.h:495
enum hzl_Err hzl_Err_t
Hazelnet error code, returned by all API functions.
#define HZL_SET_BY_USER
Identifier of the struct fields of the public API the user must set manually.
Definition: hzl.h:128
uint64_t hzl_ReqNonce_t
Request Nonce data type.
Definition: hzl.h:474
_Static_assert(sizeof(hzl_ClientConfig_t)==22, "The size of the Client Config struct must be exactly 22 B")
Double-checking the size of the hzl_ClientConfig_t struct to avoid unexpected paddings.
struct hzl_ClientConfig hzl_ClientConfig_t
Hazelnet Client constant configuration.
struct hzl_ClientCtx hzl_ClientCtx_t
Configuration and status of the HazelNet Client library.
HZL_API hzl_Err_t hzl_ClientBuildRequest(hzl_CbsPduMsg_t *requestPdu, hzl_ClientCtx_t *ctx, hzl_Gid_t groupId)
Builds a Request message, asking for the Session information for a specific group,...
HZL_API hzl_Err_t hzl_ClientProcessReceived(hzl_CbsPduMsg_t *reactionPdu, hzl_RxSduMsg_t *receivedUserData, hzl_ClientCtx_t *ctx, const uint8_t *receivedPdu, size_t receivedPduLen, hzl_CanId_t receivedCanId)
Validates, unpacks and decrypts (if necessary) any received message, preparing an automatic response ...
HZL_API hzl_Err_t hzl_ClientDeInit(hzl_ClientCtx_t *ctx)
Deinitialisation of the Client, securely clearing the state.
HZL_API hzl_Err_t hzl_ClientInit(hzl_ClientCtx_t *ctx)
Initialisation of the Client.
struct hzl_ClientGroupConfig hzl_ClientGroupConfig_t
Hazelnet Client constant Group configuration.
struct hzl_ClientGroupState hzl_ClientGroupState_t
Hazelnet Client variable State.
HZL_API hzl_Err_t hzl_ClientBuildSecuredFd(hzl_CbsPduMsg_t *securedPdu, hzl_ClientCtx_t *ctx, const uint8_t *userData, size_t userDataLen, hzl_Gid_t groupId)
Builds a secured message, encrypted, authenticated and timely, only for the given group to be able to...
HZL_API hzl_Err_t hzl_ClientBuildUnsecured(hzl_CbsPduMsg_t *unsecuredPdu, const hzl_ClientCtx_t *ctx, const uint8_t *userData, size_t userDataLen, hzl_Gid_t groupId)
Builds an unsecured message in plaintext.
Packed CBS PDU (Protocol Data Unit message) ready to be transmitted by the library user.
Definition: hzl.h:512
Hazelnet Client constant configuration.
Definition: hzl_Client.h:62
HZL_SET_BY_USER uint8_t amountOfGroups
Only Groups this client is in, i.e.
Definition: hzl_Client.h:98
uint8_t unusedPadding[1]
Padding to the next struct.
Definition: hzl_Client.h:100
HZL_SET_BY_USER uint8_t headerType
Header Type (h) used by the network of CBS-enabled nodes.
Definition: hzl_Client.h:91
HZL_SET_BY_USER uint8_t ltk[HZL_LTK_LEN]
Symmetric Long Term Key of this Client (LTK_{AS}), uniquely identifying this Client against the Serve...
Definition: hzl_Client.h:77
HZL_SET_BY_USER hzl_Sid_t sid
Source Identifier of this Client.
Definition: hzl_Client.h:83
HZL_SET_BY_USER uint16_t timeoutReqToResMillis
Duration in milliseconds until a Request times out (t_{reqres}).
Definition: hzl_Client.h:70
Configuration and status of the HazelNet Client library.
Definition: hzl_Client.h:221
HZL_SET_BY_USER const hzl_ClientGroupConfig_t * groupConfigs
Pointer to an array of structs, each with the constant configuration of one Group.
Definition: hzl_Client.h:240
HZL_SET_BY_USER hzl_ClientGroupState_t * groupStates
Pointer to an array of structs, each with the variable state of one Group.
Definition: hzl_Client.h:252
HZL_SET_BY_USER const hzl_ClientConfig_t * clientConfig
Pointer to one struct with the constant Client configuration.
Definition: hzl_Client.h:227
HZL_SET_BY_USER hzl_Io_t io
Set of function pointers binding the API to the rest of the system.
Definition: hzl_Client.h:258
Hazelnet Client constant Group configuration.
Definition: hzl_Client.h:115
HZL_SET_BY_USER uint16_t sessionRenewalDurationMillis
Client-Side Session Renewal time Duration (t^{ren}_G) in milliseconds.
Definition: hzl_Client.h:136
HZL_SET_BY_USER uint16_t maxSilenceIntervalMillis
Maximum Silence Interval (S^{max}_G) in milliseconds, used to filter out recent messages from old one...
Definition: hzl_Client.h:129
uint8_t unusedPadding[3]
Padding to the next struct.
Definition: hzl_Client.h:145
HZL_SET_BY_USER uint32_t maxCtrnonceDelayMsgs
Maximum Counter Nonce Delay (D^{max}_G) in milliseconds, used to filter out recent messages from old ...
Definition: hzl_Client.h:122
HZL_SET_BY_USER hzl_Gid_t gid
Group Identifier of this Group (id_G).
Definition: hzl_Client.h:143
Hazelnet Client variable State.
Definition: hzl_Client.h:161
hzl_CtrNonce_t previousCtrNonce
Counter Nonce of the the previously active Session (N^{ctr,old}_G), currently about to expire.
Definition: hzl_Client.h:196
hzl_Timestamp_t currentRxLastMessageInstant
Timestamp of when the last valid received secured message belonging to the currently active Session w...
Definition: hzl_Client.h:180
hzl_Timestamp_t lastHandshakeEventInstant
Timestamp of when the Request was transmitted or when the Response was received (r_G).
Definition: hzl_Client.h:173
uint8_t previousStk[HZL_LTK_LEN]
Short Term Key of the the previously active Session (STK^{old}_G), currently about to expire.
Definition: hzl_Client.h:205
hzl_CtrNonce_t currentCtrNonce
Counter Nonce of the the currently active Session (N^{ctr}_G).
Definition: hzl_Client.h:191
hzl_Timestamp_t previousRxLastMessageInstant
Timestamp of when the last valid received secured message belonging to the previously active Session ...
Definition: hzl_Client.h:187
uint8_t currentStk[HZL_LTK_LEN]
Short Term Key of the the currently active Session (STK_G).
Definition: hzl_Client.h:200
uint8_t unusedPadding[4]
Padding to the next struct.
Definition: hzl_Client.h:207
hzl_ReqNonce_t requestNonce
Random nonce used in the last Request (N^{req}_G).
Definition: hzl_Client.h:167
Functions used by Hazelnet to interact with the rest of the system in order to obtain random numbers,...
Definition: hzl.h:568
Unpacked received SDU (Service Data Unit message) after validation (and optional decryption).
Definition: hzl.h:519