Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mle_service_interface.h Source File

mle_service_interface.h

00001 /*
00002  * Copyright (c) 2015-2018, 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 /*
00019  * \file mle_service_interface.h
00020  * \brief Add short description about this file!!!
00021  *
00022  */
00023 
00024 #ifndef MLE_SERVICE_INTERFACE_H_
00025 #define MLE_SERVICE_INTERFACE_H_
00026 #include <ns_types.h>
00027 #include "ns_list.h"
00028 
00029 #include "Service_Libs/mle_service/mle_service_api.h"
00030 
00031 typedef struct {
00032     mle_service_receive_cb *recv_cb; /*!< Interface message handler */
00033     mle_service_receive_security_bypass_cb *recv_security_bypass_cb; /*!< Interface message security bypass handler */
00034     void *interface_ptr;
00035     uint8_t mac64[8]; /*!< Interface MAC 64 used for Security nonce and LL64 address define */
00036     int8_t interface_id; /*!< Interface Id */
00037     uint8_t challenge_length; /*!< Define MLE challenge length */
00038     uint16_t URT; /*!< Unicast Retransmission timeout */
00039     uint16_t MRT; /*!< Multicast Retransmission timeout */
00040     uint8_t MRC; /*!< Maximum retransmission count */
00041     int16_t token_bucket; /*!< Token bucket */
00042     uint16_t token_bucket_ticks; /*!< Token bucket ticks */
00043     uint8_t token_bucket_size; /*!< MLE token bucket size */
00044     uint8_t token_bucket_rate; /*!< Rate in which tokens are added to bucket (0.1 seconds * rate) */
00045     uint8_t token_bucket_count; /*!< Count of tokens added to bucket at a time */
00046     ns_list_link_t link;
00047 } service_instance_t;
00048 
00049 typedef NS_LIST_HEAD (service_instance_t, link) service_instance_list_t;
00050 
00051 /**
00052  * Find registered service client class
00053  *
00054  * \param interface_id interface id
00055  *
00056  * \return >0 Pointer to interface structure
00057  * \return < 0 Unknown interface id
00058  */
00059 service_instance_t *mle_service_interface_find(int8_t interface_id);
00060 
00061 /**
00062  * Allocate or return current registered service client class
00063  *
00064  * \param interface_id interface id
00065  *
00066  * \return >0 Pointer to interface structure
00067  * \return < 0 Allocate fail
00068  */
00069 service_instance_t *mle_service_interface_get(int8_t interface_id);
00070 
00071 /**
00072  * Delete and free service
00073  */
00074 int mle_service_interface_delete(int8_t interface_id);
00075 /**
00076  * Check is all interfaced freed
00077  */
00078 bool mle_service_interface_list_empty(void);
00079 
00080 /**
00081  *  MLE service interface timer call back
00082  *
00083  *  This function will be called when timer is updated
00084  *
00085  * \param ticks
00086  *
00087  * \return true Keep timer active
00088  * \return false Stop timer
00089  *
00090  */
00091 typedef bool (mle_service_interface_timer_cb)(uint16_t ticks, service_instance_t *cur_ptr);
00092 
00093 /**
00094  * MLE service interface timeout handling
00095  *
00096  * \param ticks timer ticks
00097  * \param timeout_cb callback called ticks are updated
00098  *
00099  * \return true Keep timer active
00100  * \return false Stop timer
00101  */
00102 bool mle_service_interface_timer_tick(uint16_t ticks, mle_service_interface_timer_cb *timeout_cb);
00103 
00104 #endif /* MLE_SERVICE_INTERFACE_H_ */