blob: cb0c2d2951d8795e42b43653f532dde7ee443aa2 [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
///////////////////////////////////////////////////////////////////////////////
//
// File: EPTF_HTTP_Logger_Functions.ttcn
// Rev: <RnXnn>
// Prodnr: CNL 113 618
// Updated: 2012-11-28
// Contact: http://ttcn.ericsson.se
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_HTTP_Logger_Functions
//
// Purpose:
// This module contains the functions for EPTF_HTTP_Logger_PT component
//
// Module Parameters:
// tsp_EPTF_HTTP_Logging_Decode - *boolean* - default value:*true*
//
// Module depends on:
// <EPTF_CLL_Base_Functions>
//
// <EPTF_HTTP_Logger_Definitions>
//
// <HTTPmsg_Types>
//
// Current owner
// EAKOPER
//
// Last Review Date:
// 2008-01-09
//
///////////////////////////////////////////////////////////
module EPTF_HTTP_Logger_Functions {
import from EPTF_CLL_Base_Functions all;
import from EPTF_HTTP_Logger_Definitions all;
import from HTTPmsg_Types all;
//=========================================================================
// Module Parameters
//=========================================================================
modulepar boolean tsp_EPTF_HTTP_Logging_Decode := true;
///////////////////////////////////////////////////////////
// Group: LoggerClient
//
// Purpose:
// Functions of the LoggerClient component
//
///////////////////////////////////////////////////////////
group LoggerClient {
///////////////////////////////////////////////////////////
// Function: f_EPTF_HTTP_LoggerClient_init_CT
//
// Purpose:
// Function to init the LoggerClient component
//
// Parameters:
// pl_functionRef - *in* - <EPTF_HTTP_LoggerClient_FT> - The send function of the logging
//
// Return Value:
// - integer - if the component initialize already the return value will be -1
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
function f_EPTF_HTTP_LoggerClient_init_CT(
in EPTF_HTTP_LoggerClient_FT pl_functionRef)
runs on EPTF_HTTP_LoggerClient_CT
return integer
{
if (v_EPTF_HTTP_LoggerClient_initialized) {
return -1;
}
f_EPTF_Base_registerCleanup(refers(f_EPTF_HTTP_LoggerClient_cleanup_CT));
vf_EPTF_HTTP_LoggerClient_sendFunction := pl_functionRef;
vc_EPTF_HTTP_LoggerClient_loggerComponent := EPTF_HTTP_Logger_CT.create;
connect(vc_EPTF_HTTP_LoggerClient_loggerComponent:HTTP_Logger_PCO,self:HTTP_LoggerClient_PCO);
vc_EPTF_HTTP_LoggerClient_loggerComponent.start(f_EPTF_HTTP_Logger_Behavior());
v_EPTF_HTTP_LoggerClient_initialized := true;
return 1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_HTTP_LoggerClient_cleanup_CT
//
// Purpose:
// Function to clean the LoggerClient component
//
// Parameters:
// -
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
function f_EPTF_HTTP_LoggerClient_cleanup_CT()
runs on EPTF_HTTP_LoggerClient_CT {
if (not v_EPTF_HTTP_LoggerClient_initialized) {
return;
}
v_EPTF_HTTP_LoggerClient_initialized := false;
vc_EPTF_HTTP_LoggerClient_loggerComponent.stop;
disconnect(vc_EPTF_HTTP_LoggerClient_loggerComponent:HTTP_Logger_PCO,
self:HTTP_LoggerClient_PCO);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_HTTP_Logger_Behavior
//
// Purpose:
// The main function of the logger component
//
// Parameters:
// -
//
// Return Value:
// -
//
// Errors:
// -
//
///////////////////////////////////////////////////////////
function f_EPTF_HTTP_Logger_Behavior()
runs on EPTF_HTTP_Logger_CT
{
var integer vl_noIntWarning;
alt {
[] HTTP_Logger_PCO.receive(octetstring:?) -> value v_EPTF_HTTP_Logger_incomingMsg
{
if(tsp_EPTF_HTTP_Logging_Decode) {
vl_noIntWarning := dec_HTTPMessage(v_EPTF_HTTP_Logger_incomingMsg,
v_EPTF_HTTP_Logger_decodedMessage )
log("The received decoded Message is: ",
v_EPTF_HTTP_Logger_decodedMessage);
}
else {
log("The received encoded Message is: ",
v_EPTF_HTTP_Logger_incomingMsg);
}
repeat;
}
}
}
}//end of module
with {
extension "version <RnXnn>"
}