Commit 7c5f440d authored by schmitting's avatar schmitting
Browse files

Further progress on RFC2765

parent 4d0d9fa6
Loading
Loading
Loading
Loading
+85 −1
Original line number Original line Diff line number Diff line
@@ -1484,6 +1484,34 @@ module LibIpv6_Interface_Templates {
				ipv4HdrOptions := '88040123'O // abritrary Stream Identifier option, header length = 6 * 32 bit)
				ipv4HdrOptions := '88040123'O // abritrary Stream Identifier option, header length = 6 * 32 bit)
			}
			}


			/*
			 *	@param  p_protocol Protocol value to be used.
			 *	@param  p_src Binary IPv6 address associated with the
			 *          test component.
			 *	@param  p_dst Binary IPv6 address associated with NUT.
			*/
			template Ipv4Header m_ipv4Hdr_protocol_srcDst_sourceOption(
				UInt8 p_protocol,
				template Ipv4Address p_src,
				template Ipv4Address p_dst
			) := {
				version := c_ipv4Version,
				headerLength := 7,
				typeOfService := c_defaultTos,
				totalLength := c_uInt16Zero,
				identification := c_defaultIdentification,
				reserved := c_uInt1Zero,
				doNotFragFlag := c_doNotFragFlag1,
				moreFragsFlag := c_moreFragsFlag0,
				fragmentOffset := c_uInt13Zero,
				timeToLive := c_ttl255,
				protocol := p_protocol,
				hcs := c_2ZeroBytes,
				sourceAddress := p_src,
				destinationAddress := p_dst,
				ipv4HdrOptions := '890704C0A8010100'O // abritrary unexpired source route option, header length = 7 * 32 bit)
			}

			/*
			/*
			 *	@param  p_protocol Protocol value to be used.
			 *	@param  p_protocol Protocol value to be used.
			 *	@param  p_src Binary IPv6 address associated with the
			 *	@param  p_src Binary IPv6 address associated with the
@@ -1496,7 +1524,7 @@ module LibIpv6_Interface_Templates {
				template Ipv4Address p_dst
				template Ipv4Address p_dst
			) := {
			) := {
				version := c_ipv4Version,
				version := c_ipv4Version,
				headerLength := ?,
				headerLength := c_defaultIhsLength,
				typeOfService := ?,
				typeOfService := ?,
				totalLength := ?,
				totalLength := ?,
				identification := ?,
				identification := ?,
@@ -1512,6 +1540,62 @@ module LibIpv6_Interface_Templates {
				ipv4HdrOptions := *
				ipv4HdrOptions := *
			}
			}


			/*
			 *	@param  p_protocol Protocol value to be used.
			 *	@param  p_src Binary IPv6 address associated with the
			 *          test component.
			 *	@param  p_dst Binary IPv6 address associated with NUT.
			*/
			template Ipv4Header mw_ipv4Hdr_protocol_noFragment(
				UInt8 p_protocol,
				template Ipv4Address p_src,
				template Ipv4Address p_dst
			) := {
				version := c_ipv4Version,
				headerLength := ?,
				typeOfService := ?,
				totalLength := 13, // 8 bytes of IPv6 payload + 5 bytes of IPv4 header
				identification := c_zeroIdentification,
				reserved := c_uInt1Zero,
				doNotFragFlag := c_doNotFragFlag1,
				moreFragsFlag := c_moreFragsFlag0,
				fragmentOffset := c_uInt13Zero,
				timeToLive := c_ttl255,
				protocol := p_protocol,
				hcs := ?,
				sourceAddress := p_src,
				destinationAddress := p_dst,
				ipv4HdrOptions := omit
			}

			/*
			 *	@param  p_protocol Protocol value to be used.
			 *	@param  p_src Binary IPv6 address associated with the
			 *          test component.
			 *	@param  p_dst Binary IPv6 address associated with NUT.
			*/
			template Ipv4Header mw_ipv4Hdr_protocol_fragment(
				UInt8 p_protocol,
				template Ipv4Address p_src,
				template Ipv4Address p_dst
			) := {
				version := c_ipv4Version,
				headerLength := ?,
				typeOfService := ?,
				totalLength := 13, // 8 bytes of IPv6 payload + 5 bytes of IPv4 header
				identification := c_zeroIdentification,
				reserved := c_uInt1Zero,
				doNotFragFlag := c_doNotFragFlag0,
				moreFragsFlag := c_moreFragsFlag0,
				fragmentOffset := c_uInt13Zero,
				timeToLive := c_ttl255,
				protocol := p_protocol,
				hcs := ?,
				sourceAddress := p_src,
				destinationAddress := p_dst,
				ipv4HdrOptions := omit
			}

		}//end ipv4HeaderTemplates
		}//end ipv4HeaderTemplates


		group ipv4PacketTemplates {
		group ipv4PacketTemplates {
+15 −0
Original line number Original line Diff line number Diff line
@@ -140,6 +140,20 @@ module LibIpv6_Interface_TypesAndValues {
			//Ipv4
			//Ipv4
			Ipv4EchoRequest,
			Ipv4EchoRequest,
			Ipv4EchoReply,
			Ipv4EchoReply,
			Ipv4InformationRequest,
			Ipv4InformationReply,
			Ipv4TimestampRequest,
			Ipv4TimestampReply,
			Ipv4MaskRequest,
			Ipv4MaskReply,
			Ipv4RouterAdvertisement,
			Ipv4RouterSolicitation,
			Ipv4Unknown,
			Ipv4DestinationUnreachable,
			Ipv4Redirect,
			Ipv4SourceQuench,
			Ipv4TimeExceeded,
			Ipv4ParameterProblem,
			Ipv4Packet
			Ipv4Packet
		}
		}
		
		
@@ -1146,6 +1160,7 @@ group ipv4Definitions {
		const UInt8 	c_ttl255 := c_uInt8Max;
		const UInt8 	c_ttl255 := c_uInt8Max;
		const Bit8 		c_defaultTos := int2bit(0,8);
		const Bit8 		c_defaultTos := int2bit(0,8);
		const Oct2		c_defaultIdentification := 'B444'O;
		const Oct2		c_defaultIdentification := 'B444'O;
		const Oct2		c_zeroIdentification := '0000'O;
		const UInt8		c_protocol_icmp := 1;
		const UInt8		c_protocol_icmp := 1;
		const UInt8		c_protocol_tunneledIpv6 := 41;
		const UInt8		c_protocol_tunneledIpv6 := 41;
		
		
+2 −2
Original line number Original line Diff line number Diff line
@@ -366,7 +366,7 @@
	 *			NUT, and does not a reply wihtin a given time limit. 
	 *			NUT, and does not a reply wihtin a given time limit. 
	 *			This function can be used to verify that the NUT is NOT 
	 *			This function can be used to verify that the NUT is NOT 
	 *			up and running.
	 *			up and running.
	 * @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	 * @remark  Time limit is defined by module parameter PX_TNOAC (see comp type)
	 * @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 
	 * @param 	p_llaAddrNut Local link address of node under test
	 * @param 	p_llaAddrNut Local link address of node under test
	 * @return 	execution status
	 * @return 	execution status
@@ -395,7 +395,7 @@
		alt {
		alt {
			[]	ipPort.receive(mw_echoReply ( 	p_llaAddrNut,
			[]	ipPort.receive(mw_echoReply ( 	p_llaAddrNut,
												p_llaAddrTn )) -> value v_echoRep {
												p_llaAddrTn )) -> value v_echoRep {
					tc_ac.stop;	
					tc_noAc.stop;	
					return e_error;
					return e_error;
				}
				}
			[]	tc_noAc.timeout{
			[]	tc_noAc.timeout{
+260 −3
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@
	import from LibIpv6_Rfc792Icmpv4_TypesAndValues all;
	import from LibIpv6_Rfc792Icmpv4_TypesAndValues all;
	import from LibIpv6_Rfc2463Icmpv6_TypesAndValues all;
	import from LibIpv6_Rfc2463Icmpv6_TypesAndValues all;
	import from LibIpv6_Rfc2463Icmpv6_Templates all;
	import from LibIpv6_Rfc2463Icmpv6_Templates all;
	import from LibIpv6_Rfc2463Icmpv6_Functions all;
	import from LibIpv6_Rfc2461NeighborDiscovery_Templates {template all};
	import from LibIpv6_Rfc2461NeighborDiscovery_Templates {template all};
	import from LibIpv6_Rfc2461NeighborDiscovery_Functions all;
	import from LibIpv6_Rfc2461NeighborDiscovery_Functions all;
	
	
@@ -564,7 +565,7 @@


	/*
	/*
	 * @desc 	This checks that no packet is received. 
	 * @desc 	This checks that no 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_TNOAC (see comp type)
	 * @return 	execution status
	 * @return 	execution status
	*/
	*/
	function f_discardPacket()
	function f_discardPacket()
@@ -573,9 +574,9 @@


		var FncRetCode v_ret := e_error;
		var FncRetCode v_ret := e_error;


		tc_ac.start;
		tc_noAc.start;
		alt {
		alt {
			[]	tc_ac.timeout{
			[]	tc_noAc.timeout{
					return e_success;
					return e_success;
			}		
			}		
		} // end alt
		} // end alt
@@ -757,6 +758,52 @@


	}//end f_sendPacketForTranslate_4
	}//end f_sendPacketForTranslate_4


	/*
	 * @desc 	An ICMPv4 packet with unexpired source route option is sent.
	 *          A Destination Unreachabel message may optionally be received.
	 * @param	p_paramsRelayRt01 Address Information of Test Node 1
	 * @param	p_paramsHs02 Address Information of Test Node 2
	*/
	function f_sendPacketSourceOption_4(
		template Ipv6NodeParams p_paramsRelayRt01,
		template Ipv6NodeParams p_paramsHs02
	)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;


		v_ret := f_sendIpv4Packet ( 
			m_ipv4EchoRequest_sourceOption (
				p_paramsRelayRt01.ipv4Addr,
				p_paramsHs02.ipv4Addr)
		);

		if(v_ret != e_success) {
			log("**** f_sendPacketSourceOption_4: Error:  Problem in f_sendIpv4Packet. ****");}

		tc_noAc.start;
		alt {
			[]	ipv4Port.receive(mw_ipv4DestinationUnreachable (
									p_paramsHs02.ipv4Addr,
									p_paramsRelayRt01.ipv4Addr,
									c_ipv4IcmpCode5)) // Source route failed
			{

					tc_noAc.stop;
					v_ret:= e_success;
			}

			[]	tc_noAc.timeout{
					return e_success;
				}		
		} // end alt

		return v_ret;

	}//end f_sendPacketSourceOption_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)
@@ -840,4 +887,214 @@


	}//end f_sendDestinationUnreachableForTranslate_4
	}//end f_sendDestinationUnreachableForTranslate_4


	/*
	 * @desc 	This sends an IPv6 packet without fragmentation header. 
	 * @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_sendPacketNoFragmentationHeader_6(template Ipv6Address 	p_llaAddrTn,
								  				 template Ipv6Address 	p_llaAddrNut)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;

		v_ret := f_sendEchoRequest( m_echoRequest_noExtHdr_noData( p_llaAddrTn,
																   p_llaAddrNut,
																   c_defId,
																   c_defSeqNo ));
		if(v_ret != e_success) {
			log("**** f_sendPacketNoFragmentationHeader_6: Error:  Problem in f_sendEchoRequest. ****");
		}

		return v_ret;

	} // end f_sendPacketNoFragmentationHeader_6

	/*
	 * @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_paramsRelayRt01 Address Information of Test Node 1
	 * @param	p_paramsHs02 Address Information of Test Node 2
	*/
	function f_waitPacketNoFragmentationHeader_4(
		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_ipv4EchoRequest_noFragmentation (
									p_paramsHs02.ipv4Addr,
									p_paramsRelayRt01.ipv4Addr))

			{
					tc_ac.stop;
					v_ret:= e_success;
			}

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

		return v_ret;

	}//end f_waitPacketNoFragmentationHeader_4

	/*
	 * @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_paramsRelayRt01 Address Information of Test Node 1
	 * @param	p_paramsHs02 Address Information of Test Node 2
	*/
	function f_waitPacketFragmentationHeader_4(
		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_ipv4EchoRequest_fragmentation (
									p_paramsHs02.ipv4Addr,
									p_paramsRelayRt01.ipv4Addr))

			{
					tc_ac.stop;
					v_ret:= e_success;
			}

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

		return v_ret;

	}//end f_waitPacketFragmentationHeader_4

	/*
	 * @desc 	This checks that a translated IPv4 packet with Source address 0.0.0.0 is received.
	 * @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	 * @param	p_paramsRelayRt01 Address Information of Test Node 1
	 * @param	p_paramsHs02 Address Information of Test Node 2
	*/
	function f_waitPacketZeroSourceAddress_4(
		template Ipv6NodeParams p_paramsHs02
	)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;

		tc_ac.start;
		alt {
			[]	ipv4Port.receive(mw_ipv4EchoRequest_noFragmentation (
									'00000000'O, // source adress = 0.0.0.0
									p_paramsHs02.ipv4Addr))

			{
					tc_ac.stop;
					v_ret:= e_success;
			}

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

		return v_ret;

	}//end f_waitPacketZeroSourceAddress_4

	/*
	 * @desc 	This sends an IPv6 packet with a parametrized header. 
	 * @param   p_nextHeader Next header identifier value to be used.
	 * @param   p_extHdrList List of extension header in the packet.
	 * @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_sendPacketHeaders_6(UInt8 p_nextHeader,
								   template ExtensionHeaderList p_extHdrList,
								   template Ipv6Address 	p_llaAddrTn,
								   template Ipv6Address 	p_llaAddrNut)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;

		v_ret := f_sendEchoRequest( m_echoRequest_extHdr_noData( p_nextHeader,
																 p_extHdrList,
																 p_llaAddrTn,
																 p_llaAddrNut,
																 c_defId,
																 c_defSeqNo ));
		if(v_ret != e_success) {
			log("**** f_sendPacketHeaders_6: Error:  Problem in f_sendEchoRequest. ****");
		}

		return v_ret;

	} // end f_sendPacketHeaders_6

	/*
	 * @desc 	This sends an IPv6 packet with a routing header with segmentsLeft set to 1. 
	 * @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_discardPacketHeaders_6(template Ipv6Address 	p_llaAddrTn,
								   	  template Ipv6Address 	p_llaAddrNut)
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret := e_error;

		v_ret := f_sendEchoRequest( m_echoRequest_extHdr_noData( 
										c_routeHdr,
										m_extHdrList_1Elem (
											m_extHdr_routingHeader (
												c_icmpHdr,
												c_routeHdrLen2,
												c_routeHdrType0,
												c_routeHdrSegmentsLeft1,
												m_routingHeaderData_ipv6AddressList_1Elem (
													p_llaAddrTn ) ) ),
										 p_llaAddrTn,
										 p_llaAddrNut,
										 c_defId,
										 c_defSeqNo ));
		if(v_ret != e_success) {
			log("**** f_discardPacketHeaders_6: Error:  Problem in f_sendEchoRequest. ****");
		}

		tc_noAc.start;
		alt {
			[]	ipPort.receive(mw_parameterProblem_code ( p_llaAddrNut,
												 		  p_llaAddrTn,
														  c_icmpCode0)) //erroneous header field encountered
			{
					tc_noAc.stop;
					v_ret:= e_success;
			}

			[]	tc_noAc.timeout{
					return e_success;
				}		
		} // end alt

		return v_ret;

	} // end f_discardPacketHeaders_6

} // end module LibIpv6_CommonTrans_Functions
} // end module LibIpv6_CommonTrans_Functions
+70 −1
Original line number Original line Diff line number Diff line
@@ -74,11 +74,62 @@ module LibIpv6_Rfc792Icmpv4_Templates {
			}
			}
		}
		}


		template Ipv4EchoRequest m_ipv4EchoRequest_sourceOption(
				template Ipv4Address p_src,
				template Ipv4Address p_dst
		) := {
			ipv4Hdr := m_ipv4Hdr_protocol_srcDst_sourceOption(c_protocol_icmp, p_src, p_dst),
			ipv4Payload := {
				ipv4EchoRequestMsg := {
					icmpType := c_icmpType_ipv4EReq,
					icmpCode := c_ipv4IcmpCode0,
					checksum := c_2ZeroBytes,
					identifier := c_defId,
					sequenceNumber := c_defSeqNo,
					data := omit
				}
			}
		}

		template Ipv4EchoRequest mw_ipv4EchoRequest_noData(
		template Ipv4EchoRequest mw_ipv4EchoRequest_noData(
			template Ipv4Address p_src,
			template Ipv4Address p_src,
			template Ipv4Address p_dst
			template Ipv4Address p_dst
		) := {
		) := {
			ipv4Hdr := m_ipv4Hdr_protocol_srcDst(c_protocol_icmp, p_src, p_dst),
			ipv4Hdr := mw_ipv4Hdr_protocol_srcDst(c_protocol_icmp, p_src, p_dst),
			ipv4Payload := {
				ipv4EchoRequestMsg := {
					icmpType := c_icmpType_ipv4EReq,
					icmpCode := c_ipv4IcmpCode0,
					checksum := ?,
					identifier := ?,
					sequenceNumber := ?,
					data := omit
				}
			}
		}

		template Ipv4EchoRequest mw_ipv4EchoRequest_noFragmentation(
			template Ipv4Address p_src,
			template Ipv4Address p_dst
		) := {
			ipv4Hdr := mw_ipv4Hdr_protocol_noFragment(c_protocol_icmp, p_src, p_dst),
			ipv4Payload := {
				ipv4EchoRequestMsg := {
					icmpType := c_icmpType_ipv4EReq,
					icmpCode := c_ipv4IcmpCode0,
					checksum := ?,
					identifier := ?,
					sequenceNumber := ?,
					data := omit
				}
			}
		}

		template Ipv4EchoRequest mw_ipv4EchoRequest_fragmentation(
			template Ipv4Address p_src,
			template Ipv4Address p_dst
		) := {
			ipv4Hdr := mw_ipv4Hdr_protocol_fragment(c_protocol_icmp, p_src, p_dst),
			ipv4Payload := {
			ipv4Payload := {
				ipv4EchoRequestMsg := {
				ipv4EchoRequestMsg := {
					icmpType := c_icmpType_ipv4EReq,
					icmpType := c_icmpType_ipv4EReq,
@@ -300,6 +351,24 @@ module LibIpv6_Rfc792Icmpv4_Templates {
			}
			}
		}
		}


		template Ipv4DestinationUnreachable mw_ipv4DestinationUnreachable(
			template Ipv4Address p_src,
			template Ipv4Address p_dst,
			UInt8 p_icmpCode
		) := {
			ipv4Hdr := mw_ipv4Hdr_protocol_srcDst(c_protocol_icmp, p_src, p_dst),
			ipv4Payload := {
				ipv4DestinationUnreachableMsg := {
					icmpType := c_icmpType_ipv4DUnr,
					icmpCode := p_icmpCode,
					checksum := ?,
					unused := ?,
					nextHopMTU := ?,
					data:= ?
				}
			}
		}

		template Ipv4Redirect m_ipv4Redirect(
		template Ipv4Redirect m_ipv4Redirect(
			template Ipv4Address p_src,
			template Ipv4Address p_src,
			template Ipv4Address p_dst
			template Ipv4Address p_dst