blob: 502421a4181d6299aaa8c2efb0bf640debb9762c [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2017 Ericsson Telecom AB
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html
///////////////////////////////////////////////////////////////////////////////
// File: EPTF_COAP_LGen_Definitions.ttcn
// Description:
// Rev: R1A
// Prodnr: CNL 113 858
// Updated: 2017-09-01
// Contact: http://ttcn.ericsson.se
///////////////////////////////////////////////////////////////////////////////
module EPTF_COAP_LGen_Definitions
{
import from EPTF_COAP_Transport_Definitions all;
import from EPTF_CLL_LGenBase_Definitions all;
import from EPTF_CLL_Logging_Definitions all;
import from EPTF_CLL_FBQ_Definitions all;
import from Socket_API_Definitions all;
import from CoAP_Types all;
modulepar boolean tsp_EPTF_COAP_LGen_debug := false;
modulepar boolean tsp_EPTF_COAP_LGen_debugVerbose := false;
modulepar integer tsp_EPTF_COAP_LGen_maxBindableCtx := -1;
modulepar CoAP_Template_List tsp_EPTF_COAP_LGen_templates := {};
const integer c_COAP_LGen_Logging_WARNING := 0;
const integer c_COAP_LGen_Logging_DEBUG := 1;
const integer c_COAP_LGen_Logging_DEBUGV := 2;
const integer c_COAP_LGen_Logging_ERROR := 3;
const charstring c_COAP_behaviorType := "COAP Behavior";
type record COAP_EntityCtx
{
integer eIdx,
integer localAddressIdx,
integer nextMID,
integer nextToken,
boolean reportCoapEvent
}
const COAP_EntityCtx c_COAP_EntityCtx_init :=
{
eIdx := -1,
localAddressIdx := -1,
nextMID := -1,
nextToken := -1,
reportCoapEvent := true
}
type record of COAP_EntityCtx COAP_EntityCtx_List;
type record COAP_EntityCtx_DB
{
EPTF_FreeBusyQueue queue,
COAP_EntityCtx_List data,
integer hashRef
}
type record COAP_FsmCtx
{
integer eIdx,
integer remoteAddressIdx,
integer rrIdx
}
const COAP_FsmCtx c_COAP_FsmCtx_init :=
{
eIdx := -1,
remoteAddressIdx := -1,
rrIdx := -1
}
type record of COAP_FsmCtx COAP_FsmCtx_List;
type record COAP_FsmCtx_DB
{
EPTF_FreeBusyQueue queue,
COAP_FsmCtx_List data,
integer hashRef
}
type enumerated COAP_Transaction_State
{
CLOSED,
RELIABLE_TX,
ACK_PENDING,
REMOVING
}
type enumerated COAP_Transaction_Direction
{
OUTGOING,
INCOMING
}
type record COAP_Transaction
{
integer mid,
integer eIdx,
integer addrIdx,
integer rrIdx,
integer retransmitTimer,
float retransmitTimerValue,
integer lifetimeTimer,
EPTF_COAP_PDU cache optional,
COAP_Transaction_State state,
COAP_Transaction_Direction direction
}
const COAP_Transaction c_COAP_Transaction_init :=
{
mid := -1,
eIdx := -1,
addrIdx := -1,
rrIdx := -1,
retransmitTimer := -1,
retransmitTimerValue := 1.0,
lifetimeTimer := -1,
cache := omit,
state := CLOSED,
direction := OUTGOING
}
type record of COAP_Transaction COAP_Transaction_List;
type record COAP_Transaction_DB
{
EPTF_FreeBusyQueue queue,
COAP_Transaction_List data,
integer hashRefOutgoing,
integer hashRefIncoming
}
type enumerated COAP_RR_Client_State
{
IDLE,
WAITING,
REMOVING
}
type enumerated COAP_RR_Server_State
{
IDLE,
SEPARATE,
SERVING,
REMOVING
}
type union COAP_RR_State
{
COAP_RR_Client_State client,
COAP_RR_Server_State server
}
type record COAP_RR
{
integer eIdx,
integer fsmIdx,
integer fsmCtxIdx,
integer addrIdx,
octetstring token,
integer trIdx,
Socket remoteAddress optional,
EPTF_COAP_PDU request optional,
EPTF_COAP_PDU response optional,
COAP_RR_State state
}
const COAP_RR c_COAP_RR_init :=
{
eIdx := -1,
fsmIdx := -1,
fsmCtxIdx := -1,
addrIdx := -1,
token := ''O,
trIdx := -1,
remoteAddress := omit,
request := omit,
response := omit,
state := { client := IDLE }
}
type record of COAP_RR COAP_RR_List;
type record COAP_RR_DB
{
EPTF_FreeBusyQueue queue,
COAP_RR_List data,
integer hashRef
}
type record CoAP_Template
{
charstring id,
CoAP_ReqResp msg
}
type record of CoAP_Template CoAP_Template_List;
type record COAP_Template_DB
{
CoAP_Template_List data,
integer hashRef
}
type record COAP_StepCtx
{
integer eIdx,
integer fsmIdx,
integer eCtxIdx,
integer fsmCtxIdx
}
const COAP_StepCtx c_COAP_StepCtx_empty :=
{
eIdx := -1,
fsmIdx := -1,
eCtxIdx := -1,
fsmCtxIdx := -1
}
type record of Socket COAP_Address_List;
type record COAP_AddressDB
{
EPTF_FreeBusyQueue queue,
COAP_Address_List data,
integer hashRef
}
type function fcb_EPTF_COAP_messageReceived(in EPTF_COAP_PDU pl_message, in boolean p_duplicate) runs on self;
type component EPTF_COAP_LGen_CT extends EPTF_COAP_Transport_User_CT, EPTF_LGenBase_CT, EPTF_Logging_CT
{
var boolean v_COAP_initialized := false;
var integer v_COAP_bIdx;
var integer v_COAP_loggingMaskId := -1;
var COAP_EntityCtx_DB v_COAP_EntityCtxDB;
var COAP_FsmCtx_DB v_COAP_FsmCtxDB;
var COAP_AddressDB v_COAP_addressDB;
var COAP_Transaction_DB v_COAP_trDB;
var COAP_RR_DB v_COAP_rrDB;
var COAP_Template_DB v_COAP_templateDB := {};
var COAP_StepCtx v_COAP_ctx := c_COAP_StepCtx_empty;
var EPTF_COAP_PDU v_COAP_msgToProcess;
var EPTF_COAP_PDU v_COAP_msgToSend;
var fcb_EPTF_COAP_messageReceived vf_COAP_msgReceived := null;
}
const integer c_COAP_AppData_fsmCtxIdx := 0;
// Events
const integer c_COAP_eventIdx_EMPTY := 0;
const charstring c_COAP_eventName_EMPTY := "COAP req: EMPTY";
const integer c_COAP_eventIdx_GET := 1;
const charstring c_COAP_eventName_GET := "COAP req: GET";
const integer c_COAP_eventIdx_POST := 2;
const charstring c_COAP_eventName_POST := "COAP req: POST";
const integer c_COAP_eventIdx_PUT := 3;
const charstring c_COAP_eventName_PUT := "COAP req: PUT";
const integer c_COAP_eventIdx_DELETE := 4;
const charstring c_COAP_eventName_DELETE := "COAP req: DELETE";
template charstring c_COAP_eventName(in integer p_code) := "COAP rsp: "&int2str(p_code);
const integer c_COAP_eventIdx_1xx := 700;
const charstring c_COAP_eventName_1xx := "COAP rsp: 1xx";
const integer c_COAP_eventIdx_2xx := 701;
const charstring c_COAP_eventName_2xx := "COAP rsp: 2xx";
const integer c_COAP_eventIdx_3xx := 702;
const charstring c_COAP_eventName_3xx := "COAP rsp: 3xx";
const integer c_COAP_eventIdx_4xx := 703;
const charstring c_COAP_eventName_4xx := "COAP rsp: 4xx";
const integer c_COAP_eventIdx_5xx := 704;
const charstring c_COAP_eventName_5xx := "COAP rsp: 5xx";
const integer c_COAP_eventIdx_6xx := 705;
const charstring c_COAP_eventName_6xx := "COAP rsp: 6xx";
const integer c_COAP_eventIdx_3xxto6xx := 706;
const charstring c_COAP_eventName_3xxto6xx := "COAP rsp: 3xxto6xx";
const integer c_COAP_eventIdx_transportSucc := 707;
const charstring c_COAP_eventName_transportSucc := "COAP transport: succ rsp";
const integer c_COAP_eventIdx_transportFail := 708;
const charstring c_COAP_eventName_transportFail := "COAP transport: fail rsp";
const integer c_COAP_eventIdx_trRST := 709;
const charstring c_COAP_eventName_trRST := "COAP transaction: reset";
const integer c_COAP_eventIdx_trTimeout := 710;
const charstring c_COAP_eventName_trTimeout := "COAP transaction: timeout";
// Steps
const integer c_COAP_stepIdx_init := 0;
const charstring c_COAP_stepName_init := "COAP Applib: init";
const integer c_COAP_stepIdx_cleanUp := 1;
const charstring c_COAP_stepName_cleanUp := "COAP Applib: cleanUp";
const integer c_COAP_stepIdx_setLocalAddress := 2;
const charstring c_COAP_stepName_setLocalAddress := "COAP Applib: setLocalAddress";
const integer c_COAP_stepIdx_setRemoteAddress_byIntIdx := 3;
const charstring c_COAP_stepName_setRemoteAddress_byIntIdx := "COAP Applib: setRemoteAddress_byIntIdx";
const integer c_COAP_stepIdx_send := 4;
const charstring c_COAP_stepName_send := "COAP Applib: send";
const integer c_COAP_stepIdx_loadTemplate_byIntIdx := 5;
const charstring c_COAP_stepName_loadTemplate_byIntIdx := "COAP Applib: loadTemplate_byIntIdx";
const integer c_COAP_stepIdx_handleRequest := 6;
const charstring c_COAP_stepName_handleRequest := "COAP Applib: handleRequest";
const integer c_COAP_stepIdx_sendResponse := 7;
const charstring c_COAP_stepName_sendResponse := "COAP Applib: sendResponse";
const integer c_COAP_stepIdx_sendAccept := 8;
const charstring c_COAP_stepName_sendAccept := "COAP Applib: sendAccept";
const integer c_COAP_stepIdx_startListening := 9;
const charstring c_COAP_stepName_startListening := "COAP Applib: startListening";
const integer c_COAP_stepIdx_reportCoapEventForEntity := 10;
const charstring c_COAP_stepName_reportCoapEventForEntity := "COAP Applib: reportCoapEventForEntity";
const integer c_COAP_stepIdx_loadTemplate_byStringId := 11;
const charstring c_COAP_stepName_loadTemplate_byStringId := "COAP Applib: loadTemplate_byStringId";
const integer c_COAP_stepIdx_setRemoteAddress_byVars := 12;
const charstring c_COAP_stepName_setRemoteAddress_byVars := "COAP Applib: setRemoteAddress_byVars";
// Step parameters:
const integer c_COAP_stepParam_true := 1;
const integer c_COAP_stepParam_false := 0;
}