Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ws_test_api.c Source File

ws_test_api.c

00001 /*
00002  * Copyright (c) 2018-2019, 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 #include "nsconfig.h"
00019 
00020 #include <string.h>
00021 #include <ns_list.h>
00022 #include <nsdynmemLIB.h>
00023 #include <net_ws_test.h>
00024 #include "NWK_INTERFACE/Include/protocol.h"
00025 #include "6LoWPAN/ws/ws_config.h"
00026 #include "6LoWPAN/ws/ws_common.h"
00027 #include "6LoWPAN/ws/ws_bbr_api_internal.h"
00028 #include "6LoWPAN/ws/ws_pae_controller.h"
00029 #include "randLIB.h"
00030 
00031 #include "ns_trace.h"
00032 #include "common_functions.h"
00033 
00034 #define TRACE_GROUP "wste"
00035 
00036 #ifdef HAVE_WS
00037 
00038 int ws_test_pan_size_set(int8_t interface_id, uint16_t pan_size)
00039 {
00040 
00041     (void) interface_id;
00042 #ifdef HAVE_WS_BORDER_ROUTER
00043     test_pan_size_override = pan_size;
00044     return 0;
00045 #else
00046     (void) pan_size;
00047     return -1;
00048 #endif
00049 }
00050 
00051 int ws_test_max_child_count_set(int8_t interface_id, uint16_t child_count)
00052 {
00053 
00054     (void) interface_id;
00055     test_max_child_count_override = child_count;
00056     return 0;
00057 }
00058 
00059 int ws_test_gtk_set(int8_t interface_id, uint8_t *gtk[4])
00060 {
00061     (void) interface_id;
00062     (void) gtk;
00063 
00064     return ws_pae_controller_gtk_update(interface_id, gtk);
00065 }
00066 
00067 int ws_test_active_key_set(int8_t interface_id, uint8_t index)
00068 {
00069     (void) interface_id;
00070     (void) index;
00071 
00072     return ws_pae_controller_active_key_update(interface_id, index);
00073 }
00074 
00075 int ws_test_key_lifetime_set(int8_t interface_id, uint32_t gtk_lifetime, uint32_t pmk_lifetime, uint32_t ptk_lifetime)
00076 {
00077     (void) interface_id;
00078     (void) gtk_lifetime;
00079     (void) pmk_lifetime;
00080     (void) ptk_lifetime;
00081 
00082     return ws_pae_controller_key_lifetime_update(interface_id, gtk_lifetime, pmk_lifetime, ptk_lifetime);
00083 }
00084 
00085 int ws_test_gtk_time_settings_set(int8_t interface_id, uint8_t revocat_lifetime_reduct, uint8_t new_activation_time, uint8_t new_install_req, uint32_t max_mismatch)
00086 {
00087     (void) interface_id;
00088     (void) revocat_lifetime_reduct;
00089     (void) new_activation_time;
00090     (void) new_install_req;
00091     (void) max_mismatch;
00092 
00093 
00094     return ws_pae_controller_gtk_time_settings_update(interface_id, revocat_lifetime_reduct, new_activation_time, new_install_req, max_mismatch);
00095 }
00096 
00097 int ws_test_next_gtk_set(int8_t interface_id, uint8_t *gtk[4])
00098 {
00099     (void) interface_id;
00100     (void) gtk;
00101 
00102     return ws_pae_controller_next_gtk_update(interface_id, gtk);
00103 }
00104 
00105 #endif // HAVE_WS