blob: 4fee445ad8dc056edc96213369fadb851ab4cd55 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2019 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
// //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Module: EPTF_CLL_Transport_IPsecHandler_Logging_Client_Functions
//
// Purpose:
// This module contains the implementation of IPSec parameters logging client functions.
//
// Module Parameters:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////////////////////////
module EPTF_CLL_Transport_IPsecHandler_Logging_Client_Functions {
import from EPTF_CLL_Transport_IPsecHandler_Logging_CommonDefinitions all;
import from EPTF_CLL_Transport_IPsecHandler_Logging_Client_Definitions all;
import from EPTF_CLL_Transport_IPsecHandler_Logging_Server_Definitions all;
import from EPTF_CLL_Transport_IPsecHandler_Logging_Functions all;
import from TCCIPsec_XFRM_Definitions all;
friend module EPTF_CLL_Transport_IPsecHandler_Functions;
///////////////////////////////////////////////////////////
// Function: f_EPTF_CLL_Transport_IPsecHandler_Logging_Client_init
//
// Purpose:
// Initialises the EPTF_CLL_Transport_IPsecHandler_Logging_Client_CT component
//
// Parameters:
// - pl_selfName - *in* *charstring* - Name of the component.
// - pl_LoggingIPSecServer_CT - *in* <EPTF_CLL_Transport_IPsecHandler_LoggingIPSecServer_CT> - reference to the IPSec Logging Server component
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_CLL_Transport_IPsecHandler_Logging_Client_init(
in charstring pl_selfName,
in EPTF_CLL_Transport_IPsecHandler_Logging_Server_CT pl_LoggingIPSecServer_CT)
runs on EPTF_CLL_Transport_IPsecHandler_Logging_Client_CT
{
if (pl_LoggingIPSecServer_CT == null)
{
return;
}
if (not v_EPTF_CLL_Transport_IPsecHandler_Logging_IPSec_initialized)
{
f_EPTF_CLL_Transport_IPsecHandler_Logging_init(pl_selfName, cg_EPTF_CLL_Transport_IPsecHandler_Logging_Client_loggingMaskName);
connect(self:EPTF_CLL_Transport_IPsecHandler_Logging_IPSec_PCO, pl_LoggingIPSecServer_CT:EPTF_CLL_Transport_IPsecHandler_Logging_Server_IPSec_PCO);
f_EPTF_CLL_Transport_IPsecHandler_Logging_debugDev("The Logging IPSec client component was initialized.");
v_EPTF_CLL_Transport_IPsecHandler_Logging_IPSec_initialized := true;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_CLL_Transport_IPsecHandler_Logging_Client_sendData
//
// Purpose:
// Send AKA parameters to server
//
// Parameters:
// - pl_srcAddr - *in* *charstring* - source IP address
// - pl_dstAddr - *in* *charstring* - destination IP address
// - pl_dstAddr - *in* *hexstring* - SPI
// - pl_ealgo - *in* *charstring* - name of the encription algorithm
// - pl_CK - *in* *octetstring* - CK
// - pl_aalgo - *in* *charstring* - name of the authentication algorithm
// - pl_CK - *in* *octetstring* - IK
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
private function f_EPTF_CLL_Transport_IPsecHandler_Logging_Client_sendData(charstring pl_srcAddr, charstring pl_dstAddr, integer pl_spi,
charstring pl_ealgo, octetstring pl_ck, charstring pl_aalgo, octetstring pl_ik)
runs on EPTF_CLL_Transport_IPsecHandler_Logging_Client_CT
{
if(not v_EPTF_CLL_Transport_IPsecHandler_Logging_IPSec_initialized)
{
return;
}
var EPTF_CLL_Transport_IPsecHandler_Logging_IPSec_Event vl_dataToSend := {pl_srcAddr, pl_dstAddr, pl_spi, pl_ealgo, pl_ck, pl_aalgo, pl_ik};
EPTF_CLL_Transport_IPsecHandler_Logging_IPSec_PCO.send(vl_dataToSend);
}
friend function f_EPTF_CLL_Transport_IPsecHandler_Logging_Client_LogSAAddInfo(in SAAddInfo pl_sa_info) runs on EPTF_CLL_Transport_IPsecHandler_Logging_Client_CT {
var charstring vl_srcAddr := pl_sa_info.src.ip_address;
var charstring vl_dstAddr := pl_sa_info.dst.ip_address;
var integer pl_spi := pl_sa_info.spi;
var Authentication vl_authInfo := pl_sa_info.ipsec_algos.auth;
var Encryption vl_encInfo := pl_sa_info.ipsec_algos.enc;
var octetstring vl_CK;
var octetstring vl_IK;
if (ischosen(vl_encInfo.key.text)) {
vl_CK := char2oct(vl_encInfo.key.text);
} else {
vl_CK := hex2oct(vl_encInfo.key.hex);
}
if (ischosen(vl_authInfo.key.text)) {
vl_IK := char2oct(vl_authInfo.key.text);
} else {
vl_IK := hex2oct(vl_authInfo.key.hex);
}
var charstring vl_aAlgo := ttcn2string(vl_authInfo.name);
var charstring vl_eAlgo := ttcn2string(vl_encInfo.name);
f_EPTF_CLL_Transport_IPsecHandler_Logging_Client_sendData(vl_srcAddr, vl_dstAddr, pl_spi, vl_eAlgo, vl_CK, vl_aAlgo, vl_IK);
}
}