Commit f103dd2a authored by schmitting's avatar schmitting
Browse files

Another day of work on RFC2765 done

parent 7c5f440d
Loading
Loading
Loading
Loading
+92 −0
Original line number Original line Diff line number Diff line
@@ -46,6 +46,30 @@ module LibIpv6_Rfc2463Icmpv6_Templates {
			}
			}
		}
		}


		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *	@param  p_dst Binary IPv6 address associated with NUT.
		 *	@param  p_icmpCode ICMPv6 type to be used
		 *	@param  p_data data in ICMPv6 Destination Unreachable message.
		*/
		template DestinationUnreachable m_destUnreachable_noExtHdr(
			template Ipv6Address p_src,
			template Ipv6Address p_dst,
			UInt8 p_icmpCode,
			octetstring p_data) := {
			ipv6Hdr := m_ipHdr_nextHdr_srcDst(c_icmpHdr, p_src, p_dst),
			extHdrList := omit,
			ipv6Payload := {
				destinationUnreachableMsg := {
					icmpType := c_destinationUnreachableMsg,
					icmpCode := p_icmpCode,
					checksum := c_2ZeroBytes,
					unused := '00000000'O,
					data := p_data }
			}
		}

		/*
		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *          test component.
@@ -841,6 +865,28 @@ module LibIpv6_Rfc2463Icmpv6_Templates {
			}
			}
		}
		}


		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *	@param  p_dst Binary IPv6 address associated with NUT.
		 *	@param  p_data data in ICMPv6 Destination Unreachable message.
		*/
		template PacketTooBig m_packetTooBig_noExtHdr(
			template Ipv6Address p_src,
			template Ipv6Address p_dst,
			octetstring p_data) := {
			ipv6Hdr := m_ipHdr_nextHdr_srcDst(c_icmpHdr, p_src, p_dst),
			extHdrList := omit,
			ipv6Payload := {
				packetTooBigMsg := {
					icmpType := c_packetTooBigMsg,
					icmpCode := c_icmpCode0,
					checksum := c_2ZeroBytes,
					mtu := c_mtu1280,
					data := p_data }
			}
		}

		/*
		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *          test component.
@@ -937,6 +983,30 @@ module LibIpv6_Rfc2463Icmpv6_Templates {
			}
			}
		}
		}


		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *	@param  p_dst Binary IPv6 address associated with NUT.
		 *	@param  p_icmpCode ICMPv6 type to be used
		 *	@param  p_data data in ICMPv6 Destination Unreachable message.
		*/
		template ParameterProblem m_parameterProblem_noExtHdr(
			template Ipv6Address p_src,
			template Ipv6Address p_dst,
			UInt8 p_icmpCode,
			octetstring p_data) := {
			ipv6Hdr := m_ipHdr_nextHdr_srcDst(c_icmpHdr, p_src, p_dst),
			extHdrList := omit,
			ipv6Payload := {
				parameterProblemMsg := {
					icmpType := c_parameterProblemMsg,
					icmpCode := p_icmpCode,
					checksum := c_2ZeroBytes,
					pointer := c_icmpPointer24, //arbitrary pointer value
					data := p_data }
			}
		}

		/*
		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *          test component.
@@ -1079,6 +1149,28 @@ module LibIpv6_Rfc2463Icmpv6_Templates {
			}
			}
		}
		}


		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *	@param  p_dst Binary IPv6 address associated with NUT.
		 *	@param  p_data data in ICMPv6 Destination Unreachable message.
		*/
		template TimeExceeded m_timeExceeded_noExtHdr(
			template Ipv6Address p_src,
			template Ipv6Address p_dst,
			octetstring p_data) := {
			ipv6Hdr := m_ipHdr_nextHdr_srcDst(c_icmpHdr, p_src, p_dst),
			extHdrList := omit,
			ipv6Payload := {
				timeExceededMsg := {
					icmpType := c_timeExceededMsg,
					icmpCode := c_icmpCode0,
					checksum := c_2ZeroBytes,
					unused := 0,
					data := p_data }
			}
		}

		/*
		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *          test component.
+287 −0
Original line number Original line Diff line number Diff line
@@ -507,6 +507,70 @@


	} // end f_waitTranslatedPacketNoFragmentHeader
	} // end f_waitTranslatedPacketNoFragmentHeader


	/*
	 * @desc 	This checks that a translated IPv4 packet is received.
	 * @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	 * @param 	p_icmpType ICMPv4 packet to expect 
	 * @param	p_paramsRelayRt01 Address Information of Test Node 1
	 * @param	p_paramsHs02 Address Information of Test Node 2
	*/
	function f_waitTranslatedPacket_4(
		UInt8 p_icmpType,
		template Ipv6NodeParams p_paramsRelayRt01,
		template Ipv6NodeParams p_paramsHs02
	)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;

		tc_ac.start;
		alt {
			[p_icmpType == c_icmpType_ipv4EReq]	ipv4Port.receive(mw_ipv4EchoRequest_noData (
														p_paramsHs02.ipv4Addr,
														p_paramsRelayRt01.ipv4Addr))

			{
					tc_ac.stop;
					v_ret:= e_success;
			}

			[p_icmpType == c_icmpType_ipv4ERep]	ipv4Port.receive(mw_ipv4EchoReply_noData (
														p_paramsHs02.ipv4Addr,
														p_paramsRelayRt01.ipv4Addr))

			{
					tc_ac.stop;
					v_ret:= e_success;
			}

			[p_icmpType == c_icmpType_ipv4TiEx]	ipv4Port.receive(mw_ipv4TimeExceeded (
														p_paramsHs02.ipv4Addr,
														p_paramsRelayRt01.ipv4Addr))

			{
					tc_ac.stop;
					v_ret:= e_success;
			}

			[p_icmpType == c_icmpType_ipv4PPro]	ipv4Port.receive(mw_ipv4ParameterProblem (
														p_paramsHs02.ipv4Addr,
														p_paramsRelayRt01.ipv4Addr))

			{
					tc_ac.stop;
					v_ret:= e_success;
			}

			[]	tc_ac.timeout{
					log("**** f_waitTranslatedPacket_4: Timeout, no message received. ****");
				}		
		} // end alt

		return v_ret;

	}//end f_waitTranslatedPacket_4

	/*
	/*
	 * @desc 	This checks that a translated packet is received. 
	 * @desc 	This checks that a translated packet is received. 
	 * @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	 * @remark  Time limit is defined by module parameter PX_TAC (see comp type)
@@ -758,6 +822,45 @@


	}//end f_sendPacketForTranslate_4
	}//end f_sendPacketForTranslate_4


	/*
	 * @desc 	An ICMPv6 packet with parametrized type is sent.
	 * @param	p_icmpType ICMPv6 packet to send
	 * @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_sendPacketForTranslate_6(UInt8 p_icmpType,
										template Ipv6Address 	p_llaAddrTn,
								  		template Ipv6Address 	p_llaAddrNut)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;

		if (p_icmpType == c_echoRequestMsg)
		{
			v_ret := f_sendEchoRequest( m_echoRequest_noExtHdr_noData(p_llaAddrTn,
																   	  p_llaAddrNut,
																   	  c_defId,
																      c_defSeqNo));
		}

		if (p_icmpType == c_echoReplyMsg)
		{
			v_ret := f_sendEchoReply( m_echoReply_noExtHdr_noData(p_llaAddrTn,
																  p_llaAddrNut,
																  c_defId,
																  c_defSeqNo));
		}

		if(v_ret != e_success) {
			log("**** f_sendPacketForTranslate_6: Error:  Problem while sending ICMPv6 message. ****");
		}

		return v_ret;

	} // end f_sendPacketForTranslate_6

	/*
	/*
	 * @desc 	An ICMPv4 packet with unexpired source route option is sent.
	 * @desc 	An ICMPv4 packet with unexpired source route option is sent.
	 *          A Destination Unreachabel message may optionally be received.
	 *          A Destination Unreachabel message may optionally be received.
@@ -804,6 +907,44 @@


	}//end f_sendPacketSourceOption_4
	}//end f_sendPacketSourceOption_4


	/*
	 * @desc 	This checks that a translated Destination Unreachable message is received. 
	 * @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	 * @param 	p_icmpCode ICMPv4 code to expect in Destination Unreachable message
	 * @param	p_paramsRelayRt01 Address Information of Test Node 1
	 * @param	p_paramsHs02 Address Information of Test Node 2
	*/
	function f_waitTranslatedDestinationUnreachable_4(
		UInt8 p_icmpCode,
		template Ipv6NodeParams p_paramsRelayRt01,
		template Ipv6NodeParams p_paramsHs02
	)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;

		tc_ac.start;
		alt {
			[]	ipv4Port.receive(mw_ipv4DestinationUnreachable (
									p_paramsHs02.ipv4Addr,
									p_paramsRelayRt01.ipv4Addr,
									p_icmpCode))

			{
					tc_ac.stop;
					v_ret:= e_success;
			}

			[]	tc_ac.timeout{
					log("**** f_waitTranslatedDestinationUnreachable_4: Timeout, no message received. ****");
				}		
		} // end alt

		return v_ret;

	}//end f_waitTranslatedDestinationUnreachable_4

	/*
	/*
	 * @desc 	This checks that a translated Destination Unreachable message is received. 
	 * @desc 	This checks that a translated Destination Unreachable message is received. 
	 * @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	 * @remark  Time limit is defined by module parameter PX_TAC (see comp type)
@@ -887,6 +1028,152 @@


	}//end f_sendDestinationUnreachableForTranslate_4
	}//end f_sendDestinationUnreachableForTranslate_4


	/*
	 * @desc 	This sends an IPv6 DestinationUnreachable message. 
	 * @param 	p_icmpCode ICMPv6 code to expect 
	 * @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_sendDestinationUnreachableForTranslate_6(UInt8 p_icmpCode,
														template Ipv6Address 	p_llaAddrTn,
								  				 		template Ipv6Address 	p_llaAddrNut)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;
		var EchoReply v_echoReply;
		var Ipv6Packet v_ip_ER;
		var octetstring v_data;

		v_echoReply := valueof(m_echoReply_noExtHdr_noData (
											p_llaAddrNut,
											p_llaAddrTn,
											c_defId,
											c_defSeqNo) );
		v_ip_ER := v_echoReply;
		v_data := fx_encodeMessage(v_ip_ER);

		v_ret := f_sendDestUnreachable( m_destUnreachable_noExtHdr( p_llaAddrTn,
														   			p_llaAddrNut,
														  			p_icmpCode,
														   			v_data));
		if(v_ret != e_success) {
			log("**** f_sendDestinationUnreachableForTranslate_6: Error:  Problem in f_sendDestUnreachable. ****");
		}

		return v_ret;

	} // end f_sendDestinationUnreachableForTranslate_6

	/*
	 * @desc 	This sends an IPv6 ParameterProblem message. 
	 * @param 	p_icmpCode ICMPv6 code to expect 
	 * @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_sendParameterProblemForTranslate_6(UInt8 p_icmpCode,
												  template Ipv6Address 	p_llaAddrTn,
								  				  template Ipv6Address 	p_llaAddrNut)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;
		var EchoReply v_echoReply;
		var Ipv6Packet v_ip_ER;
		var octetstring v_data;

		v_echoReply := valueof(m_echoReply_noExtHdr_noData (
											p_llaAddrNut,
											p_llaAddrTn,
											c_defId,
											c_defSeqNo) );
		v_ip_ER := v_echoReply;
		v_data := fx_encodeMessage(v_ip_ER);

		v_ret := f_sendParameterProblem( m_parameterProblem_noExtHdr( p_llaAddrTn,
														     		  p_llaAddrNut,
														     		  p_icmpCode,
														     		  v_data));
		if(v_ret != e_success) {
			log("**** f_sendParameterProblemForTranslate_6: Error:  Problem in f_sendParameterProblem. ****");
		}

		return v_ret;

	} // end f_sendParameterProblemForTranslate_6

	/*
	 * @desc 	This sends an IPv6 PacketTooBig message. 
	 * @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_sendPacketTooBigForTranslate_6(template Ipv6Address 	p_llaAddrTn,
								  			  template Ipv6Address 	p_llaAddrNut)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;
		var EchoReply v_echoReply;
		var Ipv6Packet v_ip_ER;
		var octetstring v_data;

		v_echoReply := valueof(m_echoReply_noExtHdr_noData (
											p_llaAddrNut,
											p_llaAddrTn,
											c_defId,
											c_defSeqNo) );
		v_ip_ER := v_echoReply;
		v_data := fx_encodeMessage(v_ip_ER);

		v_ret := f_sendPacketTooBig( m_packetTooBig_noExtHdr( p_llaAddrTn,
														 	  p_llaAddrNut,
														 	  v_data));
		if(v_ret != e_success) {
			log("**** f_sendPacketTooBigForTranslate_6: Error:  Problem in f_sendPacketTooBig. ****");
		}

		return v_ret;

	} // end f_sendPacketTooBigForTranslate_6

	/*
	 * @desc 	This sends an IPv6 TimeExceeded message. 
	 * @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_sendTimeExceededForTranslate_6(template Ipv6Address 	p_llaAddrTn,
								  			  template Ipv6Address 	p_llaAddrNut)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;
		var EchoReply v_echoReply;
		var Ipv6Packet v_ip_ER;
		var octetstring v_data;

		v_echoReply := valueof(m_echoReply_noExtHdr_noData (
											p_llaAddrNut,
											p_llaAddrTn,
											c_defId,
											c_defSeqNo) );
		v_ip_ER := v_echoReply;
		v_data := fx_encodeMessage(v_ip_ER);

		v_ret := f_sendTimeExceeded( m_timeExceeded_noExtHdr( p_llaAddrTn,
														      p_llaAddrNut,
														      v_data));
		if(v_ret != e_success) {
			log("**** f_sendTimeExceededForTranslate_6: Error:  Problem in f_sendTimeExceeded. ****");
		}

		return v_ret;

	} // end f_sendTimeExceededForTranslate_6

	/*
	/*
	 * @desc 	This sends an IPv6 packet without fragmentation header. 
	 * @desc 	This sends an IPv6 packet without fragmentation header. 
	 * @param 	p_llaAddrTn Local link address of testing node which calls this function 
	 * @param 	p_llaAddrTn Local link address of testing node which calls this function 
+33 −0
Original line number Original line Diff line number Diff line
@@ -420,6 +420,22 @@ module LibIpv6_Rfc792Icmpv4_Templates {
			}
			}
		}
		}


		template Ipv4TimeExceeded mw_ipv4TimeExceeded(
			template Ipv4Address p_src,
			template Ipv4Address p_dst
		) := {
			ipv4Hdr := mw_ipv4Hdr_protocol_srcDst(c_protocol_icmp, p_src, p_dst),
			ipv4Payload := {
				ipv4TimeExceededMsg := {
					icmpType := c_icmpType_ipv4TiEx,
					icmpCode := c_ipv4IcmpCode0,
					checksum := ?,
					unused := ?,
					data:= ?
				}
			}
		}

		template Ipv4ParameterProblem m_ipv4ParameterProblem(
		template Ipv4ParameterProblem m_ipv4ParameterProblem(
			template Ipv4Address p_src,
			template Ipv4Address p_src,
			template Ipv4Address p_dst
			template Ipv4Address p_dst
@@ -438,6 +454,23 @@ module LibIpv6_Rfc792Icmpv4_Templates {
			}
			}
		}
		}


		template Ipv4ParameterProblem mw_ipv4ParameterProblem(
			template Ipv4Address p_src,
			template Ipv4Address p_dst
		) := {
			ipv4Hdr := mw_ipv4Hdr_protocol_srcDst(c_protocol_icmp, p_src, p_dst),
			ipv4Payload := {
				ipv4ParameterProblemMsg := {
					icmpType := c_icmpType_ipv4PPro,
					icmpCode := c_ipv4IcmpCode0,
					checksum := ?,
					pointer := ?,
					unused := ?,
					data:= ?
				}
			}
		}

	}// end ICMPv4_Other_Messages
	}// end ICMPv4_Other_Messages
	
	
} // end module LibIpv6_Rfc792Icmpv4_Templates
} // end module LibIpv6_Rfc792Icmpv4_Templates