mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
rpl: introduce constants for DODAG_CONF length with and without RPL_OPT_LEN
This commit is contained in:
parent
432688accb
commit
26095013a1
@ -48,18 +48,19 @@ enum RPL_MSG_CODE {
|
||||
};
|
||||
|
||||
/* packet base lengths */
|
||||
#define DIO_BASE_LEN 24
|
||||
#define DIS_BASE_LEN 2
|
||||
#define DAO_BASE_LEN 4
|
||||
#define DAO_D_LEN 24
|
||||
#define DAO_ACK_LEN 4
|
||||
#define DAO_ACK_D_LEN 24
|
||||
#define RPL_OPT_LEN 2
|
||||
#define RPL_OPT_DODAG_CONF_LEN 16
|
||||
#define RPL_OPT_PREFIX_INFO_LEN 32
|
||||
#define RPL_OPT_SOLICITED_INFO_LEN 21
|
||||
#define RPL_OPT_TARGET_LEN 20
|
||||
#define RPL_OPT_TRANSIT_LEN 22
|
||||
#define DIO_BASE_LEN 24
|
||||
#define DIS_BASE_LEN 2
|
||||
#define DAO_BASE_LEN 4
|
||||
#define DAO_D_LEN 24
|
||||
#define DAO_ACK_LEN 4
|
||||
#define DAO_ACK_D_LEN 24
|
||||
#define RPL_OPT_LEN 2
|
||||
#define RPL_OPT_DODAG_CONF_LEN 14
|
||||
#define RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN (RPL_OPT_DODAG_CONF_LEN + RPL_OPT_LEN)
|
||||
#define RPL_OPT_PREFIX_INFO_LEN 32
|
||||
#define RPL_OPT_SOLICITED_INFO_LEN 21
|
||||
#define RPL_OPT_TARGET_LEN 20
|
||||
#define RPL_OPT_TRANSIT_LEN 22
|
||||
|
||||
/* message options */
|
||||
#define RPL_OPT_PAD1 0
|
||||
|
@ -263,7 +263,7 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination)
|
||||
/* DODAG configuration option */
|
||||
rpl_send_opt_dodag_conf_buf = get_rpl_send_opt_dodag_conf_buf(DIO_BASE_LEN);
|
||||
rpl_send_opt_dodag_conf_buf->type = RPL_OPT_DODAG_CONF;
|
||||
rpl_send_opt_dodag_conf_buf->length = (RPL_OPT_DODAG_CONF_LEN - RPL_OPT_LEN);
|
||||
rpl_send_opt_dodag_conf_buf->length = RPL_OPT_DODAG_CONF_LEN;
|
||||
rpl_send_opt_dodag_conf_buf->flags_a_pcs = 0;
|
||||
rpl_send_opt_dodag_conf_buf->DIOIntDoubl = mydodag->dio_interval_doubling;
|
||||
rpl_send_opt_dodag_conf_buf->DIOIntMin = mydodag->dio_min;
|
||||
@ -276,7 +276,7 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination)
|
||||
rpl_send_opt_dodag_conf_buf->default_lifetime = mydodag->default_lifetime;
|
||||
rpl_send_opt_dodag_conf_buf->lifetime_unit = mydodag->lifetime_unit;
|
||||
|
||||
opt_hdr_len += RPL_OPT_DODAG_CONF_LEN;
|
||||
opt_hdr_len += RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN;
|
||||
|
||||
|
||||
uint16_t plen = ICMPV6_HDR_LEN + DIO_BASE_LEN + opt_hdr_len;
|
||||
@ -468,7 +468,7 @@ void rpl_recv_DIO_mode(void)
|
||||
case (RPL_OPT_DODAG_CONF): {
|
||||
has_dodag_conf_opt = 1;
|
||||
|
||||
if (rpl_opt_buf->length != (RPL_OPT_DODAG_CONF_LEN - RPL_OPT_LEN)) {
|
||||
if (rpl_opt_buf->length != RPL_OPT_DODAG_CONF_LEN) {
|
||||
DEBUGF("DODAG configuration is malformed.\n");
|
||||
/* error malformed */
|
||||
return;
|
||||
@ -483,7 +483,7 @@ void rpl_recv_DIO_mode(void)
|
||||
dio_dodag.default_lifetime = rpl_opt_dodag_conf_buf->default_lifetime;
|
||||
dio_dodag.lifetime_unit = rpl_opt_dodag_conf_buf->lifetime_unit;
|
||||
dio_dodag.of = (struct rpl_of_t *) rpl_get_of_for_ocp(rpl_opt_dodag_conf_buf->ocp);
|
||||
len += RPL_OPT_DODAG_CONF_LEN;
|
||||
len += RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination)
|
||||
/* DODAG configuration option */
|
||||
rpl_send_opt_dodag_conf_buf = get_rpl_send_opt_dodag_conf_buf(DIO_BASE_LEN);
|
||||
rpl_send_opt_dodag_conf_buf->type = RPL_OPT_DODAG_CONF;
|
||||
rpl_send_opt_dodag_conf_buf->length = (RPL_OPT_DODAG_CONF_LEN - RPL_OPT_LEN);
|
||||
rpl_send_opt_dodag_conf_buf->length = RPL_OPT_DODAG_CONF_LEN;
|
||||
rpl_send_opt_dodag_conf_buf->flags_a_pcs = 0;
|
||||
rpl_send_opt_dodag_conf_buf->DIOIntDoubl = mydodag->dio_interval_doubling;
|
||||
rpl_send_opt_dodag_conf_buf->DIOIntMin = mydodag->dio_min;
|
||||
@ -274,7 +274,7 @@ void rpl_send_DIO_mode(ipv6_addr_t *destination)
|
||||
rpl_send_opt_dodag_conf_buf->default_lifetime = mydodag->default_lifetime;
|
||||
rpl_send_opt_dodag_conf_buf->lifetime_unit = mydodag->lifetime_unit;
|
||||
|
||||
opt_hdr_len += RPL_OPT_DODAG_CONF_LEN;
|
||||
opt_hdr_len += RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN;
|
||||
|
||||
uint16_t plen = ICMPV6_HDR_LEN + DIO_BASE_LEN + opt_hdr_len;
|
||||
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, IPV6_PROTO_NUM_ICMPV6);
|
||||
@ -499,7 +499,7 @@ void rpl_recv_DIO_mode(void)
|
||||
case (RPL_OPT_DODAG_CONF): {
|
||||
has_dodag_conf_opt = 1;
|
||||
|
||||
if (rpl_opt_buf->length != (RPL_OPT_DODAG_CONF_LEN - RPL_OPT_LEN)) {
|
||||
if (rpl_opt_buf->length != RPL_OPT_DODAG_CONF_LEN) {
|
||||
DEBUGF("DODAG configuration is malformed.\n");
|
||||
/* error malformed */
|
||||
return;
|
||||
@ -514,7 +514,7 @@ void rpl_recv_DIO_mode(void)
|
||||
dio_dodag.default_lifetime = rpl_opt_dodag_conf_buf->default_lifetime;
|
||||
dio_dodag.lifetime_unit = rpl_opt_dodag_conf_buf->lifetime_unit;
|
||||
dio_dodag.of = (struct rpl_of_t *) rpl_get_of_for_ocp(rpl_opt_dodag_conf_buf->ocp);
|
||||
len += RPL_OPT_DODAG_CONF_LEN;
|
||||
len += RPL_OPT_DODAG_CONF_LEN_WITH_OPT_LEN;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user