blob: 3ac2fe79bd580f09d11163122a92542a1b17238a [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_NameService_Definitions
//
// Purpose:
// This module contains type definitions for TTCN-3 EPTF NameService implementation.
//
// Module Parameters:
// tsp_EPTF_NameService_loggingComponentMask - *charstring* - component-type mask for logging, default value: "EPTF_NameService"
// tsp_EPTF_NameServiceClient_loggingComponentMask - *charstring* - component-type mask for logging, default value: "EPTF_NameServiceClient"
//
// Module depends on:
// <EPTF_CLL_Base_Definitions>
// <EPTF_CLL_Logging_Definitions>
//
// Current Owner:
// Jozsef Gyurusi (ETHJGI)
//
// Last Review Date:
// 2007-12-06
//
// Detailed Comments:
// This module contains type definitions for TTCN-3 EPTF Name Service implementation.
//
///////////////////////////////////////////////////////////////
module EPTF_CLL_NameService_Definitions {
import from EPTF_CLL_Base_Definitions all;
import from EPTF_CLL_Logging_Definitions all;
modulepar charstring tsp_EPTF_NameService_loggingComponentMask := "EPTF_NameService";
modulepar charstring tsp_EPTF_NameServiceClient_loggingComponentMask := "EPTF_NameServiceClient";
///////////////////////////////////////////////////////////
// Type: EPTF_NS_RegisteredItem
//
// Purpose:
// Type of the registered items
//
// Elements:
// name - *charstring* - name of the registered object
// ownerComp - <EPTF_NS_Client_CT> - reference to the component which registered the name
// id - *integer* *optional* - a user given id that identifies the registered object in the client component (in the sender component)
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
type record EPTF_NS_RegisteredItem {
charstring name, // the name to register
EPTF_NS_Client_CT ownerComp, // reference to the component which registered the name
integer id optional // a user given id that identifies the registered object in the client component (in the sender component)
}
///////////////////////////////////////////////////////////
// Type: EPTF_NS_RegisteredItems
//
// Purpose:
// List of <EPTF_NS_RegisteredItem>-s. The type of the database.
//
// Elements:
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
type record of EPTF_NS_RegisteredItem EPTF_NS_RegisteredItems;
///////////////////////////////////////////////////////////
// Type: EPTF_NS_RegisterName
//
// Purpose:
// This record defines the management message EPTF_NS_RegisterName sent/received by the <EPTF_NS_Mgmt_PT>
//
// Elements:
// name - *charstring* - name of the registered object
// id - *integer* *optional* - a user given id that identifies the registered object in the client component (in the sender component)
//
// Detailed Comments:
// This message is sent to the NS server component
// to register the name
//
///////////////////////////////////////////////////////////
type record EPTF_NS_RegisterName {
charstring name, // the name to register
integer id optional // a user given id that identifies the registered object in the client component (in the sender component)
// the sender component reference will be read from the sender of the message
}
///////////////////////////////////////////////////////////
// Type: EPTF_NS_RegisterNAck
//
// Purpose:
// This record defines the management message EPTF_NS_RegisterNAck sent/received by the <EPTF_NS_Mgmt_PT>
//
// Elements:
// name - *charstring* - name of the registered object
//
// Detailed Comments:
// This message is sent to the NS client component
// as a negative response to the register message
//
///////////////////////////////////////////////////////////
type EPTF_NS_RegisterName EPTF_NS_RegisterNAck; // sent in case of a failed registration to the client
///////////////////////////////////////////////////////////
// Type: EPTF_NS_DeregisterName
//
// Purpose:
// This record defines the management message EPTF_NS_DeregisterName sent/received by the <EPTF_NS_Mgmt_PT>
//
// Elements:
// name - *charstring* - name of the registered object
//
// Detailed Comments:
// This message is sent to the NS server component
// to clear the name from the database
//
///////////////////////////////////////////////////////////
type record EPTF_NS_DeregisterName {
charstring name // the name to register
}
///////////////////////////////////////////////////////////
// Type: EPTF_NS_Query
//
// Purpose:
// This record defines the management message EPTF_NS_Query sent/received by the <EPTF_NS_Mgmt_PT>
//
// Elements:
// name - *charstring* - name of the registered object
//
// Detailed Comments:
// This message is sent to the NS server component
// to query a registered item by name
//
///////////////////////////////////////////////////////////
type record EPTF_NS_Query {
charstring name // the name to query
}
///////////////////////////////////////////////////////////
// Type: EPTF_NS_QueryResp
//
// Purpose:
// This record defines the management message EPTF_NS_QueryResp sent/received by the <EPTF_NS_Mgmt_PT>
//
// Elements:
// name - *charstring* - the name queried
// ownerComp - <EPTF_NS_Client_CT> *optional* - component reference of the registerer (owner) (set to omit if name is not found)
// id - *integer* - a user given id that identifies the registered object in the client component (in the sender component) (set to omit if name is not found)
//
// Detailed Comments:
// This message is the response for the EPTF_NS_Query message.
// If the query fails, i.e. there is no registered item found for
// the given name, the fields ownerComp and id are set to omit.
//
///////////////////////////////////////////////////////////
type record EPTF_NS_QueryResp {
charstring name, // the name queried
EPTF_NS_Client_CT ownerComp optional, // component reference of the registerer (owner) (set to omit if name is not found)
integer id optional // a user given id that identifies the registered object in the client component (in the sender component) (set to omit if name is not found)
}
///////////////////////////////////////////////////////////
// Type: EPTF_NS_Bye
//
// Purpose:
// This record defines the management message EPTF_NS_Bye sent/received by the <EPTF_NS_Mgmt_PT>
//
// Elements:
// -
//
// Detailed Comments:
// This message is sent to the NS server component
// before the EPTF_NS_Client_CT component terminates
//
///////////////////////////////////////////////////////////
type record EPTF_NS_Bye {
}
///////////////////////////////////////////////////////////
// Type: EPTF_NS_ByeAck
//
// Purpose:
// This record defines the management message EPTF_NS_ByeAck sent/received by the <EPTF_NS_Mgmt_PT>
//
// Elements:
// -
//
// Detailed Comments:
// This message is a response to the <EPTF_NS_ByeAck> message
//
///////////////////////////////////////////////////////////
type EPTF_NS_Bye EPTF_NS_ByeAck;
///////////////////////////////////////////////////////////
// Type: EPTF_NS_MgmtMsg
//
// Purpose:
// This union defines the management message type sent/received by the <EPTF_NS_Mgmt_PT>
//
// Elements:
// registerName - <EPTF_NS_RegisterName> - register a name into the NameService
// registerNAck - <EPTF_NS_RegisterNAck> - sent in case of a failed registration to the client
// deregisterName - <EPTF_NS_DeregisterName> - deregister the name from the NameService
// query - <EPTF_NS_Query> - client query a registered object by name
// queryResp - <EPTF_NS_QueryResp> - response to the query
// bye - <EPTF_NS_Bye> - message sent by the client to notify the name service before it exits
// byeAck - <EPTF_NS_ByeAck> - response to the bye
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
type union EPTF_NS_MgmtMsg {
EPTF_NS_RegisterName registerName, // register a name into the NameService
EPTF_NS_RegisterNAck registerNAck, // sent in case of a failed registration to the client
EPTF_NS_DeregisterName deregisterName, // deregister the name from the NameService
EPTF_NS_Query query, // client query a registered object by name
EPTF_NS_QueryResp queryResp, // response to the query
EPTF_NS_Bye bye, // message sent by the client to notify the name service before it exits
EPTF_NS_ByeAck byeAck // response to the bye
}
///////////////////////////////////////////////////////////
// Type: EPTF_NS_Mgmt_PT
//
// Purpose:
// The management port of EPTF Name Service component
//
// Elements:
// -
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
type port EPTF_NS_Mgmt_PT message {
inout EPTF_NS_MgmtMsg;
} with {extension "internal"}
///////////////////////////////////////////////////////////
// Type: EPTF_NS_Client_CT
//
// Purpose:
// The component that implements the EPTF Name Service Client feature
//
// Elements:
// v_NS_Client_initialized - *boolean* - initialized flag to prevent miltiple execution of the init/cleanup functions
// EPTF_NS_MgmtIf - <EPTF_NS_Mgmt_PT> - the management port
// v_NS_Server - <EPTF_NS_CT> - reference to the NS server component
// v_EPTF_NS_Client_def - *default* - the default altstep
// v_NameServiceClient_loggingMaskId - *integer* - logging component mask ID
//
// Detailed Comments:
// To use the EPTF Name Service, extend your component with <EPTF_NS_Client_CT>
//
///////////////////////////////////////////////////////////
type component EPTF_NS_Client_CT extends EPTF_Base_CT, EPTF_Logging_CT {
private var boolean v_NS_Client_initialized := false; // initialized flag to prevent miltiple execution of the init/cleanup functions
private port EPTF_NS_Mgmt_PT EPTF_NS_Client_MgmtIf; // management interface of EPTF_NS_Client_CT
private var EPTF_NS_CT v_NS_Server; // reference to the NS server component
private var default v_EPTF_NS_Client_def;
// logging
private var integer v_NameServiceClient_loggingMaskId := c_EPTF_Logging_invalidMaskId;
}
///////////////////////////////////////////////////////////
// Type: EPTF_NS_Server_CT
//
// Purpose:
// The component that implements the EPTF Name Service feature
//
// Elements:
// v_NS_initialized - *boolean* - initialized flag to prevent miltiple execution of the init/cleanup functions
// EPTF_NS_MgmtIf - <EPTF_NS_Mgmt_PT> - the management port
// v_EPTF_NS_RegisteredItems - <EPTF_NS_RegisteredItems> - the database of registered items
// v_EPTF_NS_def - *default* - the default altstep
// v_NameService_loggingMaskId - *integer* - logging component mask ID
//
// Detailed Comments:
// To use the EPTF Name Service, this component should be created
// and its behaviour function should be started on it.
// This Name Service component implements the Name Service feature
// and Name Service Clients can connect and register/search names in it
//
///////////////////////////////////////////////////////////
type component EPTF_NS_CT extends EPTF_Base_CT, EPTF_Logging_CT {
private var boolean v_NS_initialized := false;
private port EPTF_NS_Mgmt_PT EPTF_NS_MgmtIf; // management interface of EPTF_NS_CT
private var EPTF_NS_RegisteredItems v_EPTF_NS_RegisteredItems := {}; // the database of registered items
private var default v_EPTF_NS_def;
// logging
private var integer v_NameService_loggingMaskId := c_EPTF_Logging_invalidMaskId;
}
// cast function to EPTF_Base_CT
///////////////////////////////////////////////////////////
// Function: f_EPTF_NS_Client_upcast
//
// Purpose:
// Casts the component type <EPTF_NS_Client_CT> to <EPTF_Base_CT>
//
// Parameters:
// pl_compRef - *in* <EPTF_NS_Client_CT> - reference to the component that should be upcasted
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// Needed for integration with other EPTF component types, e.g. for <EPTF_Var_CT>.
//
///////////////////////////////////////////////////////////
public external function f_EPTF_NS_Client_upcast(in EPTF_NS_Client_CT pl_compRef) return EPTF_Base_CT;
///////////////////////////////////////////////////////////
// Function: f_EPTF_NS_Client_downcast
//
// Purpose:
// Casts the component type <EPTF_Base_CT> to <EPTF_NS_Client_CT>
//
// Parameters:
// pl_compRef - *in* <EPTF_Base_CT> - reference to the component that should be downcasted
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// Needed for integration with other EPTF component types, e.g. for <EPTF_Var_CT>.
//
///////////////////////////////////////////////////////////
public external function f_EPTF_NS_Client_downcast(in EPTF_Base_CT pl_compRef) return EPTF_NS_Client_CT;
///////////////////////////////////////////////////////////
// Constant: c_EPTF_NameService_loggingEventClasses
//
// Purpose:
// list of logging event class names used on the NameService
//
// Detailed Comments:
// <EPTF_Logging_EventClassPrefixList> { "Warning", "Debug" }
///////////////////////////////////////////////////////////
const EPTF_Logging_EventClassPrefixList c_EPTF_NameService_loggingEventClasses := { "Warning", "Debug" };
///////////////////////////////////////////////////////////
// Constant: c_EPTF_NameService_loggingClassIdx_Warning
//
// Purpose:
// logging class index for Error
//
// Detailed Comments:
// *0*
///////////////////////////////////////////////////////////
const integer c_EPTF_NameService_loggingClassIdx_Warning := 0;
///////////////////////////////////////////////////////////
// Constant: c_EPTF_NameService_loggingClassIdx_Debug
//
// Purpose:
// logging class index for Error
//
// Detailed Comments:
// *1*
///////////////////////////////////////////////////////////
const integer c_EPTF_NameService_loggingClassIdx_Debug := 1;
} // end of module