BA / Mbed OS BaBoRo1
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers blacklist.h Source File

blacklist.h

00001 /*
00002  * Copyright (c) 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 BLACKLIST_H_
00019 #define BLACKLIST_H_
00020 
00021 #define BLACKLIST_DEFAULT_TIMER_TIMEOUT           4
00022 #define BLACKLIST_DEFAULT_TIMER_MAX_TIMEOUT       40
00023 #define BLACKLIST_DEFAULT_ENTRY_LIFETIME          8
00024 #define BLACKLIST_DEFAULT_ENTRY_MAX_NBR           15
00025 #define BLACKLIST_DEFAULT_PURGE_NBR               3
00026 #define BLACKLIST_DEFAULT_PURGE_TIMER_TIMEOUT     6
00027 
00028 typedef struct blacklist_entry {
00029     uint8_t               eui64[8];
00030     uint16_t              ttl;        // time to live in is MLE advertisement cycles
00031     uint16_t              interval;   // current interval in MLE advertisement cycles
00032     ns_list_link_t        link;
00033 } blacklist_entry_t;
00034 
00035 typedef NS_LIST_HEAD (blacklist_entry_t, link) blacklist_list_t;
00036 
00037 typedef struct blacklist_data {
00038     blacklist_list_t  blacklist;            // Blacklist entries
00039     uint16_t blacklist_purge_ttl;           // Blacklist purge ttl
00040     uint16_t blacklist_entry_lifetime;      // Base lifetime value
00041     uint16_t blacklist_timer_max_timeout;   // Max. timeout value
00042     uint16_t blacklist_timer_timeout;       // Initial timeout value
00043     uint16_t blacklist_entry_max_nbr;       // Max. blacklist entries
00044     uint16_t blacklist_purge_nbr;           // # of entries to purge
00045     uint16_t blacklist_purge_timer_timeout; // Timeout for purge timer
00046 } blacklist_data_t;
00047 
00048 uint8_t blacklist_init(void);
00049 void blacklist_params_set(uint16_t entry_lifetime, uint16_t timer_max_timeout, uint16_t timer_timeout, uint16_t entry_max_nbr, uint16_t purge_nbr, uint16_t purge_timer_timeout);
00050 bool blacklist_reject(const uint8_t *ll64_address);
00051 void blacklist_update(const uint8_t *ll64_address, bool success);
00052 void blacklist_ttl_update(uint16_t ticks);
00053 void blacklist_clear(void);
00054 void blacklist_free(void);
00055 
00056 #endif /* BLACKLIST_H_ */