EPTF_MQTT_LocalTransport_Functions

Purpose

This module contains the functions of the MQTT local transport component

See also

EPTF_MQTT_LocalTransport_Definitions

Summary
EPTF_MQTT_LocalTransport_FunctionsThis module contains the functions of the MQTT local transport component
f_EPTF_MQTT_LocalTransport_initThe main initialization function of the <EPTF_MQTT_LocalTransport_CT> component type
f_EPTF_MQTT_LocalTransport_initLoggingInitializing CLL’s logging feature on the <EPTF_MQTT_LocalTransport_CT> component type
f_EPTF_MQTT_LocalTransport_cleanupThe main clean up function for the <EPTF_MQTT_LocalTransport_CT> component type
f_EPTF_MQTT_IPL4asp_handleEventHandler function to be registered into the IPL4 transport layer <EPTF_CLL_TransportIPL4_Functions>.
f_EPTF_MQTT_IPL4asp_handleMessageHandler function to be regisitered into the IPL4 transport layer <EPTF_CLL_TransportIPL4_Functions>.
f_EPTF_MQTT_LocalTransport_sendFunction to send out a EPTF_MQTT_PDU message using the local transport.
f_EPTF_MQTT_LocalTransport_transportApiRequestFunction to handle incoming transport API requests
f_EPTF_MQTT_LocalTransport_sendApiResponseFunction to handle incoming transport API requests
f_EPTF_MQTT_LocalTransport_startListeningStart listening on a local TCP socket and store its data and state in socketDB
f_EPTF_MQTT_LocalTransport_connectOpen a TCP connection and store its data and state in socketDB
f_EPTF_MQTT_LocalTransport_closeClose a TCP connection and remove its entry from the socketDB
f_EPTF_MQTT_LocalTransport_IPL4_sendSend a message and add 1 message and its length to MQTT transport stats variable
f_EPTF_MQTT_LocalTransport_socketDB_initInitializes the v_MQTT_LocalTransport_localSocketDB <SocketDB> database
f_EPTF_MQTT_LocalTransport_socketDB_cleanUpCleans up the reserved resources of the v_MQTT_LocalTransport_localSocketDB <SocketDB> database
f_EPTF_MQTT_LocalTransport_socketDB_addAdds a new element to the v_MQTT_LocalTransport_localSocketDB <SocketDB> database
f_EPTF_MQTT_LocalTransport_socketDB_lookUpGets the index of an <SocketEntry> element in v_MQTT_LocalTransport_localSocketDB <SocketDB> database based on its socket data
f_EPTF_MQTT_LocalTransport_socketDB_lookUp_connIdGets the index of an <SocketEntry> element in v_MQTT_LocalTransport_localSocketDB <SocketDB> database based on its connection id
f_EPTF_MQTT_LocalTransport_socketDB_getRetrieves an element from the v_MQTT_LocalTransport_localSocketDB <SocketDB> database
f_EPTF_MQTT_LocalTransport_socketDB_removeRemoves an element from the v_MQTT_LocalTransport_localSocketDB <SocketDB> database and frees up its reserved resources
f_EPTF_MQTT_Socket2StringConverts socket data from <Socket> type to the format “<hostname>:<port number>”
f_MQTT_Transport_Logging_VERBOSELogging functions for the VERBOSE log level
f_MQTT_Transport_Logging_DEBUGLogging functions for the DEBUG log level
f_MQTT_Transport_Logging_WARNINGLogging functions for the WARNING log level
f_MQTT_Transport_Logging_ERRORLogging functions for the ERROR log level
f_EPTF_MQTT_IPL4asp_handleResultChecks the result of an IPL4 transport operation and records an MQTT transport stats warning if unsuccessful

f_EPTF_MQTT_LocalTransport_init

function f_EPTF_MQTT_LocalTransport_init() runs on EPTF_MQTT_LocalTransport_CT

Purpose

The main initialization function of the <EPTF_MQTT_LocalTransport_CT> component type

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_initLogging

function f_EPTF_MQTT_LocalTransport_initLogging() runs on EPTF_MQTT_LocalTransport_CT

Purpose

Initializing CLL’s logging feature on the <EPTF_MQTT_LocalTransport_CT> component type

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_cleanup

function f_EPTF_MQTT_LocalTransport_cleanup() runs on EPTF_MQTT_LocalTransport_CT

Purpose

The main clean up function for the <EPTF_MQTT_LocalTransport_CT> component type

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_IPL4asp_handleEvent

function f_EPTF_MQTT_IPL4asp_handleEvent(
   in EPTF_Transport_TransportType pl_transportType,
   in ConnectionId pl_connId,
   in PortEvent pl_event
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Handler function to be registered into the IPL4 transport layer <EPTF_CLL_TransportIPL4_Functions>.  It is used to receieve transport events from the underlying IPL4 transport layer.  The function currently handles the connection closed event and forwards every event to the load generator layer’s handler function.

Parameters

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_IPL4asp_handleMessage

function f_EPTF_MQTT_IPL4asp_handleMessage(
   in EPTF_Transport_TransportType pl_transportType,
   in ConnectionId pl_connId,
   in HostName pl_remHost,
   in PortNumber pl_remPort,
   in HostName pl_locHost,
   in PortNumber pl_locPort,
   in ProtoTuple pl_proto,
   in integer pl_userData,
   in octetstring pl_msg
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Handler function to be regisitered into the IPL4 transport layer <EPTF_CLL_TransportIPL4_Functions>.  It is used to receieve MQTT messages from the underlying IPL4 transport layer.  The function looks up the entity that owns the particular connection and forwards the message and the entity information to the load generator layer

Parameters

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_send

function f_EPTF_MQTT_LocalTransport_send(
   in EPTF_MQTT_PDU pl_msg
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Function to send out a EPTF_MQTT_PDU message using the local transport.  It automatically looks up the corresponding <Socket> or creates it on the fly if it doesn’t exist yet

Parameters

pl_msgin EPTF_MQTT_PDU - message to be sent

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_transportApiRequest

function f_EPTF_MQTT_LocalTransport_transportApiRequest(
   EPTF_MQTT_Transport_Request pl_req
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Function to handle incoming transport API requests

Parameters

pl_reqin EPTF_MQTT_Transport_Request - transport API request

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_sendApiResponse

function f_EPTF_MQTT_LocalTransport_sendApiResponse(
   EPTF_MQTT_Transport_Response pl_rsp
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Function to handle incoming transport API requests

Parameters

pl_rspin EPTF_MQTT_Transport_Response - transport API response

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_startListening

function f_EPTF_MQTT_LocalTransport_startListening(
   in Socket p_local,
   in integer p_sessionIdx,
   inout integer p_idx
) runs on EPTF_MQTT_LocalTransport_CT return boolean

Purpose

Start listening on a local TCP socket and store its data and state in socketDB

Parameters

p_localin <Socket> - local socket
p_sessionIdxin integer - session Id stored with the socket data in socketDB
p_idxinout integer - the index of the added element in the database

Return Type

*boolean*was the operation succesful?

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_connect

function f_EPTF_MQTT_LocalTransport_connect(
   in Socket p_local,
   in Socket p_remote,
   in integer p_sessionIdx,
   inout integer p_idx
) runs on EPTF_MQTT_LocalTransport_CT return boolean

Purpose

Open a TCP connection and store its data and state in socketDB

Parameters

p_localin <Socket> - local socket
p_remotein <Socket> - remote socket
pl_sessionIdxin integer - session Id stored with the connection data in socketDB
p_idxinout integer - the index of the added element in the database

Return Value

*boolean*was the operation succesful?

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_close

function f_EPTF_MQTT_LocalTransport_close(
   in integer p_socketIdx
) runs on EPTF_MQTT_LocalTransport_CT return boolean

Purpose

Close a TCP connection and remove its entry from the socketDB

Parameters

p_socketIdxin integer - the index of the connection in socketDB to be closed

Return Value

*boolean*was the operation succesful?

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_IPL4_send

function f_EPTF_MQTT_LocalTransport_IPL4_send(
   in integer pl_connId,
   in charstring pl_remName,
   in integer pl_remPort,
   in ProtoTuple pl_proto,
   in octetstring pl_msg
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Send a message and add 1 message and its length to MQTT transport stats variable

Parameters

pl_connIdin integer - connection Id
pl_remNamein charstring - name of the remote host
pl_remPortin integer - remote port number
pl_protoin <ProtoTuple> - type of protocol of the connection
pl_msgin octetstring - message to be sent

Related Type

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_socketDB_init

function f_EPTF_MQTT_LocalTransport_socketDB_init() runs on EPTF_MQTT_LocalTransport_CT

Purpose

Initializes the v_MQTT_LocalTransport_localSocketDB <SocketDB> database

Related Type

<SocketDB> <EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_socketDB_cleanUp

function f_EPTF_MQTT_LocalTransport_socketDB_cleanUp() runs on EPTF_MQTT_LocalTransport_CT

Purpose

Cleans up the reserved resources of the v_MQTT_LocalTransport_localSocketDB <SocketDB> database

Related Type

<SocketDB> <EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_socketDB_add

function f_EPTF_MQTT_LocalTransport_socketDB_add(
   in SocketEntry p_sock
) runs on EPTF_MQTT_LocalTransport_CT return integer

Purpose

Adds a new element to the v_MQTT_LocalTransport_localSocketDB <SocketDB> database

Parameters

p_sockin <SocketEntry> - the element to be added

Returns

*integer*the index of the added element in the database

Related Type

<SocketDB> <EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_socketDB_lookUp

function f_EPTF_MQTT_LocalTransport_socketDB_lookUp(
   in Socket p_sock
) runs on EPTF_MQTT_LocalTransport_CT return integer

Purpose

Gets the index of an <SocketEntry> element in v_MQTT_LocalTransport_localSocketDB <SocketDB> database based on its socket data

Parameters

p_sockin <Socket> - socket data of the element to be found

Returns

*integer*the index of the element, or -1 if not found

Related Type

<SocketDB> <EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_socketDB_lookUp_connId

function f_EPTF_MQTT_LocalTransport_socketDB_lookUp_connId(
   in integer p_connId
) runs on EPTF_MQTT_LocalTransport_CT return integer

Purpose

Gets the index of an <SocketEntry> element in v_MQTT_LocalTransport_localSocketDB <SocketDB> database based on its connection id

Parameters

p_connIdin integer - the connection id

Returns

*integer*the index of the element, or -1 if not found

Related Type

<SocketDB> <EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_socketDB_get

function f_EPTF_MQTT_LocalTransport_socketDB_get(
   in integer p_idx,
   inout SocketEntry p_sock
) runs on EPTF_MQTT_LocalTransport_CT return boolean

Purpose

Retrieves an element from the v_MQTT_LocalTransport_localSocketDB <SocketDB> database

Parameters

p_idxin integer - the index of the element to be retrieved
p_sockinout <SocketEntry> - the retrieved element

Returns

booleanwas the operation successful?

Related Type

<SocketDB> <EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_LocalTransport_socketDB_remove

function f_EPTF_MQTT_LocalTransport_socketDB_remove(
   in integer p_idx
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Removes an element from the v_MQTT_LocalTransport_localSocketDB <SocketDB> database and frees up its reserved resources

Parameters

p_idxin integer - the index of the element to be removed

Related Type

<SocketDB> <EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_Socket2String

function f_EPTF_MQTT_Socket2String(Socket p_sock) return charstring

Purpose

Converts socket data from <Socket> type to the format “<hostname>:<port number>”

Parameters

p_sockin <Socket> - Socket data to be converted

Return

charstringthe converted socket data

f_MQTT_Transport_Logging_VERBOSE

function f_MQTT_Transport_Logging_VERBOSE(
   in @lazy charstring pl_message
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Logging functions for the VERBOSE log level

Parameters

pl_messagein charstring - string to be logged

Related Types

<EPTF_MQTT_LocalTransport_CT>

f_MQTT_Transport_Logging_DEBUG

function f_MQTT_Transport_Logging_DEBUG(
   in @lazy charstring pl_message
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Logging functions for the DEBUG log level

Parameters

pl_messagein charstring - string to be logged

Related Types

<EPTF_MQTT_LocalTransport_CT>

f_MQTT_Transport_Logging_WARNING

function f_MQTT_Transport_Logging_WARNING(
   in @lazy charstring pl_message
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Logging functions for the WARNING log level

Parameters

pl_messagein charstring - string to be logged

Related Types

<EPTF_MQTT_LocalTransport_CT>

f_MQTT_Transport_Logging_ERROR

function f_MQTT_Transport_Logging_ERROR(
   in @lazy charstring pl_message
) runs on EPTF_MQTT_LocalTransport_CT

Purpose

Logging functions for the ERROR log level

Parameters

pl_messagein charstring - string to be logged

Related Types

<EPTF_MQTT_LocalTransport_CT>

f_EPTF_MQTT_IPL4asp_handleResult

function f_EPTF_MQTT_IPL4asp_handleResult(
   inout Result p_res
) runs on EPTF_MQTT_LocalTransport_CT return boolean

Purpose

Checks the result of an IPL4 transport operation and records an MQTT transport stats warning if unsuccessful

Parameters

p_resinout Result - result of an IPL4 transport operation

Return Type

boolentrue: no error or “Temporary unavailable”, false: error different from “Temporary unavailable”

Related Types

<EPTF_MQTT_LocalTransport_CT>

function f_EPTF_MQTT_LocalTransport_init() runs on EPTF_MQTT_LocalTransport_CT
The main initialization function of the EPTF_MQTT_LocalTransport_CT component type
function f_EPTF_MQTT_LocalTransport_initLogging() runs on EPTF_MQTT_LocalTransport_CT
Initializing CLL’s logging feature on the EPTF_MQTT_LocalTransport_CT component type
function f_EPTF_MQTT_LocalTransport_cleanup() runs on EPTF_MQTT_LocalTransport_CT
The main clean up function for the EPTF_MQTT_LocalTransport_CT component type
function f_EPTF_MQTT_IPL4asp_handleEvent(
   in EPTF_Transport_TransportType pl_transportType,
   in ConnectionId pl_connId,
   in PortEvent pl_event
) runs on EPTF_MQTT_LocalTransport_CT
Handler function to be registered into the IPL4 transport layer EPTF_CLL_TransportIPL4_Functions.
function f_EPTF_MQTT_IPL4asp_handleMessage(
   in EPTF_Transport_TransportType pl_transportType,
   in ConnectionId pl_connId,
   in HostName pl_remHost,
   in PortNumber pl_remPort,
   in HostName pl_locHost,
   in PortNumber pl_locPort,
   in ProtoTuple pl_proto,
   in integer pl_userData,
   in octetstring pl_msg
) runs on EPTF_MQTT_LocalTransport_CT
Handler function to be regisitered into the IPL4 transport layer EPTF_CLL_TransportIPL4_Functions.
function f_EPTF_MQTT_LocalTransport_send(
   in EPTF_MQTT_PDU pl_msg
) runs on EPTF_MQTT_LocalTransport_CT
Function to send out a EPTF_MQTT_PDU message using the local transport.
type record EPTF_MQTT_PDU
Encapsulates a MQTT PDU with the corresponding entity (and FSM) indices and transport information
function f_EPTF_MQTT_LocalTransport_transportApiRequest(
   EPTF_MQTT_Transport_Request pl_req
) runs on EPTF_MQTT_LocalTransport_CT
Function to handle incoming transport API requests
function f_EPTF_MQTT_LocalTransport_sendApiResponse(
   EPTF_MQTT_Transport_Response pl_rsp
) runs on EPTF_MQTT_LocalTransport_CT
Function to handle incoming transport API requests
function f_EPTF_MQTT_LocalTransport_startListening(
   in Socket p_local,
   in integer p_sessionIdx,
   inout integer p_idx
) runs on EPTF_MQTT_LocalTransport_CT return boolean
Start listening on a local TCP socket and store its data and state in socketDB
function f_EPTF_MQTT_LocalTransport_connect(
   in Socket p_local,
   in Socket p_remote,
   in integer p_sessionIdx,
   inout integer p_idx
) runs on EPTF_MQTT_LocalTransport_CT return boolean
Open a TCP connection and store its data and state in socketDB
function f_EPTF_MQTT_LocalTransport_close(
   in integer p_socketIdx
) runs on EPTF_MQTT_LocalTransport_CT return boolean
Close a TCP connection and remove its entry from the socketDB
function f_EPTF_MQTT_LocalTransport_IPL4_send(
   in integer pl_connId,
   in charstring pl_remName,
   in integer pl_remPort,
   in ProtoTuple pl_proto,
   in octetstring pl_msg
) runs on EPTF_MQTT_LocalTransport_CT
Send a message and add 1 message and its length to MQTT transport stats variable
function f_EPTF_MQTT_LocalTransport_socketDB_init() runs on EPTF_MQTT_LocalTransport_CT
Initializes the v_MQTT_LocalTransport_localSocketDB SocketDB database
function f_EPTF_MQTT_LocalTransport_socketDB_cleanUp() runs on EPTF_MQTT_LocalTransport_CT
Cleans up the reserved resources of the v_MQTT_LocalTransport_localSocketDB SocketDB database
function f_EPTF_MQTT_LocalTransport_socketDB_add(
   in SocketEntry p_sock
) runs on EPTF_MQTT_LocalTransport_CT return integer
Adds a new element to the v_MQTT_LocalTransport_localSocketDB SocketDB database
function f_EPTF_MQTT_LocalTransport_socketDB_lookUp(
   in Socket p_sock
) runs on EPTF_MQTT_LocalTransport_CT return integer
Gets the index of an SocketEntry element in v_MQTT_LocalTransport_localSocketDB SocketDB database based on its socket data
function f_EPTF_MQTT_LocalTransport_socketDB_lookUp_connId(
   in integer p_connId
) runs on EPTF_MQTT_LocalTransport_CT return integer
Gets the index of an SocketEntry element in v_MQTT_LocalTransport_localSocketDB SocketDB database based on its connection id
function f_EPTF_MQTT_LocalTransport_socketDB_get(
   in integer p_idx,
   inout SocketEntry p_sock
) runs on EPTF_MQTT_LocalTransport_CT return boolean
Retrieves an element from the v_MQTT_LocalTransport_localSocketDB SocketDB database
function f_EPTF_MQTT_LocalTransport_socketDB_remove(
   in integer p_idx
) runs on EPTF_MQTT_LocalTransport_CT
Removes an element from the v_MQTT_LocalTransport_localSocketDB SocketDB database and frees up its reserved resources
function f_EPTF_MQTT_Socket2String(Socket p_sock) return charstring
Converts socket data from Socket type to the format “hostname:<port number>”
function f_MQTT_Transport_Logging_VERBOSE(
   in @lazy charstring pl_message
) runs on EPTF_MQTT_LocalTransport_CT
Logging functions for the VERBOSE log level
function f_MQTT_Transport_Logging_DEBUG(
   in @lazy charstring pl_message
) runs on EPTF_MQTT_LocalTransport_CT
Logging functions for the DEBUG log level
function f_MQTT_Transport_Logging_WARNING(
   in @lazy charstring pl_message
) runs on EPTF_MQTT_LocalTransport_CT
Logging functions for the WARNING log level
function f_MQTT_Transport_Logging_ERROR(
   in @lazy charstring pl_message
) runs on EPTF_MQTT_LocalTransport_CT
Logging functions for the ERROR log level
function f_EPTF_MQTT_IPL4asp_handleResult(
   inout Result p_res
) runs on EPTF_MQTT_LocalTransport_CT return boolean
Checks the result of an IPL4 transport operation and records an MQTT transport stats warning if unsuccessful
This module contains the definitions for the MQTT local transport component
type record EPTF_MQTT_Transport_Request
Type for transport request
type record EPTF_MQTT_Transport_Response
Type for transport response