/**
 * @author	STF 424_ITS_Test_Platform
 * @version	$id$
 */
package org.etsi.its.extfunc;

import org.etsi.ttcn.tci.CharstringValue;
import org.etsi.ttcn.tci.FloatValue;
import org.etsi.ttcn.tci.IntegerValue;
import org.etsi.ttcn.tci.OctetstringValue;

/** 
 * This interface provides the list of the TTCN-3 external function to be implemented
 * 
 * Refer to TTCN-3 modules LibItsGeoNetworking_Functions and LibItsCommon_Functions
 */
public interface IItsExternalFunctionsProvider {

	/**
	 * This external function gets the current time
	 * @return The current time in Epoch format
	 * 
	 * TTCN-3 signature:
	 * external function fx_getCurrentTime() return TimestampIts;
	 */
	public IntegerValue fx_getCurrentTime();

	/**
	 * This external function gets the current time
	 * @param p_latitudeA Latitude of node A
	 * @param p_longitudeA Longitude of node A
	 * @param p_latitudeB Latitude of node B
	 * @param p_longitudeB Longitude of node B
	 * @return The current time in Epoch format
	 * 
	 * TTCN-3 signature:
	 * external function fx_computeDistance(in UInt32 p_latitudeA, in UInt32 p_longitudeA, in UInt32 p_latitudeB, in UInt32 p_longitudeB) return float;
	 */
	public FloatValue fx_computeDistance(final IntegerValue p_latitudeA, final IntegerValue p_longitudeA, final IntegerValue p_latitudeB, final IntegerValue p_longitudeB);

	/**
	 * External function to compute a position using a reference position, a distance and an orientation 
	 * @param p_iutLongPosVector Reference position
	 * @param p_distance Distance to the reference position (in meter)
	 * @param p_orientation Direction of the computed position (0 to 359; 0 means North)
	 * @param p_latitude Computed position's latitude
	 * @param p_longitude Computed position's longitude
	 * 
	 * TTCN-3 signature:
	 * external function fx_computePositionUsingDistance(in UInt32 p_refLatitude, in Uint32 p_refLongitude, in integer p_distance, in integer p_orientation, out UInt32 p_latitude, out UInt32 p_longitude);
	 */
	public void fx_computePositionUsingDistance(final IntegerValue p_refLatitude, final IntegerValue p_refLongitude, final IntegerValue p_distance, final IntegerValue p_orientation, IntegerValue p_latitude, IntegerValue p_longitude);
	
	/**
     * External function to compute radius of a given circular area
     * @param   p_squareMeters  Square meters of an circular area
     * @return  Computed radius in meters
     */
    public FloatValue fx_computeRadiusFromCircularArea(final FloatValue p_squareMeters);
	
	/**
     * External function to compute timestamp based on current time
     * @return  Unix-Epoch-Time mod 2^32
     * 
     * TTCN-3 signature:
     * external function fx_computeGnTimestamp() return UInt32;
     */
     public IntegerValue fx_computeGnTimestamp();
     
     /**
      * @desc    Calculate ICMPv6 checksum on pseudo header according RFC 4443 - Clause 2.3
      * @param   p_sourceAddress         Source address, 
      * @param   p_destinationAddress    Destination address
      * @param   p_payloadLength         Upper-Layer Packet Length
      * @param   p_payload               Upper-Layer payload
      * @param   p_nextHdr               Next header value (e.g. 0x3a for ICMPv6)
      * @return  The checksum value
      * @see     RFC 2460 IPv6 Specification
      * 
      * TTCN-3 signature:
      * external function fx_computeIPv6CheckSum( 
      *     in template (value) Ipv6Address p_sourceAddress, 
      *     in template (value) Ipv6Address p_destinationAddress, 
      *     in template (value) integer p_payloadLength, 
      *     in template (value) octetstring p_payload, 
      *     in template (value) integer p_nextHdr 
      * ) return Oct2; 
      * <pre>
      * Pseudo header is defined by RFC 2460 - Clause 8.1
      *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      *  |                                                               |
      *  +                                                               +
      *  |                                                               |
      *  +                         Source Address                        +
      *  |                                                               |
      *  +                                                               +
      *  |                                                               |
      *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      *  |                                                               |
      *  +                                                               +
      *  |                                                               |
      *  +                      Destination Address                      +
      *  |                                                               |
      *  +                                                               +
      *  |                                                               |
      *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      *  |                   Upper-Layer Packet Length                   |
      *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      *  |                      zero                     |  Next Header  |
      *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      * </pre>
      */
     public OctetstringValue fx_computeIPv6CheckSum(
             final OctetstringValue p_sourceAddress, 
             final OctetstringValue p_destinationAddress, 
             final IntegerValue p_payloadLength, 
             final OctetstringValue p_payload, 
             final IntegerValue p_nextHdr 
     );
     
     public OctetstringValue xf_parseIpv6Address(final CharstringValue p_textIpv6Address);
}
