1
10
11
12
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
117
118
119
120
121
122
123
...
...
#define NX_SOURCE_CODE
#include "nx_api.h"
#include "nx_ipv6.h"
#ifdef FEATURE_NX_IPV6
...
UINT _nxd_ipv6_find_max_prefix_length(ULONG *addr1, ULONG *addr2, UINT max_length)
{
UINT length = 0;
UINT i, j, bit, time;
for (i = 0; i < 4; i++)
{
if (addr1[i] == addr2[i])
{
length += 32;
}if (addr1[i] == addr2[i]) { ... }
else if (length + 31 < max_length)
{
break;
}else if (length + 31 < max_length) { ... }
else
{
bit = 16;
time = 16;
for (j = 0; j < 5; j++)
{
time = time / 2;
if (addr1[i] >> bit == addr2[i] >> bit)
{
bit -= time;
if (time == 0)
{
length += (32 - bit);
}if (time == 0) { ... }
}if (addr1[i] >> bit == addr2[i] >> bit) { ... }
else if (j == 4)
{
length += (31 - bit);
break;
}else if (j == 4) { ... }
else
{
bit += time;
}else { ... }
}for (j = 0; j < 5; j++) { ... }
break;
}else { ... }
}for (i = 0; i < 4; i++) { ... }
return(length);
}_nxd_ipv6_find_max_prefix_length (ULONG *addr1, ULONG *addr2, UINT max_length) { ... }
/* ... */
#endif