LibIpv6_ExternalFunctions.ttcn 5.1 KB
Newer Older
alex's avatar
alex committed
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc		This module collects external functions available
 *              to any function implementation in the IPv6 lirbary or
 *              ATS. Notice that the test case execution is only possible
 *              if a Platform Adapter with their implementation is used
 *              by the test system.
 */
 module LibIpv6_ExternalFunctions {
	
	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	import from LibCommon_VerdictControl all;
alex's avatar
alex committed
	//LibIpv6
	import from LibIpv6_CommonRfcs_TypesAndValues { type all };
	import from LibIpv6_Interface_TypesAndValues all;
alex's avatar
alex committed

	/* @desc    This external function calculates the payload length
	 *			of a IPv6 packet
	 * @param   p_msg Ipv6 packet
	 * @return  payload length in bytes
alex's avatar
alex committed
	*/
seb's avatar
seb committed
	external function fx_payloadLength( in template Ipv6Packet p_msg ) 
alex's avatar
alex committed
	return UInt16;
	
	/* @desc    This external function calculates the payload length
	 *			of a IPv6 packet
	 * @param   p_msg Ipv6 packet
	 * @param   p_entry Nr of Tunnelled packet within the IPv6Packet
	 * @return  payload length in bytes
	*/
	external function fx_tunnelledPayloadLength( template Ipv6Packet p_msg, in UInt8 p_entry ) 
	return UInt16;
alex's avatar
alex committed

	/* @desc	This external function calculates the checksum for any
	 *         	IPv6 packet which contains an ICMP message as its payload.
	 *			If ICMP message contains DestOptionHdr with HomeAddress, then checksum is calculated
	 *			by using this home address as entry for source address.
	 * @param  p_packet ICMPv6 packet 
	 * @return checksum value 
alex's avatar
alex committed
	*/
seb's avatar
seb committed
	external function fx_icmpv6Checksum( in template Ipv6Packet p_packet) 
alex's avatar
alex committed
	return Oct2;
validator's avatar
""  
validator committed
	
seb's avatar
seb committed
	external function fx_encodeMessage (in template Ipv6Packet p_msg)
validator's avatar
""  
validator committed
	return octetstring;
alex's avatar
alex committed

	/* @desc   This external function calculates the checksum for MIPv6 Header.
	 *	       If HomeAddressOption present, then this external function is called with the
	 *		   HomeAddress as Source Address
	 * @param  p_srcAddr Source Address to be used for Checksum calculation
	 * @param  p_dstAddr MobileHeader
	 * @param  p_mobileHeader MobileHeader
	 * @return MIPv6 Header checksum
	*/
	external function fx_mipHeaderChecksum( in Ipv6Address p_srcAddr,
											in Ipv6Address p_dstAddr,
	return Oct2;

	/* @desc   This external function calculates the length of MIPv6 Header.
	 * @return MIPv6 Header length
	*/
	external function fx_mipHeaderLength( in  MobileHeader p_mobileHeader) 
	return UInt8;

	/* @desc   This external function calculates the length of DstOptHeader .
	 * @param  p_extHdr Extension header
	 * @return DstOpt Header length
	*/
//	external function fx_dstOptHdrLength( in  ExtensionHeader p_extHdr) 
//	return UInt8;


	/* @desc    Apply indicated Integrity algorithm to the message. Message is an octetstring.
	 *			If e_sha1_96 is chosen, then the key input shall be ignored.
	 *			
	 * @param  p_integrityAlgo Cryptographic function used to compute MAC
	 * @param  p_key Key used to compute the MAC
	 * @param  p_message Octetstring message
	 * @return Message HMAC
	external function fx_mac( IntegrityAlgo p_integrityAlgo, in octetstring p_key, in octetstring p_message) 
	return octetstring;
mullers's avatar
mullers committed


	//p_message := SPI & SEQNr & IV & encrypted data
	//* @param 	p_spi Security parameter Index whihc poinst to the SAD to be used
	external function fx_integrity(in UInt31 p_spi, in octetstring p_key, in octetstring p_message) 
	return octetstring;
	/* @desc 	This external function runs the MobileHeader through Codec and returns 
	 *			the octetstring representing the MobileHeader
	 * @param 	p_mobileHeader Mip Header to be encoded to octetstring
	 * @return 	octetstring
	*/
	external function fx_mipHdrToOct(MobileHeader p_mobileHeader)
	return octetstring;
mullers's avatar
mullers committed
	/* @desc 	This external function byte aligns the EspPayload (Iv, EspIpDatagram, TfcPadding) + next Header + pad Length
	*			with padding according to the byteBoundary set by the encryption algo.
	*			The nextHeader is of constant size 1 octet,
	*			and is therefore no input parameter to this external function.
	*			The padLnength is of constant size 1 octet,
	*			and is therefore no input parameter to this external function.
	*			
	* @param 	p_spi Security parameter Index whihc poinst to the SAD to be used
	 * @param 	p_espPayload EspPayload to be byteAligned
	 * @return 	octetstring
	*/
	external function fx_generatePadding(in UInt31 p_spi, EspPayload p_espPayload)
	return octetstring;

	/* @desc 	This external function encrypts the EspPayload(except iv) + padding + padLen + nextHeader 
	 *
	 * @param 	p_spi Security parameter Index whihc poinst to the SAD to be used
	 * @param 	p_espHeader Esp Header to be encoded to octetstring
	 * @return 	octetstring Is used for calculating the ICV
	*/
	external function fx_encrypt(in UInt31 p_spi, in EspHeader p_espHeader)
	return octetstring;

mullers's avatar
mullers committed
	external function fx_setSecurityParameters(in Sa p_sa)
	return FncRetCode;

alex's avatar
alex committed
}// end module LibIpv6_ExternalFunctions