Neighbor cache component of neighbor information base.
More...
Neighbor cache component of neighbor information base.
|
file | nc.h |
| Neighbor cache definitions.
|
|
◆ GNRC_IPV6_NIB_NC_INFO_AR_STATE_MASK
#define GNRC_IPV6_NIB_NC_INFO_AR_STATE_MASK (0x0600) |
◆ GNRC_IPV6_NIB_NC_INFO_IS_ROUTER
#define GNRC_IPV6_NIB_NC_INFO_IS_ROUTER (0x0008) |
gnrc_ipv6_nib_t::next_hop is router
This flag indicates that gnrc_ipv6_nib_t::next_hop is a router, but it does not necessarily indicate that it is in the default router list! A neighbor that has this flag unset however must not appear in the default router list.
- See also
- RFC 4861, Appendix D
Definition at line 94 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_NUD_STATE_MASK
#define GNRC_IPV6_NIB_NC_INFO_NUD_STATE_MASK (0x0007) |
◆ gnrc_ipv6_nib_nc_del()
void gnrc_ipv6_nib_nc_del |
( |
const ipv6_addr_t * |
ipv6, |
|
|
unsigned |
iface |
|
) |
| |
Deletes neighbor with address ipv6
from NIB.
- Precondition
ipv6 != NULL
- Parameters
-
[in] | ipv6 | The neighbor's IPv6 address. |
[in] | iface | The interface to the neighbor. |
If the ipv6
can't be found for a neighbor in the NIB nothing happens.
◆ gnrc_ipv6_nib_nc_get_ar_state()
Gets address registration state of an entry.
- Parameters
-
[in] | entry | A neighbor cache entry |
- Returns
- The address registration state of
entry
.
Definition at line 202 of file nc.h.
◆ gnrc_ipv6_nib_nc_get_iface()
Gets interface from entry.
- Parameters
-
[in] | entry | A neighbor cache entry |
- Returns
- The interface identifier of
entry
.
-
0 if no interface is identified for
entry
.
Definition at line 189 of file nc.h.
◆ gnrc_ipv6_nib_nc_get_nud_state()
Gets neighbor unreachability state from entry.
- Parameters
-
[in] | entry | A neighbor cache entry. |
- Returns
- The neighbor unreachability state of
entry
.
Definition at line 163 of file nc.h.
◆ gnrc_ipv6_nib_nc_is_router()
Gets router flag of a neighbor.
- Parameters
-
[in] | entry | A neighbor cache entry. |
- Returns
- true, if
entry
is a router.
-
false, if
entry
is not a router.
Definition at line 176 of file nc.h.
◆ gnrc_ipv6_nib_nc_iter()
Iterates over all neighbor cache entries in the NIB.
- Precondition
(state != NULL) && (nce != NULL)
- Parameters
-
[in] | iface | Restrict iteration to entries on this interface. 0 for any interface. |
[in,out] | state | Iteration state of the neighbor cache. Must point to a NULL pointer to start iteration. |
[out] | nce | The next neighbor cache entry. |
Usage example:
int main(void) {
void *state = NULL;
puts("My neighbors:");
}
return 0;
}
- Note
- The list may change during iteration.
- Returns
- true, if iteration can be continued.
-
false, if
nce
is the last neighbor cache entry in the NIB.
◆ gnrc_ipv6_nib_nc_mark_reachable()
void gnrc_ipv6_nib_nc_mark_reachable |
( |
const ipv6_addr_t * |
ipv6 | ) |
|
Mark neighbor with address ipv6
as reachable.
- Precondition
ipv6 != NULL
- Parameters
-
[in] | ipv6 | A neighbor's IPv6 address. Must not be NULL. |
This function shall be called if an upper layer gets reachability confirmation via its own means (e.g. a TCP connection build-up or confirmation). Unmanaged neighbor cache entries (i.e. entries created using gnrc_ipv6_nib_nc_set()) or entries whose next-hop are not yet in the neighbor cache are ignored.
Entries in state GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNMANAGED are not affected by this, since they are assumed to always be reachable and kept out of the NUD state-machine
◆ gnrc_ipv6_nib_nc_print()
Prints a neighbor cache entry.
- Precondition
nce != NULL
- Parameters
-
[in] | nce | A neighbor cache entry. |
◆ gnrc_ipv6_nib_nc_set()
int gnrc_ipv6_nib_nc_set |
( |
const ipv6_addr_t * |
ipv6, |
|
|
unsigned |
iface, |
|
|
const uint8_t * |
l2addr, |
|
|
size_t |
l2addr_len |
|
) |
| |
Adds an unmanaged neighbor entry to NIB.
- Precondition
ipv6 != NULL
-
l2addr_len <= CONFIG_GNRC_IPV6_NIB_L2ADDR_MAX_LEN
-
(iface > KERNEL_PID_UNDEF) && (iface <= KERNEL_PID_LAST)
- Parameters
-
[in] | ipv6 | The neighbor's IPv6 address. |
[in] | iface | The interface to the neighbor. |
[in] | l2addr | The neighbor's L2 address. |
[in] | l2addr_len | Length of l2addr . |
A neighbor cache entry created this way is marked as persistent. Also, a non-persistent neighbor or destination cache entry already in the NIB might be removed to make room for the new entry. If an entry pointing to the same IPv6 address as ipv6
exists already it will be overwritten and marked as unmanaged.
If CONFIG_GNRC_IPV6_NIB_ARSM == 0 l2addr
and l2addr_len
won't be set and ipv6
must be a link-local address.
- Returns
- 0 on success.
-
-ENOMEM, if no space is left in neighbor cache.
-
-EINVAL, if
ipv6
is invalid (i.e. CONFIG_GNRC_IPV6_NIB_ARSM == 0 and ipv6
is not link-local).