Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rpl_protocol.h Source File

rpl_protocol.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 RPL_PROTOCOL_H_
00019 #define RPL_PROTOCOL_H_
00020 
00021 #include "net_rpl.h" // for RPL_INSTANCE_LOCAL
00022 
00023 /* RPL messages are defined as ICMPv6 Codes in Common_Protocols/icmpv6.h */
00024 
00025 /* Options in ICMPv6 RPL messages (RFC 6550) */
00026 #define RPL_PAD1_OPTION         0
00027 #define RPL_PADN_OPTION         1
00028 #define RPL_DAG_METRIC_OPTION   2
00029 #define RPL_ROUTE_INFO_OPTION   3
00030 #define RPL_DODAG_CONF_OPTION   4
00031 #define RPL_TARGET_OPTION       5
00032 #define RPL_TRANSIT_OPTION      6
00033 #define RPL_SOL_INFO_OPTION     7
00034 #define RPL_PREFIX_INFO_OPTION  8
00035 #define RPL_TARGET_DESC_OPTION  9
00036 #define RPL_P2P_ROUTE_DESC_OPTION 0x0a
00037 
00038 /* Flags in DAO_Transit Information Option */
00039 #define TRANSIT_FLAG_EXTERNAL       0x80
00040 
00041 /* Predicates in DIS Solicited Information Option */
00042 #define RPL_SOLINFO_PRED_VERSION        0x80
00043 #define RPL_SOLINFO_PRED_INSTANCEID     0x40
00044 #define RPL_SOLINFO_PRED_DODAGID        0x20
00045 
00046 /* Flags in DODAG Configuration */
00047 #define RPL_CONF_FLAG_AUTH      0x08
00048 #define RPL_CONF_PCS_MASK       0x07
00049 
00050 /* Flags in DAO Base Object */
00051 #define RPL_DAO_FLAG_ACK_REQ    0x80    /* 'K' */
00052 #define RPL_DAO_FLAG_DODAGID    0x40    /* 'D' */
00053 
00054 /* Flags in DAO-ACK Base Object */
00055 #define RPL_DAO_ACK_FLAG_DODAGID 0x80   /* 'D' */
00056 
00057 /* RPL Objective Code Points */
00058 #define RPL_OCP_OF0             0       /* RFC 6552 */
00059 #define RPL_OCP_MRHOF           1       /* RFC 6719 */
00060 
00061 /* Routing Metric/Constraint Types (RFC 6551) */
00062 #define RPL_MC_NODE_STATE       1
00063 #define RPL_MC_NODE_ENERGY      2
00064 #define RPL_MC_HOP_COUNT        3
00065 #define RPL_MC_LINK_THROUGHPUT  4
00066 #define RPL_MC_LINK_LATENCY     5
00067 #define RPL_MC_LINK_QUALITY     6
00068 #define RPL_MC_LINK_ETX         7
00069 #define RPL_MC_LINK_COLOR       8
00070 
00071 /* Flags in IPv6 RPL Option (RFC 6553) */
00072 #define RPL_OPT_DOWN            0x80    /* 'O' */
00073 #define RPL_OPT_RANK_ERROR      0x40    /* 'R' */
00074 #define RPL_OPT_FWD_ERROR       0x20    /* 'F' */
00075 
00076 /* Flags in RPL InstanceID */
00077 // RPL_INSTANCE_LOCAL defined in net_rpl.h, as it's part of public API
00078 #define RPL_INSTANCE_DEST       0x40    /* 'D' */
00079 
00080 #define rpl_instance_id_is_local(id)  (((id) & RPL_INSTANCE_LOCAL) != 0)
00081 #define rpl_instance_id_is_global(id) (((id) & RPL_INSTANCE_LOCAL) == 0)
00082 
00083 #define RPL_RANK_INFINITE       0xffff
00084 
00085 extern const uint8_t ADDR_LINK_LOCAL_ALL_RPL_NODES[16];
00086 
00087 #endif /* RPL_PROTOCOL_H_ */