Commit 1a37e218 authored by berge's avatar berge
Browse files

STF320: Added T3Doc @desc for each function (cor/mob/sec/tra) as part of Mantis@880

parent 77030b20
Loading
Loading
Loading
Loading
+1088 −998
Original line number Original line Diff line number Diff line
@@ -21,6 +21,11 @@


	group calcPrefixFns {
	group calcPrefixFns {


		/*
		 * @desc 	Compute an Unique Interface ID based on a MAC Address
		 * @param	p_macAddr MAC Address
		 * @return 	Unique interface ID
		*/		
		function f_createUniqueInterfaceId ( 	
		function f_createUniqueInterfaceId ( 	
			in 	Oct6to15 p_macAddr
			in 	Oct6to15 p_macAddr
		)
		)
@@ -48,6 +53,18 @@
			
			
		}
		}


		/*
		 * @desc 	Compute link-local, global, solicited-node multicast IPv6 addresses<br>
		 * 		and MAC-Solicited-node Address, based on prefix and MAC address
		 * @param	p_macAddr MAC Address
		 * @param	p_prefix Prefix
		 * @param 	p_prefixLen Prefix Length
		 * @param	p_lla Computed link-local address
		 * @param	p_lla Computed global address
		 * @param	p_lla Computed solicited-node multicast address
		 * @param	p_lla Computed MAC solicited-node multicast address
		 * @return 	Execution status
		*/	
		function f_createIpAddresses( in Oct6to15 p_macAddr,
		function f_createIpAddresses( in Oct6to15 p_macAddr,
									in Oct16 /*Prefix*/ p_prefix,//Type changed so that NbrDsc moduel does not need to be imported 
									in Oct16 /*Prefix*/ p_prefix,//Type changed so that NbrDsc moduel does not need to be imported 
									in UInt8 p_prefixLen,
									in UInt8 p_prefixLen,
@@ -103,6 +120,13 @@
			return e_success;
			return e_success;
		}//end function f_createIpAddresses
		}//end function f_createIpAddresses


		/*
		 * @desc 	Create a Home Agent Anycast address for a given prefix
		 * @param	p_prefix Prefix
		 * @param 	p_prefixLen Prefix Length
		 * @param	p_haAca Computed HA anycast address
		 * @return 	Execution status
		*/
		function f_createHaAnycastAddress( 	in Oct16 /*Prefix*/ p_prefix,
		function f_createHaAnycastAddress( 	in Oct16 /*Prefix*/ p_prefix,
											in UInt8 p_prefixLen,
											in UInt8 p_prefixLen,
											out Ipv6Address p_haAca )
											out Ipv6Address p_haAca )
@@ -303,7 +327,11 @@


group ipSecFns {
group ipSecFns {
	
	
	//in units of octets
	/*
	 * @desc 	Get the length of ICV depending on the chosen algo
	 * @param	p_integrityAlgo Chosen integrity algo
	 * @return 	ICV length in units of octets
	*/
	function f_getIcvLen(IntegrityAlgo p_integrityAlgo)
	function f_getIcvLen(IntegrityAlgo p_integrityAlgo)
	runs on LibIpv6Node
	runs on LibIpv6Node
	return UInt8 {
	return UInt8 {
@@ -321,8 +349,11 @@ group ipSecFns {
		return 12;
		return 12;
	}
	}
	
	
	
	/*
	//in units of octets
	 * @desc 	Get the length of ICV Padding depending on the chosen algo
	 * @param	p_integrityAlgo Chosen integrity algo
	 * @return 	ICV Padding length in units of octets
	*/
	function f_getIcvPadLen(IntegrityAlgo p_integrityAlgo)
	function f_getIcvPadLen(IntegrityAlgo p_integrityAlgo)
	runs on LibIpv6Node
	runs on LibIpv6Node
	return UInt8 {
	return UInt8 {
@@ -340,7 +371,12 @@ group ipSecFns {
		return 0;
		return 0;
	}
	}


	//in units of octets
	/*
	 * @desc 	Check that an integrity key as the correct length, regarding the chosen algo
	 * @param	p_integrityAlgo Chosen intergity algo
	 * @param	p_keyLen Integrity key length in octets
	 * @return 	True if length is correct, False if not.
	*/
	function f_checkIntegrityKeyLen(IntegrityAlgo p_integrityAlgo, UInt8 p_keyLen)
	function f_checkIntegrityKeyLen(IntegrityAlgo p_integrityAlgo, UInt8 p_keyLen)
	runs on LibIpv6Node
	runs on LibIpv6Node
	return boolean {
	return boolean {
@@ -363,7 +399,11 @@ group ipSecFns {
		return true;
		return true;
	}
	}


	//in units of octets
	/*
	 * @desc 	Get the length of an integrity key depending on the chosen algo
	 * @param	p_integrityAlgo Chosen integrity algo
	 * @return 	Integrity key length in units of octets
	*/
	function f_getIntegrKeyLen( in IntegrityAlgo p_integrityAlgo)
	function f_getIntegrKeyLen( in IntegrityAlgo p_integrityAlgo)
	return UInt8 {
	return UInt8 {
		
		
@@ -398,7 +438,11 @@ group ipSecFns {


	}//end function f_getIntegrKeyLen
	}//end function f_getIntegrKeyLen


	//in units of octets
	/*
	 * @desc 	Get the length of an prf key depending on the chosen prf function
	 * @param	p_pseudoRandomFunction Chosen prf function
	 * @return 	Prf key length in units of octets
	*/
	function f_getPrfKeyLen(in PseudoRandomFunction p_pseudoRandomFunction)
	function f_getPrfKeyLen(in PseudoRandomFunction p_pseudoRandomFunction)
	return UInt8 {
	return UInt8 {


@@ -422,7 +466,11 @@ group ipSecFns {


	}//end function f_getPrfKeyLen
	}//end function f_getPrfKeyLen
			
			
	//in units of octets
	/*
	 * @desc 	Get the length of IV depending on the chosen algo
	 * @param	p_encryptionAlgo Chosen encryption algo
	 * @return 	Initialization Vector length in units of octets
	*/
	function f_getEncryptionIvLen(EncryptionAlgo p_encryptionAlgo)
	function f_getEncryptionIvLen(EncryptionAlgo p_encryptionAlgo)
	runs on LibIpv6Node
	runs on LibIpv6Node
	return UInt8 {
	return UInt8 {
@@ -469,7 +517,11 @@ group ipSecFns {
		}
		}
	}
	}


	//in units of octets
	/*
	 * @desc 	Compute random IV corresponding to the chosen algo
	 * @param	p_encryptionAlgo Chosen encryption algo
	 * @return 	Initialization Vector
	*/
	function f_getIv(EncryptionAlgo p_encryptionAlgo)
	function f_getIv(EncryptionAlgo p_encryptionAlgo)
	runs on LibIpv6Node
	runs on LibIpv6Node
	return octetstring {
	return octetstring {
@@ -520,7 +572,11 @@ group ipSecFns {
		return int2oct(float2int(int2float(20000-5000)*rnd())+5000, v_keyLen);
		return int2oct(float2int(int2float(20000-5000)*rnd())+5000, v_keyLen);
	}
	}


	//in units of octets
	/*
	 * @desc 	Get the block size corresponding to the chosen algo
	 * @param	p_encryptionAlgo Chosen encryption algo
	 * @return 	Block size in units of octets
	*/
	function f_getEncrBlockSize(EncryptionAlgo p_encryptionAlgo)
	function f_getEncrBlockSize(EncryptionAlgo p_encryptionAlgo)
	runs on LibIpv6Node
	runs on LibIpv6Node
	return UInt8 {
	return UInt8 {
@@ -567,7 +623,11 @@ group ipSecFns {
		}
		}
	}
	}


	//in units of octets
	/*
	 * @desc 	Get the block size corresponding to the chosen algo
	 * @param	p_integrityAlgo Chosen integrity algo
	 * @return 	Block size in units of octets
	*/
	function f_getIntegrBlockSize(in IntegrityAlgo p_integrityAlgo)
	function f_getIntegrBlockSize(in IntegrityAlgo p_integrityAlgo)
	runs on LibIpv6Node
	runs on LibIpv6Node
	return UInt8 {
	return UInt8 {
@@ -605,7 +665,12 @@ group ipSecFns {
		}
		}
	}
	}


	//in units of octets
	/*
	 * @desc 	Check that an encryption key as the correct length, regarding the chosen algo
	 * @param	p_encryptionAlgo Chosen encryption algo
	 * @param	p_keyLen Encryption key length in octets
	 * @return 	True if length is correct, False if not.
	*/
	function f_checkEncryptionKeyLen( EncryptionAlgo p_encryptionAlgo, UInt8 p_keyLen)
	function f_checkEncryptionKeyLen( EncryptionAlgo p_encryptionAlgo, UInt8 p_keyLen)
	runs on LibIpv6Node
	runs on LibIpv6Node
	return boolean {
	return boolean {
@@ -625,7 +690,11 @@ group ipSecFns {
		return true;
		return true;
	}
	}


	//in units of octets
	/*
	 * @desc 	Get the length of an encryption key depending on the chosen algo
	 * @param	p_encryptionAlgo Chosen encryption algo
	 * @return 	Encryption key length in units of octets
	*/
	function f_getEncrKeyLen( in EncryptionAlgo p_encryptionAlgo)
	function f_getEncrKeyLen( in EncryptionAlgo p_encryptionAlgo)
	return UInt8 {
	return UInt8 {


@@ -693,6 +762,12 @@ group ipSecFns {
		return v_key;
		return v_key;
	}//end f_createSecretKey
	}//end f_createSecretKey


	/*
	 * @desc 	Initialize security parameters (SAD, keys, algos, ...)
	 * @param	p_ipSecControl Select manual or automatic SA establishment
	 * @param	p_ipSec Select transport or Tunnel mode
	 * @return 	Execution status
	*/
	function f_init_ipSecParams (
	function f_init_ipSecParams (
		IpSecControl p_ipSecControl,
		IpSecControl p_ipSecControl,
		IpSecProtocolMode p_ipSecProtocolMode
		IpSecProtocolMode p_ipSecProtocolMode
@@ -925,6 +1000,11 @@ group ipSecFns {
		
		
	}//end f_init_ipSecParams
	}//end f_init_ipSecParams


	/*
	 * @desc 	Compute length of SA Proposal List
	 * @param	p_saProposalList SA Proposal list
	 * @return 	SA proposal list length
	*/
	function f_getLenSaProposalList(in template SaProposalList p_saProposalList)
	function f_getLenSaProposalList(in template SaProposalList p_saProposalList)
	return UInt8 {
	return UInt8 {
		var UInt8 v_len := 0;
		var UInt8 v_len := 0;
@@ -939,6 +1019,12 @@ group ipSecFns {
		
		
	}
	}


	/*
	 * @desc 	Compute length of SA Transform List
	 * @param	p_numberOfTransforms Number of Transform in the Transform list
	 * @param	p_saTransformList SA Transformlist
	 * @return 	SA transform list length
	*/
	function f_getLenSaTransformList(in UInt8 p_numberOfTransforms, in template SaTransformList p_saTransformList)
	function f_getLenSaTransformList(in UInt8 p_numberOfTransforms, in template SaTransformList p_saTransformList)
	return UInt8 {
	return UInt8 {
		var UInt8 v_len := 0;
		var UInt8 v_len := 0;
@@ -957,6 +1043,11 @@ group ipSecFns {
		
		
	}
	}


	/*
	 * @desc 	Compute length of SA Transform Attribute List
	 * @param	p_saTransformAttributeList SA Transform attribute list
	 * @return 	SA transform attribute list length
	*/
	function f_getLenSaTransformAttributeList (in template SaTransformAttributeList p_saTransformAttributeList)
	function f_getLenSaTransformAttributeList (in template SaTransformAttributeList p_saTransformAttributeList)
	return UInt8 {
	return UInt8 {
		var UInt8 v_len := 0;
		var UInt8 v_len := 0;
@@ -973,6 +1064,12 @@ group ipSecFns {
		
		
	}
	}



	/*
	 * @desc 	Compute padding length
	 * @param	p_ikeMsg IKE Message
	 * @return 	Padding length
	*/
	function f_getLenPadding(IkeMsg p_ikeMsg)
	function f_getLenPadding(IkeMsg p_ikeMsg)
	return UInt8 {
	return UInt8 {
		var UInt8 v_len := 0;
		var UInt8 v_len := 0;
@@ -985,13 +1082,6 @@ group ipSecFns {
		
		
	}
	}


//	function f_setTransformAttributeKeyLen(inout Ipv6Packet p_ipv6Packet) {
//		
//		//if (ischosen(p_ipv6Packet.IkeSaInitRequest))
//		v_activeIpv6Packet.ipv6Payload.ikeMsg
//		
//	}
	
}//end ipSecFns
}//end ipSecFns


} // end module LibIpv6_CommonRfcs_Functions
} // end module LibIpv6_CommonRfcs_Functions
+152 −145
Original line number Original line Diff line number Diff line
@@ -122,6 +122,9 @@ module LibIpv6_CommonRfcs_Templates {


	group nbrDiscOptions {
	group nbrDiscOptions {
		
		
		/*
		 *  @param  p_advInterval Advertisement Interval
    		*/
		template AdvertisementInterval m_advInterval(UInt32 p_advInterval) := {
		template AdvertisementInterval m_advInterval(UInt32 p_advInterval) := {
			icmpType := c_advertisementInterval,
			icmpType := c_advertisementInterval,
			optionLength := 1,
			optionLength := 1,
@@ -129,6 +132,10 @@ module LibIpv6_CommonRfcs_Templates {
			advInterval := p_advInterval
			advInterval := p_advInterval
		}
		}


		/*
		 *  @param  p_homeAgentPreference Home Agent preference value
		 *  @param  p_homeAgentLifetime Home Agent Lifetime
    		*/
		template HomeAgentInfo m_homeAgentInfo(	UInt16 p_homeAgentPreference,
		template HomeAgentInfo m_homeAgentInfo(	UInt16 p_homeAgentPreference,
												UInt16 p_homeAgentLifetime) := {
												UInt16 p_homeAgentLifetime) := {
			icmpType := c_homeAgentInfo,
			icmpType := c_homeAgentInfo,
+358 −327
Original line number Original line Diff line number Diff line
@@ -22,13 +22,31 @@ module LibIpv6_CommonRfcs_TypesAndValues {


	group rfc4291AddressingArchitecture {
	group rfc4291AddressingArchitecture {


		/*
		 * @desc IPv6 Address
		*/
		type Oct16 Ipv6Address;
		type Oct16 Ipv6Address;

		/*
		 * @desc IPv4 Address
		*/
		type Oct4 Ipv4Address;
		type Oct4 Ipv4Address;
		type UInt8 PrefixLength ;//indicates nr of bits to be used as Prefix

		//Unspecified address
		/*
		 * @desc Indicates the number of bits to be used as Prefix
		*/
		type UInt8 PrefixLength;

		/*
		 * @desc Unspecified address
		*/
	        const Ipv6Address c_unspecifiedAdd := c_16ZeroBytes;
	        const Ipv6Address c_unspecifiedAdd := c_16ZeroBytes;

		const UInt8	c_maxNrIpv6Address := 10;
		const UInt8	c_maxNrIpv6Address := 10;
		
		
		/*
		 * @desc List of Ipv6Address
		*/	
		type record length(1 .. c_maxNrIpv6Address) of Ipv6Address Ipv6AddressList;
		type record length(1 .. c_maxNrIpv6Address) of Ipv6Address Ipv6AddressList;
		
		
		
		
@@ -83,6 +101,10 @@ module LibIpv6_CommonRfcs_TypesAndValues {
				const UInt8 	c_optPadNLen2 := 2;
				const UInt8 	c_optPadNLen2 := 2;
				const UInt8 	c_optPadNLen4 := 4 ;
				const UInt8 	c_optPadNLen4 := 4 ;


				/*
				 * @desc Derived from RFC2460 clause 4.2 
				 * @url http://www.ietf.org/rfc/rfc2460.txt
				*/			
				type record OptPad1 {
				type record OptPad1 {
					UInt8 			optType(c_optPad1)
					UInt8 			optType(c_optPad1)
				}
				}
@@ -90,6 +112,10 @@ module LibIpv6_CommonRfcs_TypesAndValues {
					encode "present=bytes(0,1,0);intTag='hdrExtIntLen',getIntTag('hdrExtIntLen')-1";
					encode "present=bytes(0,1,0);intTag='hdrExtIntLen',getIntTag('hdrExtIntLen')-1";
				}
				}


				/*
				 * @desc Derived from RFC2460 clause 4.2 
				 * @url http://www.ietf.org/rfc/rfc2460.txt
				*/	
				type record OptPadN {
				type record OptPadN {
					UInt8 			optType(c_optPadN),
					UInt8 			optType(c_optPadN),
					UInt8 			optLen,
					UInt8 			optLen,
@@ -107,7 +133,9 @@ module LibIpv6_CommonRfcs_TypesAndValues {


				const UInt8	c_maxNrDestOption := 10;
				const UInt8	c_maxNrDestOption := 10;


				/* @remark In a DestOptionList value either the pad1 or padN 
				/* 
				 * @desc   List of DestOption
				 * @remark In a DestOptionList value either the pad1 or padN 
				 *         option can appear only once!
				 *         option can appear only once!
			        */
			        */
				type set length (1..c_maxNrDestOption) of DestOption   DestOptionList
				type set length (1..c_maxNrDestOption) of DestOption   DestOptionList
@@ -115,6 +143,9 @@ module LibIpv6_CommonRfcs_TypesAndValues {
					encode "elements=valueOf(getTag('hdrExtLen'));"
					encode "elements=valueOf(getTag('hdrExtLen'));"
				}
				}


				/*
				*   @desc Ipv6 Destination Options
				*/
				type union DestOption {
				type union DestOption {
					OptPad1					pad1 ,
					OptPad1					pad1 ,
					OptPadN					padN ,
					OptPadN					padN ,
+1260 −1246
Original line number Original line Diff line number Diff line
@@ -322,6 +322,13 @@ group rfc2460Root_Functions {


	}//end group extHdrFns
	}//end group extHdrFns


	/*
	 * @desc 	Compute the payload checksum
	 * @param 	p_srcAddr Source address, needed to create pseudo header
	 * @param 	p_dstAddr Destination address, needed to create pseudo header
	 * @param 	p_ipv6Payload Payload used for computing checksum
	 * @return 	execution status 
	*/
	function f_calcIpv6PayloadChecksum( in template Ipv6Address p_srcAddr,	
	function f_calcIpv6PayloadChecksum( in template Ipv6Address p_srcAddr,	
										in template Ipv6Address p_dstAddr, 
										in template Ipv6Address p_dstAddr, 
										inout Ipv6Payload p_ipv6Payload)
										inout Ipv6Payload p_ipv6Payload)
@@ -639,7 +646,14 @@ group rfc3775Mipv6_ExtHdrFunctions {
		return e_success;
		return e_success;
	}
	}
		
		

	/*
	 * @desc 	Checks that the Authenticator of a mobile message is correct
	 * @param 	p_srcAddr Source address of the received packet
	 * @param 	p_dstAddr Destination address of the received packet
	 * @param 	p_mobileHeader Mobile Header of the received packet
	 * @param 	p_receivedAuthenticator Received Authenticator to be compared with the computed value
	 * @return 	execution status 
	*/
	function f_checkAuthenticator (	in Ipv6Address p_srcAddr,
	function f_checkAuthenticator (	in Ipv6Address p_srcAddr,
									in Ipv6Address p_dstAddr,
									in Ipv6Address p_dstAddr,
									in MobileHeader p_mobileHeader,
									in MobileHeader p_mobileHeader,
+190 −166
Original line number Original line Diff line number Diff line
@@ -1302,15 +1302,20 @@ module LibIpv6_Interface_Templates {
	} //end group rfc4068HastHandovers_OptionTemplates
	} //end group rfc4068HastHandovers_OptionTemplates
	group rfc4302Ah_ExtHdrTemplates {
	group rfc4302Ah_ExtHdrTemplates {


			template ExtensionHeader m_extHdr_AhHeaders(UInt8 nextHeader_p, 
			/*
												UInt32 securityParametersIndex_p,
			 *	@param  p_nextHeader Next header value
												UInt32 sequenceNumber_p) := {
			 *	@param  p_securityParametersIndex Security Parameters Index
			 *	@param  p_sequenceNumber AH sequence Number
			*/
			template ExtensionHeader m_extHdr_AhHeaders(UInt8 p_nextHeader, 
												UInt32 p_securityParametersIndex,
												UInt32 p_sequenceNumber) := {
				authHeader := {
				authHeader := {
					nextHeader := nextHeader_p,
					nextHeader := p_nextHeader,
					payloadLen := c_uInt8Zero,
					payloadLen := c_uInt8Zero,
					reserved := c_uInt16Zero,
					reserved := c_uInt16Zero,
					securityParametersIndex := securityParametersIndex_p,
					securityParametersIndex := p_securityParametersIndex,
					sequenceNumber := sequenceNumber_p,
					sequenceNumber := p_sequenceNumber,
					icv := int2oct(0,4),
					icv := int2oct(0,4),
					icvPadding := omit
					icvPadding := omit
				}
				}
@@ -1331,6 +1336,12 @@ module LibIpv6_Interface_Templates {
			ipv6Payload := p_ipv6Payload
			ipv6Payload := p_ipv6Payload
		}
		}


		/*
		 *	@param  p_spi Security Paramter Index
		 *	@param  p_seqNr ESP Sequence number
		 *	@param  p_espIpDatagram Secured payload
		 *	@param  p_nextHeader Next Header value of the first element in the secured payload
		*/
		template ExtensionHeader m_extHdr_espHeader(
		template ExtensionHeader m_extHdr_espHeader(
			in UInt32 p_spi,
			in UInt32 p_spi,
			in UInt32 p_seqNr,
			in UInt32 p_seqNr,
@@ -1351,6 +1362,13 @@ module LibIpv6_Interface_Templates {
				icv := omit}
				icv := omit}
		}
		}


		/*
		 *	@param  p_spi Security Paramter Index
		 *	@param  p_seqNr ESP Sequence number
		 *	@param  p_espIpDatagram Secured payload
		 *	@param  p_nextHeader Next Header value of the first element in the secured payload
		 *	@param  p_icv Integrity Check Value
		*/
		template ExtensionHeader m_extHdr_espHeader_icv(
		template ExtensionHeader m_extHdr_espHeader_icv(
			in UInt32 p_spi,
			in UInt32 p_spi,
			in UInt32 p_seqNr,
			in UInt32 p_seqNr,
@@ -1372,6 +1390,12 @@ module LibIpv6_Interface_Templates {
				icv := p_icv}
				icv := p_icv}
		}
		}


		/*
		 *	@param  p_spi Security Paramter Index
		 *	@param  p_seqNr ESP Sequence number
		 *	@param  p_espIpDatagram Secured payload
		 *	@param  p_nextHeader Next Header value of the first element in the secured payload
		*/
		template ExtensionHeader mw_extHdr_espHeader(
		template ExtensionHeader mw_extHdr_espHeader(
			in template UInt32 p_spi,
			in template UInt32 p_spi,
			in template UInt32 p_seqNr,
			in template UInt32 p_seqNr,
Loading