Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers net_ipv6.c Source File

net_ipv6.c

00001 /*
00002  * Copyright (c) 2016-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_types.h"
00022 #include "nsdynmemLIB.h"
00023 
00024 #include "Core/include/ns_address_internal.h"
00025 #include "Common_Protocols/ipv6_flow.h"
00026 #include "Common_Protocols/ipv6_fragmentation.h"
00027 #include "NWK_INTERFACE/Include/protocol.h"
00028 
00029 #include "net_ipv6_api.h"
00030 
00031 #include "ns_trace.h"
00032 
00033 #define TRACE_GROUP "nip6"
00034 
00035 int8_t arm_nwk_ipv6_frag_mru(uint16_t frag_mru)
00036 {
00037     uint16_t set_mru = ipv6_frag_set_mru(frag_mru);
00038     return set_mru >= frag_mru ? 0 : -1;
00039 }
00040 
00041 int8_t arm_nwk_ipv6_max_cache_entries(uint16_t max_entries)
00042 {
00043     return ipv6_neighbour_set_current_max_cache(max_entries);
00044 }
00045 
00046 int8_t arm_nwk_ipv6_destination_cache_configure(uint16_t max_entries, uint16_t short_term_threshold, uint16_t long_term_threshold, uint16_t lifetime)
00047 {
00048     return ipv6_destination_cache_configure(max_entries, short_term_threshold, long_term_threshold, lifetime);
00049 }
00050 
00051 int8_t arm_nwk_ipv6_neighbour_cache_configure(uint16_t max_entries, uint16_t short_term_threshold, uint16_t long_term_threshold, uint16_t lifetime)
00052 {
00053     return ipv6_neighbour_cache_configure(max_entries, short_term_threshold, long_term_threshold, lifetime);
00054 }
00055 
00056 void arm_nwk_ipv6_auto_flow_label(bool auto_flow_label)
00057 {
00058     ipv6_flow_auto_label = auto_flow_label;
00059 }
00060 
00061 int8_t arm_nwk_ipv6_opaque_iid_key(const void *secret_key, uint8_t key_len)
00062 {
00063     return addr_opaque_iid_key_set(secret_key, key_len);
00064 }
00065 
00066 int8_t arm_nwk_ipv6_opaque_iid_enable(int8_t interface_id, bool enable)
00067 {
00068     protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
00069     if (!cur) {
00070         return -1;
00071     }
00072 
00073     cur->opaque_slaac_iids = enable;
00074     return 0;
00075 }