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.
mle_service_api.h
00001 /* 00002 * Copyright (c) 2015-2017, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef MLE_SERVICE_API_H_ 00019 #define MLE_SERVICE_API_H_ 00020 00021 #include <ns_types.h> 00022 #include "ns_list.h" 00023 #include "ccmLIB.h" 00024 00025 #define MLE_STANDARD_RESPONSE_DELAY 10 00026 #define MLE_HALF_SECOND_MAX_DELAY 5 00027 #define MLE_NO_DELAY 0 00028 #define MLE_TOKEN_DELAY 10 00029 #define MLE_TOKEN_BUFFER_MAX_NBR 10 00030 #define MLE_TOKEN_BUFFER_MIN_NBR -10 00031 00032 /** 00033 * \file mle_service_api.h 00034 * \brief Mle service API for multiple MLE protocol user. 00035 * 00036 * MLE service interface configuration API 00037 * 00038 * - mle_service_interface_register(), Register interface for first user service will open socket 00039 * - mle_service_interface_unregister(), Unregister service after last user call socket will be closed 00040 * - mle_service_interface_registeration_validate(), Validate has interface registered service already 00041 * - mle_service_interface_receiver_handler_update(), Update registered message handler to new one 00042 * - mle_service_interface_tx_queue_clean(), Free interface active queued messages 00043 * - mle_service_interface_token_bucket_settings_set(), Sets token bucket settings 00044 * 00045 * MLE Security configuration API 00046 * 00047 * - mle_service_security_init(), allocate security class for interface 00048 * - mle_service_security_set_security_key(), Set security key to security class 00049 * - mle_service_security_set_frame_counter(), Update security class frame counter 00050 * - mle_service_security_key_trig() Indicate mle security class to switch default key 00051 * 00052 * MLE Security class get API 00053 * 00054 * - mle_service_security_default_key_get(). Get default key pointer 00055 * - mle_service_security_default_key_id_get(), Get default key id 00056 * - mle_service_security_next_key_get(), Get secondary or pending key pointer 00057 * - mle_service_security_next_key_id_get(), Get secondary or pending key id 00058 * - mle_service_security_level_get(), Get configured security level 00059 * 00060 * MLE message Data flow API 00061 * 00062 * - mle_service_msg_allocate(), Allocate message buffer and set default security params based on configuration 00063 * - mle_service_msg_free(), Release allocated buffer 00064 * - mle_service_message_tail_get(), Get more space for message end 00065 * - mle_service_get_data_pointer(), Get messages data pointer DO NOT USE FOR WRITE 00066 * - mle_service_get_payload_length(), Get messages payload length 00067 * - mle_service_get_payload_start_point(), Get pointer to message payload start 00068 * - mle_service_update_length(), Update messages data length by given number of added bytes 00069 * - mle_service_update_length_by_ptr(), Update messages data length by updated data pointer 00070 * - mle_service_msg_update_security_params(), Change messages default setup 00071 * - mle_service_set_msg_response_true(), Mark message response status when you know that 00072 * - mle_service_check_msg_response(), Verify messages response status (typically called at timeout call back) 00073 * - mle_service_trasnaction_buffer_get_for_response(), Validate received response for interface request 00074 * - mle_service_check_msg_sent(), Check if message has been sent to socket 00075 * 00076 * Messages TX API 00077 * - mle_service_set_packet_callback(), Set messages timeout call back 00078 * - mle_service_get_msg_destination_address_pointer(), Get messages destination address pointer for verify or write 00079 * - mle_service_set_msg_destination_address(), Set messages IPv6 destination address 00080 * - mle_service_set_msg_timeout_parameters(), Update messages timeout and delay parameters 00081 * - mle_service_send_message(), Send builded message with given timeout parameters 00082 * - mle_service_reject_message_build(), Build and send MLE link reject message to given destination address 00083 * - mle_service_set_msg_token_bucket_priority(), Sets message a priority over token bucket restrictions 00084 * 00085 * Service Messages timeout API 00086 * - mle_service_timer_tick(), This need to be call periodically and give time in 100ms ticks 00087 * 00088 */ 00089 00090 typedef struct mle_security_header { 00091 unsigned securityLevel:3; 00092 unsigned KeyIdMode:2; 00093 uint32_t frameCounter; 00094 uint8_t Keysource[8]; 00095 uint8_t KeyIndex; 00096 bool invalid_frame_counter; 00097 } mle_security_header_t; 00098 00099 00100 typedef enum mle_security_event { 00101 MLE_SEC_MAX_FRAME_COUNTER_REACHED = 0, /*!< MLE security counter reach max 0xffffffff value when device can't use same key anymore */ 00102 MLE_SEC_KEY_UPDATE_NOTIFY , /*!< MLE security have trigger new default key */ 00103 MLE_SEC_UNKNOWN_KEY /*!< MLE security have detect unknown key id*/ 00104 } mle_security_event_t; 00105 00106 #define MLE_ALLOCATED_PORT 19788 /* Mesh Link Establishment - draft */ 00107 00108 /* 00109 * When MLE service receives MLE message it will parse Generic MLE header 00110 * 00111 */ 00112 typedef struct { 00113 uint8_t message_type; /*!< MLE message type */ 00114 uint8_t *packet_src_address; /*!< Packet Source address */ 00115 uint8_t *packet_dst_address; /*!< Packet Destination address */ 00116 uint8_t *data_ptr; /*!< Data pointer */ 00117 uint16_t data_length; /*!< Data Length */ 00118 uint16_t src_pan_id; /*!< Link source Pan-id */ 00119 uint16_t dst_pan_id; /*!< Link destination Pan-id */ 00120 uint8_t lqi; /*!< Received Link quality*/ 00121 int8_t dbm; /*!< Received RSSI */ 00122 } mle_message_t; 00123 00124 /* 00125 * MLE message timeout and re transmission parameters 00126 * 00127 */ 00128 typedef struct { 00129 uint16_t timeout_init; /*!< Define start timeout */ 00130 uint16_t timeout_max; /*!< Define max timeout time */ 00131 uint8_t retrans_max; /*!< Define max packet TX count */ 00132 uint8_t delay; /*!< 100ms Ticks for random delay */ 00133 } mle_message_timeout_params_t; 00134 00135 /** 00136 * MLE service message receiver handler call back function pointer 00137 * 00138 * All service user need to register this function pointer. 00139 * 00140 * \param interface_id define interface id for receiver 00141 * \param mle_msg mle message structure 00142 * \param security_headers indicate messages security parameters 00143 */ 00144 typedef void (mle_service_receive_cb)(int8_t interface_id, mle_message_t *mle_msg, mle_security_header_t *security_headers); 00145 00146 /** 00147 * MLE service security bypass message receiver handler call back function pointer 00148 * 00149 * All service user need to register this function pointer. 00150 * 00151 * \param interface_id define interface id for receiver 00152 * \param mle_msg mle message structure 00153 */ 00154 typedef void (mle_service_receive_security_bypass_cb)(int8_t interface_id, mle_message_t *mle_msg); 00155 00156 /** 00157 * MLE service security key request by 32-bit key source 00158 * 00159 * All service user need to register this function pointer if they support 32-bit key source. 00160 * 00161 * \param interface_id define interface id for receiver 00162 * \param keyId key identifier 00163 * \param keySequnce 32-bit key source 00164 */ 00165 typedef uint8_t * (mle_service_key_request_by_counter_cb)(int8_t interface_id, uint8_t keyId, uint32_t keySequnce); 00166 00167 /** 00168 * MLE service security event notify 00169 * 00170 * \param interface_id define interface id for receiver 00171 * \param event 00172 * \param keyId key identifier 00173 * 00174 */ 00175 typedef uint8_t * (mle_service_security_notify_cb)(int8_t interface_id, mle_security_event_t event, uint8_t keyId); 00176 00177 /** 00178 * MLE service message timeout call back 00179 * 00180 * This function will be called when msg timeout happen 00181 * 00182 * \param interface_id define interface id for receiver 00183 * \param msgId key identifier 00184 * \param usedAllRetries false when 00185 * 00186 * \return true Continue packet retry 00187 * \return false Stop TX process and 00188 * 00189 */ 00190 typedef bool (mle_service_message_timeout_cb)(int8_t interface_id, uint16_t msgId, bool usedAllRetries); 00191 00192 /** 00193 * A callback for receive MLE message filtering 00194 * 00195 * This function will be called when MLE message is received. Only for testing purposes. 00196 * 00197 * \param interface_id define interface id for receiver 00198 * \param mle_msg received MLE message 00199 * \param security_headers messages security parameters 00200 * 00201 * \return true continue MLE packet processing 00202 * \return false drop MLE packet 00203 * 00204 */ 00205 typedef bool (mle_service_filter_cb)(int8_t interface_id, mle_message_t *mle_msg, mle_security_header_t *security_headers); 00206 00207 /* 00208 * Initialise server instance. 00209 * Creates and shares socket for other mle services. 00210 * 00211 * \param interface_id Registered services interface Id. 00212 * \param receive_cb Message RX handler. 00213 * \param mac64 Interface 64-bit MAC. 00214 * \param challengeLength challenge length 00215 * Return values 00216 * 0, Register OK. 00217 */ 00218 int mle_service_interface_register(int8_t interface_id, mle_service_receive_cb *receive_cb, uint8_t *mac64, uint8_t challengeLength); 00219 00220 /* 00221 * Deletes server instance. 00222 * Removes all data related to this instance 00223 * 00224 * \param interface_id interface Id. 00225 * 00226 */ 00227 void mle_service_interface_unregister(int8_t interface_id); 00228 00229 /* 00230 * Validate is this interface register service already. 00231 * 00232 * \param interface_id interface Id. 00233 * 00234 * \return true when register ready 00235 * \return false when register not ready 00236 * 00237 */ 00238 bool mle_service_interface_registeration_validate(int8_t interface_id); 00239 00240 /* 00241 * Update Interface packet handler. 00242 * 00243 * Usefully function to switch message handler based on state machine 00244 * 00245 * \param interface_id interface Id. 00246 * \param receive_cb new message handler function pointer 00247 * 00248 * \return 0 register OK 00249 * \return < 0 Register fail 00250 * 00251 */ 00252 int mle_service_interface_receiver_handler_update(int8_t interface_id, mle_service_receive_cb *receive_cb); 00253 00254 /* 00255 * Update Interface security by pass handler. 00256 * 00257 * Usefully function to switch message handler based on state machine 00258 * 00259 * \param interface_id interface Id. 00260 * \param receive_cb new message handler function pointer 00261 * 00262 * \return 0 register OK 00263 * \return < 0 Register fail 00264 * 00265 */ 00266 int mle_service_interface_receiver_bypass_handler_update(int8_t interface_id, mle_service_receive_security_bypass_cb *receive_cb); 00267 00268 /** 00269 * Delete and free all activated Transaction. 00270 * 00271 * \param interface_id interface Id. 00272 * 00273 */ 00274 void mle_service_interface_tx_queue_clean(int8_t interface_id); 00275 00276 /** 00277 * count all activated Transactions. 00278 * 00279 * \param interface_id interface Id. 00280 * 00281 * \return count of active buffers 00282 * 00283 */ 00284 00285 int mle_service_reset_frame_counters(int8_t interfaceId); 00286 00287 uint16_t mle_service_interface_tx_queue_size(int8_t interface_id); 00288 00289 /** 00290 * Sets MLE token bucket settings 00291 * 00292 * Using of message tokens is optional. 00293 * 00294 * \param size Bucket size, 0 to 255, 0 means not in use 00295 * \param rate Token rate, 0 to 255, 0 means not in use 00296 * \param count, 0 to 255, 0 means not in use 00297 * 00298 * \return 0 Set is OK 00299 * \return -1 Unknown interface id 00300 * \return -2 Other error 00301 */ 00302 int mle_service_interface_token_bucket_settings_set(int8_t interface_id, uint8_t size, uint8_t rate, uint8_t count); 00303 00304 /* 00305 * MLE service interface security init. 00306 * 00307 * \param interface_id Id of registered server. 00308 * \param security_level valid values below: 00309 * - AES_NO_SECURITY 00310 * - AES_SECURITY_LEVEL_MIC32 00311 * - AES_SECURITY_LEVEL_MIC64 00312 * - AES_SECURITY_LEVEL_MIC128 00313 * - AES_SECURITY_LEVEL_ENC 00314 * - AES_SECURITY_LEVEL_ENC_MIC32 00315 * - AES_SECURITY_LEVEL_ENC_MIC64 00316 * - AES_SECURITY_LEVEL_ENC_MIC128 00317 * \param security_frame_counter MLE security frame counter init value 00318 * \param key_counter_req function pointer for request key by when key source is 32-bit 00319 * \param notify function pointer for service notify security events 00320 * 00321 * \return 0 Init OK 00322 * \return -1 Unknown interface id 00323 * \return -2 Un supported security level 00324 * 00325 */ 00326 int mle_service_security_init(int8_t interfaceId, uint8_t security_level,uint32_t security_frame_counter, mle_service_key_request_by_counter_cb * key_counter_req, mle_service_security_notify_cb *notify); 00327 00328 /* 00329 * SET MLE service interfac primary or pending primary security key. 00330 * 00331 * \param interface_id Id of registered server. 00332 * \param security_key pointer to 128-bit key 00333 * \param keyId key id. 00334 * \param primary true when set new primary and 00335 * 00336 */ 00337 00338 bool mle_service_security_set_security_key(int8_t interfaceId, const uint8_t *security_key, uint8_t keyId, bool primary); 00339 00340 /* 00341 * SET MLE security frame counter 00342 * 00343 * \param interface_id Id of registered server. 00344 * \param frame_counter new frame counter 00345 * 00346 */ 00347 bool mle_service_security_set_frame_counter(int8_t interfaceId, uint32_t frame_counter); 00348 /* 00349 * GET MLE security frame counter 00350 * 00351 * \param interface_id Id of registered server. 00352 * 00353 * \return Current frame counter 00354 * 00355 */ 00356 uint32_t mle_service_security_get_frame_counter(int8_t interfaceId); 00357 00358 00359 /* 00360 * Notify MLE service interface for switch default security key. 00361 * 00362 * \param interface_id Id of registered server. 00363 * \param keyId Trigged key id. 00364 * 00365 */ 00366 bool mle_service_security_key_trig(int8_t interfaceId, uint8_t keyId); 00367 00368 /* 00369 * GET MLE security default key 00370 * 00371 * \param interface_id Id of registered server. 00372 * 00373 * \return > 0 Key pointer 00374 * \return NULL No key available 00375 */ 00376 uint8_t * mle_service_security_default_key_get(int8_t interfaceId); 00377 00378 /* 00379 * GET MLE security default key id 00380 * 00381 * \param interface_id Id of registered server. 00382 * 00383 * \return > 0 Key id 00384 * \return 0 not key id available or interface is not regostred 00385 */ 00386 uint8_t mle_service_security_default_key_id_get(int8_t interfaceId); 00387 00388 /* 00389 * GET MLE security coming key pointer 00390 * 00391 * \param interface_id Id of registered server. 00392 * 00393 * \return > 0 Key id 00394 * \return 0 no available 00395 */ 00396 uint8_t * mle_service_security_next_key_get(int8_t interfaceId); 00397 00398 /** 00399 * GET MLE security coming key id 00400 * 00401 * \param interface_id Id of registered server. 00402 * 00403 * \return > 0 Pointer to key 00404 * \return NULL no available 00405 */ 00406 uint8_t mle_service_security_next_key_id_get(int8_t interfaceId); 00407 00408 /* 00409 * GET MLE security security level 00410 * 00411 * \param interface_id Id of registered server. 00412 * 00413 * \return Security level 00414 */ 00415 uint8_t mle_service_security_level_get(int8_t interfaceId); 00416 00417 /** 00418 * Allocate MLE transaction buffer and set default security parameters to buffer. 00419 * 00420 * Configured security params from interface 00421 * * security level 00422 * * key id mode MAC_KEY_ID_MODE_IDX 00423 * Service will automatically set next params 00424 * * Key id 00425 * * security frame counter 00426 * 00427 * \param interface_id interface Id. 00428 * \param data_length Payload max length 00429 * \param challengeAllocate True allocate challenge and write that to message automatically 00430 * \param type message type 00431 * 00432 * \return > 0 Message id 00433 * \return 0 Allocate fail 00434 * 00435 */ 00436 uint16_t mle_service_msg_allocate(int8_t interface_id, uint16_t data_length, bool challengeAllocate, uint8_t type); 00437 00438 /** 00439 * Free message. 00440 * 00441 * \param msgId buffer Id. 00442 * 00443 * \return 0 Free Valid 00444 * \return -1 Unknown Id 00445 * 00446 */ 00447 int mle_service_msg_free(uint16_t msgId); 00448 00449 /** 00450 * Set new security level and Key id mode. 00451 * 00452 * 00453 * \param msgId message id for update. 00454 * \param security_level valid values below: 00455 * - AES_NO_SECURITY 00456 * - AES_SECURITY_LEVEL_MIC32 00457 * - AES_SECURITY_LEVEL_MIC64 00458 * - AES_SECURITY_LEVEL_MIC128 00459 * - AES_SECURITY_LEVEL_ENC 00460 * - AES_SECURITY_LEVEL_ENC_MIC32 00461 * - AES_SECURITY_LEVEL_ENC_MIC64 00462 * - AES_SECURITY_LEVEL_ENC_MIC128 00463 * 00464 * \param key_id_mode valid values below: 00465 * - MAC_KEY_ID_MODE_IDX 00466 * - MAC_KEY_ID_MODE_SRC4_IDX 00467 * 00468 * \return 0 Set OK 00469 * \return -1 Unknown message id 00470 * \return -2 Not supported parameters 00471 * 00472 */ 00473 int mle_service_msg_update_security_params(uint16_t msgId, uint8_t security_level, uint8_t key_id_mode, uint32_t keysequence); 00474 00475 /** 00476 * MLE message tail get for new payload. 00477 * 00478 * \param msgId message id. 00479 * \param tail_length define messages new need tail length 00480 * 00481 * \return 0 tail allocated OK 00482 * \return -1 tail allocate fail 00483 * \return -2 unknown message id 00484 * 00485 */ 00486 int mle_service_message_tail_get(uint16_t msgId, uint16_t tail_length); 00487 00488 /** 00489 * Get MLE message data pointer for write. 00490 * 00491 * \param msgId message id. 00492 * 00493 * \return >0 Valid pointer for write 00494 * \return NULL Not valid message id 00495 * 00496 */ 00497 uint8_t * mle_service_get_data_pointer(uint16_t msgId); 00498 00499 /** 00500 * Get MLE message pointer to message start 00501 * 00502 * \param msgId message id. 00503 * 00504 * \return >0 Valid pointer for read or verify 00505 * \return NULL Not valid message id 00506 * 00507 */ 00508 uint8_t * mle_service_get_payload_start_point(uint16_t msgId); 00509 00510 /** 00511 * Get MLE message payload length 00512 * 00513 * \param msgId message id. 00514 * 00515 * \return length of payload 00516 * 00517 */ 00518 uint16_t mle_service_get_payload_length(uint16_t msgId); 00519 00520 /** 00521 * Set MLE message end point by new tail. 00522 * 00523 * \param msgId message id. 00524 * \param tail_length how many new byte added to message end 00525 * 00526 * \return 0 Length Update OK 00527 * \return -1 Unknown message id 00528 * \return -2 buffer overflow 00529 * 00530 */ 00531 int mle_service_update_length(uint16_t msgId, uint16_t tail_length); 00532 00533 /** 00534 * Set MLE message end point by new data end pointer. 00535 * 00536 * \param msgId message id. 00537 * \param data_end_ptr new message end pointer 00538 * 00539 * \return 0 Length Update OK 00540 * \return -1 Unknown message id 00541 * \return -2 buffer overflow 00542 * 00543 */ 00544 int mle_service_update_length_by_ptr(uint16_t msgId, uint8_t *data_end_ptr); 00545 00546 /** 00547 * Get MLE message destination address pointer for write purpose. 00548 * 00549 * \param msgId message id. 00550 * 00551 * \return >0 Pointer get OK 00552 * \return NULL message id not valid 00553 * 00554 */ 00555 uint8_t * mle_service_get_msg_destination_address_pointer(uint16_t msgId); 00556 00557 00558 /** 00559 * Set MLE message destination address 00560 * 00561 * \param msgId message id. 00562 * \param dstAddress message destination address 00563 * 00564 * \return 0 Set OK 00565 * \return -1 message id not valid 00566 * \return -2 address pointer is NULL 00567 * 00568 */ 00569 int mle_service_set_msg_destination_address(uint16_t msgId, const uint8_t *dstAddress); 00570 00571 /** 00572 * Set Messages link PAN 00573 * 00574 * \param msgId message id. 00575 * \param panid Link pan-id for this packet 00576 * 00577 * \return 0 Set OK 00578 * \return -1 message id not valid 00579 * 00580 */ 00581 int mle_service_set_msg_panid(uint16_t msgId, uint16_t panid); 00582 00583 /** 00584 * Set messages timeout parameters. 00585 * 00586 * Struct timeout_params defines messages retransmission times in seconds, retransmission count and sending delay. 00587 * Delayed message will affect random time between 100-900ms 00588 * 00589 * \param msgId Message Id. 00590 * \param timeout_params messages transmission parameters 00591 */ 00592 int mle_service_set_msg_timeout_parameters(uint16_t msgId, mle_message_timeout_params_t *timeout_params); 00593 00594 /** 00595 * Set messages timeout parameters. 00596 * 00597 * Struct timeout_params defines messages retransmission times in 100ms, retransmission count and sending delay. 00598 * Delayed message will affect random time between 100-900ms 00599 * 00600 * \param msgId Message Id. 00601 * \param timeout_params messages transmission parameters 00602 */ 00603 int mle_service_set_msg_timeout_parameters_fast(uint16_t msgId, mle_message_timeout_params_t *timeout_params); 00604 00605 int mle_service_set_msg_rf_channel(uint16_t msgId, uint8_t channel); 00606 00607 int mle_service_set_msg_link_layer_security_mode(uint16_t msgId, bool use_key_id_mode_2); 00608 00609 00610 /** 00611 * Set MLE message response received state 00612 * 00613 * \param msgId message id. 00614 * 00615 * \return 0 Set OK 00616 * \return -1 Unknown Id 00617 * 00618 */ 00619 int mle_service_set_msg_response_true(uint16_t msgId); 00620 00621 /** 00622 * Check MLE message response received state 00623 * 00624 * Usefully function at message timeout call back to check response status 00625 * 00626 * \param msgId message id. 00627 * 00628 * \return true message has received response 00629 * \return false no response or unknow message id 00630 * 00631 */ 00632 bool mle_service_check_msg_response(uint16_t msgId); 00633 00634 /* 00635 * MLE active transaction buffer id get by challenge data. 00636 * 00637 * \param responseData 00638 * \param responseData True allocate challenge and write that to message automatically 00639 * \param msgId pointer where message id can be saved 00640 * 00641 * \return true Response is valid and tied to this msgId 00642 * \return false No active Tx buffer available for this response 00643 * 00644 */ 00645 bool mle_service_transaction_buffer_get_for_response(uint8_t *responseData, uint16_t length, uint16_t *msgId); 00646 00647 /** 00648 * Check if message has been sent to socket. 00649 * 00650 * Function can be used whether message has been sent to socket or 00651 * has been rejected by token bucket. 00652 * 00653 * \param msgId message id. 00654 * 00655 * \return true message has been sent 00656 * \return false message has not been sent 00657 * 00658 */ 00659 bool mle_service_check_msg_sent(uint16_t msgId); 00660 00661 /** 00662 * MLE message timeout handler set. 00663 * 00664 * \param msgId message id. 00665 * \param cb message timeout call back 00666 * 00667 * \return 0 Callback set OK 00668 * \return < 0 unknown message id 00669 * 00670 */ 00671 int mle_service_set_packet_callback(uint16_t msgId, mle_service_message_timeout_cb *cb); 00672 00673 00674 /** 00675 * Sends MLE message. 00676 * 00677 * \param msgId Message Id. 00678 */ 00679 int mle_service_send_message(uint16_t msgId); 00680 00681 /** 00682 * Timer tick function. 00683 * 00684 * should be called in 100ms intervals if more time passes before call amount in 100ms units. 00685 * 00686 */ 00687 bool mle_service_timer_tick(uint16_t ticks); 00688 00689 /** 00690 * Build and send standard link reject message. 00691 * 00692 * \param msgId Message Id. 00693 * \param dstIpv6 rejected link 00694 * \param force_unsecure true force force disbale security 00695 */ 00696 int mle_service_reject_message_build(int8_t interfaceId, uint8_t *dstIpv6, bool force_unsecure); 00697 00698 /** 00699 * Sets message a priority over token bucket restrictions. 00700 * 00701 * \param msgId Message Id. 00702 * 00703 * \return 0 priority set OK 00704 * \return < 0 unknown message id 00705 */ 00706 int mle_service_set_msg_token_bucket_priority(uint16_t msgId); 00707 00708 /** 00709 * Activates MLE Frame counter checking for the interface. 00710 * 00711 * \param value set true for check activation. 00712 * 00713 */ 00714 void mle_service_set_frame_counter_check(bool value); 00715 00716 /** 00717 * Set 802.15.4 security option for fragmented MLE messages 00718 * 00719 * \param value set true to force security for fragmented packets. 00720 * \param value set false to use default security for fragmented packets. 00721 * 00722 */ 00723 void mle_service_set_fragmented_msg_ll_security(bool value); 00724 00725 /** 00726 * Commands MLE service to accept message with invalid MLE frame counter. 00727 * 00728 * \param value set true to accept invalid frame counters 00729 * 00730 */ 00731 void mle_service_set_accept_invalid_frame_counter(bool value); 00732 00733 #ifdef MLE_TEST 00734 /** 00735 * Set callback for MLE receiving packet filtering. 00736 * 00737 * If this is set, all received MLE messages will be passed to given callback. 00738 */ 00739 void mle_service_receive_filter_cb_set(mle_service_filter_cb *filter_cb); 00740 #else 00741 #define mle_service_receive_filter_cb_set(filter_cb) ((void) 0) 00742 #endif /* MLE_TEST */ 00743 #endif /* MLE_SERVICE_API_H_ */
Generated on Tue Jul 12 2022 12:45:32 by
