add qualifier const to uip-ds6-route methods

This commit is contained in:
Afonso Oliveira 2018-09-07 16:39:53 +01:00
parent 86c3db944e
commit 57f1042bf3
3 changed files with 26 additions and 26 deletions

View File

@ -480,7 +480,7 @@ output_fallback(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
annotate_transmission(uip_ipaddr_t *nexthop) annotate_transmission(const uip_ipaddr_t *nexthop)
{ {
#if TCPIP_CONF_ANNOTATE_TRANSMISSIONS #if TCPIP_CONF_ANNOTATE_TRANSMISSIONS
static uint8_t annotate_last; static uint8_t annotate_last;
@ -495,10 +495,10 @@ annotate_transmission(uip_ipaddr_t *nexthop)
#endif /* TCPIP_CONF_ANNOTATE_TRANSMISSIONS */ #endif /* TCPIP_CONF_ANNOTATE_TRANSMISSIONS */
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static uip_ipaddr_t* static const uip_ipaddr_t*
get_nexthop(uip_ipaddr_t *addr) get_nexthop(uip_ipaddr_t *addr)
{ {
uip_ipaddr_t *nexthop; const uip_ipaddr_t *nexthop;
uip_ds6_route_t *route; uip_ds6_route_t *route;
LOG_INFO("output: processing %u bytes packet from ", uip_len); LOG_INFO("output: processing %u bytes packet from ", uip_len);
@ -597,7 +597,7 @@ send_queued(uip_ds6_nbr_t *nbr)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static int static int
send_nd6_ns(uip_ipaddr_t *nexthop) send_nd6_ns(const uip_ipaddr_t *nexthop)
{ {
int err = 1; int err = 1;
@ -638,7 +638,7 @@ tcpip_ipv6_output(void)
uip_ipaddr_t ipaddr; uip_ipaddr_t ipaddr;
uip_ds6_nbr_t *nbr = NULL; uip_ds6_nbr_t *nbr = NULL;
const uip_lladdr_t *linkaddr; const uip_lladdr_t *linkaddr;
uip_ipaddr_t *nexthop; const uip_ipaddr_t *nexthop;
if(uip_len == 0) { if(uip_len == 0) {
return; return;

View File

@ -133,8 +133,8 @@ assert_nbr_routes_list_sane(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if UIP_DS6_NOTIFICATIONS #if UIP_DS6_NOTIFICATIONS
static void static void
call_route_callback(int event, uip_ipaddr_t *route, call_route_callback(int event, const uip_ipaddr_t *route,
uip_ipaddr_t *nexthop) const uip_ipaddr_t *nexthop)
{ {
int num; int num;
struct uip_ds6_notification *n; struct uip_ds6_notification *n;
@ -199,7 +199,7 @@ uip_ds6_route_nexthop_lladdr(uip_ds6_route_t *route)
} }
#endif /* (UIP_MAX_ROUTES != 0) */ #endif /* (UIP_MAX_ROUTES != 0) */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uip_ipaddr_t * const uip_ipaddr_t *
uip_ds6_route_nexthop(uip_ds6_route_t *route) uip_ds6_route_nexthop(uip_ds6_route_t *route)
{ {
#if (UIP_MAX_ROUTES != 0) #if (UIP_MAX_ROUTES != 0)
@ -263,7 +263,7 @@ uip_ds6_route_num_routes(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uip_ds6_route_t * uip_ds6_route_t *
uip_ds6_route_lookup(uip_ipaddr_t *addr) uip_ds6_route_lookup(const uip_ipaddr_t *addr)
{ {
#if (UIP_MAX_ROUTES != 0) #if (UIP_MAX_ROUTES != 0)
uip_ds6_route_t *r; uip_ds6_route_t *r;
@ -321,8 +321,8 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uip_ds6_route_t * uip_ds6_route_t *
uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, uip_ds6_route_add(const uip_ipaddr_t *ipaddr, uint8_t length,
uip_ipaddr_t *nexthop) const uip_ipaddr_t *nexthop)
{ {
#if (UIP_MAX_ROUTES != 0) #if (UIP_MAX_ROUTES != 0)
uip_ds6_route_t *r; uip_ds6_route_t *r;
@ -350,7 +350,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
one first. */ one first. */
r = uip_ds6_route_lookup(ipaddr); r = uip_ds6_route_lookup(ipaddr);
if(r != NULL) { if(r != NULL) {
uip_ipaddr_t *current_nexthop; const uip_ipaddr_t *current_nexthop;
current_nexthop = uip_ds6_route_nexthop(r); current_nexthop = uip_ds6_route_nexthop(r);
if(current_nexthop != NULL && uip_ipaddr_cmp(nexthop, current_nexthop)) { if(current_nexthop != NULL && uip_ipaddr_cmp(nexthop, current_nexthop)) {
/* no need to update route - already correct! */ /* no need to update route - already correct! */
@ -580,7 +580,7 @@ rm_routelist_callback(nbr_table_item_t *ptr)
#endif /* (UIP_MAX_ROUTES != 0) */ #endif /* (UIP_MAX_ROUTES != 0) */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
uip_ds6_route_rm_by_nexthop(uip_ipaddr_t *nexthop) uip_ds6_route_rm_by_nexthop(const uip_ipaddr_t *nexthop)
{ {
#if (UIP_MAX_ROUTES != 0) #if (UIP_MAX_ROUTES != 0)
/* Get routing entry list of this neighbor */ /* Get routing entry list of this neighbor */
@ -601,7 +601,7 @@ uip_ds6_defrt_head(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uip_ds6_defrt_t * uip_ds6_defrt_t *
uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, unsigned long interval) uip_ds6_defrt_add(const uip_ipaddr_t *ipaddr, unsigned long interval)
{ {
uip_ds6_defrt_t *d; uip_ds6_defrt_t *d;
@ -684,7 +684,7 @@ uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uip_ds6_defrt_t * uip_ds6_defrt_t *
uip_ds6_defrt_lookup(uip_ipaddr_t *ipaddr) uip_ds6_defrt_lookup(const uip_ipaddr_t *ipaddr)
{ {
uip_ds6_defrt_t *d; uip_ds6_defrt_t *d;
if(ipaddr == NULL) { if(ipaddr == NULL) {
@ -700,7 +700,7 @@ uip_ds6_defrt_lookup(uip_ipaddr_t *ipaddr)
return NULL; return NULL;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uip_ipaddr_t * const uip_ipaddr_t *
uip_ds6_defrt_choose(void) uip_ds6_defrt_choose(void)
{ {
uip_ds6_defrt_t *d; uip_ds6_defrt_t *d;

View File

@ -89,8 +89,8 @@ void uip_ds6_route_init(void);
#define UIP_DS6_NOTIFICATION_ROUTE_RM 3 #define UIP_DS6_NOTIFICATION_ROUTE_RM 3
typedef void (* uip_ds6_notification_callback)(int event, typedef void (* uip_ds6_notification_callback)(int event,
uip_ipaddr_t *route, const uip_ipaddr_t *route,
uip_ipaddr_t *nexthop, const uip_ipaddr_t *nexthop,
int num_routes); int num_routes);
struct uip_ds6_notification { struct uip_ds6_notification {
struct uip_ds6_notification *next; struct uip_ds6_notification *next;
@ -201,11 +201,11 @@ typedef struct uip_ds6_defrt {
/** \name Default router list basic routines */ /** \name Default router list basic routines */
/** @{ */ /** @{ */
uip_ds6_defrt_t *uip_ds6_defrt_head(void); uip_ds6_defrt_t *uip_ds6_defrt_head(void);
uip_ds6_defrt_t *uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, uip_ds6_defrt_t *uip_ds6_defrt_add(const uip_ipaddr_t *ipaddr,
unsigned long interval); unsigned long interval);
void uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt); void uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt);
uip_ds6_defrt_t *uip_ds6_defrt_lookup(uip_ipaddr_t *ipaddr); uip_ds6_defrt_t *uip_ds6_defrt_lookup(const uip_ipaddr_t *ipaddr);
uip_ipaddr_t *uip_ds6_defrt_choose(void); const uip_ipaddr_t *uip_ds6_defrt_choose(void);
void uip_ds6_defrt_periodic(void); void uip_ds6_defrt_periodic(void);
/** @} */ /** @} */
@ -213,13 +213,13 @@ void uip_ds6_defrt_periodic(void);
/** \name Routing Table basic routines */ /** \name Routing Table basic routines */
/** @{ */ /** @{ */
uip_ds6_route_t *uip_ds6_route_lookup(uip_ipaddr_t *destipaddr); uip_ds6_route_t *uip_ds6_route_lookup(const uip_ipaddr_t *destipaddr);
uip_ds6_route_t *uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, uip_ds6_route_t *uip_ds6_route_add(const uip_ipaddr_t *ipaddr, uint8_t length,
uip_ipaddr_t *next_hop); const uip_ipaddr_t *next_hop);
void uip_ds6_route_rm(uip_ds6_route_t *route); void uip_ds6_route_rm(uip_ds6_route_t *route);
void uip_ds6_route_rm_by_nexthop(uip_ipaddr_t *nexthop); void uip_ds6_route_rm_by_nexthop(const uip_ipaddr_t *nexthop);
uip_ipaddr_t *uip_ds6_route_nexthop(uip_ds6_route_t *); const uip_ipaddr_t *uip_ds6_route_nexthop(uip_ds6_route_t *);
int uip_ds6_route_num_routes(void); int uip_ds6_route_num_routes(void);
uip_ds6_route_t *uip_ds6_route_head(void); uip_ds6_route_t *uip_ds6_route_head(void);
uip_ds6_route_t *uip_ds6_route_next(uip_ds6_route_t *); uip_ds6_route_t *uip_ds6_route_next(uip_ds6_route_t *);