64#define HZL_SERVER_MAX_AMOUNT_OF_CLIENTS 32U
77#define HZL_SERVER_LARGEST_MAX_COUNTER_NONCE_DELAY (1U << 22U)
84#define HZL_SERVER_MAX_COUNTER_NONCE_UPPER_LIMIT 0xFFFF80U
120 "The size of the Server Config struct must be exactly 3 B");
156 "The size of the Server-side Client Config struct must be exactly 17 B");
244 "The size of the Server Group Config struct must be exactly 24 B");
299 "The size of the Server Group State struct must be exactly 52 B");
473 const uint8_t* userData,
507 const uint8_t* userData,
569 const uint8_t* receivedPdu,
570 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
struct hzl_ServerGroupConfig hzl_ServerGroupConfig_t
Hazelnet Server constant Group configuration.
struct hzl_ServerGroupState hzl_ServerGroupState_t
Hazelnet Server variable State.
struct hzl_ServerCtx hzl_ServerCtx_t
Configuration and status of the HazelNet Server library.
HZL_API hzl_Err_t hzl_ServerProcessReceived(hzl_CbsPduMsg_t *reactionPdu, hzl_RxSduMsg_t *receivedUserData, hzl_ServerCtx_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 ...
struct hzl_ServerClientsConfig hzl_ServerClientConfig_t
Hazelnet Server constant per-Client configuration.
uint32_t hzl_ServerBitMap_t
Integer data type used for the bitmap of Clients that must support HZL_SERVER_MAX_AMOUNT_OF_CLIENTS b...
Definition: hzl_Server.h:70
HZL_API hzl_Err_t hzl_ServerDeInit(hzl_ServerCtx_t *ctx)
Deinitialisation of the Server, securely clearing the state.
HZL_API hzl_Err_t hzl_ServerBuildSecuredFd(hzl_CbsPduMsg_t *securedPdu, hzl_ServerCtx_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_ServerInit(hzl_ServerCtx_t *ctx)
Initialisation of the Server.
HZL_API hzl_Err_t hzl_ServerBuildUnsecured(hzl_CbsPduMsg_t *unsecuredPdu, const hzl_ServerCtx_t *ctx, const uint8_t *userData, size_t userDataLen, hzl_Gid_t groupId)
Builds an unsecured message in plaintext.
_Static_assert(sizeof(hzl_ServerConfig_t)==3, "The size of the Server Config struct must be exactly 3 B")
Double-checking the size of the hzl_ServerConfig_t struct to avoid unexpected paddings.
struct hzl_ServerConfig hzl_ServerConfig_t
Hazelnet Server constant configuration.
HZL_API hzl_Err_t hzl_ServerForceSessionRenewal(hzl_CbsPduMsg_t *renewalPdu, hzl_ServerCtx_t *ctx, hzl_Gid_t groupId)
Forcibly start a Session Renewal Phase, unless one is already ongoing or no Clients are currently ena...
Packed CBS PDU (Protocol Data Unit message) ready to be transmitted by the library user.
Definition: hzl.h:512
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
Hazelnet Server constant per-Client configuration.
Definition: hzl_Server.h:129
HZL_SET_BY_USER hzl_Sid_t sid
Source Identifier of the Client.
Definition: hzl_Server.h:143
HZL_SET_BY_USER uint8_t ltk[HZL_LTK_LEN]
Symmetric Long Term Key of the Client X (LTK_{XS}), uniquely identifying the Client against the Serve...
Definition: hzl_Server.h:150
Hazelnet Server constant configuration.
Definition: hzl_Server.h:93
HZL_SET_BY_USER uint8_t amountOfGroups
Amount of hzl_ServerGroupConfig_t instances.
Definition: hzl_Server.h:99
HZL_SET_BY_USER uint8_t amountOfClients
Amount of Clients this Server knows, i.e.
Definition: hzl_Server.h:106
HZL_SET_BY_USER uint8_t headerType
Header Type (h) used by the network of CBS-enabled nodes.
Definition: hzl_Server.h:114
Configuration and status of the HazelNet Server library.
Definition: hzl_Server.h:307
HZL_SET_BY_USER hzl_Io_t io
Set of function pointers binding the API to the rest of the system.
Definition: hzl_Server.h:363
HZL_SET_BY_USER const hzl_ServerClientConfig_t * clientConfigs
Pointer to an array of structs, each with the constant configuration of one Client.
Definition: hzl_Server.h:329
HZL_SET_BY_USER const hzl_ServerConfig_t * serverConfig
Pointer to one struct with the constant Server configuration.
Definition: hzl_Server.h:313
HZL_SET_BY_USER hzl_ServerGroupState_t * groupStates
Pointer to an array of structs, each with the variable state of one Group.
Definition: hzl_Server.h:357
HZL_SET_BY_USER const hzl_ServerGroupConfig_t * groupConfigs
Pointer to an array of structs, each with the constant configuration of one Group.
Definition: hzl_Server.h:345
Hazelnet Server constant Group configuration.
Definition: hzl_Server.h:165
HZL_SET_BY_USER hzl_CtrNonce_t ctrNonceUpperLimit
Counter Nonce upper limit (N^{exp}_G), used to know when the current Session expires due to the amoun...
Definition: hzl_Server.h:179
HZL_SET_BY_USER hzl_Gid_t gid
Group Identifier of this Group (id_G).
Definition: hzl_Server.h:236
HZL_SET_BY_USER hzl_ServerBitMap_t clientSidsInGroupBitmap
Bitmap of the Client SIDs included in this Group.
Definition: hzl_Server.h:215
HZL_SET_BY_USER uint32_t delayBetweenRenNotificationsMillis
Delay between consecutive Session renewal notification (REN) messages (t^{ntf}_G) in milliseconds.
Definition: hzl_Server.h:197
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_Server.h:172
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_Server.h:222
HZL_SET_BY_USER uint32_t sessionDurationMillis
Server-Side Session time Duration (s^{exp}_G) in milliseconds.
Definition: hzl_Server.h:188
uint8_t unusedPadding[1]
Padding to the next struct.
Definition: hzl_Server.h:238
Hazelnet Server variable State.
Definition: hzl_Server.h:254
hzl_Timestamp_t previousRxLastMessageInstant
Timestamp of when the last valid received secured message belonging to the previously active Session ...
Definition: hzl_Server.h:275
hzl_CtrNonce_t previousCtrNonce
Counter Nonce of the the previously active Session (N^{ctr,old}_G), currently about to expire.
Definition: hzl_Server.h:284
uint8_t previousStk[HZL_LTK_LEN]
Short Term Key of the the previously active Session (STK^{old}_G), currently about to expire.
Definition: hzl_Server.h:293
hzl_Timestamp_t currentRxLastMessageInstant
Timestamp of when the last valid received secured message belonging to the currently active Session w...
Definition: hzl_Server.h:268
uint8_t currentStk[HZL_LTK_LEN]
Short Term Key of the currently active Session (STK_G).
Definition: hzl_Server.h:288
hzl_CtrNonce_t currentCtrNonce
Counter Nonce of the the currently active Session (N^{ctr}_G).
Definition: hzl_Server.h:279
hzl_Timestamp_t sessionStartInstant
Timestamp of when the Session was started.
Definition: hzl_Server.h:260