rpl: shell: don't compile PIO code dependent on CFLAGS
This commit is contained in:
parent
288212af36
commit
73fac82b58
@ -483,6 +483,7 @@ void gnrc_rpl_send(gnrc_pktsnip_t *pkt, ipv6_addr_t *src, ipv6_addr_t *dst, ipv6
|
|||||||
*/
|
*/
|
||||||
uint8_t gnrc_rpl_gen_instance_id(bool local);
|
uint8_t gnrc_rpl_gen_instance_id(bool local);
|
||||||
|
|
||||||
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
||||||
/**
|
/**
|
||||||
* @brief (De-)Activate the transmission of Prefix Information Options within DIOs
|
* @brief (De-)Activate the transmission of Prefix Information Options within DIOs
|
||||||
* for a particular DODAG
|
* for a particular DODAG
|
||||||
@ -495,6 +496,8 @@ static inline void gnrc_rpl_config_pio(gnrc_rpl_dodag_t *dodag, bool status)
|
|||||||
dodag->req_opts = (dodag->req_opts & ~GNRC_RPL_REQ_OPT_PREFIX_INFO) |
|
dodag->req_opts = (dodag->req_opts & ~GNRC_RPL_REQ_OPT_PREFIX_INFO) |
|
||||||
(status << GNRC_RPL_REQ_OPT_PREFIX_INFO_SHIFT);
|
(status << GNRC_RPL_REQ_OPT_PREFIX_INFO_SHIFT);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -104,7 +104,9 @@ gnrc_rpl_instance_t *gnrc_rpl_root_init(uint8_t instance_id, ipv6_addr_t *dodag_
|
|||||||
dodag->node_status = GNRC_RPL_ROOT_NODE;
|
dodag->node_status = GNRC_RPL_ROOT_NODE;
|
||||||
dodag->my_rank = GNRC_RPL_ROOT_RANK;
|
dodag->my_rank = GNRC_RPL_ROOT_RANK;
|
||||||
dodag->req_opts |= GNRC_RPL_REQ_OPT_DODAG_CONF;
|
dodag->req_opts |= GNRC_RPL_REQ_OPT_DODAG_CONF;
|
||||||
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
||||||
dodag->req_opts |= GNRC_RPL_REQ_OPT_PREFIX_INFO;
|
dodag->req_opts |= GNRC_RPL_REQ_OPT_PREFIX_INFO;
|
||||||
|
#endif
|
||||||
|
|
||||||
trickle_start(gnrc_rpl_pid, &dodag->trickle, GNRC_RPL_MSG_TYPE_TRICKLE_INTERVAL,
|
trickle_start(gnrc_rpl_pid, &dodag->trickle, GNRC_RPL_MSG_TYPE_TRICKLE_INTERVAL,
|
||||||
GNRC_RPL_MSG_TYPE_TRICKLE_CALLBACK, (1 << dodag->dio_min),
|
GNRC_RPL_MSG_TYPE_TRICKLE_CALLBACK, (1 << dodag->dio_min),
|
||||||
|
|||||||
@ -116,6 +116,7 @@ gnrc_pktsnip_t *_dio_dodag_conf_build(gnrc_pktsnip_t *pkt, gnrc_rpl_dodag_t *dod
|
|||||||
return opt_snip;
|
return opt_snip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
||||||
gnrc_pktsnip_t *_dio_prefix_info_build(gnrc_pktsnip_t *pkt, gnrc_rpl_dodag_t *dodag)
|
gnrc_pktsnip_t *_dio_prefix_info_build(gnrc_pktsnip_t *pkt, gnrc_rpl_dodag_t *dodag)
|
||||||
{
|
{
|
||||||
gnrc_rpl_opt_prefix_info_t *prefix_info;
|
gnrc_rpl_opt_prefix_info_t *prefix_info;
|
||||||
@ -140,6 +141,7 @@ gnrc_pktsnip_t *_dio_prefix_info_build(gnrc_pktsnip_t *pkt, gnrc_rpl_dodag_t *do
|
|||||||
ipv6_addr_init_prefix(&prefix_info->prefix, &dodag->dodag_id, dodag->prefix_len);
|
ipv6_addr_init_prefix(&prefix_info->prefix, &dodag->dodag_id, dodag->prefix_len);
|
||||||
return opt_snip;
|
return opt_snip;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void gnrc_rpl_send_DIO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination)
|
void gnrc_rpl_send_DIO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination)
|
||||||
{
|
{
|
||||||
@ -152,11 +154,13 @@ void gnrc_rpl_send_DIO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination)
|
|||||||
gnrc_pktsnip_t *pkt = NULL, *tmp = NULL;
|
gnrc_pktsnip_t *pkt = NULL, *tmp = NULL;
|
||||||
gnrc_rpl_dio_t *dio;
|
gnrc_rpl_dio_t *dio;
|
||||||
|
|
||||||
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
||||||
if (dodag->req_opts & GNRC_RPL_REQ_OPT_PREFIX_INFO) {
|
if (dodag->req_opts & GNRC_RPL_REQ_OPT_PREFIX_INFO) {
|
||||||
if ((pkt = _dio_prefix_info_build(pkt, dodag)) == NULL) {
|
if ((pkt = _dio_prefix_info_build(pkt, dodag)) == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (dodag->req_opts & GNRC_RPL_REQ_OPT_DODAG_CONF) {
|
if (dodag->req_opts & GNRC_RPL_REQ_OPT_DODAG_CONF) {
|
||||||
if ((pkt = _dio_dodag_conf_build(pkt, dodag)) == NULL) {
|
if ((pkt = _dio_dodag_conf_build(pkt, dodag)) == NULL) {
|
||||||
@ -411,7 +415,9 @@ bool _parse_options(int msg_type, gnrc_rpl_instance_t *inst, gnrc_rpl_opt_t *opt
|
|||||||
case (GNRC_RPL_OPT_PREFIX_INFO):
|
case (GNRC_RPL_OPT_PREFIX_INFO):
|
||||||
DEBUG("RPL: Prefix Information DIO option parsed\n");
|
DEBUG("RPL: Prefix Information DIO option parsed\n");
|
||||||
*included_opts |= ((uint32_t) 1) << GNRC_RPL_OPT_PREFIX_INFO;
|
*included_opts |= ((uint32_t) 1) << GNRC_RPL_OPT_PREFIX_INFO;
|
||||||
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
||||||
dodag->req_opts |= GNRC_RPL_REQ_OPT_PREFIX_INFO;
|
dodag->req_opts |= GNRC_RPL_REQ_OPT_PREFIX_INFO;
|
||||||
|
#endif
|
||||||
gnrc_rpl_opt_prefix_info_t *pi = (gnrc_rpl_opt_prefix_info_t *) opt;
|
gnrc_rpl_opt_prefix_info_t *pi = (gnrc_rpl_opt_prefix_info_t *) opt;
|
||||||
ipv6_addr_t all_RPL_nodes = GNRC_RPL_ALL_NODES_ADDR;
|
ipv6_addr_t all_RPL_nodes = GNRC_RPL_ALL_NODES_ADDR;
|
||||||
if_id = gnrc_ipv6_netif_find_by_addr(NULL, &all_RPL_nodes);
|
if_id = gnrc_ipv6_netif_find_by_addr(NULL, &all_RPL_nodes);
|
||||||
|
|||||||
@ -241,6 +241,7 @@ int _gnrc_rpl_operation(bool leaf, char *arg1)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
||||||
int _gnrc_rpl_set_pio(char *inst_id, bool status)
|
int _gnrc_rpl_set_pio(char *inst_id, bool status)
|
||||||
{
|
{
|
||||||
uint8_t instance_id = (uint8_t) atoi(inst_id);
|
uint8_t instance_id = (uint8_t) atoi(inst_id);
|
||||||
@ -256,6 +257,7 @@ int _gnrc_rpl_set_pio(char *inst_id, bool status)
|
|||||||
printf("success: %sactivated PIO transmissions\n", status ? "" : "de");
|
printf("success: %sactivated PIO transmissions\n", status ? "" : "de");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int _gnrc_rpl(int argc, char **argv)
|
int _gnrc_rpl(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -301,6 +303,7 @@ int _gnrc_rpl(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else if (strcmp(argv[1], "set") == 0) {
|
else if (strcmp(argv[1], "set") == 0) {
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
||||||
if (strcmp(argv[2], "pio") == 0) {
|
if (strcmp(argv[2], "pio") == 0) {
|
||||||
if ((argc == 5) && (strcmp(argv[3], "on") == 0)) {
|
if ((argc == 5) && (strcmp(argv[3], "on") == 0)) {
|
||||||
return _gnrc_rpl_set_pio(argv[4], true);
|
return _gnrc_rpl_set_pio(argv[4], true);
|
||||||
@ -309,6 +312,7 @@ int _gnrc_rpl(int argc, char **argv)
|
|||||||
return _gnrc_rpl_set_pio(argv[4], false);
|
return _gnrc_rpl_set_pio(argv[4], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +326,9 @@ int _gnrc_rpl(int argc, char **argv)
|
|||||||
puts("* root <inst_id> <dodag_id>\t- add a dodag to a new or existing instance");
|
puts("* root <inst_id> <dodag_id>\t- add a dodag to a new or existing instance");
|
||||||
puts("* router <instance_id>\t\t- operate as router in the instance");
|
puts("* router <instance_id>\t\t- operate as router in the instance");
|
||||||
puts("* send dis\t\t\t- send a multicast DIS");
|
puts("* send dis\t\t\t- send a multicast DIS");
|
||||||
|
#ifndef GNRC_RPL_WITHOUT_PIO
|
||||||
puts("* set pio <on/off> <instance_id>- (de-)activate PIO transmissions in DIOs");
|
puts("* set pio <on/off> <instance_id>- (de-)activate PIO transmissions in DIOs");
|
||||||
|
#endif
|
||||||
puts("* show\t\t\t\t- show instance and dodag tables");
|
puts("* show\t\t\t\t- show instance and dodag tables");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user