Newer
Older
/*
* @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;
import from LibIpv6_CommonRfcs_TypesAndValues { type all };
import from LibIpv6_Interface_TypesAndValues all;
import from LibIpv6_Interface_TypesAndValues all;
/* @desc This external function calculates the payload length
* of a IPv6 packet
* @param p_msg Ipv6 packet
* @return payload length in bytes
external function fx_payloadLength( in template Ipv6Packet p_msg )
/* @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;
/* @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
external function fx_icmpv6Checksum( in template Ipv6Packet p_packet)
external function fx_encodeMessage (in template Ipv6Packet p_msg)
/* @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 MipHeader
* @param p_mipHeader MipHeader
* @return MIPv6 Header checksum
*/
external function fx_mipHeaderChecksum( in Ipv6Address p_srcAddr,
in Ipv6Address p_dstAddr,
in MipHeader p_mipHeader)
return Oct2;
/* @desc This external function calculates the length of MIPv6 Header.
* @param p_mipHeader MipHeader
* @return MIPv6 Header length
*/
external function fx_mipHeaderLength( in MipHeader p_mipHeader)
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 encryption algorithm to the message.
*
* @param p_crypto 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_encrypt( EncryptionAlgo p_encryptionAlgo, in octetstring p_key, in octetstring p_message)
// return octetstring;
external function fx_encrypt( in IpSecProtocolMode p_ipSecProtocolMode,
in EncryptionAlgo p_encryptionAlgo,
in octetstring p_key,
in PlaintextData p_plaintextData,
out EncryptResult p_encryptResult)
return FncRetCode;
external function fx_decrypt( in UInt8 p_ivLength,
in UInt8 p_icvLength,
in IpSecProtocolMode p_ipSecProtocolMode,
in EncryptionAlgo p_encryptionAlgo,
in octetstring p_key,
in octetstring p_encryptedMsg,
out PlaintextData p_plaintextData)
return FncRetCode;
/* @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
external function fx_integrity( IntegrityAlgo p_integrityAlgo, in octetstring p_key, in octetstring p_message)
return octetstring;
/* @desc Apply indicated Integrity algorithm to the message. Message can only be an EspHeader.
* 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_espHeader EspHeader
* @param p_integrityResult Result of Integrity function
* @return Message HMAC
external function fx_integrityEspHdr( in IntegrityAlgo p_integrityAlgo,
in octetstring p_key,
in EspHeader p_espHeader,
out IntegrityResult p_integrityResult)
return FncRetCode;
/* @desc This external function runs the MipHeader through Codec and returns
* the octetstring representing the MipHeader
*
* @param p_mipHeader MIp Header to be encoded to octetstring
* @return octetstring
*/
external function fx_mipHdrToOct(MipHeader p_mipHeader)
return octetstring;
/* @desc This external function computes Integrity Check Value
* @param p_ipv6Packet Ipv6 Packet
* @param p_sa Security association
* @return Integrity Check Value
*/
external function fx_integrityCheckValue( in Ipv6Packet p_ipv6Packet,
in octetstring p_sa,
out octetstring p_result)
return FncRetCode;
/* @desc This external function returns the padding octets that
* are needed to align to a given Byte Boundary.
* Example: Byte Boundary == 4
* If lenghtof EspHeader is 3, then result = 1
* @param p_byteBoundary Align to a multiple of this value
* @param p_espHeader ESP-HDR to be aligned
* @return Padding needed to align
*/
external function fx_byteAlignEspHeader( in UInt8 p_byteBoundary,
in EspHeader p_espHeader,
out octetstring p_result)
return FncRetCode;