LibIpv6_Rfc2463Icmpv6_Functions.ttcn 21.9 KB
Newer Older
peter's avatar
peter committed
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc		This module specifies common ICMP 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_Rfc2463Icmpv6_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_ModuleParameters all ;
	import from LibIpv6_Interface { type Ipv6Packet };
	import from LibIpv6_Rfc2460Root_TypesAndValues { type all };
	import from LibIpv6_Rfc2460Root_Templates all;
	import from LibIpv6_Rfc2463Icmpv6_Templates all;
	import from LibIpv6_Rfc2463Icmpv6_TypesAndValues all;
peter's avatar
peter committed
	import from LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues all;
	import from LibIpv6_Rfc2461NeighborDiscovery_Templates all;
	import from LibIpv6_MultiRfcs_TypesAndValues all;

peter's avatar
peter committed
	group sendCalculation {	

		/*
		** @desc  	This sends an ICMPv6 echo request from an IPv6 node to 
		**          any NUT. Prior it modifies IPv6 packet payload length 
		**			and ICMPv6 checksum to their correct values using external 
		**          functions.
		** @remark  The template passed in must NOT contain any matching expressions!
		** @param 	p_echoRequest Ipv6 packet value or template with echo request to be sent
		** @returns	execution status
		*/
		function f_sendEchoRequest (in template EchoRequest p_echoRequest) 
		runs on LibIpv6Node
		return FncRetCode {
			var Ipv6Packet v_ipPkt;
			v_ipPkt.echoRequest := valueof(p_echoRequest);
			//calc payloadLen
			v_ipPkt.echoRequest.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
			//set checksum to zero
			v_ipPkt.echoRequest.checksum := c_2ZeroBytes;
			//calc checksum
			v_ipPkt.echoRequest.checksum := fx_icmpv6Checksum(v_ipPkt);
			//send
			ipPort.send(v_ipPkt.echoRequest);
		
			return e_success;
		
		}//end f_sendEchoRequest

		/*
		** @desc  	This sends an ICMPv6 echo request from an IPv6 node to any NUT. 
		**			Prior it modifies IPv6 packet payload length and ICMPv6 checksum 
		**			to their correct values using external functions
		** @remark  The template passed in must NOT contain any matching expressions!
		** @param 	p_echoReply Ipv6 packet value or template with echo reply to be sent
		** @returns	execution status
		*/
		function f_sendEchoReply (in template EchoReply p_echoReply) 
		runs on LibIpv6Node
		return FncRetCode {
			var Ipv6Packet v_ipPkt;
			v_ipPkt.echoReply := valueof(p_echoReply);
			//calc payloadLen
			v_ipPkt.echoReply.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
			//set checksum to zero
			v_ipPkt.echoReply.checksum := c_2ZeroBytes;
			//calc checksum
			v_ipPkt.echoReply.checksum := fx_icmpv6Checksum(v_ipPkt);
			//send
			ipPort.send(v_ipPkt.echoReply);
		
			return e_success;
		
peter's avatar
peter committed
		}//end f_sendEchoReply
peter's avatar
peter committed


	} // end group sendCalculation

	/*
	** @desc 	This sends an ICMPv6 echo request from an IPv6 node to any NUT,
	**			and waits for any ICMP packet for a fixed amount of time. 
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_hops Number of hops to be used in IPv6 header 
	** @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_ipPkt ICMPv6 packet which has been received 
	** @return 	execution status
	*/
	function f_getIpPktAfterEchoReq( 	in  UInt8 			p_hops,
validator's avatar
validator committed
							  		   	in  template Ipv6Address 	p_llaAddrTn,
										in  template Ipv6Address 	p_llaAddrNut,
peter's avatar
peter committed
							  		   	out Ipv6Packet		p_ipPkt)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret;

		v_ret := f_sendEchoRequest( m_echoRequest_hop_noExtHdr_noData(  p_hops,
																p_llaAddrTn,
																p_llaAddrNut,
																c_defId,
																c_defSeqNo ));
		if ( v_ret != e_success ) {return v_ret;}
		tc_ac.start;
		alt {
			[]	ipPort.receive(mw_ipPkt) -> value p_ipPkt {
					tc_ac.stop;	
					return e_success;
				}
			[]	tc_ac.timeout{
					return e_timeout;
				}		
		} // end alt
	} // end f_getIcmpAfterEchoReq
	
peter's avatar
peter committed
	/*
	** @desc 	This sends an ICMPv6 echo request from an IPv6 node to any NUT,
	**			and waits for a Time Exceeded message for a fixed amount of time. 
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_hops Number of hops to be used in IPv6 header 
	** @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_llaAddrRut Local link address of router under test 
	** @return 	execution status
	*/
peter's avatar
peter committed
	function f_getTimeExceededAfterEchoReq( 	in  UInt8 			p_hops,
validator's avatar
validator committed
											in  template Ipv6Address 	p_llaAddrTn,
											in  template Ipv6Address 	p_llaAddrNut,
											in  template Ipv6Address 	p_llaAddrRut)
peter's avatar
peter committed
		runs on LibIpv6Node
		return FncRetCode {

			var FncRetCode v_ret;

			v_ret := f_sendEchoRequest( m_echoRequest_hop_noExtHdr_noData(  p_hops,
																	p_llaAddrTn,
																	p_llaAddrNut,
																	c_defId,
																	c_defSeqNo ));
			if ( v_ret != e_success ) {return v_ret;}
			tc_ac.start;
			alt {
				[]	ipPort.receive(mw_timeExceeded_noExtHdr (	p_llaAddrRut,
																p_llaAddrTn,
																c_icmpCode0 ))  {
						tc_ac.stop;	
						return e_success;
					}
				[]	tc_ac.timeout{
						return e_timeout;
					}		
peter's avatar
peter committed
			} // end al

peter's avatar
peter committed
		} // end f_getTimeExceedAfterEchoReq

peter's avatar
peter committed
	/*
	** @desc 	This sends an ICMPv6 echo request from an IPv6 node to any NUT,
	**			and waits for a Packet Too Big message for a fixed amount of time. 
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_echoRequest Template of the Echo Request to be sent
	** @param 	p_packetTooBig Template of the Packet Too Big message that is expected
	** @return 	execution status
	*/
	function f_getPacketTooBigAfterEchoReq (
		template EchoRequest p_echoRequest,
		template PacketTooBig p_packetTooBig )
		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_packetTooBig )  {
						tc_ac.stop;	
						return e_success;
					}
				[]	tc_ac.timeout{
						return e_timeout;
					}		
			} // end alt

		} // end f_getPacketTooBigAfterEchoReq

peter's avatar
peter committed
	/*
	** @desc 	This sends an ICMPv6 echo request from an IPv6 node to any NUT,
	**			and waits for a Destination Unreachable message for a fixed amount of time. 
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_echoRequest Template of the Echo Request to be sent
	** @param 	p_destUnreachable Template of the Packet Too Big message that is expected
	** @return 	execution status
	*/
	function f_getDestinationUnreachableAfterEchoReq (
		template EchoRequest p_echoRequest,
		template DestinationUnreachable p_destUnreachable )
		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_destUnreachable )  {
						tc_ac.stop;	
						return e_success;
					}
				[]	tc_ac.timeout{
						return e_timeout;
					}		
			} // end alt

		} // end f_getDestinationUnreachableAfterEchoReq

peter's avatar
peter committed

	/*
	** @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.
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @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_identifier Idenitifier to be used in ICMPv6 echo request 
	** @param 	p_seqNo Sequence number to be used in ICMPv6 echo request 
	** @param 	p_icmpPkt IPv6 packet which has been received 
	** @return 	execution status
	*/
validator's avatar
validator committed
	function f_echoProcUp(  in  template Ipv6Address p_llaAddrTn,
							in  template Ipv6Address p_llaAddrNut,
peter's avatar
peter committed
							in  UInt16 		p_identifier,
							in  UInt16 		p_seqNo,
							out EchoReply	p_icmpPkt)
	runs on LibIpv6Node
	return FncRetCode {

		var EchoReply v_echoRep;
		var FncRetCode v_ret;

		v_ret := f_sendEchoRequest( m_echoRequest_noExtHdr_noData( p_llaAddrTn,
															p_llaAddrNut,
															p_identifier,
															p_seqNo ));
		if ( v_ret != e_success ) {return v_ret;}
		tc_ac.start;
		alt {
			[]	ipPort.receive(mw_echoReply ( 	p_llaAddrNut,
												p_llaAddrTn )) -> value v_echoRep {
					p_icmpPkt := v_echoRep ;
					tc_ac.stop;	
					return e_success;
				}
			[]	tc_ac.timeout{
					return e_timeout;
				}		
		} // end alt
	} // end f_echoProcUp

	/*
	** @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. 
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @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_identifier Idenitifier to be used in ICMPv6 echo request 
	** @param 	p_seqNo Sequence number to be used in ICMPv6 echo request 
	** @return 	execution status
	*/
validator's avatar
validator committed
	function f_replyToEchoRequest(in  template Ipv6Address 	p_llaAddrTn,
								  in  template Ipv6Address 	p_llaAddrNut,
peter's avatar
peter committed
								  in  UInt16 		p_identifier,
								  in  UInt16		p_seqNo )
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;

		tc_ac.start;
		alt {
			[]	ipPort.receive(mw_echoRequest ( 	p_llaAddrNut,
												p_llaAddrTn )) {
					tc_ac.stop;	
					v_ret := e_success;
				}
			[]	tc_ac.timeout{
					return e_timeout;
				}		
		} // end alt

		v_ret := f_sendEchoReply( m_echoReply_noExtHdr_noData( p_llaAddrTn,
															p_llaAddrNut,
															p_identifier,
															p_seqNo ));
		return v_ret ;

	} // end f_replyToEchoRequest


	
	/*
	** @desc 	This sends an ICMPv6 echo request from an IPv6 node to any 
	**			NUT, and does not a reply wihtin a given time limit. 
	**			This function can be used to verify that the NUT is NOT 
	**			up and running.
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_llaAddrTn Local link address of testing node which calls this function 
	** @param 	p_llaAddrNut Local link address of node under test
	** @return 	execution status
	*/
validator's avatar
validator committed
	function f_echoProcDown( template Ipv6Address p_llaAddrTn, template Ipv6Address p_llaAddrNut)
peter's avatar
peter committed
	runs on LibIpv6Node
	return FncRetCode {
		
		var EchoReply v_echoReply;
		if ( f_echoProcUp( p_llaAddrTn, p_llaAddrNut, c_defId, c_defSeqNo, v_echoReply) == e_timeout ) {
			// that means no echo reply was received - this is what we want here
			return e_success;
		} else {
			return e_error;
		}
	}//end f_echoProcDown

	/*
	** @desc  	This sends an ICMPv6 echo request from an IPv6 node to 
	**          any NUT. Prior it modifies IPv6 packet payload length 
	**			and ICMPv6 checksum to their correct values using external 
	**          functions.
	** @remark  The template passed in must NOT contain any matching expressions!
	** @param 	p_echoRequest Ipv6 packet value or template with echo request to be sent
	** @param 	p_payloadLength Length of the IPv6 packet to be sent
	** @returns	execution status
	*/
	function f_sendEchoRequest_noCalcPayloadLength (in template EchoRequest p_echoRequest,
		UInt16 p_payloadLength ) 
	runs on LibIpv6Node
	return FncRetCode {
		var Ipv6Packet v_ipPkt;
		v_ipPkt.echoRequest := valueof(p_echoRequest);
		//set payload length
		v_ipPkt.echoRequest.ipv6Hdr.payloadLength := p_payloadLength;
		//set checksum to zero
		v_ipPkt.echoRequest.checksum := c_2ZeroBytes;
		//calc checksum
		v_ipPkt.echoRequest.checksum := fx_icmpv6Checksum(v_ipPkt);
		//send
		ipPort.send(v_ipPkt.echoRequest);

		return e_success;

peter's avatar
peter committed
	}//end f_sendEchoRequest_noCalcPayloadLength
peter's avatar
peter committed

	/*
	** @desc  	This sends an ICMPv6 echo request from an IPv6 node to 
	**          any NUT. Prior it modifies IPv6 packet payload length 
	**			and ICMPv6 checksum to their correct values using external 
	**          functions. Waits for a Parameter Problem message.
	** @param 	p_echoRequest Ipv6 packet value or template with echo request to be sent (must not contains wildcards)
	** @param 	p_parameterProblem Parameter Problem message we are waiting for.
	** @returns	execution status
	*/
	function f_getParameterProblemAfterEchoReq_ignoreEchoReply (
		in template EchoRequest p_echoRequest,
		in template ParameterProblem p_parameterProblem )
	runs on LibIpv6Node
	return FncRetCode {
		var FncRetCode v_ret;
		var boolean v_ppReceived := false;

		v_ret := f_sendEchoRequest ( p_echoRequest );

		if ( v_ret != e_success ) {
			return v_ret;
		}

		tc_ac.start;
		alt {
			[]	ipPort.receive ( p_parameterProblem ) {
					v_ppReceived := true;
					repeat;
				}
			[]	ipPort.receive ( ParameterProblem:? ) {
					log("**** f_getParameterProblemAfterEchoReq_ignoreEchoReply: ERROR: Template mismatch **** ");
					v_ret := e_error;
				}
			[]	ipPort.receive(mw_echoReply ( 	p_echoRequest.ipv6Hdr.destinationAddress,
												p_echoRequest.ipv6Hdr.sourceAddress ) ) {
					tc_ac.stop;	
					log("**** f_getParameterProblemAfterEchoReq_ignoreEchoReply: ERROR: An Echo Reply was received, HUT did not discard our Echo Request **** ");
					v_ret := e_error;
				}
			[v_ppReceived==false]	tc_ac.timeout{
					v_ret := e_timeout;
				}		
			[v_ppReceived==true]	tc_ac.timeout{
					v_ret := e_success;
				}		
		} // end alt

		return v_ret;

	}//end f_getParameterProblemAfterEchoReq_ignoreEchoReply

peter's avatar
peter committed
	/*
	** @desc 	Creates a prefix using p_address and p_prefixLength. The p_prefixLength
	**			MSB bits remain unchanged, the others are set to zero.
	** @param	p_address Address used for prefix creation
	** @param	p_prefixLength Length of the prefix
	*/
peter's avatar
peter committed
	function f_createPrefix ( template Ipv6Address p_address, template UInt8 p_prefixLength )
peter's avatar
peter committed
	runs on LibIpv6Node
    return Ipv6Address {

		var Bit128 v_prefix;
		var integer v_pos;

peter's avatar
peter committed
		v_prefix := oct2bit ( valueof ( p_address ) );
peter's avatar
peter committed

peter's avatar
peter committed
		for ( v_pos := 128 - valueof ( p_prefixLength ); v_pos < 128; v_pos := v_pos + 1 ) {
peter's avatar
peter committed
			v_prefix[v_pos] := '0'B;
		}

		return bit2oct ( v_prefix );

	} // end f_createPrefix

	/*
	** @desc 	Creates a prefix using p_address. The length of the prefix is fixed
	**			in 64. The first 64 bits remain unchanged, the others are set to zero.
	** @param	p_address Address used for prefix creation
	*/
validator's avatar
validator committed
	function f_createPrefix64 ( template Ipv6Address p_address )
peter's avatar
peter committed
	runs on LibIpv6Node
    return Ipv6Address {

		var Bit128 v_prefix;
		var integer v_pos;

peter's avatar
peter committed
		v_prefix := oct2bit ( valueof ( p_address ) );
peter's avatar
peter committed

		for ( v_pos := 64; v_pos < 128; v_pos := v_pos + 1 ) {
			v_prefix[v_pos] := '0'B;
		}
peter's avatar
peter committed

peter's avatar
peter committed
		return bit2oct ( v_prefix );

	} // end f_createPrefix

peter's avatar
peter committed
	/*
	** @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.
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_llaAddrTn Local link address of testing node which calls this function
	** @param 	p_llaAddrNut Local link address of node under test
	** @return 	execution status
	*/
	function f_echoProcUp_withHopL255Len1280(
validator's avatar
validator committed
							in  template Ipv6Address p_llaAddrTn,
							in  template Ipv6Address p_llaAddrNut)
peter's avatar
peter committed
	runs on LibIpv6Node	return FncRetCode {

	var FncRetCode v_ret;
	v_ret := f_sendEchoRequest( m_echoRequest_noExtHdr_dataHopL255( p_llaAddrTn,
															p_llaAddrNut,
															c_defId, c_defSeqNo,
															c_1280ZeroBytes));
	if ( v_ret == e_success ) {
		tc_ac.start;
			alt {
				[]	ipPort.receive(mw_echoReply_hopL255_data ( 	p_llaAddrNut,
																p_llaAddrTn ,
														 		c_1280ZeroBytes)) {
						tc_ac.stop;
						return e_success;
					}
				[]	tc_ac.timeout{
						return e_timeout;
					}
			} // end alt
		} // End If
    return v_ret;
	} // End function f_echoProcUp_withHopL255Len1280

	/*
	** @desc  	This sends other ICMPv6 packet from an IPv6 node to 
	**          any IUT. Prior it modifies IPv6 packet payload length 
	**			and ICMPv6 checksum to their correct values using external 
	**          functions.
	** @remark  The template passed in must NOT contain any matching expressions!
	** @param 	p_otherIcmpv6 Ipv6 packet value or template with the ICMPv6 packet to be sent
	** @returns	execution status
	*/
	function f_sendOtherIcmpv6 (in template OtherIcmpv6Hdr p_otherIcmpv6) 
	runs on LibIpv6Node
	return FncRetCode {
		var Ipv6Packet v_ipPkt;
		v_ipPkt.otherHeader := valueof(p_otherIcmpv6);
		//calc payloadLen
		v_ipPkt.otherHeader.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
		//set checksum to zero
		v_ipPkt.otherHeader.checksum := c_2ZeroBytes;
		//calc checksum
		v_ipPkt.otherHeader.checksum := fx_icmpv6Checksum(v_ipPkt);
		//send
		ipPort.send(v_ipPkt.otherHeader);
		
		return e_success;
		
	} // end f_sendOtherIcmpv6

	/*
	** @desc  	This sends an ICMPv6 Destination Unreachable message to 
	**          any IUT. Prior it modifies IPv6 packet payload length 
	**			and ICMPv6 checksum to their correct values using external 
	**          functions.
	** @remark  The template passed in must NOT contain any matching expressions!
	** @param 	p_destUnreachable Ipv6 packet value or template with the Destination
	**			Unreachable message to be sent
	** @returns	execution status
	*/
	function f_sendDestUnreachable (in template DestinationUnreachable p_destUnreachable ) 
	runs on LibIpv6Node
	return FncRetCode {
		var Ipv6Packet v_ipPkt;
		v_ipPkt.destinationUnreachable := valueof(p_destUnreachable);
		//calc payloadLen
		v_ipPkt.destinationUnreachable.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
		//set checksum to zero
		v_ipPkt.destinationUnreachable.checksum := c_2ZeroBytes;
		//calc checksum
		v_ipPkt.destinationUnreachable.checksum := fx_icmpv6Checksum(v_ipPkt);
		//send
		ipPort.send(v_ipPkt.destinationUnreachable);
		
		return e_success;
		
	} // end f_sendDestUnreachable

	/*
	** @desc  	This sends an ICMPv6 Packet Too Big message to 
	**          any IUT. Prior it modifies IPv6 packet payload length 
	**			and ICMPv6 checksum to their correct values using external 
	**          functions.
	** @remark  The template passed in must NOT contain any matching expressions!
	** @param 	p_packetTooBig Ipv6 packet value or template with the Packet
	**			Too Big message to be sent
	** @returns	execution status
	*/
	function f_sendPacketTooBig (in template PacketTooBig p_packetTooBig ) 
	runs on LibIpv6Node
	return FncRetCode {
		var Ipv6Packet v_ipPkt;
		v_ipPkt.packetTooBig := valueof(p_packetTooBig);
		//calc payloadLen
		v_ipPkt.packetTooBig.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
		//set checksum to zero
		v_ipPkt.packetTooBig.checksum := c_2ZeroBytes;
		//calc checksum
		v_ipPkt.packetTooBig.checksum := fx_icmpv6Checksum(v_ipPkt);
		//send
		ipPort.send(v_ipPkt.packetTooBig);
		
		return e_success;
		
	} // end f_sendPacketTooBig

	/*
	** @desc  	This sends an ICMPv6 Packet Too Big message to 
	**          any IUT. Prior it modifies IPv6 packet payload length 
	**			and ICMPv6 checksum to their correct values using external 
	**          functions.
	** @remark  The template passed in must NOT contain any matching expressions!
	** @param 	p_timeExceeded Ipv6 packet value or template with the Time
	**			Exceeded message to be sent
	** @returns	execution status
	*/
	function f_sendTimeExceeded (in template TimeExceeded p_timeExceeded ) 
	runs on LibIpv6Node
	return FncRetCode {
		var Ipv6Packet v_ipPkt;
		v_ipPkt.timeExceeded := valueof(p_timeExceeded);
		//calc payloadLen
		v_ipPkt.timeExceeded.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
		//set checksum to zero
		v_ipPkt.timeExceeded.checksum := c_2ZeroBytes;
		//calc checksum
		v_ipPkt.timeExceeded.checksum := fx_icmpv6Checksum(v_ipPkt);
		//send
		ipPort.send(v_ipPkt.timeExceeded);
		
		return e_success;
		
	} // end f_sendTimeExceeded

	/*
	** @desc  	This sends an ICMPv6 Packet Too Big message to 
	**          any IUT. Prior it modifies IPv6 packet payload length 
	**			and ICMPv6 checksum to their correct values using external 
	**          functions.
	** @remark  The template passed in must NOT contain any matching expressions!
	** @param 	p_parameterProblem Ipv6 packet value or template with the Parameter
	**			Problem message to be sent
	** @returns	execution status
	*/
	function f_sendParameterProblem (in template ParameterProblem p_parameterProblem ) 
	runs on LibIpv6Node
	return FncRetCode {
		var Ipv6Packet v_ipPkt;
		v_ipPkt.parameterProblem := valueof(p_parameterProblem);
		//calc payloadLen
		v_ipPkt.parameterProblem.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
		//set checksum to zero
		v_ipPkt.parameterProblem.checksum := c_2ZeroBytes;
		//calc checksum
		v_ipPkt.parameterProblem.checksum := fx_icmpv6Checksum(v_ipPkt);
		//send
		ipPort.send(v_ipPkt.parameterProblem);
		
		return e_success;
		
	} // end f_sendParameterProblem

peter's avatar
peter committed
} // end module LibIpv6_Rfc2463Icmpv6_Functions