BA / Mbed OS BaBoRo1
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mpl.h Source File

mpl.h

00001 /*
00002  * Copyright (c) 2015-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 MPL_H_
00019 #define MPL_H_
00020 
00021 #ifdef HAVE_MPL
00022 struct protocol_interface_info_entry;
00023 struct trickle_params;
00024 
00025 /* Timing is in 50 ms (1/20 s) ticks */
00026 #define MPL_TICK_MS 50
00027 
00028 #define MPL_MS_TO_TICKS(t) (((t) + MPL_TICK_MS - 1) / MPL_TICK_MS)
00029 
00030 extern const struct trickle_params rfc7731_default_data_message_trickle_params;
00031 extern const struct trickle_params rfc7731_default_control_message_trickle_params;
00032 #define RFC7731_DEFAULT_SEED_SET_ENTRY_LIFETIME (30 * 60) // seconds
00033 
00034 typedef struct mpl_domain mpl_domain_t;
00035 bool mpl_hbh_len_check(const uint8_t *opt_data, uint8_t opt_data_len);
00036 bool mpl_process_hbh(buffer_t *buf, struct protocol_interface_info_entry *cur, uint8_t *opt_data);
00037 
00038 buffer_t *mpl_control_handler(buffer_t *buf, struct protocol_interface_info_entry *cur);
00039 
00040 bool mpl_forwarder_process_message(buffer_t *buf, mpl_domain_t *domain, bool decrement_hop_limit);
00041 
00042 void mpl_slow_timer(uint16_t seconds);
00043 
00044 void mpl_clear_realm_scope_seeds(struct protocol_interface_info_entry *cur);
00045 
00046 /* Time units for trickle parameters is 50 ms (1/20 s) ticks */
00047 mpl_domain_t *mpl_domain_create(struct protocol_interface_info_entry *cur, const uint8_t address[16],
00048                                 const uint8_t *seed_id, multicast_mpl_seed_id_mode_e seed_id_type,
00049                                 int_fast8_t proactive_forwarding, uint16_t seed_set_entry_lifetime,
00050                                 const struct trickle_params *data_trickle_params,
00051                                 const struct trickle_params *control_trickle_params);
00052 mpl_domain_t *mpl_domain_lookup(struct protocol_interface_info_entry *cur, const uint8_t address[16]);
00053 bool mpl_domain_delete(struct protocol_interface_info_entry *cur, const uint8_t address[16]);
00054 
00055 /* Back door to implement deprecated multicast_set_parameters() API */
00056 void mpl_domain_change_timing(mpl_domain_t *domain, const struct trickle_params *data_trickle_params, uint16_t seed_set_entry_lifetime);
00057 
00058 #else // HAVE_MPL
00059 #define mpl_slow_timer(seconds) ((void)0)
00060 #endif // HAVE_MPL
00061 
00062 #endif /* MPL_H_ */