Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of OmniWheels by
mle_service_api.h File Reference
Mle service API for multiple MLE protocol user. More...
Go to the source code of this file.
Typedefs | |
| typedef void( | mle_service_receive_cb )(int8_t interface_id, mle_message_t *mle_msg, mle_security_header_t *security_headers) |
| MLE service message receiver handler call back function pointer. | |
| typedef void( | mle_service_receive_security_bypass_cb )(int8_t interface_id, mle_message_t *mle_msg) |
| MLE service security bypass message receiver handler call back function pointer. | |
| typedef uint8_t *( | mle_service_key_request_by_counter_cb )(int8_t interface_id, uint8_t keyId, uint32_t keySequnce) |
| MLE service security key request by 32-bit key source. | |
| typedef uint8_t *( | mle_service_security_notify_cb )(int8_t interface_id, mle_security_event_t event, uint8_t keyId) |
| MLE service security event notify. | |
| typedef bool( | mle_service_message_timeout_cb )(int8_t interface_id, uint16_t msgId, bool usedAllRetries) |
| MLE service message timeout call back. | |
Enumerations | |
| enum | mle_security_event { MLE_SEC_MAX_FRAME_COUNTER_REACHED = 0, MLE_SEC_KEY_UPDATE_NOTIFY, MLE_SEC_UNKNOWN_KEY } |
Functions | |
| void | mle_service_interface_tx_queue_clean (int8_t interface_id) |
| Delete and free all activated Transaction. | |
| int | mle_service_reset_frame_counters (int8_t interfaceId) |
| count all activated Transactions. | |
| int | mle_service_interface_token_bucket_settings_set (int8_t interface_id, uint8_t size, uint8_t rate, uint8_t count) |
| Sets MLE token bucket settings. | |
| uint8_t | mle_service_security_next_key_id_get (int8_t interfaceId) |
| GET MLE security coming key id. | |
| uint16_t | mle_service_msg_allocate (int8_t interface_id, uint16_t data_length, bool challengeAllocate, uint8_t type) |
| Allocate MLE transaction buffer and set default security parameters to buffer. | |
| int | mle_service_msg_free (uint16_t msgId) |
| Free message. | |
| int | mle_service_msg_update_security_params (uint16_t msgId, uint8_t security_level, uint8_t key_id_mode, uint32_t keysequence) |
| Set new security level and Key id mode. | |
| int | mle_service_message_tail_get (uint16_t msgId, uint16_t tail_length) |
| MLE message tail get for new payload. | |
| uint8_t * | mle_service_get_data_pointer (uint16_t msgId) |
| Get MLE message data pointer for write. | |
| uint8_t * | mle_service_get_payload_start_point (uint16_t msgId) |
| Get MLE message pointer to message start. | |
| uint16_t | mle_service_get_payload_length (uint16_t msgId) |
| Get MLE message payload length. | |
| int | mle_service_update_length (uint16_t msgId, uint16_t tail_length) |
| Set MLE message end point by new tail. | |
| int | mle_service_update_length_by_ptr (uint16_t msgId, uint8_t *data_end_ptr) |
| Set MLE message end point by new data end pointer. | |
| uint8_t * | mle_service_get_msg_destination_address_pointer (uint16_t msgId) |
| Get MLE message destination address pointer for write purpose. | |
| int | mle_service_set_msg_destination_address (uint16_t msgId, const uint8_t *dstAddress) |
| Set MLE message destination address. | |
| int | mle_service_set_msg_panid (uint16_t msgId, uint16_t panid) |
| Set Messages link PAN. | |
| int | mle_service_set_msg_timeout_parameters (uint16_t msgId, mle_message_timeout_params_t *timeout_params) |
| Set messages timeout parameters. | |
| int | mle_service_set_msg_response_true (uint16_t msgId) |
| Set MLE message response received state. | |
| bool | mle_service_check_msg_response (uint16_t msgId) |
| Check MLE message response received state. | |
| bool | mle_service_check_msg_sent (uint16_t msgId) |
| Check if message has been sent to socket. | |
| int | mle_service_set_packet_callback (uint16_t msgId, mle_service_message_timeout_cb *cb) |
| MLE message timeout handler set. | |
| int | mle_service_send_message (uint16_t msgId) |
| Sends MLE message. | |
| bool | mle_service_timer_tick (uint16_t ticks) |
| Timer tick function. | |
| int | mle_service_reject_message_build (int8_t interfaceId, uint8_t *dstIpv6, bool force_unsecure) |
| Build and send standard link reject message. | |
| int | mle_service_set_msg_token_bucket_priority (uint16_t msgId) |
| Sets message a priority over token bucket restrictions. | |
| void | mle_service_set_frame_counter_check (bool value) |
| Activates MLE Frame counter checking for the interface. | |
| void | mle_service_set_fragmented_msg_ll_security (bool value) |
| Set 802.15.4 security option for fragmented MLE messages. | |
| void | mle_service_set_accept_invalid_frame_counter (bool value) |
| Commands MLE service to accept message with invalid MLE frame counter. | |
Detailed Description
Mle service API for multiple MLE protocol user.
MLE service interface configuration API
- mle_service_interface_register(), Register interface for first user service will open socket
- mle_service_interface_unregister(), Unregister service after last user call socket will be closed
- mle_service_interface_registeration_validate(), Validate has interface registered service already
- mle_service_interface_receiver_handler_update(), Update registered message handler to new one
- mle_service_interface_tx_queue_clean(), Free interface active queued messages
- mle_service_interface_token_bucket_settings_set(), Sets token bucket settings
MLE Security configuration API
- mle_service_security_init(), allocate security class for interface
- mle_service_security_set_security_key(), Set security key to security class
- mle_service_security_set_frame_counter(), Update security class frame counter
- mle_service_security_key_trig() Indicate mle security class to switch default key
MLE Security class get API
- mle_service_security_default_key_get(). Get default key pointer
- mle_service_security_default_key_id_get(), Get default key id
- mle_service_security_next_key_get(), Get secondary or pending key pointer
- mle_service_security_next_key_id_get(), Get secondary or pending key id
- mle_service_security_level_get(), Get configured security level
MLE message Data flow API
- mle_service_msg_allocate(), Allocate message buffer and set default security params based on configuration
- mle_service_msg_free(), Release allocated buffer
- mle_service_message_tail_get(), Get more space for message end
- mle_service_get_data_pointer(), Get messages data pointer DO NOT USE FOR WRITE
- mle_service_get_payload_length(), Get messages payload length
- mle_service_get_payload_start_point(), Get pointer to message payload start
- mle_service_update_length(), Update messages data length by given number of added bytes
- mle_service_update_length_by_ptr(), Update messages data length by updated data pointer
- mle_service_msg_update_security_params(), Change messages default setup
- mle_service_set_msg_response_true(), Mark message response status when you know that
- mle_service_check_msg_response(), Verify messages response status (typically called at timeout call back)
- mle_service_trasnaction_buffer_get_for_response(), Validate received response for interface request
- mle_service_check_msg_sent(), Check if message has been sent to socket
Messages TX API
- mle_service_set_packet_callback(), Set messages timeout call back
- mle_service_get_msg_destination_address_pointer(), Get messages destination address pointer for verify or write
- mle_service_set_msg_destination_address(), Set messages IPv6 destination address
- mle_service_set_msg_timeout_parameters(), Update messages timeout and delay parameters
- mle_service_send_message(), Send builded message with given timeout parameters
- mle_service_reject_message_build(), Build and send MLE link reject message to given destination address
- mle_service_set_msg_token_bucket_priority(), Sets message a priority over token bucket restrictions
Service Messages timeout API
- mle_service_timer_tick(), This need to be call periodically and give time in 100ms ticks
Definition in file mle_service_api.h.
Typedef Documentation
| typedef uint8_t*( mle_service_key_request_by_counter_cb)(int8_t interface_id, uint8_t keyId, uint32_t keySequnce) |
MLE service security key request by 32-bit key source.
All service user need to register this function pointer if they support 32-bit key source.
- Parameters:
-
interface_id define interface id for receiver keyId key identifier keySequnce 32-bit key source
Definition at line 165 of file mle_service_api.h.
| typedef bool( mle_service_message_timeout_cb)(int8_t interface_id, uint16_t msgId, bool usedAllRetries) |
MLE service message timeout call back.
This function will be called when msg timeout happen
- Parameters:
-
interface_id define interface id for receiver msgId key identifier usedAllRetries false when
- Returns:
- true Continue packet retry
- false Stop TX process and
Definition at line 190 of file mle_service_api.h.
| typedef void( mle_service_receive_cb)(int8_t interface_id, mle_message_t *mle_msg, mle_security_header_t *security_headers) |
MLE service message receiver handler call back function pointer.
All service user need to register this function pointer.
- Parameters:
-
interface_id define interface id for receiver mle_msg mle message structure security_headers indicate messages security parameters
Definition at line 144 of file mle_service_api.h.
| typedef void( mle_service_receive_security_bypass_cb)(int8_t interface_id, mle_message_t *mle_msg) |
MLE service security bypass message receiver handler call back function pointer.
All service user need to register this function pointer.
- Parameters:
-
interface_id define interface id for receiver mle_msg mle message structure
Definition at line 154 of file mle_service_api.h.
| typedef uint8_t*( mle_service_security_notify_cb)(int8_t interface_id, mle_security_event_t event, uint8_t keyId) |
MLE service security event notify.
- Parameters:
-
interface_id define interface id for receiver event keyId key identifier
Definition at line 175 of file mle_service_api.h.
Enumeration Type Documentation
| enum mle_security_event |
- Enumerator:
Definition at line 100 of file mle_service_api.h.
Function Documentation
| bool mle_service_check_msg_response | ( | uint16_t | msgId ) |
Check MLE message response received state.
Usefully function at message timeout call back to check response status
- Parameters:
-
msgId message id.
- Returns:
- true message has received response
- false no response or unknow message id
Definition at line 167 of file mle_service_buffer.c.
| bool mle_service_check_msg_sent | ( | uint16_t | msgId ) |
Check if message has been sent to socket.
Function can be used whether message has been sent to socket or has been rejected by token bucket.
- Parameters:
-
msgId message id.
- Returns:
- true message has been sent
- false message has not been sent
Definition at line 1186 of file mle_service.c.
| uint8_t* mle_service_get_data_pointer | ( | uint16_t | msgId ) |
Get MLE message data pointer for write.
- Parameters:
-
msgId message id.
- Returns:
- >0 Valid pointer for write
- NULL Not valid message id
Definition at line 1068 of file mle_service.c.
| uint8_t* mle_service_get_msg_destination_address_pointer | ( | uint16_t | msgId ) |
Get MLE message destination address pointer for write purpose.
- Parameters:
-
msgId message id.
- Returns:
- >0 Pointer get OK
- NULL message id not valid
Definition at line 1138 of file mle_service.c.
| uint16_t mle_service_get_payload_length | ( | uint16_t | msgId ) |
Get MLE message payload length.
- Parameters:
-
msgId message id.
- Returns:
- length of payload
Definition at line 1084 of file mle_service.c.
| uint8_t* mle_service_get_payload_start_point | ( | uint16_t | msgId ) |
Get MLE message pointer to message start.
- Parameters:
-
msgId message id.
- Returns:
- >0 Valid pointer for read or verify
- NULL Not valid message id
Definition at line 1073 of file mle_service.c.
| int mle_service_interface_token_bucket_settings_set | ( | int8_t | interface_id, |
| uint8_t | size, | ||
| uint8_t | rate, | ||
| uint8_t | count | ||
| ) |
Sets MLE token bucket settings.
Using of message tokens is optional.
- Parameters:
-
size Bucket size, 0 to 255, 0 means not in use rate Token rate, 0 to 255, 0 means not in use count,0 to 255, 0 means not in use
- Returns:
- 0 Set is OK
- -1 Unknown interface id
- -2 Other error
Definition at line 997 of file mle_service.c.
| void mle_service_interface_tx_queue_clean | ( | int8_t | interface_id ) |
Delete and free all activated Transaction.
- Parameters:
-
interface_id interface Id.
Definition at line 987 of file mle_service.c.
| int mle_service_message_tail_get | ( | uint16_t | msgId, |
| uint16_t | tail_length | ||
| ) |
MLE message tail get for new payload.
- Parameters:
-
msgId message id. tail_length define messages new need tail length
- Returns:
- 0 tail allocated OK
- -1 tail allocate fail
- -2 unknown message id
Definition at line 1197 of file mle_service.c.
| uint16_t mle_service_msg_allocate | ( | int8_t | interface_id, |
| uint16_t | data_length, | ||
| bool | challengeAllocate, | ||
| uint8_t | type | ||
| ) |
Allocate MLE transaction buffer and set default security parameters to buffer.
Configured security params from interface * security level * key id mode MAC_KEY_ID_MODE_IDX Service will automatically set next params * Key id * security frame counter
- Parameters:
-
interface_id interface Id. data_length Payload max length challengeAllocate True allocate challenge and write that to message automatically type message type
- Returns:
- > 0 Message id
- 0 Allocate fail
Definition at line 1014 of file mle_service.c.
| int mle_service_msg_free | ( | uint16_t | msgId ) |
Free message.
- Parameters:
-
msgId buffer Id.
- Returns:
- 0 Free Valid
- -1 Unknown Id
Definition at line 1170 of file mle_service.c.
| int mle_service_msg_update_security_params | ( | uint16_t | msgId, |
| uint8_t | security_level, | ||
| uint8_t | key_id_mode, | ||
| uint32_t | keysequence | ||
| ) |
Set new security level and Key id mode.
- Parameters:
-
msgId message id for update. security_level valid values below: - AES_NO_SECURITY
- AES_SECURITY_LEVEL_MIC32
- AES_SECURITY_LEVEL_MIC64
- AES_SECURITY_LEVEL_MIC128
- AES_SECURITY_LEVEL_ENC
- AES_SECURITY_LEVEL_ENC_MIC32
- AES_SECURITY_LEVEL_ENC_MIC64
- AES_SECURITY_LEVEL_ENC_MIC128
key_id_mode valid values below: - MAC_KEY_ID_MODE_IDX
- MAC_KEY_ID_MODE_SRC4_IDX
- Returns:
- 0 Set OK
- -1 Unknown message id
- -2 Not supported parameters
Definition at line 1109 of file mle_service.c.
| int mle_service_reject_message_build | ( | int8_t | interfaceId, |
| uint8_t * | dstIpv6, | ||
| bool | force_unsecure | ||
| ) |
Build and send standard link reject message.
- Parameters:
-
msgId Message Id. dstIpv6 rejected link force_unsecure true force force disbale security
Definition at line 1393 of file mle_service.c.
| int mle_service_reset_frame_counters | ( | int8_t | interfaceId ) |
count all activated Transactions.
- Parameters:
-
interface_id interface Id.
- Returns:
- count of active buffers
Definition at line 980 of file mle_service.c.
| uint8_t mle_service_security_next_key_id_get | ( | int8_t | interfaceId ) |
GET MLE security coming key id.
- Parameters:
-
interface_id Id of registered server.
- Returns:
- > 0 Pointer to key
- NULL no available
Definition at line 1357 of file mle_service.c.
| int mle_service_send_message | ( | uint16_t | msgId ) |
| void mle_service_set_accept_invalid_frame_counter | ( | bool | value ) |
Commands MLE service to accept message with invalid MLE frame counter.
- Parameters:
-
value set true to accept invalid frame counters
Definition at line 1493 of file mle_service.c.
| void mle_service_set_fragmented_msg_ll_security | ( | bool | value ) |
Set 802.15.4 security option for fragmented MLE messages.
- Parameters:
-
value set true to force security for fragmented packets. value set false to use default security for fragmented packets.
Definition at line 1476 of file mle_service.c.
| void mle_service_set_frame_counter_check | ( | bool | value ) |
Activates MLE Frame counter checking for the interface.
- Parameters:
-
value set true for check activation.
Definition at line 1469 of file mle_service.c.
| int mle_service_set_msg_destination_address | ( | uint16_t | msgId, |
| const uint8_t * | dstAddress | ||
| ) |
Set MLE message destination address.
- Parameters:
-
msgId message id. dstAddress message destination address
- Returns:
- 0 Set OK
- -1 message id not valid
- -2 address pointer is NULL
Definition at line 1143 of file mle_service.c.
| int mle_service_set_msg_panid | ( | uint16_t | msgId, |
| uint16_t | panid | ||
| ) |
Set Messages link PAN.
- Parameters:
-
msgId message id. panid Link pan-id for this packet
- Returns:
- 0 Set OK
- -1 message id not valid
Definition at line 1158 of file mle_service.c.
| int mle_service_set_msg_response_true | ( | uint16_t | msgId ) |
Set MLE message response received state.
- Parameters:
-
msgId message id.
- Returns:
- 0 Set OK
- -1 Unknown Id
Definition at line 1133 of file mle_service.c.
| int mle_service_set_msg_timeout_parameters | ( | uint16_t | msgId, |
| mle_message_timeout_params_t * | timeout_params | ||
| ) |
Set messages timeout parameters.
Messages timeout parameters define messages TX count and init timeout and max timeout values is messages delayed. Delayed message will affect random time between 100-900ms
- Parameters:
-
msgId Message Id. timeout_params messages transmission parameters
Definition at line 1202 of file mle_service.c.
| int mle_service_set_msg_token_bucket_priority | ( | uint16_t | msgId ) |
Sets message a priority over token bucket restrictions.
- Parameters:
-
msgId Message Id.
- Returns:
- 0 priority set OK
- < 0 unknown message id
Definition at line 1218 of file mle_service.c.
| int mle_service_set_packet_callback | ( | uint16_t | msgId, |
| mle_service_message_timeout_cb * | cb | ||
| ) |
MLE message timeout handler set.
- Parameters:
-
msgId message id. cb message timeout call back
- Returns:
- 0 Callback set OK
- < 0 unknown message id
Definition at line 1128 of file mle_service.c.
| bool mle_service_timer_tick | ( | uint16_t | ticks ) |
Timer tick function.
should be called in 100ms intervals if more time passes before call amount in 100ms units.
Definition at line 261 of file mle_service.c.
| int mle_service_update_length | ( | uint16_t | msgId, |
| uint16_t | tail_length | ||
| ) |
Set MLE message end point by new tail.
- Parameters:
-
msgId message id. tail_length how many new byte added to message end
- Returns:
- 0 Length Update OK
- -1 Unknown message id
- -2 buffer overflow
Definition at line 1099 of file mle_service.c.
| int mle_service_update_length_by_ptr | ( | uint16_t | msgId, |
| uint8_t * | data_end_ptr | ||
| ) |
Set MLE message end point by new data end pointer.
- Parameters:
-
msgId message id. data_end_ptr new message end pointer
- Returns:
- 0 Length Update OK
- -1 Unknown message id
- -2 buffer overflow
Definition at line 1104 of file mle_service.c.
Generated on Fri Jul 22 2022 04:54:07 by
1.7.2
