Added #if UIP_CONF_IPV6 around the IPv6 code in the uIP source tree to allow the C files to be compiled even if IPv6 is not configured.

This commit is contained in:
Adam Dunkels 2013-03-17 23:21:30 +01:00
parent db1e8cdbac
commit 927cc8d895
14 changed files with 40 additions and 7 deletions

View File

@ -57,6 +57,7 @@
#include "net/neighbor-info.h"
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/
extern rpl_of_t RPL_OF;
static rpl_of_t * const objective_functions[] = {&RPL_OF};
@ -1230,3 +1231,4 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
p->dtsn = dio->dtsn;
}
/*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View File

@ -62,6 +62,7 @@
#define UIP_EXT_HDR_OPT_PADN_BUF ((struct uip_ext_hdr_opt_padn *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
#define UIP_EXT_HDR_OPT_RPL_BUF ((struct uip_ext_hdr_opt_rpl *)&uip_buf[uip_l2_l3_hdr_len + uip_ext_opt_offset])
/*---------------------------------------------------------------------------*/
#if UIP_CONF_IPV6
int
rpl_verify_header(int uip_ext_opt_offset)
{
@ -313,3 +314,4 @@ rpl_invert_header(void)
}
}
/*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View File

@ -57,6 +57,7 @@
#include "net/uip-debug.h"
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/
#define RPL_DIO_GROUNDED 0x80
#define RPL_DIO_MOP_SHIFT 3
@ -841,3 +842,4 @@ uip_rpl_input(void)
uip_len = 0;
}
#endif /* UIP_CONF_IPV6 */

View File

@ -44,6 +44,8 @@
#include "lib/random.h"
#include "sys/ctimer.h"
#if UIP_CONF_IPV6
#define DEBUG DEBUG_NONE
#include "net/uip-debug.h"
@ -235,3 +237,4 @@ rpl_schedule_dao(rpl_instance_t *instance)
}
}
/*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View File

@ -52,6 +52,8 @@
#include <limits.h>
#include <string.h>
#if UIP_CONF_IPV6
#if RPL_CONF_STATS
rpl_stats_t rpl_stats;
#endif
@ -262,3 +264,4 @@ rpl_init(void)
#endif
}
/*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View File

@ -68,6 +68,10 @@
#include "net/neighbor-info.h"
#include "net/netstack.h"
#if UIP_CONF_IPV6
#include <stdio.h>
#define DEBUG 0
#if DEBUG
/* PRINTFI and PRINTFO are defined for input and output to debug one without changing the timing of the other */
@ -1843,3 +1847,4 @@ const struct network_driver sicslowpan_driver = {
};
/*--------------------------------------------------------------------*/
/** @} */
#endif /* UIP_CONF_IPV6 */

View File

@ -765,7 +765,7 @@ PROCESS_THREAD(tcpip_process, ev, data)
UIP_FALLBACK_INTERFACE.init();
#endif
/* initialize RPL if configured for using RPL */
#if UIP_CONF_IPV6_RPL
#if UIP_CONF_IPV6 && UIP_CONF_IPV6_RPL
rpl_init();
#endif /* UIP_CONF_IPV6_RPL */

View File

@ -35,6 +35,7 @@
#include "lib/list.h"
#include "lib/memb.h"
#if UIP_CONF_IPV6
#include <string.h>
@ -368,4 +369,4 @@ uip_ds6_defrt_periodic(void)
}
/*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View File

@ -48,6 +48,8 @@
#include "net/uip-ds6.h"
#include "net/uip-packetqueue.h"
#if UIP_CONF_IPV6
#define DEBUG DEBUG_NONE
#include "net/uip-debug.h"
@ -876,3 +878,4 @@ uip_ds6_compute_reachable_time(void)
/** @} */
#endif /* UIP_CONF_IPV6 */

View File

@ -34,6 +34,8 @@
#include "net/uip-fw.h"
#if !UIP_CONF_IPV6
PROCESS(uip_fw_process, "IP forwarding");
/*---------------------------------------------------------------------------*/
@ -48,3 +50,5 @@ PROCESS_THREAD(uip_fw_process, ev, data)
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
#endif /* UIP_CONF_IPV6 */

View File

@ -70,6 +70,7 @@ static uip_ipaddr_t tmp_ipaddr;
#include "rpl/rpl.h"
#endif /* UIP_CONF_IPV6_RPL */
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/
void
uip_icmp6_echo_request_input(void)
@ -272,3 +273,4 @@ uip_icmp6_send(uip_ipaddr_t *dest, int type, int code, int payload_len)
/*---------------------------------------------------------------------------*/
/** @} */
#endif /* UIP_CONF_IPV6 */

View File

@ -74,6 +74,7 @@
#include "net/uip-ds6.h"
#include "lib/random.h"
#if UIP_CONF_IPV6
/*------------------------------------------------------------------*/
#define DEBUG 0
#include "net/uip-debug.h"
@ -662,6 +663,7 @@ uip_nd6_ra_output(uip_ipaddr_t * dest)
nd6_opt_offset = UIP_ND6_RA_LEN;
#if !UIP_CONF_ROUTER
/* Prefix list */
for(prefix = uip_ds6_prefix_list;
prefix < uip_ds6_prefix_list + UIP_DS6_PREFIX_NB; prefix++) {
@ -678,6 +680,7 @@ uip_nd6_ra_output(uip_ipaddr_t * dest)
uip_len += UIP_ND6_OPT_PREFIX_INFO_LEN;
}
}
#endif /* !UIP_CONF_ROUTER */
/* Source link-layer option */
create_llao((uint8_t *)UIP_ND6_OPT_HDR_BUF, UIP_ND6_OPT_SLLAO);
@ -960,3 +963,4 @@ discard:
#endif /* !UIP_CONF_ROUTER */
/** @} */
#endif /* UIP_CONF_IPV6 */

View File

@ -1017,11 +1017,11 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport);
(addr1)->u16[1] == (addr2)->u16[1])
#define uip_ip6addr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
#if !UIP_CONF_IPV6
#define uip_ipaddr_cmp(addr1, addr2) uip_ip4addr_cmp(addr1, addr2)
#else /* !UIP_CONF_IPV6 */
#if UIP_CONF_IPV6
#define uip_ipaddr_cmp(addr1, addr2) uip_ip6addr_cmp(addr1, addr2)
#endif /* !UIP_CONF_IPV6 */
#else /* UIP_CONF_IPV6 */
#define uip_ipaddr_cmp(addr1, addr2) uip_ip4addr_cmp(addr1, addr2)
#endif /* UIP_CONF_IPV6 */
/**
* Compare two IP addresses with netmasks
@ -1936,7 +1936,7 @@ CCIF extern uip_lladdr_t uip_lladdr;
#ifdef UIP_CONF_IPV6
#if UIP_CONF_IPV6
/** Length of the link local prefix */
#define UIP_LLPREF_LEN 10

View File

@ -78,6 +78,7 @@
#include <string.h>
#if UIP_CONF_IPV6
/*---------------------------------------------------------------------------*/
/* For Debug, logging, statistics */
/*---------------------------------------------------------------------------*/
@ -2303,3 +2304,4 @@ uip_send(const void *data, int len)
}
/*---------------------------------------------------------------------------*/
/** @} */
#endif /* UIP_CONF_IPV6 */