Newer
Older
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*
* @author STF 276
* @version $Id$
* @desc This module specifies common neighborhood and router
* discovery messages interchanges (= operations)
* for an Ipv6 test component.
* Functions do not set a test component verdict but instead
* use the function return value instead to notify the function
* caller about the success of the operation.
*
*/
module LibIpv6_Rfc2461NeighborDiscovery_Functions {
//LibCommon
import from LibCommon_BasicTypesAndValues all;
import from LibCommon_DataStrings all;
import from LibCommon_VerdictControl { type FncRetCode };
//LibIpv6
import from LibIpv6_ExternalFunctions all;
import from LibIpv6_Interface all ;
import from LibIpv6_Rfc2460Root_TypesAndValues { type all };
import from LibIpv6_ModuleParameters all ;
import from LibIpv6_MultiRfcs_Templates all;
import from LibIpv6_MultiRfcs_TypesAndValues all;
import from LibIpv6_Rfc2461NeighborDiscovery_Templates all;
import from LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues all;
/*
** @desc This sends an ICMPv6 router advertisement from a router node
** to any NUT. Prior it modifies IPv6 packet payload length
** and ICMPv6 checksum to their correct values
** @remark The template passed in must NOT contain any matching expressions!
** @param p_rtAdv Ipv6 packet template with router advertisement to be sent
** @returns execution status
*/
function f_sendRtAdv (in template RouterAdvertisement p_rtAdv)
runs on LibIpv6Node
return FncRetCode {
var Ipv6Packet v_ipPkt;
v_ipPkt.routerAdvert := valueof(p_rtAdv);
//calc payloadLen
v_ipPkt.routerAdvert.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
//set checksum to zero
v_ipPkt.routerAdvert.checksum := c_2ZeroBytes;
//calc checksum
v_ipPkt.routerAdvert.checksum := fx_icmpv6Checksum(v_ipPkt);
//send
ipPort.send(v_ipPkt.routerAdvert);
return e_success;
} // end f_sendRtAdv
/*
** @desc This functions sends a router advertisement with the specified
** prefix, so that NUT adds the test component as its RT to its
** default router list
** @param p_llaAddrTn Local link address of testing node which calls this function
** @param p_llaAddrNut Local link address of node under test
** @param p_prefix Router advertisement option prefix value
** @param p_glaAddrTn Global address of testing node which calls this function
*/
function f_sendRtAdvWithPrefix( in Ipv6Address p_llaAddrTn,
in Ipv6Address p_dstAddr,
in PrefixLength p_prefixLength,
in Ipv6Address p_glaAddrTn)
runs on LibIpv6Node
return FncRetCode {
var FncRetCode v_ret;
v_ret := f_sendRtAdv( m_rtAdv_noExtHdr( p_llaAddrTn,
p_dstAddr,
c_mFlag0,
c_oFlag0,
c_infiniteLifetime,
c_unspecifiedReachTime,
c_unspecifiedRetransTime,
m_rtAdvOpt_prefix ( p_prefixLength,
c_lFlag1,
c_aFlag1,
c_infiniteLifetime,
c_infiniteLifetime,
p_glaAddrTn)) ) ;
return v_ret ;
}
/*
** @desc This functions sends a router advertisement with the specified
** prefix with routerLifetime and prefixLifetime set to Zero.
** This is used in the postamble to make the IUT to delete neighbor cache.
** @param p_llaAddrTn Local link address of testing node which calls this function
** @param p_llaAddrNut Local link address of node under test
** @param p_prefix Router advertisement option prefix value
** @param p_glaAddrTn Global address of testing node which calls this function
*/
function f_sendRtAdvCleanUp( in Ipv6Address p_llaAddrTn,
in Ipv6Address p_dstAddr,
in PrefixLength p_prefixLength,
in Ipv6Address p_glaAddrTn)
runs on LibIpv6Node
return FncRetCode {
var FncRetCode v_ret;
v_ret := f_sendRtAdv( m_rtAdv_noExtHdr( p_llaAddrTn,
p_dstAddr,
c_mFlag0,
c_oFlag0,
c_zeroLifetime,
c_unspecifiedReachTime,
c_unspecifiedRetransTime,
m_rtAdvOpt_prefix ( p_prefixLength,
c_lFlag1,
c_aFlag1,
c_zeroLifetime,
c_zeroLifetime,
p_glaAddrTn)) ) ;
return v_ret ;
}
group neighborDiscovery {
/*
** @desc This sends an ICMPv6 neighborhood advertisement from any
** Ipv6 node to the NUT. Prior it modifies IPv6 packet payload
** length and ICMPv6 checksum to their correct values
** @remark The template passed in must NOT contain any matching expressions!
** @param Ipv6 packet template with neighborhood advertisement to be sent
** @returns execution status
*/
function f_sendNbrAdv(in template NeighborAdvertisement p_nbrAdv)
runs on LibIpv6Node
return FncRetCode {
var Ipv6Packet v_ipPkt;
v_ipPkt.nbrAdvert := valueof(p_nbrAdv);
//calc payloadLen
v_ipPkt.nbrAdvert.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
//set checksum to zero
v_ipPkt.nbrAdvert.checksum := c_2ZeroBytes;
//calc checksum
v_ipPkt.nbrAdvert.checksum := fx_icmpv6Checksum(v_ipPkt);
//send
ipPort.send(v_ipPkt.nbrAdvert);
return e_success;
}// end f_sendNbrAdv
}//end group neighborDiscovery
/*
** @desc This sends an ICMPv6 redirect for a test component
** acting as any IPv6 node to the NUT.
** Prior it modifies IPv6 packet payload ength and ICMPv6
** checksum to their correct values
** @remark The template passed in must NOT contain any matching expressions!
** @param Ipv6 packet template with neighborhood advertisement to be sent
** @returns execution status
*/
function f_sendRedirect(in template Redirect p_redirect)
runs on LibIpv6Node
return FncRetCode {
var Ipv6Packet v_ipPkt;
v_ipPkt.redirect := valueof(p_redirect);
//calc payloadLen
v_ipPkt.redirect.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
//set checksum to zero
v_ipPkt.redirect.checksum := c_2ZeroBytes;
//calc checksum
v_ipPkt.redirect.checksum := fx_icmpv6Checksum(v_ipPkt);
//send
ipPort.send(v_ipPkt.redirect);
return e_success;
}// end f_sendRedirect
} // end module LibIpv6_Rfc2461NeighborDiscovery_Functions