p2p_structs.h
3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
* Copyright (C) 2016 Cenk Gündoğan <mail@cgundogan.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup net_gnrc_rpl_p2p
* @{
*
* @file
* @brief P2P-RPL data structs
*
* Header file, which defines all structs used by P2P-RPL.
*
* @author Cenk Gündoğan <mail@cgundogan.de>
*/
#ifndef GNRC_RPL_P2P_STRUCTS_H_
#define GNRC_RPL_P2P_STRUCTS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "net/ipv6/addr.h"
#include "net/gnrc/rpl/structs.h"
/**
* @brief Address vector length in RDO DIO options and maximal hop count for the P2P-DODAG
*/
#define GNRC_RPL_P2P_ADDR_VEC_NUMOF (8)
/**
* @brief P2P Route Discovery Object (RDO) Option
* @see <a href="https://tools.ietf.org/html/rfc6997#section-7">
* RFC 6997, section 7, P2P Route Discovery Option (P2P-RDO)
* </a>
*/
typedef struct __attribute__((packed)) {
uint8_t type; /**< Option Type: 0x0a */
uint8_t length; /**< length of option, not including first two bytes */
uint8_t compr_flags; /**< flags and number of elided prefix octets */
uint8_t lmn; /**< lifetime, maxrank/nexthop */
ipv6_addr_t target; /**< target address */
} gnrc_rpl_p2p_opt_rdo_t;
/**
* @brief P2P Discovery Reply Object (P2P-DRO)
* @see <a href="https://tools.ietf.org/html/rfc6997#section-8">
* RFC 6997, section 8, P2P Discovery Reply Object (P2P-DRO)
* </a>
*/
typedef struct __attribute__((packed)) {
uint8_t instance_id; /**< id of the instance */
uint8_t version_number; /**< version number of the DODAG */
network_uint16_t flags_rev; /**< flags and reserved */
ipv6_addr_t dodag_id; /**< id of the dodag */
} gnrc_rpl_p2p_dro_t;
/**
* @brief P2P Discovery Reply Object Acknowledgement (P2P-DRO-ACK)
* @see <a href="https://tools.ietf.org/html/rfc6997#section-10">
* RFC 6997, section 10, P2P Discovery Reply Object Acknowledgement (P2P-DRO-ACK)
* </a>
*/
typedef struct __attribute__((packed)) {
uint8_t instance_id; /**< id of the instance */
uint8_t version_number; /**< version number of the DODAG */
network_uint16_t seq_rev; /**< sequence number and reserved */
ipv6_addr_t dodag_id; /**< id of the dodag */
} gnrc_rpl_p2p_dro_ack_t;
/**
* @brief Extended DODAG information for P2P-RPL
*/
typedef struct {
bool state; /**< state: used / unused */
gnrc_rpl_dodag_t *dodag;/**< DODAG, which owns this P2P extension */
uint8_t compr; /**< number of elided prefix octets */
uint8_t routes_numof; /**< number of requested routes */
bool hop_by_hop; /**< request hop-by-hop routes or source routes */
bool stop; /**< stop route discovery */
bool reply; /**< request P2P-DRO */
bool dro_ack; /**< request P2P-DRO-ACK */
uint8_t lifetime_enc; /**< encoded lifetime of the P2P-DODAG */
int8_t lifetime_sec; /**< lifetime of the P2P-DODAG in seconds */
uint8_t maxrank; /**< maximum rank the P2P-DODAG should span */
uint8_t dro_seq; /**< sequence number of the P2P-DRO */
ipv6_addr_t target; /**< target of the P2P route discovery */
bool for_me; /**< true if this node is the target */
uint8_t addr_numof; /**< number of addresses in the address vector */
int8_t dro_delay; /**< delay DRO after it was requested in seconds */
ipv6_addr_t addr_vec[GNRC_RPL_P2P_ADDR_VEC_NUMOF]; /**< address vector */
} gnrc_rpl_p2p_ext_t;
#ifdef __cplusplus
}
#endif
#endif /* GNRC_RPL_P2P_STRUCTS_H_ */
/**
* @}
*/