/******************************************************************************
 * Copyright (c) 2000-2021 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
 *
 * Contributors:
 *   Balasko, Jeno
 *   Raduly, Csaba
 *
 ******************************************************************************/
module TitanLoggerControl {
/*
This module allows modification of logger parameters during run-time.
The module defines a number of external functions which can be called from TTCN-3 code.
The implementation of these external funtions is built into the TITAN runtime.

This module needs to be included in the project; linking of the runtime is automatic.
*/

external function set_log_file(in charstring plugin, in charstring filename);

external function set_log_entity_name(in charstring plugin, in boolean b);

external function get_log_entity_name(in charstring plugin) return boolean;

type enumerated verbosity
{
  compact,
  full
};

external function set_matching_verbosity(in charstring plugin, in verbosity v);

external function get_matching_verbosity(in charstring plugin) return verbosity;

type enumerated Severity // copy-paste from Logger.hh
{
    NOTHING_TO_LOG(0), // for compatibility

    ACTION_UNQUALIFIED,

    DEFAULTOP_ACTIVATE,
    DEFAULTOP_DEACTIVATE,
    DEFAULTOP_EXIT,
    DEFAULTOP_UNQUALIFIED,

    ERROR_UNQUALIFIED,

    EXECUTOR_RUNTIME,
    EXECUTOR_CONFIGDATA,
    EXECUTOR_EXTCOMMAND,
    EXECUTOR_COMPONENT,
    EXECUTOR_LOGOPTIONS,
    EXECUTOR_UNQUALIFIED,

    FUNCTION_RND,
    FUNCTION_UNQUALIFIED,

    PARALLEL_PTC,
    PARALLEL_PORTCONN,
    PARALLEL_PORTMAP,
    PARALLEL_UNQUALIFIED,

    TESTCASE_START,
    TESTCASE_FINISH,
    TESTCASE_UNQUALIFIED,

    PORTEVENT_PQUEUE,
    PORTEVENT_MQUEUE,
    PORTEVENT_STATE,
    PORTEVENT_PMIN,
    PORTEVENT_PMOUT,
    PORTEVENT_PCIN,
    PORTEVENT_PCOUT,
    PORTEVENT_MMRECV,
    PORTEVENT_MMSEND,
    PORTEVENT_MCRECV,
    PORTEVENT_MCSEND,
    PORTEVENT_DUALRECV,
    PORTEVENT_DUALSEND,
    PORTEVENT_UNQUALIFIED,
    PORTEVENT_SETSTATE,

    STATISTICS_VERDICT,
    STATISTICS_UNQUALIFIED,

    TIMEROP_READ,
    TIMEROP_START,
    TIMEROP_GUARD,
    TIMEROP_STOP,
    TIMEROP_TIMEOUT,
    TIMEROP_UNQUALIFIED,

    USER_UNQUALIFIED,

    VERDICTOP_GETVERDICT,
    VERDICTOP_SETVERDICT,
    VERDICTOP_FINAL,
    VERDICTOP_UNQUALIFIED,

    WARNING_UNQUALIFIED,

    // MATCHING and DEBUG should be at the end (not included in LOG_ALL)
    MATCHING_DONE,
    MATCHING_TIMEOUT,
    MATCHING_PCSUCCESS,
    MATCHING_PCUNSUCC,
    MATCHING_PMSUCCESS,
    MATCHING_PMUNSUCC,
    MATCHING_MCSUCCESS,
    MATCHING_MCUNSUCC,
    MATCHING_MMSUCCESS,
    MATCHING_MMUNSUCC,
    MATCHING_PROBLEM,
    MATCHING_UNQUALIFIED,

    DEBUG_ENCDEC,
    DEBUG_TESTPORT,
    DEBUG_USER,
    DEBUG_FRAMEWORK,
    DEBUG_UNQUALIFIED
};

type record of Severity Severities;

const Severities log_nothing    := {};

const Severities log_console_default :=
{
    ACTION_UNQUALIFIED,

    ERROR_UNQUALIFIED,

    TESTCASE_START, TESTCASE_FINISH, TESTCASE_UNQUALIFIED,

    STATISTICS_VERDICT, STATISTICS_UNQUALIFIED,
/*
    TIMEROP_READ, TIMEROP_START, TIMEROP_GUARD, TIMEROP_STOP, TIMEROP_TIMEOUT,
    TIMEROP_UNQUALIFIED,

    USER_UNQUALIFIED,

    VERDICTOP_GETVERDICT, VERDICTOP_SETVERDICT, VERDICTOP_FINAL, VERDICTOP_UNQUALIFIED,
*/
    WARNING_UNQUALIFIED
};

const Severities log_all :=
{
    ACTION_UNQUALIFIED,

    DEFAULTOP_ACTIVATE, DEFAULTOP_DEACTIVATE, DEFAULTOP_EXIT, DEFAULTOP_UNQUALIFIED,

    ERROR_UNQUALIFIED,

    EXECUTOR_RUNTIME, EXECUTOR_CONFIGDATA, EXECUTOR_EXTCOMMAND, EXECUTOR_COMPONENT,
    EXECUTOR_LOGOPTIONS, EXECUTOR_UNQUALIFIED,

    FUNCTION_RND, FUNCTION_UNQUALIFIED,

    PARALLEL_PTC, PARALLEL_PORTCONN, PARALLEL_PORTMAP, PARALLEL_UNQUALIFIED,

    TESTCASE_START, TESTCASE_FINISH, TESTCASE_UNQUALIFIED,

    PORTEVENT_PQUEUE, PORTEVENT_MQUEUE, PORTEVENT_STATE,
    PORTEVENT_PMIN, PORTEVENT_PMOUT, PORTEVENT_PCIN, PORTEVENT_PCOUT,
    PORTEVENT_MMRECV, PORTEVENT_MMSEND, PORTEVENT_MCRECV, PORTEVENT_MCSEND,
    PORTEVENT_DUALRECV, PORTEVENT_DUALSEND, PORTEVENT_UNQUALIFIED, PORTEVENT_SETSTATE,

    STATISTICS_VERDICT, STATISTICS_UNQUALIFIED,

    TIMEROP_READ, TIMEROP_START, TIMEROP_GUARD, TIMEROP_STOP, TIMEROP_TIMEOUT,
    TIMEROP_UNQUALIFIED,

    USER_UNQUALIFIED,

    VERDICTOP_GETVERDICT, VERDICTOP_SETVERDICT, VERDICTOP_FINAL, VERDICTOP_UNQUALIFIED,

    WARNING_UNQUALIFIED
};

const Severities log_everything :=
{
    ACTION_UNQUALIFIED,

    DEFAULTOP_ACTIVATE, DEFAULTOP_DEACTIVATE, DEFAULTOP_EXIT, DEFAULTOP_UNQUALIFIED,

    ERROR_UNQUALIFIED,

    EXECUTOR_RUNTIME, EXECUTOR_CONFIGDATA, EXECUTOR_EXTCOMMAND, EXECUTOR_COMPONENT,
    EXECUTOR_LOGOPTIONS, EXECUTOR_UNQUALIFIED,

    FUNCTION_RND, FUNCTION_UNQUALIFIED,

    PARALLEL_PTC, PARALLEL_PORTCONN, PARALLEL_PORTMAP, PARALLEL_UNQUALIFIED,

    TESTCASE_START, TESTCASE_FINISH, TESTCASE_UNQUALIFIED,

    PORTEVENT_PQUEUE, PORTEVENT_MQUEUE, PORTEVENT_STATE,
    PORTEVENT_PMIN, PORTEVENT_PMOUT, PORTEVENT_PCIN, PORTEVENT_PCOUT,
    PORTEVENT_MMRECV, PORTEVENT_MMSEND, PORTEVENT_MCRECV, PORTEVENT_MCSEND,
    PORTEVENT_DUALRECV, PORTEVENT_DUALSEND, PORTEVENT_UNQUALIFIED, PORTEVENT_SETSTATE,

    STATISTICS_VERDICT, STATISTICS_UNQUALIFIED,

    TIMEROP_READ, TIMEROP_START, TIMEROP_GUARD, TIMEROP_STOP, TIMEROP_TIMEOUT,
    TIMEROP_UNQUALIFIED,

    USER_UNQUALIFIED,

    VERDICTOP_GETVERDICT, VERDICTOP_SETVERDICT, VERDICTOP_FINAL, VERDICTOP_UNQUALIFIED,

    WARNING_UNQUALIFIED,

    // MATCHING and DEBUG should be at the end (not included in LOG_ALL)
    MATCHING_DONE,      MATCHING_TIMEOUT,
    MATCHING_PCSUCCESS, MATCHING_PCUNSUCC,
    MATCHING_PMSUCCESS, MATCHING_PMUNSUCC,
    MATCHING_MCSUCCESS, MATCHING_MCUNSUCC,
    MATCHING_MMSUCCESS, MATCHING_MMUNSUCC,
    MATCHING_PROBLEM,   MATCHING_UNQUALIFIED,

    DEBUG_ENCDEC, DEBUG_TESTPORT, DEBUG_USER, DEBUG_FRAMEWORK, DEBUG_UNQUALIFIED
};


// getters
external function get_console_mask(in charstring plugin) return Severities;
external function get_file_mask   (in charstring plugin) return Severities;

// setters
external function set_console_mask(in charstring plugin, in Severities s);
external function set_file_mask   (in charstring plugin, in Severities s);

// additive
external function add_to_console_mask(in charstring plugin, in Severities s);
external function add_to_file_mask   (in charstring plugin, in Severities s);

// subtractive
external function remove_from_console_mask(in charstring plugin, in Severities s);
external function remove_from_file_mask   (in charstring plugin, in Severities s);


}  // end of module
