Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
e3da-public
contiki-ng
Commits
c9861b07
Commit
c9861b07
authored
Dec 10, 2017
by
Simon Duquennoy
Browse files
Routing API: added neighbor_state_changed
parent
c6f2364b
Changes
6
Hide whitespace changes
Inline
Side-by-side
os/net/ipv6/uip-ds6-nbr.c
View file @
c9861b07
...
...
@@ -53,19 +53,13 @@
#include
"net/ipv6/uip-ds6.h"
#include
"net/ipv6/uip-ds6-nbr.h"
#include
"net/ipv6/uip-nd6.h"
#include
"net/routing/routing.h"
/* Log configuration */
#include
"sys/log.h"
#define LOG_MODULE "IPv6 Nbr"
#define LOG_LEVEL LOG_LEVEL_IPV6
#ifdef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED
#define NEIGHBOR_STATE_CHANGED(n) UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED(n)
void
NEIGHBOR_STATE_CHANGED
(
uip_ds6_nbr_t
*
n
);
#else
#define NEIGHBOR_STATE_CHANGED(n)
#endif
/* UIP_DS6_CONF_NEIGHBOR_STATE_CHANGED */
NBR_TABLE_GLOBAL
(
uip_ds6_nbr_t
,
ds6_neighbors
);
/*---------------------------------------------------------------------------*/
...
...
@@ -107,7 +101,7 @@ uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr,
LOG_INFO_
(
" link addr "
);
LOG_INFO_LLADDR
((
linkaddr_t
*
)
lladdr
);
LOG_INFO_
(
" state %u
\n
"
,
state
);
NE
IGHBOR_STATE_CHANGED
(
nbr
);
NE
TSTACK_ROUTING
.
neighbor_state_changed
(
nbr
);
return
nbr
;
}
else
{
LOG_INFO
(
"Add drop ip addr "
);
...
...
@@ -127,7 +121,7 @@ uip_ds6_nbr_rm(uip_ds6_nbr_t *nbr)
#if UIP_CONF_IPV6_QUEUE_PKT
uip_packetqueue_free
(
&
nbr
->
packethandle
);
#endif
/* UIP_CONF_IPV6_QUEUE_PKT */
NE
IGHBOR_STATE_CHANGED
(
nbr
);
NE
TSTACK_ROUTING
.
neighbor_state_changed
(
nbr
);
return
nbr_table_remove
(
ds6_neighbors
,
nbr
);
}
return
0
;
...
...
os/net/ipv6/uip-ds6.h
View file @
c9861b07
...
...
@@ -226,13 +226,6 @@ typedef struct uip_ds6_maddr {
uip_ipaddr_t
ipaddr
;
}
uip_ds6_maddr_t
;
/* only define the callback if RPL is active */
#if UIP_CONF_IPV6_RPL && (UIP_CONF_IPV6_RPL_LITE == 0)
#ifndef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED
#define UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED rpl_ipv6_neighbor_callback
#endif
/* UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED */
#endif
/* UIP_CONF_IPV6_RPL */
/** \brief Interface structure (contains all the interface variables) */
typedef
struct
uip_ds6_netif
{
uint32_t
link_mtu
;
...
...
os/net/routing/nullrouting/nullrouting.c
View file @
c9861b07
...
...
@@ -104,6 +104,11 @@ link_callback(const linkaddr_t *addr, int status, int numtx)
}
/*---------------------------------------------------------------------------*/
static
void
neighbor_state_changed
(
uip_ds6_nbr_t
*
nbr
)
{
}
/*---------------------------------------------------------------------------*/
static
void
drop_route
(
uip_ds6_route_t
*
route
)
{
}
...
...
@@ -121,6 +126,7 @@ const struct routing_driver nullrouting_driver = {
ext_header_srh_update
,
ext_header_srh_get_next_hop
,
link_callback
,
neighbor_state_changed
,
drop_route
,
};
/*---------------------------------------------------------------------------*/
...
...
os/net/routing/routing.h
View file @
c9861b07
...
...
@@ -42,6 +42,7 @@
#include
"contiki.h"
#include
"net/ipv6/uip.h"
#include
"net/ipv6/uip-ds6-nbr.h"
#include
"net/ipv6/uip-ds6-route.h"
#include
"net/linkaddr.h"
...
...
@@ -118,6 +119,14 @@ struct routing_driver {
* \param numtx The total number of transmission attempts
*/
void
(
*
link_callback
)(
const
linkaddr_t
*
addr
,
int
status
,
int
numtx
);
/**
* Called by uIP to notify addition/removal of IPv6 neighbor entries
*
* \param addr The link-layer addrress of the packet destination
* \param status The transmission status (see os/net/mac/mac.h)
* \param numtx The total number of transmission attempts
*/
void
(
*
neighbor_state_changed
)(
uip_ds6_nbr_t
*
nbr
);
/**
* Called by uIP if it has decided to drop a route because
*
...
...
os/net/routing/rpl-classic/rpl.c
View file @
c9861b07
...
...
@@ -396,6 +396,7 @@ const struct routing_driver rpl_classic_driver = {
rpl_ext_header_srh_update
,
rpl_ext_header_srh_get_next_hop
,
rpl_link_callback
,
rpl_ipv6_neighbor_callback
,
drop_route
,
};
/*---------------------------------------------------------------------------*/
...
...
os/net/routing/rpl-lite/rpl.c
View file @
c9861b07
...
...
@@ -194,6 +194,12 @@ init(void)
}
/*---------------------------------------------------------------------------*/
static
void
neighbor_state_changed
(
uip_ds6_nbr_t
*
nbr
)
{
/* Nothing needs be done in non-storing mode */
}
/*---------------------------------------------------------------------------*/
static
void
drop_route
(
uip_ds6_route_t
*
route
)
{
/* Do nothing. RPL-lite only supports non-storing mode, i.e. no routes */
...
...
@@ -212,6 +218,7 @@ const struct routing_driver rpl_lite_driver = {
rpl_ext_header_srh_update
,
rpl_ext_header_srh_get_next_hop
,
rpl_link_callback
,
neighbor_state_changed
,
drop_route
,
};
/*---------------------------------------------------------------------------*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment