Commit 2249bbf9 authored by peter's avatar peter
Browse files

No commit message

No commit message
parent 0437f91a
Loading
Loading
Loading
Loading
+180 −63
Original line number Diff line number Diff line
@@ -22,7 +22,9 @@
	import from LibIpv6_MultiRfcs_TypesAndValues all;
	import from LibIpv6_Rfc2460Root_TypesAndValues { type all };
	import from LibIpv6_Rfc2460Root_Templates all;
	import from LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues all;
	import from LibIpv6_Rfc2461NeighborDiscovery_Functions all;
	import from LibIpv6_Rfc2461NeighborDiscovery_Functions_PK all;
	import from LibIpv6_Rfc2461NeighborDiscovery_Templates all;
	import from LibIpv6_Rfc2463Icmpv6_Functions all;
	import from LibIpv6_Rfc2463Icmpv6_Templates all;
@@ -62,17 +64,21 @@
	**			up and running. Neighbor detection is handled here, rather than in 
	**			a default. Might be useful if NUT must perform neighbor detection.
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_llaAddrNut Local link address of node under test
	** @param 	p_llaAddrTn Local link address of testing node which calls this function 
	** @param 	p_addrNutND Address (used for Neighbor Discovery) of node under test
	** @param 	p_addrTnND Address (used for Neighbor Discovery) of testing node which calls this function 
	** @param 	p_addrNutER Address (used for Echo procedure) of node under test
	** @param 	p_addrTnER Address (used for Echo procedure) of testing node which calls this function 
	** @param 	p_SolNodeAddrTn Solicited-node multicast address of testing node which calls this function 
	** @param 	p_macAddrTn MAC address of testing node which calls this function 
	** @param 	p_identifier Idenitifier to be used in ICMPv6 echo request 
	** @param 	p_seqNo Sequence number to be used in ICMPv6 echo request 
	** @return 	execution status
	*/
	function f_echoProcUpLocal_withNbrDetection (
		in  Ipv6Address p_llaAddrNut,
		in  Ipv6Address p_llaAddrTn,
	function f_echoProcUp_withNbrDetection_simple (
		in  Ipv6Address p_addrNutND,
		in  Ipv6Address p_addrTnND,
		in  Ipv6Address p_addrNutER,
		in  Ipv6Address p_addrTnER,
		in  Ipv6Address p_solNodeAddrTn,
		in  Oct6to15	p_macAddrTn,
		in  UInt16 		p_identifier,
@@ -82,35 +88,37 @@

		var FncRetCode v_ret;

		v_ret := f_sendEchoRequest( m_echoRequest_noExtHdr_noData( p_llaAddrTn,
															p_llaAddrNut,
		v_ret := f_sendEchoRequest( m_echoRequest_noExtHdr_noData( p_addrTnER,
															p_addrNutER,
															p_identifier,
															p_seqNo ));
		if ( v_ret != e_success ) { return v_ret; }

		tc_ac.start;
		alt {
			[]	ipPort.receive(mw_nbrSol_noExtHdr ( 
						p_llaAddrNut,
						p_addrNutND,
						p_solNodeAddrTn,
						p_llaAddrTn,
						p_addrTnND,
						*) ) {
					tc_ac.stop;

					// Send a Neighbor Advertisement
					v_ret := f_sendNbrAdv ( m_nbrAdv_noExtHdr (
						p_llaAddrTn,
						p_llaAddrNut,
						p_addrTnND,
						p_addrNutND,
						c_rFlag0,
						c_sFlag1,
						c_oFlag0,
						p_llaAddrTn,
						p_addrNutND,
						m_nbrAdvOpt_macTlla ( p_macAddrTn ) ) );
					if ( v_ret != e_success ) { return v_ret; }

						tc_ac.start;
						alt {
							[]	ipPort.receive ( mw_echoReply_noExtHdr_noData (
										p_llaAddrNut,
										p_llaAddrTn,
										p_addrNutER,
										p_addrTnER,
										c_defId,
										c_defSeqNo )) {
									tc_ac.stop;	
@@ -122,12 +130,12 @@
						} // end alt
				}
			[]	ipPort.receive ( mw_echoReply_noExtHdr_noData (
						p_llaAddrNut,
						p_llaAddrTn,
						p_addrNutER,
						p_addrTnER,
						c_defId,
						c_defSeqNo )) {
					tc_ac.stop;	
					log("**** f_echoProcUpLocal_withNbrDetection: ERROR: neighbor reachability was not checked **** ");
					log("**** f_echoProcUp_withNbrDetection_simple: ERROR: neighbor reachability was not checked **** ");
					v_ret := e_error;
				}
			[]	tc_ac.timeout{
@@ -137,66 +145,46 @@

		return v_ret;

	} // end f_echoProcUpLocal_withNbrDetection
	} // end f_echoProcUp_withNbrDetection_simple

	/*
	** @desc 	This sends an ICMPv6 echo request from an IPv6 node to any
	**			NUT, and waits for a echo reply for a fixed amount of time. 
	**          This function can be used to verify that the NUT is 
	**			up and running. Neighbor detection is handled here, rather than in 
	**			a default. Might be useful if NUT must perform neighbor detection.
	**			a default. Sent and received packets must be given as templates.
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_glaAddrNut Global address of node under test
	** @param 	p_glaAddrTn Global address of testing node which calls this function 
	** @param 	p_SolNodeAddrTn Solicited-node multicast address of testing node which calls this function 
	** @param 	p_macAddrTn MAC address of testing node which calls this function 
	** @param 	p_identifier Idenitifier to be used in ICMPv6 echo request 
	** @param 	p_seqNo Sequence number to be used in ICMPv6 echo request 
	** @param 	p_echoRequest Echo Request to be sent
	** @param 	p_nbrSol template of an NS that is sent by NUT
	** @param 	p_nbrAdv Neighbor Advertisement to be sent
	** @param 	p_echoReply template of an Echo Reply that is sent by NUT
	** @return 	execution status
	*/
	function f_echoProcUpGlobal_withNbrDetection (
		in  Ipv6Address p_glaAddrNut,
		in  Ipv6Address p_glaAddrTn,
		in  Ipv6Address p_solNodeAddrTn,
		in  Oct6to15	p_macAddrTn,
		in  UInt16 		p_identifier,
		in  UInt16 		p_seqNo)
	function f_echoProcUp_withNbrDetection (
		in template EchoRequest p_echoRequest,
		in template NeighborSolicitation p_nbrSol,
		in template NeighborAdvertisement p_nbrAdv,
		in template EchoReply p_echoReply )
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret;

		v_ret := f_sendEchoRequest( m_echoRequest_noExtHdr_noData( p_glaAddrTn,
															p_glaAddrNut,
															p_identifier,
															p_seqNo ));
		v_ret := f_sendEchoRequest( p_echoRequest );
		if ( v_ret != e_success ) { return v_ret; }

		tc_ac.start;
		alt {
			[]	ipPort.receive(mw_nbrSol_noExtHdr ( 
						p_glaAddrNut,
						p_solNodeAddrTn,
						p_glaAddrTn,
						*) ) {
			[]	ipPort.receive ( p_nbrSol ) {
					tc_ac.stop;

					// Send a Neighbor Advertisement
					v_ret := f_sendNbrAdv ( m_nbrAdv_noExtHdr (
						p_glaAddrTn,
						p_glaAddrNut,
						c_rFlag0,
						c_sFlag1,
						c_oFlag0,
						p_glaAddrTn,
						m_nbrAdvOpt_macTlla ( p_macAddrTn ) ) );
					v_ret := f_sendNbrAdv ( p_nbrAdv );
					if ( v_ret != e_success ) { return v_ret; }

						tc_ac.start;
						alt {
							[]	ipPort.receive ( mw_echoReply_noExtHdr_noData (
										p_glaAddrNut,
										p_glaAddrTn,
										c_defId,
										c_defSeqNo )) {
							[]	ipPort.receive ( p_echoReply ) {
									tc_ac.stop;	
									v_ret := e_success;
								}
@@ -205,13 +193,9 @@
								}		
						} // end alt
				}
			[]	ipPort.receive ( mw_echoReply_noExtHdr_noData (
						p_glaAddrNut,
						p_glaAddrTn,
						c_defId,
						c_defSeqNo )) {
			[]	ipPort.receive ( p_echoReply ) {
					tc_ac.stop;	
					log("**** f_echoProcUpGlobal_withNbrDetection: ERROR: neighbor reachability was not checked **** ");
					log("**** f_echoProcUp_withNbrDetection: ERROR: neighbor reachability was not checked **** ");
					v_ret := e_error;
				}
			[]	tc_ac.timeout{
@@ -221,6 +205,139 @@

		return v_ret;

	} // end f_echoProcUpGlobal_withNbrDetection
	} // end f_echoProcUp_withNbrDetection

	/*
	** @desc 	This function answers to Neighbor detection and then receives an
	**			ICMPv6 echo Request from NUT.
	**			Sent and received packets must be given as templates.
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_echoRequest Echo Request to be sent
	** @param 	p_nbrSol template of an NS that is sent by NUT
	** @param 	p_nbrAdv Neighbor Advertisement to be sent
	** @param 	p_echoRequest template of an Echo Request that is sent by NUT
	** @return 	execution status
	*/
	function f_reveiceEchoRequest_withNbrDetection (
		in template NeighborSolicitation p_nbrSol,
		in template NeighborAdvertisement p_nbrAdv,
		in template EchoRequest p_echoRequest )
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret;

		tc_ac.start;
		alt {
			[]	ipPort.receive ( p_nbrSol ) {
					tc_ac.stop;

					// Send a Neighbor Advertisement
					v_ret := f_sendNbrAdv ( p_nbrAdv );
					if ( v_ret != e_success ) { return v_ret; }

						tc_ac.start;
						alt {
							[]	ipPort.receive ( p_echoRequest ) {
									tc_ac.stop;	
									v_ret := e_success;
								}
							[]	tc_ac.timeout{
									v_ret := e_timeout;
								}		
						} // end alt
				}
			[]	ipPort.receive ( p_echoRequest ) {
					tc_ac.stop;	
					log("**** f_reveiceEchoRequest_withNbrDetection: ERROR: neighbor reachability was not checked **** ");
					v_ret := e_error;
				}
			[]	tc_ac.timeout{
					v_ret := e_timeout;
				}		
		} // end alt

		return v_ret;

	} // end f_reveiceEchoRequest_withNbrDetection

	/*
	** @desc 	This sends an ICMPv6 echo request from an IPv6 node to any
	**			NUT, and waits for a echo reply for a fixed amount of time. 
	**          Also checks that Neighbor detection is not performed.
	**			Sent and received packets must be given as templates.
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_echoRequest Echo Request to be sent
	** @param 	p_nbrSol template of an NS that is sent by NUT
	** @param 	p_echoReply template of an Echo Reply that is sent by NUT
	** @return 	execution status
	*/
	function f_echoProcUp_withoutNbrDetection (
		in template EchoRequest p_echoRequest,
		in template NeighborSolicitation p_nbrSol,
		in template EchoReply p_echoReply )
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret;

		v_ret := f_sendEchoRequest( p_echoRequest );
		if ( v_ret != e_success ) { return v_ret; }

		tc_ac.start;
		alt {
			[]	ipPort.receive ( p_echoReply ) {
					tc_ac.stop;
					v_ret := e_success;
				}
			[]	ipPort.receive ( p_nbrSol ) {
					tc_ac.stop;	
					log("**** f_echoProcUp_withoutNbrDetection: ERROR: neighbor reachability was not checked **** ");
					v_ret := e_error;
				}
			[]	tc_ac.timeout{
					v_ret := e_timeout;
				}		
		} // end alt

		return v_ret;

	} // end f_echoProcUp_withoutNbrDetection

	/*
	** @desc 	This function initiates Neighbor detection.
	**			Sent and received packets must be given as templates.
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_echoRequest Echo Request to be sent
	** @param 	p_nbrSol Neighbor Solicitation to be sent
	** @param 	p_nbrAdv template of an NA that is sent by NUT
	** @return 	execution status
	*/
	function f_performNeighborDetection (
		in template NeighborSolicitation p_nbrSol,
		in template NeighborAdvertisement p_nbrAdv )
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret;

		// Send a Neighbor Solicitation
		v_ret := f_sendNbrSol ( p_nbrSol );
		if ( v_ret != e_success ) { return v_ret; }

		tc_ac.start;
		alt {
			[]	ipPort.receive ( p_nbrAdv ) {
					tc_ac.stop;
					v_ret := e_success;
				}
			[]	tc_ac.timeout{
					v_ret := e_timeout;
				}
		} // end alt

		return v_ret;

	} // end f_reveiceEchoRequest_withNbrDetection

} // end module LibIpv6_Rfc2463Icmpv6_Functions