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_GC
#define GNRC_IPV6_NIB_NC_INFO_AR_STATE_GC (0x0000) |
Not managed by 6Lo-AR (address can be removed when memory is low.
Definition at line 121 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_AR_STATE_MANUAL
#define GNRC_IPV6_NIB_NC_INFO_AR_STATE_MANUAL (0x0600) |
Address was added manually.
Definition at line 136 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_AR_STATE_MASK
#define GNRC_IPV6_NIB_NC_INFO_AR_STATE_MASK (0x0600) |
◆ GNRC_IPV6_NIB_NC_INFO_AR_STATE_POS
#define GNRC_IPV6_NIB_NC_INFO_AR_STATE_POS (9) |
Shift position of address registration states.
Definition at line 116 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_AR_STATE_REGISTERED
#define GNRC_IPV6_NIB_NC_INFO_AR_STATE_REGISTERED (0x0400) |
Address is registered.
Definition at line 131 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_AR_STATE_TENTATIVE
#define GNRC_IPV6_NIB_NC_INFO_AR_STATE_TENTATIVE (0x0200) |
Address registration still pending at upstream router.
Definition at line 126 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_IFACE_MASK
#define GNRC_IPV6_NIB_NC_INFO_IFACE_MASK (0x01f0) |
Mask for interface identifier.
Definition at line 99 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_IFACE_POS
#define GNRC_IPV6_NIB_NC_INFO_IFACE_POS (4) |
Shift position of interface identifier.
Definition at line 104 of file nc.h.
◆ 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_DELAY
#define GNRC_IPV6_NIB_NC_INFO_NUD_STATE_DELAY (0x0004) |
NUD will be performed in a moment.
Definition at line 72 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_NUD_STATE_INCOMPLETE
#define GNRC_IPV6_NIB_NC_INFO_NUD_STATE_INCOMPLETE (0x0002) |
Address resolution is currently performed.
Definition at line 62 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_INFO_NUD_STATE_PROBE
#define GNRC_IPV6_NIB_NC_INFO_NUD_STATE_PROBE (0x0005) |
NUD is performed.
Definition at line 77 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_NUD_STATE_REACHABLE
#define GNRC_IPV6_NIB_NC_INFO_NUD_STATE_REACHABLE (0x0006) |
Entry is reachable.
Definition at line 82 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE
#define GNRC_IPV6_NIB_NC_INFO_NUD_STATE_STALE (0x0003) |
Address might not be reachable.
Definition at line 67 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNMANAGED
#define GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNMANAGED (0x0000) |
Not managed by NUD.
Definition at line 52 of file nc.h.
◆ GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNREACHABLE
#define GNRC_IPV6_NIB_NC_INFO_NUD_STATE_UNREACHABLE (0x0001) |
Entry is not reachable.
Definition at line 57 of file nc.h.
◆ 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;
}
void gnrc_ipv6_nib_nc_print(gnrc_ipv6_nib_nc_t *nce)
Prints a neighbor cache entry.
bool gnrc_ipv6_nib_nc_iter(unsigned iface, void **state, gnrc_ipv6_nib_nc_t *nce)
Iterates over all neighbor cache entries in the NIB.
Neighbor cache definitions.
Neighbor cache entry view on NIB.
- 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).