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_api.h Source File

net_ipv6_api.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2016-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 /**
00019  * \file net_ipv6_api.h
00020  * \brief IPv6 configuration API.
00021  */
00022 
00023 #ifndef NET_IPV6_API_H_
00024 #define NET_IPV6_API_H_
00025 
00026 #include "ns_types.h"
00027 
00028 /**
00029  * \brief Set maximum IPv6 fragmented datagram reception size.
00030  *
00031  * Set the maximum size limit for fragmented datagram reception.
00032  *
00033  * RFC 2460 requires this to be at least 1500. It should also be at least
00034  * as large as the MTU of each attached link.
00035  *
00036  * \param frag_mru The fragmented Maximum Receive Unit in octets.
00037  * \return 0 Change OK - actual MRU is at least the requested value.
00038  * \return <0 Change invalid - unable to set the specified MRU.
00039  */
00040 int8_t arm_nwk_ipv6_frag_mru(uint16_t frag_mru);
00041 
00042 /**
00043  * \brief Set the maximum number of entries for the neighbour cache and
00044  * destination cache. Default value is 64 and minimum allowed value is 4.
00045  *
00046  * Note: This must be called before arm_nwk_interface_lowpan_init()
00047  *
00048  * \param max_entries The absolute maximum entries allowed in cache at any time.
00049  * \return 0 Change OK.
00050  * \return <0 Change invalid - unable to change the maximum for cache.
00051  */
00052 int8_t arm_nwk_ipv6_max_cache_entries(uint16_t max_entries);
00053 
00054 /**
00055  * \brief Configure destination cache.
00056  *
00057  * Set destination cache maximum entry count, thresholds where amount of entries is kept during operation and lifetime.
00058  *
00059  * Note: This must be called before arm_nwk_interface_lowpan_init()
00060  *
00061  * \param max_entries Maximum number of entries allowed in destination cache at any time.
00062  * \param short_term_threshold Amount of cache entries kept in memory in short term. Must be less than max_entries.
00063  * \param long_term_threshold Amount of entries kept in memory over long period of time. Must be less than short_term_threshold.
00064  * \param lifetime Lifetime of cache entry, must be over 120 seconds
00065  *
00066  * \return 0 Change OK.
00067  * \return <0 Change invalid - unable to change the maximum for cache.
00068  */
00069 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);
00070 
00071 /**
00072  * \brief Configure neighbour cache.
00073  *
00074  * Set neighbour cache maximum entry count, thresholds where amount of entries is kept during operation and lifetime.
00075  *
00076  * Note: This must be called before arm_nwk_interface_lowpan_init()
00077  *
00078  * \param max_entries Maximum number of entries allowed in neighbour cache at any time.
00079  * \param short_term_threshold Amount of cache entries kept in memory in short term. Must be less than max_entries.
00080  * \param long_term_threshold Amount of entries kept in memory over long period of time. Must be less than short_term_threshold.
00081  * \param lifetime Lifetime of cache entry, must be over 120 seconds
00082  *
00083  * \return 0 Change OK.
00084  * \return <0 Change invalid - unable to change the maximum for cache.
00085  */
00086 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);
00087 
00088 /**
00089  * \brief Configure automatic flow label calculation.
00090  *
00091  * Enable or disable automatic generation of IPv6 flow labels for outgoing
00092  * packets.
00093  *
00094  * \param auto_flow_label True to enable auto-generation.
00095  */
00096 void arm_nwk_ipv6_auto_flow_label(bool auto_flow_label);
00097 
00098 /**
00099  * \brief Set the key for opaque IPv6 interface identifiers
00100  *
00101  * This call sets the secret key used to generate opaque interface identifiers,
00102  * as per RFC 7217. Once this has been set, all interfaces will use opaque
00103  * interface identifiers by default. If secret_key is NULL, opaque interface
00104  * identifiers will be disabled.
00105  *
00106  * Correct implementation of RFC 7217 would require that this key be
00107  * randomly generated at first bootstrap, and thereafter remain constant, which
00108  * would require non-volatile storage. The next closest alternative would be
00109  * to base this on a MAC address.
00110  *
00111  * \param secret_key A pointer to secret key (will be copied by call).
00112  * \param key_len The length of the key.
00113  *
00114  * \return 0 key set okay.
00115  * \return <0 key set failed (for example due to memory allocation).
00116  */
00117 int8_t arm_nwk_ipv6_opaque_iid_key(const void *secret_key, uint8_t key_len);
00118 
00119 /**
00120  * \brief Enable/disable opaque IPv6 interface identifiers by interface
00121  *
00122  * Enable or disable RFC 7217 opaque IIDs generated by SLAAC, per interface.
00123  * By default opaque IIDs are enabled if the opaque key is set. If disabled,
00124  * SLAAC IIDs will be EUI-64-based as per RFC 4291.
00125  *
00126  * \param interface_id Interface ID.
00127  * \param enable True to enable.
00128  * \return 0 enabled/disabled OK.
00129  * \return <0 failed (for example invalid interface ID).
00130  *
00131  */
00132 int8_t arm_nwk_ipv6_opaque_iid_enable(int8_t interface_id, bool enable);
00133 
00134 #endif /* NET_IPV6_API_H_ */