Commit 0437f91a authored by alex's avatar alex
Browse files

Initial project content

parent 9a4019e5
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc		This module specifies functions definitions
 *              based on the IPv6 meta message type.  
 *  
 */
 module LibIpv6_Rfc2460Root_Functions {

	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	import from LibCommon_VerdictControl { type FncRetCode };
	//LibIpv6
	import from LibIpv6_Rfc2460Root_Templates all;
	import from LibIpv6_Rfc2460Root_TypesAndValues all;
	import from LibIpv6_Interface all;
	import from LibIpv6_ExternalFunctions all;

	group ipv6Packets {	

		/*
		** @desc  	This sends an IPv6 epacket from an IPv6 node to 
		**          any NUT. Prior it modifies IPv6 packet payload length.
		** @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_sendIpv6Packet (in template GeneralIpv6 p_genIpv6) 
		runs on LibIpv6Node
		return FncRetCode {
			var Ipv6Packet v_ipPkt;
			v_ipPkt.generalIpv6 := valueof(p_genIpv6);
			//calc payloadLen
			v_ipPkt.generalIpv6.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
			//send
			ipPort.send(v_ipPkt.generalIpv6);

			return e_success;

        }//end f_sendIpv6Packet

    } //end group ipv6Packets
	
} // end module LibIpv6_Rfc2460Root_Functions
+310 −0
Original line number Diff line number Diff line
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc		This module specifies common template definitions
 *              for the IPv6 meta message type
 */
 module LibIpv6_Rfc2460Root_Templates {

	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	//LibIpv6
	import from LibIpv6_ExternalFunctions all;
	import from LibIpv6_ModuleParameters all ;
	import from LibIpv6_MultiRfcs_Templates all;
	import from LibIpv6_MultiRfcs_TypesAndValues all;
	import from LibIpv6_Rfc2460Root_TypesAndValues all ;
	import from LibIpv6_Rfc2462StatelessAddressAutoconf_TypesAndValues all;

	group ipv6Header{

		/*
		 *	@param  p_nextHdr Next header identifier 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 Ipv6Header m_ipHdr (	UInt8 p_nextHdr,
										template Ipv6Address p_src,
										template Ipv6Address p_dst) := {
			version 		:= c_ipv6Version ,
			trafficClass 	:= c_trafficClassZero ,
			flowLabel 		:= c_flowLabelZero ,
			payloadLength 	:= c_zeroPayloadLength,
			nextHeader 		:= p_nextHdr,
			hopLimit 		:= c_hopLimit255,
			sourceAddress 	:= p_src,
			destinationAddress := p_dst
		}

		/*
		 *	@param  p_nextHdr Next header identifier value to be used.
	    */
		template Ipv6Header mw_ipHdr (	UInt8 p_nextHdr) := {
			version 		:= c_ipv6Version ,
			trafficClass 	:= c_trafficClassZero ,
			flowLabel 		:= c_flowLabelZero ,
			payloadLength 	:= ?,
			nextHeader 		:= p_nextHdr,
			hopLimit 		:= ?,
			sourceAddress 	:= ?,
			destinationAddress := ?
		}

		/*  @desc   Template for NUT Local Link Address determination
		 *	@param  p_nextHdr Next header identifier value to be used.
		 *	@param  p_dst Binary IPv6 address associated with NUT.
	    */
		template Ipv6Header mw_ipHdr_init (	UInt8 p_nextHdr,
											template Ipv6Address p_dst) := {
			version 		:= c_ipv6Version ,
			trafficClass 	:= c_trafficClassZero ,
			flowLabel 		:= c_flowLabelZero ,
			payloadLength 	:= c_zeroPayloadLength,
			nextHeader 		:= p_nextHdr,
			hopLimit 		:= ?,
			sourceAddress 	:= ?,
			destinationAddress := p_dst
		}

		/*
		 *	@param  p_nextHdr Next header identifier value to be used.
		 *	@param  p_hopLimit Number of hops to be used.
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *	@param  p_dst Binary IPv6 address associated with NUT.
	    */
		template Ipv6Header m_ipHdr_hop (	UInt8 p_nextHdr,
											UInt8 p_hopLimit,
											template Ipv6Address p_src,
											template Ipv6Address p_dst ) := {
			version 		:= c_ipv6Version ,
			trafficClass 	:= c_trafficClassZero ,
			flowLabel 		:= c_flowLabelZero ,
			payloadLength 	:= c_zeroPayloadLength,
			nextHeader 		:= p_nextHdr,
			hopLimit 		:= p_hopLimit,
			sourceAddress 	:= p_src,
			destinationAddress := p_dst
		}

		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *	@param  p_dst Binary IPv6 address associated with NUT.
	    */
		template Ipv6Header mw_ipHdr_basic ( template Ipv6Address p_src,
											template Ipv6Address p_dst):= {
			version 		:= c_ipv6Version,
			trafficClass 	:= ? ,
			flowLabel 		:= ? ,
			payloadLength 	:= ?,
			nextHeader 		:= ?,
			hopLimit 		:= ?,
			sourceAddress 	:= p_src,
			destinationAddress := p_dst
		}

		/*
		 *	@param  p_nextHdr Next header identifier 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 Ipv6Header mw_ipHdr_srcDst (	template UInt8 p_nextHdr,
												template Ipv6Address p_src,
												template Ipv6Address p_dst) := {
			version 		:= c_ipv6Version ,
			trafficClass 	:= ? ,
			flowLabel 		:= ? ,
			payloadLength 	:= ?,
			nextHeader 		:= p_nextHdr,
			hopLimit 		:= ?,
			sourceAddress 	:= p_src,
			destinationAddress := p_dst
		}

		/*
		 *	@param  p_dst destination address for DAD.
		*/
		template Ipv6Header mw_ipHdr_src0 (Ipv6Address p_dst) := {
			version 		:= c_ipv6Version ,
			trafficClass 	:= c_trafficClassZero ,
			flowLabel 		:= c_flowLabelZero ,
			payloadLength 	:= ?,
			nextHeader 		:= c_icmpHdr,
			hopLimit 		:= ?,
			sourceAddress 	:= c_unspecifiedAdd,
			destinationAddress := p_dst
		}
// Added AF
		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *	@param  p_dst Binary IPv6 address associated with NUT.
	    */
		template Ipv6Header mw_ipHdr_srcDst_hopL255 (	template Ipv6Address p_src,
														template Ipv6Address p_dst) := {
			version 		:= c_ipv6Version ,
			trafficClass 	:= ? ,
			flowLabel 		:= ? ,
			payloadLength 	:= ?,
			nextHeader 		:= c_icmpHdr,
			hopLimit 		:= c_hopLimit255,
			sourceAddress 	:= p_src,
			destinationAddress := p_dst
		}

	}//end ipv6Header

	group extensionHeader {

		/*
		**	@param  p_extHdr First element in extension header
	    */
		template ExtensionHeaderList m_extHdrList_elemNo1 ( template ExtensionHeader p_extHdr ) := {
			p_extHdr
		}

		/*
		**	@param  p_extHdr1 First element in extension header
		**	@param  p_extHdr2 Second element in extension header
	    */
		template ExtensionHeaderList m_extHdrList_elemNo2 ( template ExtensionHeader p_extHdr1,
			template ExtensionHeader p_extHdr2
		) := {
			p_extHdr1,
			p_extHdr2
		}

		/*
		**	@param  p_nextHeader Next header identifier value to be used
		**	@param  p_hdrExtLen Length of this extension header
		**	@param  p_optionList List of options that this extension header carries
	    */
		template ExtensionHeader m_extHdr_hbhOptHeader (
			UInt8 p_nextHeader,
			UInt8 p_hdrExtLen,
			template HopByHopOptionList p_optionList
		) := {
			hopByHopHeader := {
				nextHeader := p_nextHeader,
				hdrExtLen := p_hdrExtLen,
				hopByHopOptionList := p_optionList
			}
		}

		/*
		**	@param  p_nextHeader Next header identifier value to be used
		**	@param  p_hdrExtLen Length of this extension header
		**	@param  p_optionList List of options that this extension header carries
	    */
		template ExtensionHeader m_extHdr_dstOptHeader (
			UInt8 p_nextHeader,
			UInt8 p_hdrExtLen,
			template DestOptionList p_optionList
		) := {
			destinationOptionHeader := {
				nextHeader := p_nextHeader,
				hdrExtLen := p_hdrExtLen,
				destOptionList := p_optionList
			}
		}

		/*
		**	@param  p_nextHeader Next header identifier value to be used
		**	@param  p_fragmentOffset The offset, in 8-octet units, of the
		**				data following this header, relative to the start
		**				of the Fragmentable Part of the original packet.
		**	@param  p_moreFlag indicates whether there are more segment or not
		**	@param  p_identification Id of the actual fragment
	    */
		template ExtensionHeader m_extHdr_fragmentHeader (
			UInt8 p_nextHeader,
			UInt13 p_fragmentOffset,
			UInt1 p_moreFlag,
			UInt32 p_identification
		) := {
			fragmentHeader := {
				nextHeader := p_nextHeader,
				reserved1 := c_uInt8Zero,
				fragmentOffset := p_fragmentOffset,
				reserved2 := c_uInt2Zero,
				moreFlag := p_moreFlag,
				identification := p_identification
			}
		}

		/*
		**	@param  p_nextHeader Next header identifier value to be used
		**	@param  p_hdrExtLen Length of this extension header in 8-octet units
		**	@param  p_routingType Type of the routing header
		**	@param  p_segmentsLeft Number of route segments remaining
		**	@param  p_routingHeaderData A list of IPv6 addresses
	    */
		template ExtensionHeader m_extHdr_routingHeader (
			UInt8 p_nextHeader,
			UInt8 p_hdrExtLen,
			UInt8 p_routingType,
			UInt8 p_segmentsLeft,
			template RoutingHeaderData p_routingHeaderData
		) := {
			routingHeader := {
				nextHeader := p_nextHeader,
				hdrExtLen := p_hdrExtLen,
				routingType := p_routingType,
				segmentsLeft := p_segmentsLeft,
				reserved := c_uInt32Zero,
				routingHeaderData := p_routingHeaderData
			}
		}

		group Routing_Header {

			/*
			 *	@param  p_ipv6Address First IPv6 address in the routing header
			*/
			template RoutingHeaderData m_routingHeaderData_ipv6AddressList_elemNo1 ( Ipv6Address p_ipv6Address ) := {
				ipv6AddressList := {
					p_ipv6Address
				}
			}

		} // end group Routing_Header

	} // end extensionHeader

//added by PK - begin
	group generalIpv6MessageType {

		/*
		**	@param  p_nextHeader Next header identifier value to be used.
		**	@param  p_extHdrList List of extension header in the packet.
		**	@param  p_src Binary IPv6 address associated with the
		**          test component.
		**	@param  p_dst Binary IPv6 address associated with NUT.
		**	@param  p_data Data sent in the Echo Request packet.
		*/
		template GeneralIpv6 m_generalIpv6_extHdr_data (
			UInt8 p_nextHeader,
			template ExtensionHeaderList p_extHdrList,
			template Ipv6Address p_src,
			template Ipv6Address p_dst,
			octetstring p_data
		) := {
			ipv6Hdr := m_ipHdr(p_nextHeader, p_src, p_dst),
			extHdrList := p_extHdrList,
			data:= p_data
		}

    } //end group generalIpv6MessageType

    group ipv6Address {

        template Ipv6Address mw_anyIpv6Address := ?

    } //end group ipv6Address
//added by PK - end

} // end module LibIpv6_Rfc2460Root_Templates
+196 −0
Original line number Diff line number Diff line
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc		This module defines the Ipv6 header and 
 *              extension headers defined in RFC 2460.
 *  @url        http://www.ietf.org/rfc/rfc2460.txt
 */
 module LibIpv6_Rfc2460Root_TypesAndValues {
	
	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	import from LibCommon_TextStrings all;
	//LibIpv6
	import from LibIpv6_MultiRfcs_TypesAndValues all ;

	group commonIpv6Values {
		const UInt4			c_ipv6Version := 6;
		//Unspecified address
        const Ipv6Address c_unspecifiedAdd := c_16ZeroBytes;
	}

	group HopLimits {
		const UInt8 	c_hopLimit0:= 0;
		const UInt8 	c_hopLimit1:= 1;
		const UInt8 	c_hopLimit5:= 5;
		const UInt8 	c_hopLimit255:= 255;
	}

 	group extHdrValues {
	 	const UInt16	c_ipv6PayloadLength0 := 0;
		const UInt13	c_fragOffset0 := 0;
		const UInt13	c_fragOffset2 := 2;
		const UInt1		c_noMoreFragments := 0;
		const UInt1		c_moreFragments := 1;
		const UInt32	c_fragmentId1 := 1;
		const float		c_fragReassemblyTimeout := 60.0;
		const UInt8		c_routeHdrLen2 := 2;
		const UInt8		c_routeHdrLen3 := 3;
		const UInt8		c_routeHdrSegmentsLeft0 := 0;
		const UInt8		c_routeHdrSegmentsLeft1 := 1;
		const UInt8		c_routeHdrSegmentsLeft2 := 2;
		const UInt8		c_routeHdrType0 := 1;
	}//end group extHdrValues


	group ipv6HeaderRelatedTypes {

		/*
		** @desc Derived from RFC 2460 Section 3
		** @url http://www.ietf.org/rfc/rfc2460.txt
		*/
		type record Ipv6Header 	{
			UInt4 		version,
			UInt8   	trafficClass,
			UInt20		flowLabel, 
			UInt16		payloadLength,
			UInt8		nextHeader,
			UInt8	 	hopLimit,
			Ipv6Address	sourceAddress,
			Ipv6Address destinationAddress
		}
		with {
			encode (payloadLength) "intTag=\"IPv6Header_payloadLength\";";
			encode (nextHeader) "tag=\"nextHeader\";";
		}
		
	} // end ipv6HeaderRelatedTypes

	group extensionHeaders {

		type set length(1 .. c_maxIpv6ExtHdrs) of ExtensionHeader ExtensionHeaderList
		with {
			encode "present=isEOF()== false && ((valueOf(dec.getTag(\"nextHeader\"))==0) || (valueOf(dec.getTag(\"nextHeader\"))==43) || (valueOf(dec.getTag(\"nextHeader\"))==44) || (valueOf(dec.getTag(\"nextHeader\"))==60) || (valueOf(dec.getTag(\"nextHeader\"))==51) || (valueOf(dec.getTag(\"nextHeader\"))==50) || (valueOf(dec.getTag(\"nextHeader\"))==41))";
		}
		
		/*
		** @desc Mainly derived from many RFC 2460
		**       Extension headers defined by other RFCs 
		**       are in LibIpv6_MultiRfcs_TypesAndValues
		** @see  LibIpv6_MultiRfcs_TypesAndValues.SharedExtensionHeaders
		*/
		type union ExtensionHeader {
			HopByHopHeader 		hopByHopHeader,
			RoutingHeader		routingHeader,
			FragmentHeader		fragmentHeader,
			DestOptionHeader 	destinationOptionHeader,
			Ipv6Header			tunnelIPv6/*,
			MobilityHeader		mobilityHeader,
			AuthHeader			authHeader,
			EspHeader			espHeader,
			OtherIpv6ExtHdr		otherHeader
*/
		} 
		with {
			encode "present=isEOF()== false && ((valueOf(dec.getTag(\"nextHeader\"))==0) || (valueOf(dec.getTag(\"nextHeader\"))==43) || (valueOf(dec.getTag(\"nextHeader\"))==44) || (valueOf(dec.getTag(\"nextHeader\"))==60) || (valueOf(dec.getTag(\"nextHeader\"))==51) || (valueOf(dec.getTag(\"nextHeader\"))==50) || (valueOf(dec.getTag(\"nextHeader\"))==41))";
		}

		/*
		** @desc Derived from  RFC 2460 Section 4.3
		*/
		type record HopByHopHeader {
			UInt8			nextHeader,
			UInt8			hdrExtLen,
			HopByHopOptionList 	hopByHopOptionList
		} 
		with {
			encode "present=(valueOf(getTag(\"nextHeader\")) == 0);";
			encode (nextHeader) "tag=\"nextHeader\";";
			encode (hdrExtLen) "tag=\"hdrExtLen\";";
			encode (hdrExtLen) "intTag=\"hdrExtIntLen\";intTag=\"IPv6Header_payloadLength\",getIntTag(\"IPv6Header_payloadLength\")-";
		}
		

		/*
		** @desc Derived from RFC 2460 Section 4.4
		*/
		type record RoutingHeader {
			UInt8				nextHeader,
			UInt8				hdrExtLen,
			UInt8				routingType,
			UInt8				segmentsLeft,
			UInt32              reserved,
			RoutingHeaderData	routingHeaderData optional
		}
		with {
			encode "present=(valueOf(getTag(\"nextHeader\")) == 43);";
			encode (nextHeader) "tag=\"nextHeader\";";
			encode (hdrExtLen) "tag=\"hdrExtLen\";";
			encode (hdrExtLen) "intTag=\"IPv6Header_payloadLength\",getIntTag(\"IPv6Header_payloadLength\")-";
			encode (routingType) "tag=\"routingType\";";
		}
		
		/*
		** @remark A RoutingHeaderData value should be only 
		**         set to ipv6AddressList when routingType==0 
		**		   and to mipDate when 2 (Length req. to be checked!!)
		*/
		type union RoutingHeaderData{
			Ipv6AddressList	ipv6AddressList,
			MipData			mipData
		}
		
		type octetstring MipData ;

		/*
		** @desc Derived from RFC 2460  Section 4.5
		*/
		type record FragmentHeader {
			UInt8	nextHeader,
			UInt8	reserved1,
			UInt13	fragmentOffset,
			UInt2	reserved2,
			UInt1	moreFlag,
			UInt32	identification 
		}
		with {
			encode "present=(valueOf(getTag(\"nextHeader\")) == 44);";
			encode (nextHeader) "tag=\"nextHeader\";";
			encode (nextHeader) "intTag=\"IPv6Header_payjoadLength\",getIntTag(\"IPv6Header_payloadLength\")-8";
		} 
		
	
		/*
		** @desc Derived from RFC 2460  Section 4.6
		*/
		type record DestOptionHeader {
			UInt8			nextHeader,
			UInt8			hdrExtLen,
			DestOptionList 	destOptionList 
		}
		with {
			encode "present=(valueOf(getTag(\"nextHeader\")) == 60);";
			encode (nextHeader) "tag=\"nextHeader\";";
			encode (hdrExtLen) "tag=\"hdrExtLen\";";
			encode (hdrExtLen) "intTag=\"IPv6Header_payloadLength\",getIntTag(\"IPv6Header_payloadLength\")-";
		} 
		
	} // end extensionHeaders 
	
//added by PK - begin
	group generalIpv6MessageType {	

		/*
		** @desc PDU type derived from RFC2460
		*/
		type record GeneralIpv6 {
			Ipv6Header			ipv6Hdr,
			ExtensionHeaderList extHdrList optional,
			octetstring	data optional
        }

    } //end group generalIpv6MessageType
//added by PK - end

} // end module LibIpv6_Rfc2460Root_TypesAndValues
+180 −0
Original line number Diff line number Diff line
/*
 *	@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
+116 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading