1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
* Copyright (c) 2025-present Eclipse ThreadX Contributors
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** Neighbor Discovery Cache Management (ND CAHCE) */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* nx_nd_cache.h PORTABLE C */
/* 6.4.3 */
/* AUTHOR */
/* */
/* Yuxin Zhou, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the basic Application Interface (API) to the */
/* high-performance NetX IPv6 Neighbor Discovery Cache implementation */
/* for the ThreadX real-time kernel. All service prototypes and data */
/* structure definitions are defined in this file. Please note that */
/* basic data type definitions and other architecture-specific */
/* information is contained in the file nx_port.h. */
/* */
/* It is assumed that nx_api.h and nx_port.h have already been */
/* included. */
/* */
/* This header file is for NetX Duo internal use only. Application */
/* shall not include this file directly. */
/* */
/**************************************************************************/
#ifndef NX_ND_CACHE_H
#define NX_ND_CACHE_H
#include "nx_ip.h"
#include "nx_ipv6.h"
#ifdef FEATURE_NX_IPV6
/* Symbols used the states of ND entries. */
#define ND_CACHE_STATE_INVALID 0
#define ND_CACHE_STATE_INCOMPLETE 1
#define ND_CACHE_STATE_REACHABLE 2
#define ND_CACHE_STATE_STALE 3
#define ND_CACHE_STATE_DELAY 4
#define ND_CACHE_STATE_PROBE 5
#define ND_CACHE_STATE_CREATED 6
/*
* Define values used for Neighbor Discovery protocol.
* The default values are suggested by RFC2461, chapter 10.
*/
#ifndef NX_MAX_MULTICAST_SOLICIT
/* Max multicast NS messages */
#define NX_MAX_MULTICAST_SOLICIT 3
#endif
#ifndef NX_MAX_UNICAST_SOLICIT
/* Max unicast NS messages. */
#define NX_MAX_UNICAST_SOLICIT 3
#endif
#ifndef NX_REACHABLE_TIME
/* Max reachable time, in seconds. */
#define NX_REACHABLE_TIME 30
#endif
#ifndef NX_RETRANS_TIMER
/* Max retrans timer, in milliseconds. */
#define NX_RETRANS_TIMER 1000
#endif
#ifndef NX_DELAY_FIRST_PROBE_TIME
#define NX_DELAY_FIRST_PROBE_TIME 5
#endif
/* Declare internal functions */
UINT _nx_nd_cache_interface_entries_delete(NX_IP *ip_ptr, UINT index);
/* Add en entry to the cache. */
UINT _nx_nd_cache_add(NX_IP *ip_ptr, ULONG *dest_ip, NX_INTERFACE *if_index, CHAR *mac, INT IsStatic, INT status, NXD_IPV6_ADDRESS *nxd_interface, ND_CACHE_ENTRY **entry);
/* Delete an entry based on IP address. */
UINT _nx_nd_cache_delete_internal(NX_IP *ip_ptr, ND_CACHE_ENTRY *entry);
/* 100ms periodic update. */
VOID _nx_nd_cache_fast_periodic_update(NX_IP *ip_ptr);
/* Find cache entry based on neighbor IP address. */
UINT _nx_nd_cache_find_entry(NX_IP *ip_ptr, ULONG *dest_ip, ND_CACHE_ENTRY **entry);
/* Find cache entry based on neighbor IP address. If not found, create new entry. */
UINT _nx_nd_cache_add_entry(NX_IP *ip_ptr, ULONG *dest_ip, NXD_IPV6_ADDRESS *nxd_address, ND_CACHE_ENTRY **entry);
/* Find cache entry based on LLA. */
UINT _nx_nd_cache_find_entry_by_mac_addr(NX_IP *ip_ptr, ULONG physical_msw, ULONG physical_lsw, ND_CACHE_ENTRY **entry);
/* The real function that invalidates the whole cache. */
VOID _nxd_nd_cache_invalidate_internal(NX_IP *ip_ptr);
/* One second periodic update. */
VOID _nx_nd_cache_slow_periodic_update(NX_IP *ip_ptr);
/* Invalidate a given entry from the neighbor discovery table. */
VOID _nx_invalidate_destination_entry(NX_IP *ip_ptr, ULONG *next_hop_ip);
#endif /* FEATURE_NX_IPV6 */
/* Delete an entry based on IP address. */
UINT _nxd_nd_cache_entry_delete(NX_IP *ip_ptr, ULONG *dest_ip);
UINT _nxde_nd_cache_entry_delete(NX_IP *ip_ptr, ULONG *dest_ip);
/* Create an IPv6-MAC mapping to the ND cache entry. */
UINT _nxd_nd_cache_entry_set(NX_IP *ip_ptr, ULONG *dest_ip, UINT if_index, CHAR *mac);
UINT _nxde_nd_cache_entry_set(NX_IP *ip_ptr, ULONG *dest_ip, UINT if_index, CHAR *mac);
/* Invalidate the whole cache. */
UINT _nxd_nd_cache_invalidate(NX_IP *ip_ptr);
UINT _nxde_nd_cache_invalidate(NX_IP *ip_ptr);
UINT _nxd_nd_cache_ip_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, ULONG physical_msw, ULONG physical_lsw, UINT *if_index);
UINT _nxde_nd_cache_ip_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, ULONG physical_msw, ULONG physical_lsw, UINT *if_index);
UINT _nxd_nd_cache_hardware_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, ULONG *physical_msw, ULONG *physical_lsw, UINT *if_index);
UINT _nxde_nd_cache_hardware_address_find(NX_IP *ip_ptr, NXD_ADDRESS *ip_address, ULONG *physical_msw, ULONG *physical_lsw, UINT *if_index);
#endif /* NX_ND_CACHE_H */
|