diff options
author | erititan | 2018-02-15 14:41:06 +0000 |
---|---|---|
committer | erititan | 2018-02-15 14:41:06 +0000 |
commit | 142885bf83460903ebcba12cb25187accca22567 (patch) | |
tree | c8a08ec346b6dc25ab32187601f93b94f54569e7 | |
parent | d07184bdcbc1a27c9736e63a2d0ecac21fa22889 (diff) | |
download | titan.ApplicationLibraries.HTTP-142885bf83460903ebcba12cb25187accca22567.tar.gz titan.ApplicationLibraries.HTTP-142885bf83460903ebcba12cb25187accca22567.tar.xz titan.ApplicationLibraries.HTTP-142885bf83460903ebcba12cb25187accca22567.zip |
Initial code commit
38 files changed, 26430 insertions, 0 deletions
diff --git a/EPTF_Applib_HTTP_CNL113618.tpd b/EPTF_Applib_HTTP_CNL113618.tpd new file mode 100755 index 0000000..199c7aa --- /dev/null +++ b/EPTF_Applib_HTTP_CNL113618.tpd @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2000-2018 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_Applib_HTTP_CNL113618.tpd + Description: tpd project file + Rev: <RnXnn> + Prodnr: CNL 113 618 + Updated: 2018-02-13 + Contact: http://ttcn.ericsson.se +--> +<TITAN_Project_File_Information version="1.0"> + <ProjectName>EPTF_Applib_HTTP_CNL113618</ProjectName> + <ReferencedProjects> + <ReferencedProject name="EPTF_CLL_Common" projectLocationURI="../EPTF_Core_Library_CNL113512/src/Common/EPTF_CLL_Common.tpd"/> + <ReferencedProject name="EPTF_CLL_LGenBase" projectLocationURI="../EPTF_Core_Library_CNL113512/src/LGenBase/EPTF_CLL_LGenBase.tpd"/> + <ReferencedProject name="EPTF_CLL_Logging" projectLocationURI="../EPTF_Core_Library_CNL113512/src/Logging/EPTF_CLL_Logging.tpd"/> + <ReferencedProject name="EPTF_CLL_RedBlackTree" projectLocationURI="../EPTF_Core_Library_CNL113512/src/RedBlackTree/EPTF_CLL_RedBlackTree.tpd"/> + <ReferencedProject name="EPTF_CLL_Scheduler" projectLocationURI="../EPTF_Core_Library_CNL113512/src/Scheduler/EPTF_CLL_Scheduler.tpd"/> + <ReferencedProject name="EPTF_CLL_Transport_CommPortIPL4" projectLocationURI="../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_Transport_CommPortIPL4.tpd"/> + <ReferencedProject name="EPTF_CLL_Transport_MessageBufferManager" projectLocationURI="../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_Transport_MessageBufferManager.tpd"/> + <ReferencedProject name="EPTF_CLL_TransportRouting" projectLocationURI="../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportRouting.tpd"/> + <ReferencedProject name="EPTF_CLL_Variable" projectLocationURI="../EPTF_Core_Library_CNL113512/src/Variable/EPTF_CLL_Variable.tpd"/> + <ReferencedProject name="HTTPmsg_CNL113312" projectLocationURI="../../TestPorts/HTTPmsg_CNL113312/HTTPmsg_CNL113312.tpd"/> + <ReferencedProject name="IPL4asp_CNL113531" projectLocationURI="../../TestPorts/IPL4asp_CNL113531/IPL4asp_CNL113531.tpd"/> + <ReferencedProject name="TCCUsefulFunctions_CNL113472_Security" projectLocationURI="../TCCUsefulFunctions_CNL113472/TCCUsefulFunctions_CNL113472_Security.tpd"/> + </ReferencedProjects> + <Files> + <FileResource projectRelativePath="EPTF_HTTP_Definitions.ttcn" relativeURI="src/LoadGen/EPTF_HTTP_Definitions.ttcn"/> + <FileResource projectRelativePath="EPTF_HTTP_Functions.ttcn" relativeURI="src/LoadGen/EPTF_HTTP_Functions.ttcn"/> + <FileResource projectRelativePath="EPTF_HTTP_Transport_Definitions.ttcn" relativeURI="src/Transport/EPTF_HTTP_Transport_Definitions.ttcn"/> + <FileResource projectRelativePath="EPTF_HTTP_Transport_Functions.ttcn" relativeURI="src/Transport/EPTF_HTTP_Transport_Functions.ttcn"/> + </Files> + <ActiveConfiguration>Default</ActiveConfiguration> + <Configurations> + <Configuration name="Default"> + <ProjectProperties> + <MakefileSettings> + <generateInternalMakefile>true</generateInternalMakefile> + <GNUMake>true</GNUMake> + <incrementalDependencyRefresh>true</incrementalDependencyRefresh> + <targetExecutable>bin/EPTF_Applib_HTTP_CNL113618</targetExecutable> + <buildLevel>Level 3 - Creating object files with dependency update</buildLevel> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>bin</workingDirectory> + </LocalBuildSettings> + </ProjectProperties> + </Configuration> + </Configurations> +</TITAN_Project_File_Information> diff --git a/demo/EPTF_HTTP_Demo.cfg b/demo/EPTF_HTTP_Demo.cfg new file mode 100644 index 0000000..191cacf --- /dev/null +++ b/demo/EPTF_HTTP_Demo.cfg @@ -0,0 +1,207 @@ +[EXECUTE] +//EPTF_HTTP_Demo.control + +EPTF_HTTP_Demo.tc_localTransportClientServer + +[LOGGING] +FileMask := TTCN_ERROR | TTCN_WARNING | TTCN_USER | TTCN_VERDICTOP | +TTCN_TESTCASE |TTCN_STATISTICS |TTCN_PARALLEL | TTCN_MATCHING | TTCN_PORTEVENT | TTCN_DEBUG +ConsoleMask := TTCN_ERROR | TTCN_WARNING | TTCN_VERDICTOP | TTCN_TESTCASE |TTCN_STATISTICS +LogEventTypes := Yes +SourceInfoFormat := Stack #Single +LogEntityName := Yes +#MatchingHints := Detailed + +[MODULE_PARAMETERS] +tsp_EPTF_HTTP_Transport_loggingEnable := true; +tsp_EPTF_HTTP_loggingEnable := true; +tsp_EPTF_HTTP_maxNumberOfEntities := 100; + +tsp_EPTF_HTTP_dispatchLevel := Detailed; + +tsp_EPTF_LGenBaseDebug := false; +tsp_EPTF_LGenBaseDebugTraffic := false; + +tsp_EPTF_HTTP_userNumber := 10; +tsp_EPTF_HTTP_headerTemplatePath := "./"; +tsp_EPTF_HTTP_headerTemplateName := ""; +tsp_EPTF_HTTP_bodyTemplatePath := "./"; +tsp_EPTF_HTTP_bodyTemplateName := ""; + +tsp_EPTF_HTTP_Demo_LocalAddress := "159.107.193.33" +tsp_EPTF_HTTP_Demo_LocalPort := 3000 +tsp_EPTF_HTTP_Demo_RemoteAddress := "159.107.193.33" +tsp_EPTF_HTTP_Demo_RemotePort := 4000 + +tsp_EPTF_HTTP_Demo_FSMs := +{ + { name := "EPTF HTTP: Basic Call", + stateList := { "idle", "wait" }, + timerList := { { name := "TIMEOUT", startValue := 1.0 } }, + table := { + // TC tarted event + { + eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Traffic_case_started.", eventType := fsm }, + cellRow := { + // state == idle + { actionList := omit, + nextStateCalculation := omit, + nextState := omit + }, + // state == wait + { actionList := omit, + nextStateCalculation := omit, + nextState := omit + } + } + }, + + // start TC event + { + eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Start_the_traffic_case!", eventType := fsm }, + cellRow := { + // state == idle + { actionList := { + { stepOrFunctionName := "EPTF HTTP: Sends HTTP Request", contextArgs := { stepContextArgs := {} } }, + { stepOrFunctionName := "LGenBase: StepFunction_timerStart", contextArgs := { timerName := "TIMEOUT"} } + }, + nextStateCalculation := omit, + nextState := "wait" + }, + // state == wait + { actionList := omit, + nextStateCalculation := omit, + nextState := omit + } + } + }, + + // answer OK event + { + eventToListen := { bName := "HTTP Behavior", iName := "HTTP CHAR Response Message Received", eventType := fsm }, + cellRow := { + // state == idle + { actionList := omit, + nextStateCalculation := omit, + nextState := omit + }, + // state == wait + { actionList := { + { stepOrFunctionName := "EPTF HTTP: Response message received", contextArgs := { stepContextArgs := {} } }, + { stepOrFunctionName := "LGenBase: StepFunction_timerCancel", contextArgs := { timerName := "TIMEOUT" } }, + { stepOrFunctionName := "LGenBase: StepFunction_trafficSuccess",contextArgs := { stepContextArgs := {} } } + }, + nextStateCalculation := omit, + nextState := "idle" + } + } + }, + + // timeout event + { + eventToListen := { bName := "Special behavior for timeout reporting", iName := "TIMEOUT", eventType := fsm }, + cellRow := { + // state == idle + { actionList := omit, + nextStateCalculation := omit, + nextState := omit + }, + // state == wait + { actionList := { + { stepOrFunctionName := "EPTF HTTP: Timeout handler", contextArgs := { stepContextArgs := {} } }, + { stepOrFunctionName := "EPTF HTTP: Closes port of user", contextArgs := { stepContextArgs := {} } }, + { stepOrFunctionName := "LGenBase: StepFunction_trafficFailed", contextArgs := { stepContextArgs := {} } } + }, + nextStateCalculation := omit, + nextState := "idle" + } + } + }, + + // connection closed event + { + eventToListen := { bName := "HTTP Behavior", iName := "HTTP Connection Closed ", eventType := fsm }, + cellRow := { + // state == idle + { actionList := omit, + nextStateCalculation := omit, + nextState := omit + }, + // state == wait + { actionList := omit, + nextStateCalculation := omit, + nextState := omit + } + } + }, + + // connection opened event + { + eventToListen := { bName := "HTTP Behavior", iName := "HTTP Connection Opened ", eventType := fsm }, + cellRow := { + // state == idle + { actionList := omit, + nextStateCalculation := omit, + nextState := omit + }, + // state == wait + { actionList := omit, + nextStateCalculation := omit, + nextState := omit + } + } + }, + + // stop TC event + { + eventToListen := { bName := "EPTF_CLL_LGenBase", iName := "LGenBase: Stop_the_traffic_case!", eventType := fsm }, + cellRow := { + // state == idle + { actionList := { + { stepOrFunctionName := "LGenBase: StepFunction_entityStopped", contextArgs := { stepContextArgs := { } } } + }, + nextStateCalculation := omit, + nextState := "idle" + }, + // state == wait + { actionList := { + { stepOrFunctionName := "LGenBase: StepFunction_entityStopped", contextArgs := { stepContextArgs := { } } } + }, + nextStateCalculation := omit, + nextState := "idle" + } + } + } + } + }, + { name := "EPTF HTTP: Server", + stateList := { "idle"}, + timerList := {}, + table := { + { + eventToListen := { bName := "HTTP Behavior", iName := "HTTP CHAR Request Message Received", eventType := entity }, + cellRow := { + // state == idle + { actionList := { + { stepOrFunctionName := "LGenBase: StepFunction_recordEntityStart",contextArgs := { stepContextArgs := {} } }, + { stepOrFunctionName := "EPTF HTTP: Handle Request", contextArgs := { stepContextArgs := {} } }, + { stepOrFunctionName := "EPTF HTTP: Send Response", contextArgs := { stepContextArgs := {} } }, + { stepOrFunctionName := "LGenBase: StepFunction_trafficSuccess",contextArgs := { stepContextArgs := {} } } + }, + nextStateCalculation := omit, + nextState := "idle" + } + } + } + } + } +} + +[TESTPORT_PARAMETERS] +#*.IPL4_PCO.debug := "YES" +#*.v_IPL4_PCO.debug := "YES" + +[MAIN_CONTROLLER] +#TCPPort := 1025 +#NumHCs := 1 +#KillTimer := 11 diff --git a/demo/EPTF_HTTP_Demo.prj b/demo/EPTF_HTTP_Demo.prj new file mode 100644 index 0000000..c54b727 --- /dev/null +++ b/demo/EPTF_HTTP_Demo.prj @@ -0,0 +1,156 @@ +<!DOCTYPE TITAN_GUI_project_file> +<Project TITAN_version="1.8.pl7" > + <General> + <Project_Name>HTTPDemo</Project_Name> + <Executable_Path>bin/HTTPDemo</Executable_Path> + <Working_Dir>bin</Working_Dir> + <Build_Host>alpha</Build_Host> + <Execution_Mode>Parallel</Execution_Mode> + <Code_Splitting_Mode>None</Code_Splitting_Mode> + <ScriptFile_AfterMake>EPTF_HTTP_Demo_Makepatch.sh</ScriptFile_AfterMake> + <Log_Format>yes</Log_Format> + <Update_Symlinks>yes</Update_Symlinks> + <Create_Absolute_Symlinks>no</Create_Absolute_Symlinks> + <Update_Makefile>yes</Update_Makefile> + <Localhost_Execute>yes</Localhost_Execute> + <Execute_Command>rsh %host "cd %project_working_dir ; "%executable" %localhost %mctr_port"</Execute_Command> + <Execute_Hosts>alfa, beta, gamma</Execute_Hosts> + <UnUsed_List>../../TCCUsefulFunctions_CNL113472/src/TCCAssertion.cc,../../TCCUsefulFunctions_CNL113472/src/TCCAssertion_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCEncoding.cc,../../TCCUsefulFunctions_CNL113472/src/TCCEncoding_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCIPsec.cc,../../TCCUsefulFunctions_CNL113472/src/TCCIPsec_Definitions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCIPsec_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCTitanMetadata.cc,../../TCCUsefulFunctions_CNL113472/src/TCCTitanMetadata_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCXPathSupport.cc,../../TCCUsefulFunctions_CNL113472/src/TCCXPathSupport_Functions.ttcn,../../EPTF_Core_Library_CNL113512/src/Common/EPTF_CLL_Common_RndDefinitions.ttcn,../../EPTF_Core_Library_CNL113512/src/Common/EPTF_CLL_Common_RndFunctions.ttcn,../../EPTF_Core_Library_CNL113512/src/LGenBase/EPTF_CLL_LGenBaseStatsUI_Definitions.ttcn,../../EPTF_Core_Library_CNL113512/src/LGenBase/EPTF_CLL_LGenBaseStatsUI_Functions.ttcn,../../EPTF_Core_Library_CNL113512/src/UIHandler/EPTF_CLL_UIHandlerCLI_Definitions.ttcn,../../EPTF_Core_Library_CNL113512/src/UIHandler/EPTF_CLL_UIHandlerCLI_Functions.ttcn,../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_User_CtrlFunct.ttcn,../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_User_CtrlFunctDef.cc</UnUsed_List> + </General> + <Configs> + <Config>EPTF_HTTP_Demo.cfg</Config> + </Configs> + <Test_Cases> + <Test_Case>EPTF_HTTP_Demo.control</Test_Case> + <Test_Case>EPTF_HTTP_Demo.tc_localTransport</Test_Case> + <Test_Case>EPTF_HTTP_Demo.tc_remoteTransport</Test_Case> + </Test_Cases> + <Others> + <Other>EPTF_HTTP_Demo.prj</Other> + <Other>EPTF_HTTP_Demo_Makepatch.sh</Other> + </Others> + <File_Group name="MainFileGroup" > + <File_Groups> + <File_Group name="HTTP_Applib" > + <File_Groups> + <File_Group name="LoadGen" > + <File path="../src/LoadGen/EPTF_HTTP_Definitions.ttcn" /> + <File path="../src/LoadGen/EPTF_HTTP_Functions.ttcn" /> + </File_Group> + <File_Group name="Logger" > + <File path="../src/Logger/EPTF_HTTP_Logger_Definitions.ttcn" /> + <File path="../src/Logger/EPTF_HTTP_Logger_Functions.ttcn" /> + </File_Group> + <File_Group name="Transport" > + <File path="../src/Transport/EPTF_HTTP_Transport_Definitions.ttcn" /> + <File path="../src/Transport/EPTF_HTTP_Transport_Functions.ttcn" /> + </File_Group> + </File_Groups> + </File_Group> + <File_Group name="Demo" > + <File path="EPTF_HTTP_Demo.ttcn" /> + <File path="EPTF_HTTP_Demo_Responder.ttcn" /> + </File_Group> + <File_Group name="TITANSimR3" > + <File_Groups> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Base/EPTF_CLL_Base.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Common/EPTF_CLL_Common.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/FreeBusyQueue/EPTF_CLL_FreeBusyQueue.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/HashMap/EPTF_CLL_HashMap.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/LGenBase/EPTF_CLL_LGenBase_All.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Logging/EPTF_CLL_Logging.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Logging/EPTF_CLL_LoggingUI.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/RedBlackTree/EPTF_CLL_RBtree.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Scheduler/EPTF_CLL_Scheduler.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Semaphore/EPTF_CLL_Semaphore.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/StatHandler/EPTF_CLL_StatHandler.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/StatHandler/EPTF_CLL_StatHandlerUI.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportCommPortIPL4.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportMessageBufferManager.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportRouting.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/UIHandler/EPTF_CLL_UIHandler.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Variable/EPTF_CLL_Variable.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/StatMeasure/EPTF_CLL_StatMeasure.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/RandomNArray/EPTF_CLL_RNA.grp" /> + </File_Groups> + </File_Group> + <File_Group name="TCCCommon" > + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCFileIO.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCFileIO_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCInterface.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCInterface_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCInterface_ip.h" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCSecurity.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCSecurity_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/aka_algorythm_set.c" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/aka_algorythm_set.h" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/digcalc.c" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/digcalc.h" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCAssertion.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCAssertion_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCConversion.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCConversion_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCDateTime.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCDateTime_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCEncoding.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCEncoding_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCEnv.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCEnv_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCIPsec.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCIPsec_Definitions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCIPsec_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCMaths.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCMaths_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCMaths_GenericTypes.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCTemplate_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCTitanMetadata.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCTitanMetadata_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCXPathSupport.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCXPathSupport_Functions.ttcn" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCMessageHandling.cc" /> + <File path="../../TCCUsefulFunctions_CNL113472/src/TCCMessageHandling_Functions.ttcn" /> + </File_Group> + <File_Group name="TestPorts" > + <File_Groups> + <File_Group path="../../../TestPorts/IPL4asp_CNL113531/src/IPL4.grp" /> + <File_Group name="IPL4 User Ctrl Functions" > + <File path="../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_User_CtrlFunct.ttcn" /> + <File path="../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_User_CtrlFunctDef.cc" /> + </File_Group> + <File_Group name="HTTP_TP" > + <File path="../../../TestPorts/HTTPmsg_CNL113312/src/HTTPmsg_PT.cc" /> + <File path="../../../TestPorts/HTTPmsg_CNL113312/src/HTTPmsg_PT.hh" /> + <File path="../../../TestPorts/HTTPmsg_CNL113312/src/HTTPmsg_PortType.ttcn" /> + <File path="../../../TestPorts/HTTPmsg_CNL113312/src/HTTPmsg_Types.ttcn" /> + </File_Group> + <File_Group name="XTDP" > + <File path="../../../TestPorts/XTDPasp_CNL113494/src/XTDP-EXER-EncDec.cc" /> + <File path="../../../TestPorts/XTDPasp_CNL113494/src/XTDP_Images.ttcn" /> + <File path="../../../TestPorts/XTDPasp_CNL113494/src/XTDP_PDU_Defs.asn" /> + <File path="../../../TestPorts/XTDPasp_CNL113494/src/XTDPasp_PT.cc" /> + <File path="../../../TestPorts/XTDPasp_CNL113494/src/XTDPasp_PT.hh" /> + <File path="../../../TestPorts/XTDPasp_CNL113494/src/XTDPasp_PortType.ttcn" /> + <File path="../../../TestPorts/XTDPasp_CNL113494/src/XTDPasp_Types.ttcn" /> + <File path="../../../TestPorts/XTDPasp_CNL113494/src/XUL_XTDL.asn" /> + <File path="../../../TestPorts/XTDPasp_CNL113494/src/lex.xtdp.c" /> + </File_Group> + <File_Group name="UDP" > + <File path="../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.cc" /> + <File path="../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PT.hh" /> + <File path="../../../TestPorts/UDPasp_CNL113346/src/UDPasp_PortType.ttcn" /> + <File path="../../../TestPorts/UDPasp_CNL113346/src/UDPasp_Types.ttcn" /> + </File_Group> + <File_Group name="AS" > + <File path="../../../TestPorts/Common_Components/Abstract_Socket_CNL113384/src/Abstract_Socket.cc" /> + <File path="../../../TestPorts/Common_Components/Abstract_Socket_CNL113384/src/Abstract_Socket.hh" /> + </File_Group> + <File_Group name="TELNET_TP" > + <File path="../../../TestPorts/TELNETasp_CNL113320/src/TELNETasp_PT.cc" /> + <File path="../../../TestPorts/TELNETasp_CNL113320/src/TELNETasp_PT.hh" /> + <File path="../../../TestPorts/TELNETasp_CNL113320/src/TELNETasp_PortType.ttcn" /> + </File_Group> + </File_Groups> + </File_Group> + </File_Groups> + </File_Group> +</Project> diff --git a/demo/EPTF_HTTP_Demo.ttcn b/demo/EPTF_HTTP_Demo.ttcn new file mode 100644 index 0000000..708deb4 --- /dev/null +++ b/demo/EPTF_HTTP_Demo.ttcn @@ -0,0 +1,1011 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_Demo.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-08-10 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// Module: EPTF_HTTP_Demo +// +// Purpose: +// This module contains the Demo module of the HTTP Application Library. +// +// Module Parameters: +// - +// +// Module depends on: +// <IPL4asp_Types> +// +// <IPL4asp_PortType> +// +// <HTTPmsg_Types> +// +// <EPTF_HTTP_Demo_Responder> +// +// <EPTF_HTTP_Transport_Definitions> +// +// <EPTF_HTTP_Transport_Functions> +// +// <EPTF_HTTP_Logger_Definitions> +// +// <EPTF_HTTP_Logger_Functions> +// +// <EPTF_HTTP_Functions> +// +// <XTDP_PDU_Defs language "ASN.1:2002"> +// +// <EPTF_CLL_Base_Functions> +// +// <EPTF_CLL_HashMapInt2Int_Functions> +// +// <EPTF_CLL_UIHandler_WidgetFunctions> +// +// <EPTF_CLL_LoggingUI_Functions> +// +// <EPTF_CLL_LoggingUI_Definitions> +// +// <EPTF_CLL_Variable_Functions> +// +// <EPTF_CLL_UIHandlerClient_Functions> +// +// <EPTF_CLL_UIHandler_Definitions> +// +// <EPTF_CLL_UIHandler_PrivateFunctions> +// +// <EPTF_CLL_Common_Definitions> +// +// <EPTF_CLL_Logging_Functions> +// +// <EPTF_CLL_LGenBase_ConfigFunctions> +// +// <EPTF_CLL_LGenBase_ConfigDefinitions> +// +// <EPTF_CLL_LGenBase_TrafficFunctions> +// +// <EPTF_CLL_LGenBase_EventHandlingFunctions> +// +// Current owner: +// EAKOPER +// +// Last Review Date: +// 2009-08-10 +// +/////////////////////////////////////////////////////////////////////////////// +module EPTF_HTTP_Demo +{ + +//============================================================================= +// Import part +//============================================================================= +import from IPL4asp_Types all; +import from IPL4asp_PortType all; +import from HTTPmsg_Types all; + +import from EPTF_HTTP_Demo_Responder all; +import from EPTF_HTTP_Transport_Definitions all; +import from EPTF_HTTP_Transport_Functions all; +import from EPTF_HTTP_Logger_Definitions all; +import from EPTF_HTTP_Logger_Functions all; +import from EPTF_HTTP_Definitions all; +import from EPTF_HTTP_Functions all; + +import from XTDP_PDU_Defs language "ASN.1:2002" all; + +import from EPTF_CLL_Base_Functions all; +import from EPTF_CLL_HashMapInt2Int_Functions all; +import from EPTF_CLL_UIHandler_WidgetFunctions all; +import from EPTF_CLL_LoggingUI_Functions all; +import from EPTF_CLL_LoggingUI_Definitions all; +import from EPTF_CLL_LGenBase_Definitions all; +import from EPTF_CLL_LGenBase_Functions all; +import from EPTF_CLL_RBTScheduler_Functions all; +import from EPTF_CLL_Variable_Functions all; +import from EPTF_CLL_UIHandlerClient_Functions all; +import from EPTF_CLL_UIHandler_Definitions all; +import from EPTF_CLL_UIHandler_PrivateFunctions all; +import from EPTF_CLL_Common_Definitions all; +import from EPTF_CLL_Logging_Functions all; +import from EPTF_CLL_LGenBase_ConfigFunctions all; +import from EPTF_CLL_LGenBase_ConfigDefinitions all; +import from EPTF_CLL_LGenBase_TrafficFunctions all; +import from EPTF_CLL_LGenBase_EventHandlingFunctions all; + +//============================================================================= +// Module parameters +//============================================================================= +modulepar +{ + integer tsp_EPTF_HTTP_userNumber := 1; + integer tsp_EPTF_HTTP_portNumber := 1; + integer tsp_EPTF_HTTP_serverUserNumber := 1; + charstring tsp_EPTF_HTTP_headerTemplatePath := "./"; + charstring tsp_EPTF_HTTP_headerTemplateName := ""; + charstring tsp_EPTF_HTTP_bodyTemplatePath := "./"; + charstring tsp_EPTF_HTTP_bodyTemplateName := ""; + + charstring tsp_EPTF_HTTP_Demo_LocalAddress := "159.107.193.33"; + integer tsp_EPTF_HTTP_Demo_LocalPort := 3000; + charstring tsp_EPTF_HTTP_Demo_RemoteAddress := "159.107.193.33"; + integer tsp_EPTF_HTTP_Demo_RemotePort := 4000; + + EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList tsp_EPTF_HTTP_Demo_FSMs := {}; + + float tsp_runningTime := 30.0; +} + +type enumerated HTTP_Demo_controlMessage {READY}; + +type port HTTP_Demo_control message +{ + inout HTTP_Demo_controlMessage; +} with {extension "internal"} + +//============================================================================= +// Component types +//============================================================================= +type component MyLogger_CT +extends EPTF_HTTP_LocalTransport_CT, EPTF_UIHandler_CT, EPTF_LoggingUI_CT +{ + var integer v_MyLogger_loggerEnabled; +} + +type component MyLGen_CT + extends EPTF_HTTP_LGen_CT +{ + var integer v_myBIdx; + port EPTF_HTTP_Demo_CM_PT v_CM_PCO; + port HTTP_Demo_control v_ctrl_PCO; +} + +type component My_Local_LGen_CT +extends MyLGen_CT, EPTF_HTTP_LocalTransport_CT +{ +} + +type component My_Remote_LGen_CT +extends MyLGen_CT, EPTF_HTTP_RemoteTransport_CT +{ +} + +type component My_Mapper_CT + extends EPTF_HTTP_Mapper_CT, My_Local_LGen_CT +{ +} + +//============================================================================= +// Functions +//============================================================================= + +function f_HTTP_CreateResponder( + in integer pl_tcIndex) +runs on My_Local_LGen_CT +{ + var EPTF_HTTP_Demo_Responder_CT v_HTTP_Responder_comp; + + v_HTTP_Responder_comp := EPTF_HTTP_Demo_Responder_CT.create("HTTP_Responder"); + connect(self:v_CM_PCO, v_HTTP_Responder_comp:v_CM_PCO); + v_HTTP_Responder_comp.start(f_EPTF_HTTP_Demo_Responder_behavior( + pl_tcIndex, tsp_runningTime + 2.0)); + + timer tl_guard; + tl_guard.start(5.0); + alt { + [] v_CM_PCO.receive {tl_guard.stop} + [] tl_guard.timeout {f_EPTF_Base_stopAll()} + } +} + +function f_HTTP_LocalLGenBehaviorClient() runs on My_Local_LGen_CT +{ + var integer dummy, nof_entity := tsp_EPTF_HTTP_userNumber; + + f_EPTF_HTTP_init("HTTP", 0, "Demo Entity#"); + + dummy := f_EPTF_HTTP_LocalTransport_init_CT("HTTP", + refers(f_EPTF_HTTP_messageReceived), + refers(f_EPTF_HTTP_eventReceived)); + + f_EPTF_HTTP_setSendRequestFunction(refers(f_EPTF_HTTP_LocalTransport_sendMessage)); + f_EPTF_HTTP_setConnectionCloseFunction(refers(f_EPTF_HTTP_LocalTransport_connectionClose)); + f_EPTF_HTTP_setConnectionOpenFunction(refers(f_EPTF_HTTP_LocalTransport_connectionOpen)); + f_EPTF_HTTP_setConnectionHalfCloseFunction(refers(f_EPTF_HTTP_LocalTransport_connectionHalfClose)); + f_EPTF_HTTP_setClosePortOfUserFunction(refers(f_EPTF_HTTP_LocalTransport_closePortOfUser)); + f_EPTF_HTTP_setFreePortOfUserFunction(refers(f_EPTF_HTTP_LocalTransport_freePortOfUser)); + + var EPTF_IntegerList vl_EPTF_HTTP_fsmIdx_basicCall := f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables( + tsp_EPTF_HTTP_Demo_FSMs); //f_EPTF_HTTP_return_CompactFsm_basicCall()); + + dummy := f_EPTF_LGenBase_declareEntityType("HTTPEntityType", { c_EPTF_HTTP_myBName }); + + dummy := f_EPTF_LGenBase_createEntityGroup( + { name := "HTTPEntityGroup", eType := "HTTPEntityType", eCount := nof_entity}); + + //adding the behaviour + var integer groupIdx:=f_EPTF_LGenBase_entityGrpNameIndex("HTTPEntityGroup"); + var integer groupBaseOffsetIdx:= f_EPTF_LGenBase_getEGrpBaseOffset(groupIdx); + log ("groupIdx: ",groupIdx," groupBaseOffsetIdx: ",groupBaseOffsetIdx); + + var integer vl_connHandle := f_EPTF_HTTP_LocalTransport_newPortGroup({ + name := "MyPortGroup", + localHostInformation := { tsp_EPTF_HTTP_Demo_LocalAddress, tsp_EPTF_HTTP_Demo_LocalPort}, + remoteHostInformation := { tsp_EPTF_HTTP_Demo_RemoteAddress, tsp_EPTF_HTTP_Demo_RemotePort}, + numberOfPorts := tsp_EPTF_HTTP_portNumber, + localportStep := 1, + remoteportStep := 0, + instantConnOpen := false, + instantConnClose := false, + useSSL := false, + userFunctions := omit}); + + + if (vl_connHandle < 0) { f_EPTF_Base_stopAll(); } + + log("Port database: ", v_EPTF_HTTP_Transport_portDB); + log("Function database: ", v_EPTF_HTTP_Transport_functionDB); + + var charstring vl_body; + for (var integer i:= groupBaseOffsetIdx; i<groupBaseOffsetIdx+nof_entity; i:=i+1) + { + vl_body := "<HTML>Request." & int2str(i) & "</HTML>" + + f_EPTF_HTTP_setEntityContext (i, + "POST", "/HTTP-ap-service/resource-lists/users/friends.xml" & "_" & int2str(i), + 1, 1, + f_EPTF_HTTP_createContextLengthHeaderLine(vl_body), + vl_connHandle, -, + { charVal := vl_body }); + } + + f_declareScenario("HTTPScenario"); + + f_EPTF_LGenBase_createScenario2EntityGroup( + { eGrpName := "HTTPEntityGroup", scenarioName :="HTTPScenario" }); + + timer t_wait := tsp_runningTime; + t_wait.start; + + alt { + [] t_wait.timeout {} + } + + f_EPTF_HTTP_printStats(); + log("v_EPTF_HTTP_contexts:", v_EPTF_HTTP_contexts); + + f_EPTF_LGenBase_stopTrafficCase("HTTPEntityGroup", "HTTPScenario", "EPTF_HTTP_DemoTrafficCase"); + + f_EPTF_Base_cleanup_CT(); +} + +const charstring c_EPTF_HTTP_fsmName_server := "EPTF HTTP: Server"; + +function f_HTTP_LocalLGenBehaviorServer() runs on My_Local_LGen_CT +{ + var integer dummy, nof_entity := tsp_EPTF_HTTP_serverUserNumber; + + f_EPTF_HTTP_init("HTTP", 0, "Demo Entity#"); + + dummy := f_EPTF_HTTP_LocalTransport_init_CT("HTTP", + refers(f_EPTF_HTTP_messageReceivedServer)/*, + refers(f_EPTF_HTTP_eventReceivedServer), + refers(f_EPTF_HTTP_socketErrorReceivedServer)*/); + + f_EPTF_HTTP_setSendResponseFunction(refers(f_EPTF_HTTP_LocalTransport_sendResponse)); + f_EPTF_HTTP_setListenFunction(refers(f_EPTF_HTTP_LocalTransport_listen)); + f_EPTF_HTTP_setClosePortFunction(refers(f_EPTF_HTTP_LocalTransport_closePort)); + + f_EPTF_HTTP_setSearchContextFunction(refers(f_HTTP_searchServerContext)); + + var EPTF_IntegerList vl_EPTF_HTTP_fsmIds:= f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables( + tsp_EPTF_HTTP_Demo_FSMs); + + dummy := f_EPTF_LGenBase_declareEntityType("HTTPEntityType", { c_EPTF_HTTP_myBName }); + + dummy := f_EPTF_LGenBase_createEntityGroup( + { name := "HTTPEntityGroup", eType := "HTTPEntityType", eCount := nof_entity}); + + //adding the behaviour + var integer groupIdx:=f_EPTF_LGenBase_entityGrpNameIndex("HTTPEntityGroup"); + var integer groupBaseOffsetIdx:= f_EPTF_LGenBase_getEGrpBaseOffset(groupIdx); + log ("groupIdx: ",groupIdx," groupBaseOffsetIdx: ",groupBaseOffsetIdx); + + var EPTF_HTTP_Transport_ServerPortMode vl_portMode := c_EPTF_HTTP_initServerPortMode; + + vl_portMode.name := "ServerPort"; + vl_portMode.localHostInformation := { tsp_EPTF_HTTP_Demo_RemoteAddress, tsp_EPTF_HTTP_Demo_RemotePort}; + vl_portMode.instantConnClose := false; + vl_portMode.userFunctions := omit; + vl_portMode.buffer := true; + + var integer vl_connHandle := f_EPTF_HTTP_LocalTransport_newServerPort(vl_portMode); + + if (vl_connHandle < 0) { f_EPTF_Base_stopAll(); } + + var integer vl_listenPortId := f_EPTF_HTTP_listen(vl_connHandle); + + if (-1 == vl_listenPortId){ f_EPTF_Base_stopAll(); } + + log("Port database: ", v_EPTF_HTTP_Transport_portDB); + log("Function database: ", v_EPTF_HTTP_Transport_functionDB); + + var charstring vl_body; + for (var integer i:= groupBaseOffsetIdx; i<groupBaseOffsetIdx+nof_entity; i:=i+1) + { + vl_body := "<HTML>Response " & int2str(i) & "." & "</HTML>" + + f_EPTF_HTTP_setEntityContextServer( + i, + 200, + "OK", + 1, + 1, + f_EPTF_HTTP_createContextLengthHeaderLine(vl_body), + { charVal := vl_body }); + } + + f_HTTP_declareServerScenario("HTTPEntityType", "HTTPEntityGroup", "HTTPScenario", "HTTPTrafficCase"); + + v_ctrl_PCO.send(READY); + + timer t_wait := tsp_runningTime + 1.0; + t_wait.start; + + alt { + [] t_wait.timeout {} + } + + f_EPTF_HTTP_printStats(); + log("v_EPTF_HTTP_contexts:", v_EPTF_HTTP_contexts); + + f_EPTF_LGenBase_stopTrafficCase("HTTPEntityGroup","HTTPScenario","HTTPTrafficCase"); + + f_EPTF_HTTP_closePort(vl_connHandle, vl_listenPortId); + + f_EPTF_Base_cleanup_CT(); +} + +function f_HTTP_RemoteLGenBehaviorClient( + in integer pl_LGenNumber) +runs on My_Remote_LGen_CT +{ + var integer dummy, nof_entity := tsp_EPTF_HTTP_userNumber; + + f_EPTF_HTTP_init("HTTP", pl_LGenNumber, "Demo Entity#"); + + var EPTF_IntegerList vl_EPTF_HTTP_fsmIdx_basicCall := f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables( + tsp_EPTF_HTTP_Demo_FSMs); //f_EPTF_HTTP_return_CompactFsm_basicCall()); + + dummy := f_EPTF_LGenBase_declareEntityType("HTTPEntityType", { c_EPTF_HTTP_myBName }); + + dummy := f_EPTF_LGenBase_createEntityGroup( + { name := "HTTPEntityGroup", eType := "HTTPEntityType", eCount := nof_entity }); + + //adding the behaviour + var integer groupIdx:=f_EPTF_LGenBase_entityGrpNameIndex("HTTPEntityGroup"); + var integer groupBaseOffsetIdx:= f_EPTF_LGenBase_getEGrpBaseOffset(groupIdx); + log ("groupIdx: ",groupIdx," groupBaseOffsetIdx: ",groupBaseOffsetIdx); + + dummy := f_EPTF_HTTP_RemoteTransport_init_CT("HTTP", + refers(f_EPTF_HTTP_messageReceived), + refers(f_EPTF_HTTP_eventReceived), + refers(f_EPTF_HTTP_socketErrorReceived)); + + f_EPTF_HTTP_setSendRequestFunction(refers(f_EPTF_HTTP_RemoteTransport_sendMessage)); + f_EPTF_HTTP_setConnectionCloseFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionClose)); + f_EPTF_HTTP_setConnectionOpenFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionOpen)); + f_EPTF_HTTP_setConnectionHalfCloseFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionHalfClose)); + f_EPTF_HTTP_setClosePortOfUserFunction(refers(f_EPTF_HTTP_RemoteTransport_closePortOfUser)); + f_EPTF_HTTP_setFreePortOfUserFunction(refers(f_EPTF_HTTP_RemoteTransport_freePortOfUser)); + + var integer vl_connHandle := f_EPTF_HTTP_RemoteTransport_newPortGroup({ + name := "MyPortGroup." & int2str(pl_LGenNumber), + localHostInformation := { tsp_EPTF_HTTP_Demo_LocalAddress, tsp_EPTF_HTTP_Demo_LocalPort + pl_LGenNumber * 10 + 10}, + remoteHostInformation := { tsp_EPTF_HTTP_Demo_RemoteAddress, tsp_EPTF_HTTP_Demo_RemotePort}, + numberOfPorts := tsp_EPTF_HTTP_portNumber, + localportStep := 1, + remoteportStep := 0, + instantConnOpen := false, + instantConnClose := false, + useSSL := false, + userFunctions := omit}); + + if (vl_connHandle < 0) { f_EPTF_Base_stopAll(); } + + var charstring vl_body; + for (var integer i:= 0; i < nof_entity; i:=i+1) + { + vl_body := "<HTML>Request." & int2str(pl_LGenNumber) & "." & int2str(i) & "</HTML>"; + + f_EPTF_HTTP_setEntityContext (i, + "POST", "/HTTP-ap-service/resource-lists/users/friends.xml" & "_" & int2str(i), + 1, 1, + f_EPTF_HTTP_createContextLengthHeaderLine(vl_body), + vl_connHandle, -, + { charVal := vl_body }); + } + + f_declareScenario("HTTPScenario"); + + f_EPTF_LGenBase_createScenario2EntityGroup( + { eGrpName := "HTTPEntityGroup", scenarioName := "HTTPScenario" }); + + timer t_wait := tsp_runningTime; + t_wait.start; + + alt { + [] t_wait.timeout {} + } + + f_EPTF_HTTP_printStats(); + log("v_EPTF_HTTP_contexts:", v_EPTF_HTTP_contexts); + + f_EPTF_LGenBase_stopTrafficCase("HTTPEntityGroup","HTTPScenario","EPTF_HTTP_DemoTrafficCase"); + + f_EPTF_Base_cleanup_CT(); +} + +function f_HTTP_RemoteLGenBehaviorServer( + in integer pl_LGenNumber) +runs on My_Remote_LGen_CT +{ + var integer dummy, nof_entity := tsp_EPTF_HTTP_userNumber; + + f_EPTF_HTTP_init("HTTP", pl_LGenNumber, "Demo Entity#"); + + var EPTF_IntegerList vl_EPTF_HTTP_fsmIds:= f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables( + tsp_EPTF_HTTP_Demo_FSMs); + + dummy := f_EPTF_LGenBase_declareEntityType("HTTPEntityType", { c_EPTF_HTTP_myBName }); + + dummy := f_EPTF_LGenBase_createEntityGroup( + { name := "HTTPEntityGroup", eType := "HTTPEntityType", eCount := nof_entity }); + + //adding the behaviour + var integer groupIdx:=f_EPTF_LGenBase_entityGrpNameIndex("HTTPEntityGroup"); + var integer groupBaseOffsetIdx:= f_EPTF_LGenBase_getEGrpBaseOffset(groupIdx); + log ("groupIdx: ",groupIdx," groupBaseOffsetIdx: ",groupBaseOffsetIdx); + + dummy := f_EPTF_HTTP_RemoteTransport_init_CT("HTTP", + refers(f_EPTF_HTTP_messageReceivedServer), + refers(f_EPTF_HTTP_eventReceivedServer), + refers(f_EPTF_HTTP_socketErrorReceivedServer)); + + f_EPTF_HTTP_setSendResponseFunction(refers(f_EPTF_HTTP_RemoteTransport_sendResponse)); + f_EPTF_HTTP_setListenFunction(refers(f_EPTF_HTTP_RemoteTransport_listen)); + f_EPTF_HTTP_setClosePortFunction(refers(f_EPTF_HTTP_RemoteTransport_closePort)); + + f_EPTF_HTTP_setSearchContextFunction(refers(f_HTTP_searchServerContext)); + + var EPTF_HTTP_Transport_ServerPortMode vl_portMode := c_EPTF_HTTP_initServerPortMode; + + vl_portMode.name := "ServerPort"; + vl_portMode.localHostInformation := { tsp_EPTF_HTTP_Demo_RemoteAddress, tsp_EPTF_HTTP_Demo_RemotePort}; + vl_portMode.instantConnClose := false; + vl_portMode.userFunctions := omit; + vl_portMode.buffer := true; + + var integer vl_connHandle := f_EPTF_HTTP_RemoteTransport_newServerPort(vl_portMode); + + if (vl_connHandle < 0) { f_EPTF_Base_stopAll(); } + + var integer vl_listenPortId := f_EPTF_HTTP_listen(vl_connHandle); + + if (-1 == vl_listenPortId){ f_EPTF_Base_stopAll(); } + + var charstring vl_body; + for (var integer i:= 0; i < nof_entity; i:=i+1) + { + vl_body := "<HTML>Request." & int2str(pl_LGenNumber) & "." & int2str(i) & "</HTML>"; + + f_EPTF_HTTP_setEntityContextServer( + i, + 200, + "OK", + 1, + 1, + f_EPTF_HTTP_createContextLengthHeaderLine(vl_body), + { charVal := vl_body }); + } + + f_HTTP_declareServerScenario("HTTPEntityType", "HTTPEntityGroup", "HTTPScenario", "HTTPTrafficCase"); + + v_ctrl_PCO.send(READY); + + timer t_wait := tsp_runningTime + 1.0; + t_wait.start; + + alt { + [] t_wait.timeout {} + } + + f_EPTF_HTTP_printStats(); + log("v_EPTF_HTTP_contexts:", v_EPTF_HTTP_contexts); + + f_EPTF_LGenBase_stopTrafficCase("HTTPEntityGroup","HTTPScenario","HTTPTrafficCase"); + + f_EPTF_HTTP_closePort(vl_connHandle, vl_listenPortId); + + f_EPTF_Base_cleanup_CT(); +} + +function f_mapperBehavior () runs on My_Mapper_CT { + timer t_wait := tsp_runningTime + 1.0; + t_wait.start; + + var integer dummy := f_EPTF_HTTP_Mapper_init_CT(); + + alt { + [] t_wait.timeout { + log("The mapper component is shutting down!"); + } + } + + f_EPTF_Base_stopRemote(mtc); +} + +function f_loggerSend(in octetstring pl_message) runs on MyLogger_CT +{ + if (f_EPTF_Var_getBoolValue(v_MyLogger_loggerEnabled)) { + HTTP_LoggerClient_PCO.send(pl_message); + } + else { + log("The logging mechanism is not enabled"); + } +} + +function f_declareScenario( + in charstring pl_name) +runs on EPTF_HTTP_LGen_CT +{ + var integer dummy, vl_tcconn := f_EPTF_LGenBase_declareTcType2({ + name := "EPTF_HTTP_DemoTrafficCase", + fsmName := c_EPTF_HTTP_fsmName_basicCall, + entityType := "HTTPEntityType", + customEntitySucc := "" + }); + + dummy := f_EPTF_LGenBase_declareScenarioType2({ + name := pl_name, + tcList := { + { + tcName := "EPTF_HTTP_DemoTrafficCase", + startDelay := 0.0, + cpsToReach := 1.0, + enableEntities := true, + enable := true, + ranges := {}, + params := + { + /* + {"HTTP",c_EPTF_HTTP_externalHeaderTemplatePath,tsp_EPTF_HTTP_headerTemplatePath}, + {"HTTP",c_EPTF_HTTP_externalHeaderTemplateName,tsp_EPTF_HTTP_headerTemplateName}, + {"HTTP",c_EPTF_HTTP_externalBodyTemplatePath,tsp_EPTF_HTTP_bodyTemplatePath}, + {"HTTP",c_EPTF_HTTP_externalBodyTemplateName,tsp_EPTF_HTTP_bodyTemplateName} + */ + }, + groupFinishConditions := + { + nrOfExecStart := omit, + nrOfSuccesses := omit, + nrOfFails := omit, + nrOfGrpLoop := omit, + nrOfRangeLoop := omit, + execTime := omit, + entitiesFinished := omit, + customFinishCondition := omit + }, + entityFinishConditions := { + nrOfExecStart := omit, + nrOfSuccesses := omit, + nrOfFails := omit, + customFinishCondition := omit + }, + entityFinishActions := { + }, + tcFinishActions := omit + } + } + }); +} + +function f_HTTP_declareServerScenario( + in charstring pl_entityType, + in charstring pl_entityGroup, + in charstring pl_scenario, + in charstring pl_tc) +runs on EPTF_HTTP_LGen_CT +{ + var integer dummy := -1; + + dummy := f_EPTF_LGenBase_declareTcType2({ + name := pl_tc, + fsmName := c_EPTF_HTTP_fsmName_server, + entityType := pl_entityType, + customEntitySucc := "" + }); + + dummy := f_EPTF_LGenBase_declareScenarioType3({ + name := pl_scenario, + tcList := { + { + tcName := pl_tc, + tcParamsList := { + { startDelay := 0.0}, + {target := {cpsToReach := 0.0}}, + {scheduler := { preDefinedName := orig }}, + {enableEntitiesAtStart := true}, + {enabledAtStart := true} + } + } + }, + scParamsList := { + {enabled :=true} + } + }); + + f_EPTF_LGenBase_createScenario2EntityGroup( + { eGrpName := pl_entityGroup, scenarioName :=pl_scenario }); + +} + +function f_HTTP_searchServerContext( + inout integer pl_eIdx, + inout integer pl_fsmCtx) +runs on MyLGen_CT +{ + pl_eIdx := 0; +} + +function f_EPTF_HTTP_printStats() +runs on MyLGen_CT +{ + action("Statistics:", + " outgoing POST number: ", f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.method.post_k), + ", incoming 200OK number: ", f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code200_k), + ", incoming POST number: ", f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.method.post_k), + ", outgoing 200OK number: ", f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code200_k), + " outgoing request number: ", f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.requests_k), + ", incoming response number: ", f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.responses_k), + ", incoming request number: ", f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.requests_k), + ", outgoing response number: ", f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.responses_k)); + +} + +/* +function f_EPTF_HTTP_return_CompactFsm_basicCall() +runs on EPTF_HTTP_LGen_CT +return EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList +{ + return { + { name := c_EPTF_HTTP_fsmName_basicCall, + stateList := { "idle", "wait" }, + timerList := { { name := "TIMEOUT", startValue := 1.0 } }, + table := { + // TC tarted event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_trafficCaseStarted, fsm }, + cellRow := { + // state == idle + { omit, omit, omit }, + // state == wait + { omit, omit, omit } + } + }, + + // start TC event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_startTC, fsm }, + cellRow := { + // state == idle + { { + { c_EPTF_HTTP_stepName_sendRequest, { stepContextArgs := {} } }//, + }, omit, "wait" }, + // state == wait + { omit, omit, omit } + } + }, + + // answer OK event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_messageReceived, fsm }, + cellRow := { + // state == idle + { omit, omit, omit }, + // state == wait + { { + { c_EPTF_HTTP_stepName_messageReceived, { stepContextArgs := {} } }, + { c_EPTF_LGenBase_StepFunction_trafficSuccess, { stepContextArgs := {} } } + }, omit, "idle" } + } + }, + + // timeout event + { + eventToListen := { c_EPTF_LGenBase_specialBName_timerTimeout, "TIMEOUT", fsm }, + cellRow := { + // state == idle + { omit, omit, omit }, + // state == wait + { { + { c_EPTF_HTTP_stepName_handleTimeout, { stepContextArgs := {} } }, + { c_EPTF_LGenBase_StepFunction_trafficFailed, { stepContextArgs := {} } } + }, omit, "idle" } + } + }, + + // connection closed event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_connectionClosed, fsm }, + cellRow := { + // state == idle + { omit, omit, omit }, + // state == wait + { omit, omit, omit } + } + }, + + // connection opened event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_connectionOpened, fsm }, + cellRow := { + // state == idle + { omit, omit, omit }, + // state == wait + { omit, omit, omit } + } + }, + + // stop TC event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_stopTC, fsm }, + cellRow := { + // state == idle + { { + { c_EPTF_LGenBase_StepFunction_entityStopped, { stepContextArgs := { } } } + }, omit, "idle" }, + // state == wait + { { + { c_EPTF_LGenBase_StepFunction_entityStopped, { stepContextArgs := { } } } + }, omit, "idle" } + } + } + } + } + } +} +*/ + +function f_demo_HTTP_sampleContentMaker(in EPTF_CharstringList pl_params) +return charstring +{ + return "Has "&int2str(sizeof(pl_params))&" elements"; +} + +function f_HTTP_wait4ready(in integer pl_nofReady, in float pl_watchdog) +runs on My_Local_LGen_CT +return boolean +{ + timer Tw := pl_watchdog; + var integer vl_nofInitReady := 0; + + Tw.start; + alt{ + []v_ctrl_PCO.receive(HTTP_Demo_controlMessage:READY); + { + vl_nofInitReady := vl_nofInitReady + 1; + if (vl_nofInitReady == pl_nofReady) + { + return true; + }else{ + repeat; + } + } + []Tw.timeout{ + return false; + } + []v_ctrl_PCO.receive{repeat;} + } + + return false; +} + +function f_HTTP_Server() +runs on My_Local_LGen_CT +{ + f_HTTP_LocalLGenBehaviorServer(); +} + +function f_HTTP_ServerRemote() +runs on My_Mapper_CT +{ + var My_Remote_LGen_CT vc_remoteLGenFirst; + var My_Remote_LGen_CT vc_remoteLGenSecond; + + var integer vl_dummy := f_EPTF_HTTP_Mapper_init_CT(-, -, 1); + + vc_remoteLGenFirst := My_Remote_LGen_CT.create; + vc_remoteLGenSecond := My_Remote_LGen_CT.create; + //vc_mapperComponent := Mapper_HTTP_Demo_CT.create; + + connect(vc_remoteLGenFirst:v_EPTF_HTTP_RemoteTransport_commPort, + self:v_EPTF_HTTP_Mapper_commPort); + connect(vc_remoteLGenFirst:v_ctrl_PCO, self:v_ctrl_PCO); + + connect(vc_remoteLGenSecond:v_EPTF_HTTP_RemoteTransport_commPort, + self:v_EPTF_HTTP_Mapper_commPort); + connect(vc_remoteLGenSecond:v_ctrl_PCO, self:v_ctrl_PCO); + + vc_remoteLGenFirst.start(f_HTTP_RemoteLGenBehaviorServer(1)); + vc_remoteLGenSecond.start(f_HTTP_RemoteLGenBehaviorServer(2)); + + if (not f_HTTP_wait4ready(2, 10.0)){vc_remoteLGenFirst.kill; vc_remoteLGenSecond.kill; return;} + + v_ctrl_PCO.send(READY) to mtc; + + vc_remoteLGenFirst.done; + vc_remoteLGenSecond.done; + + f_EPTF_Base_cleanup_CT(); + + disconnect(vc_remoteLGenFirst:v_EPTF_HTTP_RemoteTransport_commPort, + self:v_EPTF_HTTP_Mapper_commPort); + disconnect(vc_remoteLGenSecond:v_EPTF_HTTP_RemoteTransport_commPort, + self:v_EPTF_HTTP_Mapper_commPort); + + + setverdict(pass); + +} + +function f_HTTP_Client() +runs on My_Local_LGen_CT +{ + f_HTTP_LocalLGenBehaviorClient(); +} + +function f_HTTP_ClientRemote() +runs on My_Mapper_CT +{ + var My_Remote_LGen_CT vc_remoteLGenFirst; + var My_Remote_LGen_CT vc_remoteLGenSecond; + + var integer vl_dummy := f_EPTF_HTTP_Mapper_init_CT(); + + vc_remoteLGenFirst := My_Remote_LGen_CT.create; + vc_remoteLGenSecond := My_Remote_LGen_CT.create; + //vc_mapperComponent := Mapper_HTTP_Demo_CT.create; + + connect(vc_remoteLGenFirst:v_EPTF_HTTP_RemoteTransport_commPort, + self:v_EPTF_HTTP_Mapper_commPort); + connect(vc_remoteLGenSecond:v_EPTF_HTTP_RemoteTransport_commPort, + self:v_EPTF_HTTP_Mapper_commPort); + + vc_remoteLGenFirst.start(f_HTTP_RemoteLGenBehaviorClient(1)); + vc_remoteLGenSecond.start(f_HTTP_RemoteLGenBehaviorClient(2)); + + vc_remoteLGenFirst.done; + vc_remoteLGenSecond.done; + + f_EPTF_Base_cleanup_CT() + + disconnect(vc_remoteLGenFirst:v_EPTF_HTTP_RemoteTransport_commPort, + self:v_EPTF_HTTP_Mapper_commPort); + disconnect(vc_remoteLGenSecond:v_EPTF_HTTP_RemoteTransport_commPort, + self:v_EPTF_HTTP_Mapper_commPort); + + + setverdict(pass); + +} +//============================================================================= +// Test cases +//============================================================================= +testcase tc_localTransport() +runs on My_Local_LGen_CT +{ + f_EPTF_Base_init_CT("MTC"); + + var My_Local_LGen_CT vl_server := My_Local_LGen_CT.create; + connect(vl_server:v_ctrl_PCO, self:v_ctrl_PCO); + vl_server.start(f_HTTP_Server()); + + if (not f_HTTP_wait4ready(1, 10.0)){all component.kill; stop;} + + var My_Local_LGen_CT vl_client := My_Local_LGen_CT.create; + vl_client.start(f_HTTP_Client()); + + vl_client.done; + vl_server.done; + + f_EPTF_Base_cleanup_CT(); + + setverdict(pass); +} + +testcase tc_remoteTransport () +runs on My_Mapper_CT +{ + f_EPTF_Base_init_CT("MTC"); + + var My_Mapper_CT vl_server := My_Mapper_CT.create; + connect(vl_server:v_ctrl_PCO, self:v_ctrl_PCO); + vl_server.start(f_HTTP_ServerRemote()); + + v_ctrl_PCO.receive(HTTP_Demo_controlMessage:READY); + + var My_Mapper_CT vl_client := My_Mapper_CT.create; + vl_client.start(f_HTTP_ClientRemote()); + + vl_client.done; + vl_server.done; + + f_EPTF_Base_cleanup_CT(); + + setverdict(pass); +} + +/* +testcase tc_graphicalLogger() runs on MyLogger_CT +{ timer t_wait := 8.0; + var integer i := 0; + + + var XTDP_XML_Tag pl_xul; + var boolean vl_exist; + + f_EPTF_UIHandler_init_CT("LoggingUIHandler"); + + f_EPTF_UIHandler_clearGUI(); + f_EPTF_UIHandler_addWindow(); + f_EPTF_LoggingUI_createTabBox("EPTF_Main_tabbox",pl_xul); + f_EPTF_UIHandler_addElementToGui(pl_xul,"EPTF_Main_Window",vl_exist); + + f_EPTF_LoggingUI_init_CT("LoggingUIHandler",self,"EPTF_Main_tabbox"); + + f_EPTF_HTTP_LocalTransport_init_CT(null,self,self,"EPTF_LoggingUI_tabbox"); + + log("Init sikeres"); + + t_wait.start; + + alt{ + [] t_wait.timeout { + vf_EPTF_HTTP_LoggerClient_sendFunction.apply(char2oct("HEHE")); + if (i != 10 ) { + + t_wait.start; + i := i + 1; + repeat; + + } + } + + } + + f_EPTF_LoggingUI_cleanup_CT(); + f_EPTF_UIHandler_cleanup_CT(); + f_EPTF_HTTP_LocalTransport_cleanup_CT(); + setverdict(pass); +} +*/ + +//============================================================================= +// Control part +//============================================================================= +/*control { + execute(tc_localTransport()); + execute(tc_remoteTransport ()); + //execute(tc_graphicalLogger()); +}*/ + +} diff --git a/demo/EPTF_HTTP_Demo_Makepatch.sh b/demo/EPTF_HTTP_Demo_Makepatch.sh new file mode 100755 index 0000000..efeb561 --- /dev/null +++ b/demo/EPTF_HTTP_Demo_Makepatch.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +sed -e ' + +s/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = -D$(PLATFORM) -I$(OPENSSL_DIR)\/include -I$(TTCN3_DIR)\/include -DNO_IPV6/g + +s/OPENSSL_DIR = $(TTCN3_DIR)/\OPENSSL_DIR = \/mnt\/TTCN\/Tools\/openssl-0.9.8e/g + +#s/CXX = g++/CXX = \/usr\/sfw\/bin\/g++/g +#s/CPP = cpp/CPP = \/usr\/sfw\/bin\/cpp/g + +#s/-L$(OPENSSL_DIR)\/lib -lcrypto $($(PLATFORM)_LIBS)/-L$(OPENSSL_DIR)\/lib -lcrypto $($(PLATFORM)_LIBS)/g + +s/SOLARIS_LIBS = -lsocket -lnsl/SOLARIS_LIBS = -lsocket -lnsl -lresolv -lxnet/g + +s/SOLARIS8_LIBS = -lsocket -lnsl/SOLARIS8_LIBS = -lsocket -lnsl -lresolv -lxnet/g + +s/CXXFLAGS = -Wall/CXXFLAGS = -Wall -g/g + +s/LDFLAGS =/LDFLAGS = -g/g + +' <$1 >$2 diff --git a/demo/EPTF_HTTP_Demo_Responder.ttcn b/demo/EPTF_HTTP_Demo_Responder.ttcn new file mode 100644 index 0000000..e21ed6e --- /dev/null +++ b/demo/EPTF_HTTP_Demo_Responder.ttcn @@ -0,0 +1,229 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_Demo_Responder.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2008-01-08 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +// Module: EPTF_HTTP_Demo_Responder +// +// Purpose: +// This module contains the functions to simulate a HTTP +// responder node for tests +// +// Module Parameters: +// - +// +// Module depends on: +// <HTTPmsg_Types> +// +// <IPL4asp_Types> +// +// <IPL4asp_PortType> +// +// <EPTF_CLL_Common_Definitions> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2008-01-09 +// +// Detailed Comments: +// - +// +/////////////////////////////////////////////////////////// + +module EPTF_HTTP_Demo_Responder { + +//========================================================================= +// Import Part +//========================================================================= +import from HTTPmsg_Types all; +import from IPL4asp_Types all; +import from IPL4asp_PortType all; +import from EPTF_CLL_Common_Definitions all; + +//========================================================================= +// Module parameters +//========================================================================= +modulepar charstring tsp_EPTF_HTTP_Demo_RemoteAddress := "159.107.193.33"; +modulepar integer tsp_EPTF_HTTP_Demo_RemotePort := 4000; + +//========================================================================= +// Component types +//========================================================================= +type component EPTF_HTTP_Demo_Responder_CT { + port IPL4asp_PT v_IPL4_PCO; + port EPTF_HTTP_Demo_CM_PT v_CM_PCO; + + var EPTF_HTTP_Demo_Responder_HostInformationList v_hostDatabase := {}; + var EPTF_IntegerList v_connIds := {}; + + var ASP_RecvFrom v_ASP_RecvFrom; + var ASP_Event v_ASP_Event; + + var HTTPMessage v_HTTP_msg; + + var integer v_intNoWarn; +} + +//========================================================================= +// Types +//========================================================================= + +type port EPTF_HTTP_Demo_CM_PT message { + inout charstring +} with {extension "internal"} + +type record EPTF_HTTP_Demo_Responder_HostInformation { + charstring hostIPAddress , + integer hostPort +} + +type record of EPTF_HTTP_Demo_Responder_HostInformation EPTF_HTTP_Demo_Responder_HostInformationList; + +//========================================================================= +// Functions +//========================================================================= +function f_EPTF_HTTP_Demo_Responder_init( + in EPTF_HTTP_Demo_Responder_HostInformationList pl_hosts) +runs on EPTF_HTTP_Demo_Responder_CT return boolean +{ + var Result vl_result; + var integer i; + + map(self:v_IPL4_PCO, system:v_IPL4_PCO); + + v_hostDatabase := pl_hosts; + + for (i := 0; i < sizeof(v_hostDatabase); i := i + 1) + { + vl_result := f_IPL4_listen(v_IPL4_PCO, + v_hostDatabase[i].hostIPAddress, v_hostDatabase[i].hostPort, { tcp := {} }); + + if (vl_result.errorCode == omit) { + log("Listening successful on: ", v_hostDatabase[i], " (", vl_result.connId, ")"); + v_connIds[i] := vl_result.connId; + v_CM_PCO.send("Hello, I'm ready! :-)") + } else { + log("Listening failed on: ", v_hostDatabase[i], " (", vl_result, ")"); + return false; + } + } + + return true; +} + +function f_EPTF_HTTP_Demo_Responder_uninit() +runs on EPTF_HTTP_Demo_Responder_CT +{ + var Result vl_result; + var integer i; + + for (i := 0; i < sizeof(v_connIds); i := i + 1) + { + vl_result := f_IPL4_close(v_IPL4_PCO, v_connIds[i], { tcp := {} }); + } + + v_hostDatabase := {}; + v_connIds := {}; + + unmap(self:v_IPL4_PCO, system:v_IPL4_PCO); +} + +function f_EPTF_HTTP_Demo_dummyHTTPResponse( + in charstring pl_body) +return octetstring +{ + var HTTPMessage vl_outgoingMessage := { + response := { + client_id := omit, + version_major := 1, + version_minor := 1, + statuscode := 200, + statustext := "OK", + header:= {{"Content-Length", int2str(lengthof(pl_body)) }}, + body:= pl_body + } + } + + log("HTTP message: ", vl_outgoingMessage); + + return enc_HTTPMessage(vl_outgoingMessage); +} + +function f_EPTF_HTTP_Demo_Responder_behavior( + in integer pl_tcId, + in float pl_runningTime) +runs on EPTF_HTTP_Demo_Responder_CT +{ + log("<< Starting HTTP responder! >>"); + + timer t_guard := pl_runningTime; + + var EPTF_HTTP_Demo_Responder_HostInformationList vl_hList; + var ASP_Send vl_send; + + // provide initial data according to TC + vl_hList := { { tsp_EPTF_HTTP_Demo_RemoteAddress, tsp_EPTF_HTTP_Demo_RemotePort + pl_tcId } }; + + // initialize component + if (not f_EPTF_HTTP_Demo_Responder_init(vl_hList)) { + log("HTTP responder failed during initialization!"); + + f_EPTF_HTTP_Demo_Responder_uninit(); + setverdict(fail); + return + } + + t_guard.start; + alt { + [] v_IPL4_PCO.receive(ASP_RecvFrom:?) -> value v_ASP_RecvFrom { + log("ASP receive from: ", v_ASP_RecvFrom); + + v_intNoWarn := dec_HTTPMessage(v_ASP_RecvFrom.msg, v_HTTP_msg, false); + log("HTTP payload: ", v_HTTP_msg); + + vl_send := { + v_ASP_RecvFrom.connId, {tcp := {}}, + f_EPTF_HTTP_Demo_dummyHTTPResponse(v_HTTP_msg.request.body) + }; + + v_IPL4_PCO.send(vl_send); + + repeat; + } + [] v_IPL4_PCO.receive(ASP_Event:?) -> value v_ASP_Event { + log("ASP event: ", v_ASP_Event); + log(v_IPL4_PCO); + repeat; + } + [] v_IPL4_PCO.receive { + log("Invalid message received!"); + repeat; + } + [] t_guard.timeout { + log("Timer timed out!"); + } + } + + f_EPTF_HTTP_Demo_Responder_uninit(); + + log("<< Stopping HTTP responder! >>"); + + setverdict(pass); +} + +}
\ No newline at end of file diff --git a/doc/EPTF AppLib HTTP for TitanSim, Function Specification.doc b/doc/EPTF AppLib HTTP for TitanSim, Function Specification.doc Binary files differnew file mode 100644 index 0000000..96cbee0 --- /dev/null +++ b/doc/EPTF AppLib HTTP for TitanSim, Function Specification.doc diff --git a/doc/EPTF Applib HTTP for TitanSim, User Guide.doc b/doc/EPTF Applib HTTP for TitanSim, User Guide.doc Binary files differnew file mode 100644 index 0000000..6dac220 --- /dev/null +++ b/doc/EPTF Applib HTTP for TitanSim, User Guide.doc diff --git a/doc/EPTF_Applib_HTTP_CNL113618_PRI.doc b/doc/EPTF_Applib_HTTP_CNL113618_PRI.doc Binary files differnew file mode 100644 index 0000000..56312fb --- /dev/null +++ b/doc/EPTF_Applib_HTTP_CNL113618_PRI.doc diff --git a/src/EPTF_HTTP_All.grp b/src/EPTF_HTTP_All.grp new file mode 100644 index 0000000..aa99e65 --- /dev/null +++ b/src/EPTF_HTTP_All.grp @@ -0,0 +1,27 @@ +<!-- +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_All.grp +// Description: FileGroup file for EPTF Applib HTTP +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-03-11 +// Contact: http://ttcn.ericsson.se +// + +--> +<!DOCTYPE TITAN_GUI_FileGroup_file> +<File_Group name="EPTF_HTTP_All" > + <File_Groups> + <File_Group path="LoadGen/EPTF_HTTP_LoadGen.grp" /> + <File_Group path="Transport/EPTF_HTTP_Transport.grp" /> + </File_Groups> +</File_Group> diff --git a/src/LoadGen/EPTF_HTTP_Definitions.ttcn b/src/LoadGen/EPTF_HTTP_Definitions.ttcn new file mode 100644 index 0000000..a9f0d9f --- /dev/null +++ b/src/LoadGen/EPTF_HTTP_Definitions.ttcn @@ -0,0 +1,3057 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_Definitions.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2014-05-20 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// Module: EPTF_HTTP_Definitions +// +// Purpose: +// This module contains the definitions for EPTF HTTP application library +// +// +// Module Parameters: +// tsp_EPTF_HTTP_latency - *float* - latency +// tsp_EPTF_HTTP_logEnabled - *boolean* - logging of messages enabled/disabled +// tsp_EPTF_HTTP_loggingComponentMask - *charstring* - logging component mask name +// tsp_EPTF_HTTP_loggingEnable - *boolean* - logging of LGen component enable/disable +// tsp_EPTF_HTTP_maxNumberOfEntities - *integer* - max number of entities +// +// Module depends on: +// <HTTPmsg_Types> +// +// <IPL4asp_Types> +// +// <EPTF_CLL_LGenBase_Definitions> +// +// <EPTF_CLL_LGenBase_Functions> +// +// <EPTF_CLL_Scheduler_Definitions> +// +// <EPTF_CLL_RBTScheduler_Definitions> +// +// <EPTF_CLL_Variable_Definitions> +// +// <EPTF_CLL_Logging_Definitions> +// +// <EPTF_CLL_Common_Definitions> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-08-10 +// +/////////////////////////////////////////////////////////////////////////////// +module EPTF_HTTP_Definitions { + +//============================================================================= +// Import Part +//============================================================================= +import from HTTPmsg_Types all; +import from IPL4asp_Types all; +import from EPTF_CLL_LGenBase_Definitions all; +//import from EPTF_CLL_LGenBase_Functions all; +//import from EPTF_CLL_Scheduler_Definitions all; +//import from EPTF_CLL_RBTScheduler_Definitions all; +import from EPTF_CLL_Variable_Definitions all; +import from EPTF_CLL_Logging_Definitions all; +import from EPTF_CLL_Common_Definitions all; + +//============================================================================= +// Module parameters +//============================================================================= +modulepar float tsp_EPTF_HTTP_latency := 2.0; +modulepar boolean tsp_EPTF_HTTP_logEnabled := false; +modulepar charstring tsp_EPTF_HTTP_loggingComponentMask := "EPTF_HTTP_LGen"; +modulepar EPTF_HTTP_EventDispatchLevel tsp_EPTF_HTTP_dispatchLevel := Detailed; +modulepar boolean tsp_EPTF_HTTP_loggingEnable := false; +modulepar integer tsp_EPTF_HTTP_maxNumberOfEntities := 1000000; +modulepar integer tsp_EPTF_HTTP_nofNonceValues := 1; + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Applib +// +// Purpose: +// Functions of the EPTF HTTP Application Libray +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Applib +{ + //============================================================================= + // Component types + //============================================================================= + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_LGen_CT + // + // Purpose: + // HTTP application library component type + // + // Extensions: + // EPTF_LGenBase_CT + // + // EPTF_Scheduler_CT + // + // EPTF_Var_CT + // + // EPTF_Logging_CT + // + // Variables: + // v_EPTF_HTTP_initialized - *boolean* - component initialization state + // v_EPTF_HTTP_contexts - <EPTF_HTTP_CtxList> - entity context database + // + // v_EPTF_HTTP_optionalTempParams - <EPTF_CharstringList> - holds the optional template + // parameter values + // + // v_boolNoWarningLG - *boolean* - dummy variable to supress warnings + // v_intNoWarningLG - *integer* - dummy variable to supress warnings + // + // v_EPTF_HTTP_EntityOffset - *integer* - entity offset for the lgen + // + // v_EPTF_HTTP_selfName - *charstring* - component's self name + // v_EPTF_HTTP_selfId - *integer* - component's self id + // + // vf_EPTF_HTTP_sendRequest - <EPTF_HTTP_messageProcessSend_FT> - send request + // callback function + // vf_EPTF_HTTP_connectionOpen - <EPTF_HTTP_connectionOpen_FT> - connection open + // callback function + // vf_EPTF_HTTP_connectionClose - <EPTF_HTTP_connectionClose_FT> - connection close + // callback function + // vf_EPTF_HTTP_connectionHalfClose - <EPTF_HTTP_connectionClose_FT> - connection + // halfe close callback function + // + // vf_EPTF_HTTP_closePort - <EPTF_HTTP_PortOperation_FT> - close port + // callback function + // + // vf_EPTF_HTTP_sendResponse - <EPTF_HTTP_sendResponse_FT> - send response + // callback function + // vf_EPTF_HTTP_listen - <EPTF_HTTP_Listen_FT> - listen callback function + // + // vf_EPTF_HTTP_searchContext - <EPTF_HTTP_searchContext_FT> - context searching callback function + // vf_EPTF_HTTP_searchContext4Event - <EPTF_HTTP_searchContext_FT> - context searching callback function + // vf_EPTF_HTTP_searchContext4Error - <EPTF_HTTP_searchContext_FT> - context searching callback function + // + // v_EPTF_HTTP_entityIdxHashMap - *integer* - entity index hash map handle + // v_EPTF_HTTP_myBIdx - *integer* - self behavior index + // + // v_EPTF_HTTP_maxNumberOfEntities - *integer* - max enabled number of entities + // v_EPTF_HTTP_logEnabled - *boolean* - logging enabled state + // v_EPTF_HTTP_latency - *float* - latency + // + // v_EPTF_HTTP_outgoingMessage - *octetstring* - outgoing message + // v_EPTF_HTTP_incomingMessage - <HTTPMessage> - incoming message + // + // v_EPTF_HTTP_lastReceivedGroupId - *integer* - the unique group identifier + // of the last received request + // v_EPTF_HTTP_lastReceivedPortId - *integer* - the unique port identifier + // of the last received request + // v_EPTF_HTTP_lastReceivedSeqNum - *integer* - the sequence number of the last received request + // + // v_EPTF_HTTP_charDB - *integer* - index of charstring database hash map + // v_EPTF_HTTP_octDB - *integer* - index of octetstring database hash map + // + // v_EPTF_HTTP_stats - <EPTF_HTTP_Stats> - statistics database + // + // v_EPTF_HTTP_headerLinesList - <EPTF_HTTP_HeaderLineList> - headerlines database + // + // v_EPTF_HTTP_ConnId2EIdx - <EPTF_IntegerList> - connection id to entity database + // v_EPTF_HTTP_ConnId2FIdx - <EPTF_IntegerList> - connection id to fsm database + // + // vf_EPTF_HTTP_dispatchFn - <EPTF_HTTP_dispatchHandler_FT> - dispatch event function pointer + // + // v_EPTF_HTTP_loggingMaskId - *integer* - logging mask id + // + // v_EPTF_HTTP_extTemplType_customHeader - *integer* + // v_EPTF_HTTP_extTemplType_customHeaderResponse - *integer* + // v_EPTF_HTTP_extTemplType_customBody - *integer* + // + // v_EPTF_HTTP_authData - <EPTF_HTTP_AuthDataServer> + // + // vf_EPTF_HTTP_messageReceivedHook - <fcb_EPTF_HTTP_messageReceivedHook> - callback placeholder for incoming HTTP message processing + // + // Timers: + // - + // + // Ports: + // - + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type component EPTF_HTTP_LGen_CT extends + EPTF_LGenBase_CT, EPTF_Var_CT, EPTF_Logging_CT + { + var boolean v_EPTF_HTTP_initialized := false; + var EPTF_HTTP_CtxList v_EPTF_HTTP_contexts :={}; + + var EPTF_CharstringList v_EPTF_HTTP_optionalTempParams := {}; + + var integer v_EPTF_HTTP_EntityOffset := 0; + + var boolean v_boolNoWarningLG; + var integer v_intNoWarningLG; + + var charstring v_EPTF_HTTP_selfName := ""; + var integer v_EPTF_HTTP_selfId := -1; + + var EPTF_HTTP_CharstringBodyDatabase v_EPTF_HTTP_charBodyDB := {}; + var EPTF_HTTP_BinaryBodyDatabase v_EPTF_HTTP_binBodyDB := {}; + + var EPTF_HTTP_messageProcessSend_FT vf_EPTF_HTTP_sendRequest := null; + var EPTF_HTTP_connectionOpen_FT vf_EPTF_HTTP_connectionOpen := null; + var EPTF_HTTP_connectionClose_FT vf_EPTF_HTTP_connectionClose := null; + var EPTF_HTTP_connectionClose_FT vf_EPTF_HTTP_connectionHalfClose := null; + var EPTF_HTTP_SessionOperation_FT vf_EPTF_HTTP_closePortOfUser := null; + var EPTF_HTTP_SessionOperation_FT vf_EPTF_HTTP_freePortOfUser := null; + + var EPTF_HTTP_PortOperation_FT vf_EPTF_HTTP_closePort := null; + + var EPTF_HTTP_sendResponse_FT vf_EPTF_HTTP_sendResponse := null; + var EPTF_HTTP_Listen_FT vf_EPTF_HTTP_listen := null; + + + var EPTF_HTTP_searchContext_FT vf_EPTF_HTTP_searchContext := null; + var EPTF_HTTP_searchContext_FT vf_EPTF_HTTP_searchContext4Event := null; + var EPTF_HTTP_searchContext_FT vf_EPTF_HTTP_searchContext4Error := null; + + var integer v_EPTF_HTTP_myBIdx; + + //component variables to the module parameters + var integer v_EPTF_HTTP_maxNumberOfEntities := tsp_EPTF_HTTP_maxNumberOfEntities; + var boolean v_EPTF_HTTP_logEnabled := tsp_EPTF_HTTP_logEnabled; + var float v_EPTF_HTTP_latency := tsp_EPTF_HTTP_latency; + + //variables to store incoming and outgoing messages + var octetstring v_EPTF_HTTP_outgoingMessage; + + var HTTPMessage v_EPTF_HTTP_incomingMessage; + + var integer v_EPTF_HTTP_lastReceivedGroupId := -1; + var integer v_EPTF_HTTP_lastReceivedPortId := -1; + var integer v_EPTF_HTTP_lastReceivedSeqNum := -1; + + var EPTF_HTTP_Event v_EPTF_HTTP_event; + var EPTF_HTTP_EventError v_EPTF_HTTP_error; + + var EPTF_HTTP_dispatchHandler_FT vf_EPTF_HTTP_dispatchFn := null; + + var integer v_EPTF_HTTP_charDB := -1; + var integer v_EPTF_HTTP_octDB := -1; + + var EPTF_HTTP_Stats v_EPTF_HTTP_stats; + + var EPTF_HTTP_HeaderLineList v_EPTF_HTTP_headerLinesList := {}; + + //var EPTF_IntegerList v_EPTF_HTTP_ConnId2EIdx := {}; + var EPTF_IntegerList v_EPTF_HTTP_ConnId2FIdx := {}; + + // logging + var integer v_EPTF_HTTP_loggingMaskId := c_EPTF_Logging_invalidMaskId; + + // template types + var integer v_EPTF_HTTP_extTemplType_customHeader; + var integer v_EPTF_HTTP_extTemplType_customHeaderResponse; + var integer v_EPTF_HTTP_extTemplType_customBody; + + var EPTF_HTTP_AuthDataServer v_EPTF_HTTP_authData; + + var fcb_EPTF_HTTP_messageReceivedHook vf_EPTF_HTTP_messageReceivedHook := null; + + } + + //============================================================================= + // Data types + //============================================================================= + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_StatusCodes + // + // Purpose: + // Container for HTTP status code statistics + // + // Elements: + // codeXXX_k - *integer* - handles for status code statistics for + // status code XXX + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_StatusCodes { + integer code100_k, + integer code101_k, + integer code200_k, + integer code201_k, + integer code202_k, + integer code203_k, + integer code204_k, + integer code205_k, + integer code206_k, + integer code300_k, + integer code301_k, + integer code302_k, + integer code303_k, + integer code304_k, + integer code305_k, + integer code306_k, + integer code307_k, + integer code400_k, + integer code401_k, + integer code402_k, + integer code403_k, + integer code404_k, + integer code405_k, + integer code406_k, + integer code407_k, + integer code408_k, + integer code409_k, + integer code410_k, + integer code411_k, + integer code412_k, + integer code413_k, + integer code414_k, + integer code415_k, + integer code416_k, + integer code417_k, + integer code500_k, + integer code501_k, + integer code502_k, + integer code503_k, + integer code504_k, + integer code505_k + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Methods + // + // Purpose: + // Container for HTTP method statistics + // + // Elements: + // options_k - *integer* - handle for options statistics + // get_k - *integer* - handle for get statistics + // head_k - *integer* - handle for head statistics + // post_k - *integer* - handle for post statistics + // put_k - *integer* - handle for put statistics + // delete_k - *integer* - handle for delete statistics + // trace_k - *integer* - handle for trace statistics + // connect_k - *integer* - handle for connect statistics + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Methods { + integer options_k, + integer get_k, + integer head_k, + integer post_k, + integer put_k, + integer delete_k, + integer trace_k, + integer connect_k + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Messages + // + // Purpose: + // Container for HTTP message statistics + // + // Elements: + // method - <EPTF_HTTP_Methods> - handles for method statistics + // status - <EPTF_HTTP_StatusCodes> - handles for status code statistics + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Messages { + EPTF_HTTP_Methods method, + integer requests_k, + EPTF_HTTP_StatusCodes status, + integer responses_k + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_EventDispatchLevel + // + // Purpose: + // Enumerate for HTTP message dispatch level control + // + // Elements: + // OnlyReceived - only message received event will be dispatched + // (reception of charstring request, charstring response, + // binary request, binary response) + // Class - OnlyReceived and status code classes event like 100 class event + // if status code is 1xx + // Detailed - Class and single status code events + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type enumerated EPTF_HTTP_EventDispatchLevel { + OnlyReceived, + Class, + Detailed + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Stats + // + // Purpose: + // TitanSim variables container for any HTTP statistics + // + // Elements: + // incoming - <EPTF_HTTP_Messages> - incoming message statistics + // outgoing - <EPTF_HTTP_Messages> - outgoing message statistics + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Stats { + EPTF_HTTP_Messages incoming, + EPTF_HTTP_Messages outgoing + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Error + // + // Purpose: + // TitanSim variables container for HTTP error messages + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type Result EPTF_HTTP_Error; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_messageProcessSend_FT + // + // Purpose: + // Type for send request callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_messageProcessSend_FT( + in integer pl_connId, + in integer pl_sessionId, + in octetstring pl_message) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_sendResponse_FT + // + // Purpose: + // Type for send response callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_sendResponse_FT( + in integer pl_groupId, + in integer pl_portId, + in integer pl_seqNum, + in octetstring pl_message) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_messageProcess_FT + // + // Purpose: + // Type for process message callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_messageProcess_FT( + in EPTF_HTTP_IncomingMessage pl_message) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_messageBetweenApplibs_FT + // + // Purpose: + // Type for message from application libraries callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_messageBetweenApplibs_FT () + runs on self; + + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_bodyContentGetter_FT + // + // Purpose: + // Type for acquire a body content for an HTTP entity + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_bodyContentGetter_FT ( + in EPTF_IntegerList pl_pars, + inout EPTF_HTTP_CharOrOct pl_body) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_headerContentGetter_FT + // + // Purpose: + // Type for acquire the header content for an HTTP entity + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_headerContentGetter_FT ( + in EPTF_IntegerList pl_pars, + inout HeaderLines pl_headerLines) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_rawHeaderContentGetter_FT + // + // Purpose: + // Type for acquire the raw (encoded) header content for an HTTP entity + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_rawHeaderContentGetter_FT ( + in EPTF_IntegerList pl_pars, + inout octetstring pl_rawHeader) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_charstringBodyHandler_FT + // + // Purpose: + // Type for charstring body handler function for an HTTP entity + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_charstringBodyHandler_FT (in integer pl_eIdx,in charstring pl_bodyMessage) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_binaryBodyHandler_FT + // + // Purpose: + // Type for binary body handler function for an HTTP entity + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_binaryBodyHandler_FT (in integer pl_eIdx,in octetstring pl_bodyMessage) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_connectionOpen_FT + // + // Purpose: + // Type for connection open callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_connectionOpen_FT ( + in integer pl_connId, + in integer pl_sessionId) + runs on self return boolean; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_connectionClose_FT + // + // Purpose: + // Type for connection close callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_connectionClose_FT ( + in integer pl_connId) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Listen_FT + // + // Purpose: + // Function type to a registerable callback function for + // opening a listen port + // + // Elements: + // pl_groupId - *in* *integer* - port group index + // + // Return value: + // boolean - open result +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Listen_FT( + in integer pl_groupId) + runs on self return integer; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_searchContext_FT + // + // Purpose: + // Defines a function type for getting the context in case of an incoming + // request. + // + // Elements: + // pl_eIdx - *inout* *integer* - entity index (-1 means generic) + // pl_fsmCtx - *inout* *integer* - fsm context index + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_searchContext_FT( + inout integer pl_eIdx, + inout integer pl_fsmCtx) + runs on self; +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_eventReceive_FT + // + // Purpose: + // Type for event receive callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_eventReceive_FT ( + in EPTF_HTTP_Event pl_event) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_socketErrorReceive_FT + // + // Purpose: + // Type for socket error receive callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_socketErrorReceive_FT ( + in EPTF_HTTP_EventError pl_error) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_listenSocketEvent_FT + // + // Purpose: + // Type for listening socket event receive callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_listenSocketEvent_FT( + in EPTF_HTTP_listenSocketEvent pl_event) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_listenSocketEvent_FT + // + // Purpose: + // Type for listening socket event receive callback function + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_listenSocketError_FT( + in EPTF_HTTP_listenSocketError pl_error) + runs on self; + +///////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_dispatchHandler_FT + // + // Purpose: + // Type for handle dispatch event for current settings + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_dispatchHandler_FT( + in integer pl_statusCode, + in integer pl_eIdx, + in integer pl_fsmIdx) + runs on self; + +///////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_SessionOperation_FT + // + // Purpose: + // Function type to a registerable callback function to + // provide a session operation on a group + // + // Elements: + // pl_groupId - *in* *integer* - group id + // pl_sessionId - *in* *integer* - session id + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_SessionOperation_FT( + in integer pl_groupId, + in integer pl_sessionId) + runs on self; + +///////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_PortOperation_FT + // + // Purpose: + // Function type to a registerable callback function to + // provide an operation on a socket. + // + // Elements: + // pl_groupId - *in* *integer* - group id + // pl_portId - *in* *integer* - port id within the group + // +/////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_PortOperation_FT( + in integer pl_groupId, + in integer pl_portId + ) + runs on self; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Event + // + // Purpose: + // Contains the event parameters received from the transport layer + // + // Elements: + // groupId - *integer* - port group ID + // sessionId - *integer* - unique identifier of the session + // eventType - *integer* - the type of the event + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Event{ + integer groupId, + integer sessionId, + integer eventType + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_EventError + // + // Purpose: + // Contains the error event parameters received from the transport layer + // + // Elements: + // groupId - *integer* - port group ID + // sessionId - *integer* - unique identifier of the message + // transportError - <EPTF_HTTP_Error> - the error + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_EventError{ + integer groupId, + integer sessionId, + EPTF_HTTP_Error transportError + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_listenSocketEvent + // + // Purpose: + // Contains the listening socket event parameters received from the transport layer + // + // Elements: + // groupId - *integer* - port group ID + // hostInfo - <EPTF_HTTP_HostInformation> - listening address and port + // eventType - *integer* - event type + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_listenSocketEvent + { + integer groupId, + EPTF_HTTP_HostInformation hostInfo, + integer eventType + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_listenSocketError + // + // Purpose: + // Contains the listening socket error parameters received from the transport layer + // + // Elements: + // groupId - *integer* - port group ID + // hostInfo - <EPTF_HTTP_HostInformation> - listening address and port + // transportError - <EPTF_HTTP_Error> - the transport error + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_listenSocketError + { + integer groupId, + EPTF_HTTP_HostInformation hostInfo, + EPTF_HTTP_Error transportError + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_IncomingMessage + // + // Purpose: + // Contains the message received from the transport layer + // + // Elements: + // groupId - *integer* - port group identifier of the message + // sessionId - *integer* - unique port identifier of the message + // seqNum - *integer* - the sequence number of the request + // message - *octetstring* - HTTP message + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_IncomingMessage{ + integer groupId, + integer sessionId, + integer seqNum, + octetstring httpMessage + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_HeaderLineList + // + // Purpose: + // Type to store a list of header lines + // + // Elements: + // - + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record of HeaderLines EPTF_HTTP_HeaderLineList; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_BinaryBodyDatabase + // + // Purpose: + // HTTP database for binary message body + // + // Elements: + // record of <octetstring> + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record of octetstring EPTF_HTTP_BinaryBodyDatabase; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_CharstringBodyDatabase + // + // Purpose: + // HTTP database for charstring message body + // + // Elements: + // <EPTF_CharstringList> + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type EPTF_CharstringList EPTF_HTTP_CharstringBodyDatabase; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_CharOrOct + // + // Purpose: + // HTTP database for charstring message body + // + // Elements: + // charVal - *charstring* - charstring value + // octVal - *octetstring* - octetstring value + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type union EPTF_HTTP_CharOrOct { + charstring charVal, + octetstring octVal + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Information + // + // Purpose: + // Type to store a number of HTTP related data + // + // Elements: + // method - *charstring* - HTTP method + // uri - *charstring* - HTTP URI + // headerLines - <HeaderLines> - HTTP header lines + // authDetails - <EPTF_HTTP_AuthDetails> - HTTP authentication details + // bodymessage - *charstring* - HTTP body + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Information { + charstring method, + charstring uri, + HeaderLines headerLines, + EPTF_HTTP_AuthDetails authDetails, + charstring bodymessage + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_AuthDetails + // + // Purpose: + // The authentication details + // + // Elements: + // realm - *charstring* - authentication realm + // qop - *charstring* - qop (quality of protection code) + // nonce - *charstring* - nonce (number used once) + // cnonce - *charstring* - client nonce value + // opaque - *charstring* - opaque + // nonceCount - *charstring* - nonce count in hexa + // algorithm - *charstring* - used algorithm eg: MD5 + // password - *charstring* - user password + // + // Detailed Comments: + // This record contains the authentication details received from + // proxy such as realm, qop, nonce, opaque. + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_AuthDetails { + charstring realm, + charstring qop, + charstring nonce, + charstring cnonce, + charstring opaque, + charstring nonceCount, + charstring algorithm, + charstring response, + charstring uri, + charstring username, + charstring password + } + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_initAuthDetails + // + // Purpose: + // Authentication data initialization. + // +/////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_AuthDetails c_EPTF_HTTP_initAuthDetails := + { + realm := "", + qop := "", + nonce := "", + cnonce := "", + opaque := "", + nonceCount := "00000001", + algorithm := "", + response := "", + uri := "", + username := "", + password := "" + } +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Ctx + // + // Purpose: + // HTTP entity context + // + // Elements: + // method - *charstring* - HTTP method + // uri - *charstring* - HTTP request URI + // version_major - *integer* - HTTP major version number + // version_minor - *integer* - HTTP minor version number + // headerLinesIdx - *integer* - headerlines database index + // authDetails - <EPTF_HTTP_authDetails> - authentication details + // connId - *integer* - port group index + // bodymessage - *charstring* - HTTP message body + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Ctx { + charstring method, + integer statusCode, + charstring statusText, + charstring uri, + charstring etag, + integer version_major, + integer version_minor, + integer headerLinesIdx, + EPTF_HTTP_AuthDetails authDetails, + boolean requestPending, + integer connId, + integer bodyId, + integer portId, + integer seqNum, + HTTPMessage httpMessage optional, + EPTF_HTTP_headerContentGetter_FT headerGetterFn, + EPTF_HTTP_rawHeaderContentGetter_FT rawHeaderGetterFn, + EPTF_HTTP_bodyContentGetter_FT contentGetterFn, + EPTF_HTTP_charstringBodyHandler_FT charBodyHandlerFn, + EPTF_HTTP_binaryBodyHandler_FT binaryBodyHandlerFn + } + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_initCtx + // + // Purpose: + // Context initialization. + // +/////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_Ctx c_EPTF_HTTP_initCtx := + { + method := "", + statusCode := -1, + statusText := "", + uri := "", + etag := "", + version_major := 1, + version_minor := 1, + headerLinesIdx := -1, + authDetails := c_EPTF_HTTP_initAuthDetails, + requestPending := false, + connId := -1, + bodyId := -1, + portId := -1, + seqNum := -1, + httpMessage := omit, + headerGetterFn := null, + rawHeaderGetterFn := null, + contentGetterFn := null, + charBodyHandlerFn := null, + binaryBodyHandlerFn := null + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_HostInformation + // + // Purpose: + // Host information + // + // Elements: + // hostIPAddress - *charstring* - store the IP address of the given host + // hostPort - *integer* - store the port of the gives host + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_HostInformation{ + charstring hostIPAddress , + integer hostPort + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_HostInformationList + // + // Purpose: + // Record of <EPTF_HTTP_HostInformation> + // + // Elements: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_HostInformation EPTF_HTTP_HostInformationList; + + + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_CtxList + // + // Purpose: + // FSM Context Database + // + // Elements: + // record of <EPTF_HTTP_Ctx> + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_Ctx EPTF_HTTP_CtxList; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_AuthDataServer + // + // Purpose: + // Stores server authentication data. + // + // Elements: + // method - *charstring* - authentication method ("Digest") + // algorithm - *charstring* - used algorithm eg: MD5 + // realm - *charstring* - authentication realm + // domain - *charstring* *optional*- authentication domain + // nonce - *charstring* - nonce (number used once) + // qopOptions - *charstring* - qop (quality of protection code) + // password - *charstring* - user password + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_AuthDataServer + { + charstring method, + charstring algorithm, + charstring realm, + charstring domain optional, + EPTF_CharstringList nonceValues, + integer currentNonce, + charstring qopOptions, + charstring password + } + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_initAuthData + // + // Purpose: + // - + // +/////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_AuthDataServer c_EPTF_HTTP_initAuthData := + { + method := "", + algorithm := "", + realm := "", + domain := omit, + nonceValues := {}, + currentNonce := 0, + qopOptions := "", + password := "" + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_ParamValue + // + // Purpose: + // - + // + // Elements: + // paramName - *charstring* - + // paramValue - *charstring* - +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_ParamValue + { + charstring paramName, + charstring paramValue + } + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_ParamValue_List + // + // Purpose: + // - +/////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_ParamValue EPTF_HTTP_ParamValue_List; + +/////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_setAuthData + // + // Purpose: + // Sets server authentication data. + // + // Elements: + // method - *charstring* - authentication method ("Digest") + // algorithm - *charstring* - used algorithm eg: MD5 + // realm - *charstring* - authentication realm + // domain - *charstring* *optional*- authentication domain + // nonce - *charstring* - nonce (number used once) + // qopOptions - *charstring* - qop (quality of protection code) + // password - *charstring* - user password + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_setAuthData + { + charstring method, + charstring algorithm, + charstring realm, + charstring domain optional, + charstring qopOptions, + charstring password + } + //============================================================================= + // Constants + //============================================================================= + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_sendRequest + // + // Purpose: + // constant for the step index of send request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_sendRequest := 0; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_sendRequest + // + // Purpose: + // constant for the step name of send request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_sendRequest := "EPTF HTTP: Sends HTTP Request"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_handleTimeout + // + // Purpose: + // constant for the step index of handle timeout step + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_handleTimeout := 1; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_handleTimeout + // + // Purpose: + // constant for the step name of handle timeout step + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_handleTimeout := "EPTF HTTP: Timeout handler"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_responseReceived + // + // Purpose: + // constant for the step index of response message received step + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_responseReceived := 2; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_responseReceived + // + // Purpose: + // constant for the step name of response message received step + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_responseReceived := "EPTF HTTP: Response message received"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_openConnection + // + // Purpose: + // constant for the step index of open connection step + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_openConnection := 3; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_openConnection + // + // Purpose: + // constant for the step name of open connection step + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_openConnection := "EPTF HTTP: Opens connection"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_closeConnection + // + // Purpose: + // constant for the step index of close connection step + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_closeConnection := 4; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_closeConnection + // + // Purpose: + // constant for the step name of close connection step + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_closeConnection := "EPTF HTTP: Closes connection"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_halfCloseConnection + // + // Purpose: + // constant for the step index of half close connection step + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_halfCloseConnection := 5; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_halfCloseConnection + // + // Purpose: + // constant for the step name of half close connection step + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_halfCloseConnection := "EPTF HTTP: Half closes connection"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_closePortOfUser + // + // Purpose: + // constant for the step index of close port of user step + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_closePortOfUser := 6; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_closePortOfUser + // + // Purpose: + // constant for the step name of close port of user step + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_closePortOfUser := "EPTF HTTP: Closes port of user"; + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_closePortOfUser + // + // Purpose: + // constant for the step index of free port of user step + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_freePortOfUser := 7; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_freePortOfUser + // + // Purpose: + // constant for the step name of free port of user step + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_freePortOfUser := "EPTF HTTP: Frees port of user"; + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodCONNECT + // + // Purpose: + // constant for the step index of send request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodCONNECT := 8; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_setEntityContextHTTPMethodCONNECT + // + // Purpose: + // constant for the step name of send request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_setEntityContextHTTPMethodCONNECT := "EPTF HTTP: Set Entity Context HTTP Method CONNECT"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodDELETE + // + // Purpose: + // constant for the step index of send request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodDELETE := 9; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_setEntityContextHTTPMethodDELETE + // + // Purpose: + // constant for the step name of send request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_setEntityContextHTTPMethodDELETE := "EPTF HTTP: Set Entity Context HTTP Method DELETE"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodGET + // + // Purpose: + // constant for the step index of send request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodGET := 10; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_setEntityContextHTTPMethodGET + // + // Purpose: + // constant for the step name of send request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_setEntityContextHTTPMethodGET := "EPTF HTTP: Set Entity Context HTTP Method GET"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodHEAD + // + // Purpose: + // constant for the step index of send request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodHEAD := 11; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_setEntityContextHTTPMethodHEAD + // + // Purpose: + // constant for the step name of send request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_setEntityContextHTTPMethodHEAD := "EPTF HTTP: Set Entity Context HTTP Method HEAD"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodOPTIONS + // + // Purpose: + // constant for the step index of send request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodOPTIONS := 12; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_setEntityContextHTTPMethodOPTIONS + // + // Purpose: + // constant for the step name of send request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_setEntityContextHTTPMethodOPTIONS := "EPTF HTTP: Set Entity Context HTTP Method OPTIONS"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodPOST + // + // Purpose: + // constant for the step index of send request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodPOST := 13; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_setEntityContextHTTPMethodPOST + // + // Purpose: + // constant for the step name of send request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_setEntityContextHTTPMethodPOST := "EPTF HTTP: Set Entity Context HTTP Method POST"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodPUT + // + // Purpose: + // constant for the step index of send request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodPUT := 14; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_setEntityContextHTTPMethodPUT + // + // Purpose: + // constant for the step name of send request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_setEntityContextHTTPMethodPUT := "EPTF HTTP: Set Entity Context HTTP Method PUT"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodTRACE + // + // Purpose: + // constant for the step index of send request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodTRACE := 15; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_setEntityContextHTTPMethodTRACE + // + // Purpose: + // constant for the step name of send request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_setEntityContextHTTPMethodTRACE := "EPTF HTTP: Set Entity Context HTTP Method TRACE"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_handleRequest + // + // Purpose: + // constant for the step index of handle request + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_handleRequest := 16; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_handleRequest + // + // Purpose: + // constant for the step name of handle request + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_handleRequest := "EPTF HTTP: Handle Request"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_sendResponse + // + // Purpose: + // constant for the step index of send response + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_sendResponse := 17; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_sendResponse + // + // Purpose: + // constant for the step name of send response + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_sendResponse := "EPTF HTTP: Send Response"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_cleanUpContext + // + // Purpose: + // constant for the step index of context cleanup + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_closePort := 18; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_closePort + // + // Purpose: + // constant for the step index of port closing + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_closePort := "EPTF HTTP: Close port"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepIdx_cleanUpContext + // + // Purpose: + // constant for the step index of context cleanup + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_stepIdx_cleanUpContext := 19; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_stepName_cleanUpContext + // + // Purpose: + // constant for the step index of context cleanup + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_stepName_cleanUpContext := "EPTF HTTP: Cleanup"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response100Continue + // + // Purpose: + // constant for the input index of response continue input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response100Continue := 0; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response100Continue + // + // Purpose: + // constant for the input name of response continue input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response100Continue := "HTTP Message arrived, Result Code: 100 Continue"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response101SwitchingProtocols + // + // Purpose: + // constant for the input index of response switching protocols input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response101SwitchingProtocols := 1; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response101SwitchingProtocols + // + // Purpose: + // constant for the input name of response switching protocols input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response101SwitchingProtocols := "HTTP Message arrived, Result Code: 101 Switching Protocols"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response200OK + // + // Purpose: + // constant for the input index of response OK input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response200OK := 2; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response200OK + // + // Purpose: + // constant for the input name of response OK input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response200OK := "HTTP Message arrived, Result Code: 200 Ok"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response201Created + // + // Purpose: + // constant for the input index of response created input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response201Created := 3; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response201Created + // + // Purpose: + // constant for the input name of response created input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response201Created := "HTTP Message arrived, Result Code: 201 Created"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response202Accepted + // + // Purpose: + // constant for the input index of response accepted input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response202Accepted := 4; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response202Accepted + // + // Purpose: + // constant for the input name of response accepted input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response202Accepted := "HTTP Message arrived, Result Code: 202 Accepted"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response203NonAuthoritativeInformation + // + // Purpose: + // constant for the input index of response non-authoritative information + // input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response203NonAuthoritativeInformation := 5; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response203NonAuthoritativeInformation + // + // Purpose: + // constant for the input name of response non-authoritative information + // input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response203NonAuthoritativeInformation:= "HTTP Message arrived, Result Code: 203 Non-Authoritative Information"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response204NoContent + // + // Purpose: + // constant for the input index of response no content input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response204NoContent := 6; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response204NoContent + // + // Purpose: + // constant for the input name of response no content input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response204NoContent := "HTTP Message arrived, Result Code: 204 No Content"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response205ResetContent + // + // Purpose: + // constant for the input index of response reset content input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response205ResetContent := 7; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response205ResetContent + // + // Purpose: + // constant for the input name of response reset content input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response205ResetContent := "HTTP Message arrived, Result Code: 205 Reset Content"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response206PartialContent + // + // Purpose: + // constant for the input index of response partial content input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response206PartialContent := 8; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response206PartialContent + // + // Purpose: + // constant for the input name of response partial content input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response206PartialContent := "HTTP Message arrived, Result Code: 206 Partial Content"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response300MultipleChoices + // + // Purpose: + // constant for the input index of response multiple choices input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response300MultipleChoices := 9; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response300MultipleChoices + // + // Purpose: + // constant for the input name of response multiple choices input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response300MultipleChoices := "HTTP Message arrived, Result Code: 300 Multiple Choices"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response301MovedPermanently + // + // Purpose: + // constant for the input index of response moved permanently input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response301MovedPermanently := 10; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response301MovedPermanently + // + // Purpose: + // constant for the input name of response moved permanently input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response301MovedPermanently := "HTTP Message arrived, Result Code: 301 Moved Permanently"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response302Found + // + // Purpose: + // constant for the input index of response found input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response302Found := 11; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response302Found + // + // Purpose: + // constant for the input name of response found input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response302Found := "HTTP Message arrived, Result Code: 302 Found"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response303SeeOther + // + // Purpose: + // constant for the input index of response see other input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response303SeeOther := 12; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response303SeeOther + // + // Purpose: + // constant for the input name of response see other input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response303SeeOther := "HTTP Message arrived, Result Code: 303 See Other"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response304NotModified + // + // Purpose: + // constant for the input index of response modified input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response304NotModified := 13; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response304NotModified + // + // Purpose: + // constant for the input name of response modified input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response304NotModified := "HTTP Message arrived, Result Code: 304 Not Modified"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response305UseProxy + // + // Purpose: + // constant for the input index of response use proxy input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response305UseProxy := 14; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response305UseProxy + // + // Purpose: + // constant for the input name of response use proxy input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response305UseProxy := "HTTP Message arrived, Result Code: 305 Use Proxy"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response306Unused + // + // Purpose: + // constant for the input index of response unused input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response306Unused := 15; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response306Unused + // + // Purpose: + // constant for the input name of response unused input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response306Unused := "HTTP Message arrived, Result Code: 306 Unused"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response307TemporaryRedirect + // + // Purpose: + // constant for the input index of response temporary redirect input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response307TemporaryRedirect := 16; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response307TemporaryRedirect + // + // Purpose: + // constant for the input name of response temporary redirect input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response307TemporaryRedirect := "HTTP Message arrived, Result Code: 307 Temporary Redirect"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response400BadRequest + // + // Purpose: + // constant for the input index of response bad request input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response400BadRequest := 17; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response400BadRequest + // + // Purpose: + // constant for the input name of response bad request input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response400BadRequest := "HTTP Message arrived, Result Code: 400 Bad Request"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response401Unauthorized + // + // Purpose: + // constant for the input index of response unauthorized input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response401Unauthorized := 18; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response401Unauthorized + // + // Purpose: + // constant for the input name of response unauthorized input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response401Unauthorized := "HTTP Message arrived, Result Code: 401 Unauthorized"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response402PaymentRequired + // + // Purpose: + // constant for the input index of response payment required input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response402PaymentRequired := 19; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response402PaymentRequired + // + // Purpose: + // constant for the input name of response payment required input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response402PaymentRequired := "HTTP Message arrived, Result Code: 402 Payment Required"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response403Forbidden + // + // Purpose: + // constant for the input index of response forbidden input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response403Forbidden := 20; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response403Forbidden + // + // Purpose: + // constant for the input name of response forbidden input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response403Forbidden := "HTTP Message arrived, Result Code: 403 Forbidden"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response404NotFound + // + // Purpose: + // constant for the input index of response not found input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response404NotFound := 21; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response404NotFound + // + // Purpose: + // constant for the input name of response not found input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response404NotFound := "HTTP Message arrived, Result Code: 404 Not Found"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response405MethodNotAllowed + // + // Purpose: + // constant for the input index of response method not allowed input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response405MethodNotAllowed := 22; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response405MethodNotAllowed + // + // Purpose: + // constant for the input name of response method not allowed input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response405MethodNotAllowed := "HTTP Message arrived, Result Code: 405 Method Not Allowed"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response406NotAcceptable + // + // Purpose: + // constant for the input index of response not acceptable input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response406NotAcceptable := 23; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response406NotAcceptable + // + // Purpose: + // constant for the input name of response not acceptable input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response406NotAcceptable := "HTTP Message arrived, Result Code: 406 Not Acceptable"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response407ProxyAuthenticationRequired + // + // Purpose: + // constant for the input index of response proxy authentication required + // input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response407ProxyAuthenticationRequired := 24; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response407ProxyAuthenticationRequired + // + // Purpose: + // constant for the input name of response proxy authentication required + // input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response407ProxyAuthenticationRequired := "HTTP Message arrived, Result Code: 407 Proxy Authentication Required"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response408RequestTimeout + // + // Purpose: + // constant for the input index of response request timeout input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response408RequestTimeout := 25; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response408RequestTimeout + // + // Purpose: + // constant for the input name of response request timeout input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response408RequestTimeout := "HTTP Message arrived, Result Code: 408 Request Timeout"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response409Conflict + // + // Purpose: + // constant for the input index of response conflict input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response409Conflict := 26; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response409Conflict + // + // Purpose: + // constant for the input name of response conflict input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response409Conflict := "HTTP Message arrived, Result Code: 409 Conflict"; + + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response410Gone + // + // Purpose: + // constant for the input index of response gone input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response410Gone := 27; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response410Gone + // + // Purpose: + // constant for the input name of response gone input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response410Gone := "HTTP Message arrived, Result Code: 410 Gone"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response411LengthRequired + // + // Purpose: + // constant for the input index of response length required input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response411LengthRequired := 28; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response411LengthRequired + // + // Purpose: + // constant for the input name of response length required input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response411LengthRequired := "HTTP Message arrived, Result Code: 411 Length Required"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response412PreconditionFailed + // + // Purpose: + // constant for the input index of response precondition failed input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response412PreconditionFailed := 29; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response412PreconditionFailed + // + // Purpose: + // constant for the input name of response precondition failed input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response412PreconditionFailed := "HTTP Message arrived, Result Code: 412 Precondition Failed"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response413RequestEntityTooLarge + // + // Purpose: + // constant for the input index of response request entity too large input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response413RequestEntityTooLarge := 30; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response413RequestEntityTooLarge + // + // Purpose: + // constant for the input name of response request entity too large input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response413RequestEntityTooLarge := "HTTP Message arrived, Result Code: 413 Request Entity Too Large"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response414RequestURITooLong + // + // Purpose: + // constant for the input index of response request URI too long input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response414RequestURITooLong := 31; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response414RequestURITooLong + // + // Purpose: + // constant for the input name of response request URI too long input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response414RequestURITooLong := "HTTP Message arrived, Result Code: 414 Request-URI Too Long"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response415UnsupportedMediaType + // + // Purpose: + // constant for the input index of response unsupported media type input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response415UnsupportedMediaType := 32; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response415UnsupportedMediaType + // + // Purpose: + // constant for the input name of response unsupported media type input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response415UnsupportedMediaType := "HTTP Message arrived, Result Code: 415 Unsupported Media Type"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response416RequestedRangeNotSatisfiable + // + // Purpose: + // constant for the input index of response requested range not + // satisfiable input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response416RequestedRangeNotSatisfiable := 33; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response416RequestedRangeNotSatisfiable + // + // Purpose: + // constant for the input name of response requested range not + // satisfiable input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response416RequestedRangeNotSatisfiable := "HTTP Message arrived, Result Code: 416 Requested Range Not Satisfiable"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response417ExpectationFailed + // + // Purpose: + // constant for the input index of response expectation failed input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response417ExpectationFailed := 34; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response417ExpectationFailed + // + // Purpose: + // constant for the input name of response expectation failed input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response417ExpectationFailed := "HTTP Message arrived, Result Code: 417 Expectation Failed"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response500InternalServerError + // + // Purpose: + // constant for the input index of response internal server error input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response500InternalServerError := 35; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response500InternalServerError + // + // Purpose: + // constant for the input name of response internal server error input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response500InternalServerError := "HTTP Message arrived, Result Code: 500 Internal Server Error"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response501NotImplemented + // + // Purpose: + // constant for the input index of response not implemented input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response501NotImplemented := 36; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response501NotImplemented + // + // Purpose: + // constant for the input name of response not implemented input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response501NotImplemented := "HTTP Message arrived, Result Code: 501 Not Implemented"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response502BadGateway + // + // Purpose: + // constant for the input index of response bad gateway input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response502BadGateway := 37; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response502BadGateway + // + // Purpose: + // constant for the input name of response bad gateway input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response502BadGateway := "HTTP Message arrived, Result Code: 502 Bad Gateway"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response503ServiceUnavailable + // + // Purpose: + // constant for the input index of response service unavailable input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response503ServiceUnavailable := 38; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response503ServiceUnavailable + // + // Purpose: + // constant for the input name of response service unavailable input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response503ServiceUnavailable := "HTTP Message arrived, Result Code: 503 Service Unavailable"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response504GatewayTimeout + // + // Purpose: + // constant for the input index of response gateway timeout input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response504GatewayTimeout := 39; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response504GatewayTimeout + // + // Purpose: + // constant for the input name of response gateway timeout input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response504GatewayTimeout := "HTTP Message arrived, Result Code: 504 Gateway Timeout"; + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response505HTTPVersionNotSupported + // + // Purpose: + // constant for the input index of response HTTP version not supported + // input + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response505HTTPVersionNotSupported := 40; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response505HTTPVersionNotSupported + // + // Purpose: + // constant for the input name of response HTTP version not supported + // input + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response505HTTPVersionNotSupported := "HTTP Message arrived, Result Code: 505 HTTP Version Not Supported"; + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response100class + // + // Purpose: + // constant for the input index of response HTTP class 100 + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response100class := 41; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response100class + // + // Purpose: + // constant for the input name of response HTTP version class 100 + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response100class := "HTTP Message arrived, Result Code: 1XX"; + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response200class + // + // Purpose: + // constant for the input index of response HTTP class 200 + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response200class := 42; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response200class + // + // Purpose: + // constant for the input name of response HTTP version class 200 + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response200class := "HTTP Message arrived, Result Code: 2XX"; + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response300class + // + // Purpose: + // constant for the input index of response HTTP class 300 + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response300class := 43; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response300class + // + // Purpose: + // constant for the input name of response HTTP version class 300 + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response300class := "HTTP Message arrived, Result Code: 3XX"; + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response400class + // + // Purpose: + // constant for the input index of response HTTP class 400 + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response400class := 44; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response400class + // + // Purpose: + // constant for the input name of response HTTP version class 400 + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response400class := "HTTP Message arrived, Result Code: 4XX"; + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_response500class + // + // Purpose: + // constant for the input index of response HTTP class 500 + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_response500class := 45; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_response500class + // + // Purpose: + // constant for the input name of response HTTP version class 500 + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_response500class := "HTTP Message arrived, Result Code: 5XX"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_connectionOpened + // + // Purpose: + // constant for the input index of connection opened + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_connectionOpened := 46; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_connectionOpened + // + // Purpose: + // constant for the input name of connection opened + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_connectionOpened := "HTTP Connection Opened "; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_connectionClosed + // + // Purpose: + // constant for the input index of connection closed + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_connectionClosed := 47; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_connectionClosed + // + // Purpose: + // constant for the input name of connection closed + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_connectionClosed := "HTTP Connection Closed "; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_errorReceived + // + // Purpose: + // constant for the input index of error received + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_errorReceived := 48; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_errorReceived + // + // Purpose: + // constant for the input name of error received + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_errorReceived := "HTTP error Result Received "; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_OKReceived + // + // Purpose: + // constant for the input index of OK received + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_OKReceived := 49; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_OKReceived + // + // Purpose: + // constant for the input name of OK received + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_OKReceived := "HTTP OK Result Received"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_responseCharReceived + // + // Purpose: + // constant for the input index of charstring response message received + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_responseCharReceived := 50; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_responseCharReceived + // + // Purpose: + // constant for the input name of charstring response message received + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_responseCharReceived := "HTTP CHAR Response Message Received"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_requestCharReceived + // + // Purpose: + // constant for the input index of charstring request message received + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_requestCharReceived := 51; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_requestCharReceived + // + // Purpose: + // constant for the input name of charstring request message received + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_requestCharReceived := "HTTP CHAR Request Message Received"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_responseOctReceived + // + // Purpose: + // constant for the input index of octetstring response message received + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_responseOctReceived := 52; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_responseOctReceived + // + // Purpose: + // constant for the input name of octetstring response message received + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_responseOctReceived := "HTTP OCT Response Message Received"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_requestOctReceived + // + // Purpose: + // constant for the input index of octetstring request message received + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_requestOctReceived := 53; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_requestOctReceived + // + // Purpose: + // constant for the input name of octetstring request message received + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_requestOctReceived := "HTTP OCT Request Message Received"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputIdx_responseSocketError + // + // Purpose: + // constant for the input index of socket error response received + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_inputIdx_responseSocketError := 54; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_inputName_responseSocketError + // + // Purpose: + // constant for the input name of socket error response received + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_inputName_responseSocketError := "HTTP Response Socket Error"; + + + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_myBName + // + // Purpose: + // constant for the name of the HTTP behaviour + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_myBName := + "HTTP Behavior"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_fsmName_basicCall + // + // Purpose: + // constant for the name of basic call FSM + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_fsmName_basicCall := "EPTF HTTP: Basic Call"; + +/////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_fsm_basicCall_state_idle + // + // Purpose: + // - + // +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_fsm_basicCall_state_idle := 0; + +/////////////////////////////////////////////////////////////////////////////// + // const: Database Hash Map name constants + // + // Purpose: + // - + // + // Elements: + // - c_EPTF_HTTP_HashMap_charDatabase + // - c_EPTF_HTTP_HashMap_octDatabase + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_HashMap_charDatabase := "EPTF HTTP: Charstring database"; + const charstring c_EPTF_HTTP_HashMap_octDatabase := "EPTF HTTP: Octetstring database"; + + //========================================================================= + // Templates + //========================================================================= + +/////////////////////////////////////////////////////////////////////////////// + // Template: t_EPTF_HTTP_HTTPdistr_request + // + // Purpose: + // <HTTPMessage> template, HTTP request message + // + // Parameters: + // p_client_id - *integer* - connection client ID + // p_method - *charstring* - GET, PUT, etc + // p_uri - *charstring* - uri ID + // p_version_major - *integer* - HTTP major version number + // p_version_minor - *integer* - HTTP minor version number + // p_header - <HeaderLines> *template* - header of the message + // p_body - *charstring* *template* - body of the message + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + template HTTPMessage t_EPTF_HTTP_HTTPdistr_request( + charstring p_method, + charstring p_uri, + integer p_version_major, + integer p_version_minor, + HeaderLines p_header, + charstring p_body + ) := + { + request:= { + client_id:= omit, + method:= p_method, + uri:= p_uri, + version_major := p_version_major, + version_minor := p_version_minor, + header:= p_header, + body:= p_body + } + } + +/////////////////////////////////////////////////////////////////////////////// + // Template: t_EPTF_HTTP_HTTPdistr_binary_request + // + // Purpose: + // <HTTPMessage> template, HTTP binary request message + // + // Parameters: + // p_client_id - *integer* - connection client ID + // p_method - *charstring* - GET, PUT, etc + // p_uri - *charstring* - uri ID + // p_version_major - *integer* - HTTP major version number + // p_version_minor - *integer* - HTTP minor version number + // p_header - <HeaderLines> *template* - header of the message + // p_body - *charstring* *template* - body of the message + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + template HTTPMessage t_EPTF_HTTP_HTTPdistr_binary_request( + charstring p_method, + charstring p_uri, + integer p_version_major, + integer p_version_minor, + HeaderLines p_header, + octetstring p_body + ) := + { + request_binary:= { + client_id:= omit, + method:= p_method, + uri:= p_uri, + version_major := p_version_major, + version_minor := p_version_minor, + header:= p_header, + body:= p_body + } + } + +/////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_templName_CustomHeader + // + // Purpose: + // constant for the name of the HTTP external template + // type Custom Header + // +/////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_templName_CustomHeader := + "CUSTOM_HEADER"; + +/////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_templName_CustomHeader + // + // Purpose: + // constant for the name of the HTTP external template + // type Custom Header + // +/////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_templName_CustomHeaderResponse := + "CUSTOM_HEADER_RESPONSE" + +/////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_templName_CustomBody + // + // Purpose: + // constant for the name of the HTTP external template + // type Custom Body + // +/////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_templName_CustomBody := + "CUSTOM_BODY"; + +} + +//========================================================================= +// Statistics +//========================================================================= + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Statistics +// +// Purpose: +// Functions of the EPTF HTTP Statistics +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Statistics +{ +/////////////////////////////////////////////////////////////////////////////// + // Constant: Method constants + // + // Purpose: + // Unique names for incoming and outgoing method statistics + // + // Elements: + // - c_EPTF_HTTP_Stat_nofIncRequests + // - c_EPTF_HTTP_Stat_nofIncOptionMessages + // - c_EPTF_HTTP_Stat_nofIncOptionMessages + // - c_EPTF_HTTP_Stat_nofIncHeadMessages + // - c_EPTF_HTTP_Stat_nofIncPostMessages + // - c_EPTF_HTTP_Stat_nofIncPutMessages + // - c_EPTF_HTTP_Stat_nofIncDeleteMessages + // - c_EPTF_HTTP_Stat_nofIncTraceMessages + // - c_EPTF_HTTP_Stat_nofIncConnectMessages + // + // - c_EPTF_HTTP_Stat_nofOutRequests + // - c_EPTF_HTTP_Stat_nofOutOptionMessages + // - c_EPTF_HTTP_Stat_nofOutOptionMessages + // - c_EPTF_HTTP_Stat_nofOutHeadMessages + // - c_EPTF_HTTP_Stat_nofOutPostMessages + // - c_EPTF_HTTP_Stat_nofOutPutMessages + // - c_EPTF_HTTP_Stat_nofOutDeleteMessages + // - c_EPTF_HTTP_Stat_nofOutTraceMessages + // - c_EPTF_HTTP_Stat_nofOutConnectMessages + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_Stat_nofIncRequests := "HTTP: Number of incoming Requests"; + const charstring c_EPTF_HTTP_Stat_nofIncOptionMessages := "HTTP: Number of incoming OPTION Messages"; + const charstring c_EPTF_HTTP_Stat_nofIncGetMessages := "HTTP: Number of incoming GET Messages"; + const charstring c_EPTF_HTTP_Stat_nofIncHeadMessages := "HTTP: Number of incoming HEAD Messages"; + const charstring c_EPTF_HTTP_Stat_nofIncPostMessages := "HTTP: Number of incoming POST Messages"; + const charstring c_EPTF_HTTP_Stat_nofIncPutMessages := "HTTP: Number of incoming PUT Messages"; + const charstring c_EPTF_HTTP_Stat_nofIncDeleteMessages := "HTTP: Number incoming of DELETE Messages"; + const charstring c_EPTF_HTTP_Stat_nofIncTraceMessages := "HTTP: Number of incoming TRACE Messages"; + const charstring c_EPTF_HTTP_Stat_nofIncConnectMessages := "HTTP: Number of incoming CONNECT Messages"; + + const charstring c_EPTF_HTTP_Stat_nofOutRequests := "HTTP: Number of outgoing Requests"; + const charstring c_EPTF_HTTP_Stat_nofOutOptionMessages := "HTTP: Number of outgoing OPTION Messages"; + const charstring c_EPTF_HTTP_Stat_nofOutGetMessages := "HTTP: Number of outgoing GET Messages"; + const charstring c_EPTF_HTTP_Stat_nofOutHeadMessages := "HTTP: Number of outgoing HEAD Messages"; + const charstring c_EPTF_HTTP_Stat_nofOutPostMessages := "HTTP: Number of outgoing POST Messages"; + const charstring c_EPTF_HTTP_Stat_nofOutPutMessages := "HTTP: Number of outgoing PUT Messages"; + const charstring c_EPTF_HTTP_Stat_nofOutDeleteMessages := "HTTP: Number outgoing of DELETE Messages"; + const charstring c_EPTF_HTTP_Stat_nofOutTraceMessages := "HTTP: Number of outgoing TRACE Messages"; + const charstring c_EPTF_HTTP_Stat_nofOutConnectMessages := "HTTP: Number of outgoing CONNECT Messages"; + +/////////////////////////////////////////////////////////////////////////////// + // Constant: Status code constants + // + // Purpose: + // Unique names for incoming and outgoing status code statistics + // + // Elements: + // - c_EPTF_HTTP_Stat_nofIncResponses + // - c_EPTF_HTTP_Stat_nofInc100StatusCode + // - c_EPTF_HTTP_Stat_nofInc101StatusCode + // - c_EPTF_HTTP_Stat_nofInc200StatusCode + // - c_EPTF_HTTP_Stat_nofInc201StatusCode + // - c_EPTF_HTTP_Stat_nofInc202StatusCode + // - c_EPTF_HTTP_Stat_nofInc203StatusCode + // - c_EPTF_HTTP_Stat_nofInc204StatusCode + // - c_EPTF_HTTP_Stat_nofInc205StatusCode + // - c_EPTF_HTTP_Stat_nofInc206StatusCode + // - c_EPTF_HTTP_Stat_nofInc300StatusCode + // - c_EPTF_HTTP_Stat_nofInc301StatusCode + // - c_EPTF_HTTP_Stat_nofInc302StatusCode + // - c_EPTF_HTTP_Stat_nofInc303StatusCode + // - c_EPTF_HTTP_Stat_nofInc304StatusCode + // - c_EPTF_HTTP_Stat_nofInc305StatusCode + // - c_EPTF_HTTP_Stat_nofInc306StatusCode + // - c_EPTF_HTTP_Stat_nofInc307StatusCode + // - c_EPTF_HTTP_Stat_nofInc400StatusCode + // - c_EPTF_HTTP_Stat_nofInc401StatusCode + // - c_EPTF_HTTP_Stat_nofInc402StatusCode + // - c_EPTF_HTTP_Stat_nofInc403StatusCode + // - c_EPTF_HTTP_Stat_nofInc404StatusCode + // - c_EPTF_HTTP_Stat_nofInc405StatusCode + // - c_EPTF_HTTP_Stat_nofInc406StatusCode + // - c_EPTF_HTTP_Stat_nofInc407StatusCode + // - c_EPTF_HTTP_Stat_nofInc408StatusCode + // - c_EPTF_HTTP_Stat_nofInc409StatusCode + // - c_EPTF_HTTP_Stat_nofInc410StatusCode + // - c_EPTF_HTTP_Stat_nofInc411StatusCode + // - c_EPTF_HTTP_Stat_nofInc412StatusCode + // - c_EPTF_HTTP_Stat_nofInc413StatusCode + // - c_EPTF_HTTP_Stat_nofInc414StatusCode + // - c_EPTF_HTTP_Stat_nofInc415StatusCode + // - c_EPTF_HTTP_Stat_nofInc416StatusCode + // - c_EPTF_HTTP_Stat_nofInc417StatusCode + // - c_EPTF_HTTP_Stat_nofInc500StatusCode + // - c_EPTF_HTTP_Stat_nofInc501StatusCode + // - c_EPTF_HTTP_Stat_nofInc502StatusCode + // - c_EPTF_HTTP_Stat_nofInc503StatusCode + // - c_EPTF_HTTP_Stat_nofInc504StatusCode + // - c_EPTF_HTTP_Stat_nofInc505StatusCode + // + // - c_EPTF_HTTP_Stat_nofOutResponses + // - c_EPTF_HTTP_Stat_nofOut100StatusCode + // - c_EPTF_HTTP_Stat_nofOut101StatusCode + // - c_EPTF_HTTP_Stat_nofOut200StatusCode + // - c_EPTF_HTTP_Stat_nofOut201StatusCode + // - c_EPTF_HTTP_Stat_nofOut202StatusCode + // - c_EPTF_HTTP_Stat_nofOut203StatusCode + // - c_EPTF_HTTP_Stat_nofOut204StatusCode + // - c_EPTF_HTTP_Stat_nofOut205StatusCode + // - c_EPTF_HTTP_Stat_nofOut206StatusCode + // - c_EPTF_HTTP_Stat_nofOut300StatusCode + // - c_EPTF_HTTP_Stat_nofOut301StatusCode + // - c_EPTF_HTTP_Stat_nofOut302StatusCode + // - c_EPTF_HTTP_Stat_nofOut303StatusCode + // - c_EPTF_HTTP_Stat_nofOut304StatusCode + // - c_EPTF_HTTP_Stat_nofOut305StatusCode + // - c_EPTF_HTTP_Stat_nofOut306StatusCode + // - c_EPTF_HTTP_Stat_nofOut307StatusCode + // - c_EPTF_HTTP_Stat_nofOut400StatusCode + // - c_EPTF_HTTP_Stat_nofOut401StatusCode + // - c_EPTF_HTTP_Stat_nofOut402StatusCode + // - c_EPTF_HTTP_Stat_nofOut403StatusCode + // - c_EPTF_HTTP_Stat_nofOut404StatusCode + // - c_EPTF_HTTP_Stat_nofOut405StatusCode + // - c_EPTF_HTTP_Stat_nofOut406StatusCode + // - c_EPTF_HTTP_Stat_nofOut407StatusCode + // - c_EPTF_HTTP_Stat_nofOut408StatusCode + // - c_EPTF_HTTP_Stat_nofOut409StatusCode + // - c_EPTF_HTTP_Stat_nofOut410StatusCode + // - c_EPTF_HTTP_Stat_nofOut411StatusCode + // - c_EPTF_HTTP_Stat_nofOut412StatusCode + // - c_EPTF_HTTP_Stat_nofOut413StatusCode + // - c_EPTF_HTTP_Stat_nofOut414StatusCode + // - c_EPTF_HTTP_Stat_nofOut415StatusCode + // - c_EPTF_HTTP_Stat_nofOut416StatusCode + // - c_EPTF_HTTP_Stat_nofOut417StatusCode + // - c_EPTF_HTTP_Stat_nofOut500StatusCode + // - c_EPTF_HTTP_Stat_nofOut501StatusCode + // - c_EPTF_HTTP_Stat_nofOut502StatusCode + // - c_EPTF_HTTP_Stat_nofOut503StatusCode + // - c_EPTF_HTTP_Stat_nofOut504StatusCode + // - c_EPTF_HTTP_Stat_nofOut505StatusCode + // + // Detailed Comments: + // - + // +/////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_Stat_nofIncResponses := "HTTP: Number of incoming responses" + const charstring c_EPTF_HTTP_Stat_nofInc100StatusCode := "HTTP: Number of incoming 100 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc101StatusCode := "HTTP: Number of incoming 101 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc200StatusCode := "HTTP: Number of incoming 200 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc201StatusCode := "HTTP: Number of incoming 201 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc202StatusCode := "HTTP: Number of incoming 202 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc203StatusCode := "HTTP: Number of incoming 203 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc204StatusCode := "HTTP: Number of incoming 204 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc205StatusCode := "HTTP: Number of incoming 205 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc206StatusCode := "HTTP: Number of incoming 206 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc300StatusCode := "HTTP: Number of incoming 300 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc301StatusCode := "HTTP: Number of incoming 301 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc302StatusCode := "HTTP: Number of incoming 302 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc303StatusCode := "HTTP: Number of incoming 303 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc304StatusCode := "HTTP: Number of incoming 304 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc305StatusCode := "HTTP: Number of incoming 305 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc306StatusCode := "HTTP: Number of incoming 306 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc307StatusCode := "HTTP: Number of incoming 307 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc400StatusCode := "HTTP: Number of incoming 400 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc401StatusCode := "HTTP: Number of incoming 401 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc402StatusCode := "HTTP: Number of incoming 402 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc403StatusCode := "HTTP: Number of incoming 403 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc404StatusCode := "HTTP: Number of incoming 404 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc405StatusCode := "HTTP: Number of incoming 405 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc406StatusCode := "HTTP: Number of incoming 406 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc407StatusCode := "HTTP: Number of incoming 407 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc408StatusCode := "HTTP: Number of incoming 408 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc409StatusCode := "HTTP: Number of incoming 409 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc410StatusCode := "HTTP: Number of incoming 410 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc411StatusCode := "HTTP: Number of incoming 411 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc412StatusCode := "HTTP: Number of incoming 412 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc413StatusCode := "HTTP: Number of incoming 413 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc414StatusCode := "HTTP: Number of incoming 414 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc415StatusCode := "HTTP: Number of incoming 415 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc416StatusCode := "HTTP: Number of incoming 416 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc417StatusCode := "HTTP: Number of incoming 417 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc500StatusCode := "HTTP: Number of incoming 500 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc501StatusCode := "HTTP: Number of incoming 501 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc502StatusCode := "HTTP: Number of incoming 502 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc503StatusCode := "HTTP: Number of incoming 503 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc504StatusCode := "HTTP: Number of incoming 504 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofInc505StatusCode := "HTTP: Number of incoming 505 Status Codes" + + const charstring c_EPTF_HTTP_Stat_nofOutResponses := "HTTP: Number of outgoing responses" + const charstring c_EPTF_HTTP_Stat_nofOut100StatusCode := "HTTP: Number of outgoing 100 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut101StatusCode := "HTTP: Number of outgoing 101 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut200StatusCode := "HTTP: Number of outgoing 200 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut201StatusCode := "HTTP: Number of outgoing 201 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut202StatusCode := "HTTP: Number of outgoing 202 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut203StatusCode := "HTTP: Number of outgoing 203 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut204StatusCode := "HTTP: Number of outgoing 204 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut205StatusCode := "HTTP: Number of outgoing 205 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut206StatusCode := "HTTP: Number of outgoing 206 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut300StatusCode := "HTTP: Number of outgoing 300 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut301StatusCode := "HTTP: Number of outgoing 301 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut302StatusCode := "HTTP: Number of outgoing 302 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut303StatusCode := "HTTP: Number of outgoing 303 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut304StatusCode := "HTTP: Number of outgoing 304 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut305StatusCode := "HTTP: Number of outgoing 305 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut306StatusCode := "HTTP: Number of outgoing 306 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut307StatusCode := "HTTP: Number of outgoing 307 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut400StatusCode := "HTTP: Number of outgoing 400 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut401StatusCode := "HTTP: Number of outgoing 401 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut402StatusCode := "HTTP: Number of outgoing 402 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut403StatusCode := "HTTP: Number of outgoing 403 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut404StatusCode := "HTTP: Number of outgoing 404 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut405StatusCode := "HTTP: Number of outgoing 405 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut406StatusCode := "HTTP: Number of outgoing 406 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut407StatusCode := "HTTP: Number of outgoing 407 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut408StatusCode := "HTTP: Number of outgoing 408 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut409StatusCode := "HTTP: Number of outgoing 409 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut410StatusCode := "HTTP: Number of outgoing 410 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut411StatusCode := "HTTP: Number of outgoing 411 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut412StatusCode := "HTTP: Number of outgoing 412 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut413StatusCode := "HTTP: Number of outgoing 413 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut414StatusCode := "HTTP: Number of outgoing 414 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut415StatusCode := "HTTP: Number of outgoing 415 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut416StatusCode := "HTTP: Number of outgoing 416 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut417StatusCode := "HTTP: Number of outgoing 417 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut500StatusCode := "HTTP: Number of outgoing 500 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut501StatusCode := "HTTP: Number of outgoing 501 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut502StatusCode := "HTTP: Number of outgoing 502 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut503StatusCode := "HTTP: Number of outgoing 503 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut504StatusCode := "HTTP: Number of outgoing 504 Status Codes" + const charstring c_EPTF_HTTP_Stat_nofOut505StatusCode := "HTTP: Number of outgoing 505 Status Codes" +} + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Logging +// +// Purpose: +// Functions of the EPTF HTTP Logging +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Logging +{ +/////////////////////////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_loggingEventClasses + // + // Purpose: + // list of logging event class names used on the EPTF HTTP component + // + // Detailed Comments: + // <EPTF_Logging_EventClassPrefixList> { "Error", "Warning", "Debug" } +/////////////////////////////////////////////////////////////////////////////// + const EPTF_Logging_EventClassPrefixList c_EPTF_HTTP_loggingEventClasses := { "Error", "Warning", "Debug" }; + +/////////////////////////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_Transport_loggingClassIdx_Error + // + // Purpose: + // logging class index for Error + // + // Detailed Comments: + // *0* +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_loggingClassIdx_Error := 0; +/////////////////////////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_Transport_loggingClassIdx_Warning + // + // Purpose: + // logging class index for Warning + // + // Detailed Comments: + // *1* +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_loggingClassIdx_Warning := 1; +/////////////////////////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_Transport_loggingClassIdx_Debug + // + // Purpose: + // logging class index for Debug + // + // Detailed Comments: + // *2* +/////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_loggingClassIdx_Debug := 2; +} + +/////////////////////////////////////////////////////////// +// Type: fcb_EPTF_HTTP_messageReceivedHook +// +// Purpose: Message hook to HTTP message received processing. +// +/////////////////////////////////////////////////////////// +type function fcb_EPTF_HTTP_messageReceivedHook(in integer pl_eIdx, in HTTPMessage pl_httpMessage) runs on self; + +}//end of module +with { +extension "version <RnXnn>" +} + diff --git a/src/LoadGen/EPTF_HTTP_Functions.ttcn b/src/LoadGen/EPTF_HTTP_Functions.ttcn new file mode 100644 index 0000000..9c52dab --- /dev/null +++ b/src/LoadGen/EPTF_HTTP_Functions.ttcn @@ -0,0 +1,7012 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_Functions.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2015-05-20 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// Module: EPTF_HTTP_Functions +// +// Purpose: +// This module contains the functions of the EPTF HTTP application id +// +// Module Parameters: +// See <EPTF_HTTP_Definitions> +// +// Module depends on: +// <EPTF_CLL_Common_Definitions> +// +// <EPTF_CLL_Base_Functions> +// +// <EPTF_CLL_LGenBase_Definitions> +// +// <EPTF_CLL_LGenBase_Functions> +// +// <EPTF_CLL_LGenBase_ConfigFunctions> +// +// <EPTF_CLL_LGenBase_EventHandlingFunctions> +// +// <EPTF_CLL_HashMapStr2Int_Functions> +// +// <EPTF_CLL_HashMapOct2Int_Functions> +// +// <EPTF_CLL_Variable_Functions> +// +// <EPTF_CLL_Logging_Functions> +// +// <EPTF_CLL_Logging_Definitions> +// +// <EPTF_HTTP_Definitions> +// +// <HTTPmsg_Types> +// +// <TCCSecurity_Functions> +// +// <TCCDateTime_Functions> +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2012-10-24 +// +/////////////////////////////////////////////////////////////////////////////// +module EPTF_HTTP_Functions { + +//============================================================================= +// Import Part +//============================================================================= +import from EPTF_CLL_Common_Definitions all; +import from EPTF_CLL_Base_Functions all; +import from EPTF_CLL_LGenBase_Definitions all; +import from EPTF_CLL_LGenBase_Functions all; +import from EPTF_CLL_LGenBase_ConfigFunctions all; +import from EPTF_CLL_LGenBase_EventHandlingFunctions all; +import from EPTF_CLL_LGenBase_TemplateFunctions all; +import from EPTF_CLL_HashMapStr2Int_Functions all; +import from EPTF_CLL_HashMapOct2Int_Functions all; +import from EPTF_CLL_Variable_Functions all; +import from EPTF_CLL_Logging_Functions all; +import from EPTF_CLL_Logging_Definitions all; +import from EPTF_HTTP_Definitions all; +import from HTTPmsg_Types all; + +import from TCCSecurity_Functions all; +import from TCCDateTime_Functions all; +import from TCCConversion_Functions all; + +//============================================================================= +// Functions +//============================================================================= + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_PublicFunctions +// +// Purpose: +// The functions of the EPTF HTTP Public Functions +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_PublicFunctions{ + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_init + // + // Purpose: + // Function to initialize HTTP behaviour + // + // Parameters: + // pl_selfName - *in* *charstring* - the components self name + // pl_selfId - *in* *integer* - component self id + // pl_entityNamePrefix - *in* *charstring* - entity name prefix + // pl_numEntities - *in* *integer* - number of entities + // pl_bind - *in* <EPTF_LGenBase_BehaviorContextBinder_FT> - behaviour + // context bind callback function + // pl_reset - *in* <EPTF_LGenBase_BehaviorContextHandler_FT> - behaviour + // context reset callback function + // pl_unbind - *in* <EPTF_LGenBase_BehaviorContextHandler_FT> - behaviour + // context unbind callback function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_init( + in charstring pl_selfName, + in integer pl_selfId, + in charstring pl_entityNamePrefix, + in integer pl_numEntities := 0, + in EPTF_LGenBase_BehaviorContextBinder_FT pl_bind := refers(f_EPTF_HTTP_bindEntity4Behavior), + in EPTF_LGenBase_BehaviorContextHandler_FT pl_reset := refers(f_EPTF_HTTP_resetEntity4Behavior), + in EPTF_LGenBase_BehaviorContextHandler_FT pl_unbind := refers(f_EPTF_HTTP_unbindEntity4Behavior)) + runs on EPTF_HTTP_LGen_CT + { + if (not v_EPTF_HTTP_initialized) + { + f_EPTF_Base_assert(%definitionId & + ": tsp_EPTF_HTTP_maxNumberOfEntities must be set to at least: " & + int2str(f_EPTF_LGenBase_entityCount()), + tsp_EPTF_HTTP_maxNumberOfEntities > f_EPTF_LGenBase_entityCount()); + + f_EPTF_HTTP_initializeExtendedComponents( // LGenbase, Variable, Logging + pl_selfName,pl_numEntities,pl_entityNamePrefix); + + f_EPTF_Base_registerCleanup(refers(f_EPTF_HTTP_cleanup_CT)); + + v_EPTF_HTTP_loggingMaskId := + f_EPTF_Logging_registerComponentMasks( + tsp_EPTF_HTTP_loggingComponentMask, + c_EPTF_HTTP_loggingEventClasses, + EPTF_Logging_CLL); + + if (tsp_EPTF_HTTP_loggingEnable) + { + f_EPTF_Logging_enableLocalMask( + v_EPTF_HTTP_loggingMaskId, + c_EPTF_HTTP_loggingClassIdx_Debug); + } + else + { + f_EPTF_Logging_disableLocalMask( + v_EPTF_HTTP_loggingMaskId, + c_EPTF_HTTP_loggingClassIdx_Debug); + } + + v_EPTF_HTTP_selfName := pl_selfName; + v_EPTF_HTTP_selfId := pl_selfId; + + v_EPTF_HTTP_EntityOffset := pl_selfId * tsp_EPTF_HTTP_maxNumberOfEntities; + + f_EPTF_HTTP_debug(%definitionId & ": Entity offset: " & + int2str(v_EPTF_HTTP_EntityOffset)); + + vf_EPTF_HTTP_sendRequest := refers(f_EPTF_HTTP_defaultSendRequest); + vf_EPTF_HTTP_connectionOpen := refers(f_EPTF_HTTP_defaultConnectionOpen); + vf_EPTF_HTTP_connectionClose := refers(f_EPTF_HTTP_defaultConnectionClose); + vf_EPTF_HTTP_connectionHalfClose := refers(f_EPTF_HTTP_defaultConnectionHalfClose); + vf_EPTF_HTTP_closePortOfUser := refers(f_EPTF_HTTP_defaultFreePortOfUser); + vf_EPTF_HTTP_freePortOfUser := refers(f_EPTF_HTTP_defaultFreePortOfUser); + + vf_EPTF_HTTP_closePort := refers(f_EPTF_HTTP_defaultClosePort); + + vf_EPTF_HTTP_sendResponse := refers(f_EPTF_HTTP_defaultSendResponse); + vf_EPTF_HTTP_listen := refers(f_EPTF_HTTP_defaultListen); + + vf_EPTF_HTTP_searchContext := refers(f_EPTF_HTTP_defaultSearch); + vf_EPTF_HTTP_searchContext4Event := refers(f_EPTF_HTTP_defaultSearch); + vf_EPTF_HTTP_searchContext4Error := refers(f_EPTF_HTTP_defaultSearch); + + v_EPTF_HTTP_myBIdx := f_EPTF_LGenBase_declareBehaviorType( + c_EPTF_HTTP_myBName, + -1, + pl_reset, + pl_bind, + pl_unbind + ); + + v_EPTF_HTTP_charDB := f_EPTF_str2int_HashMap_New(c_EPTF_HTTP_HashMap_charDatabase); + v_EPTF_HTTP_octDB := f_EPTF_oct2int_HashMap_New(c_EPTF_HTTP_HashMap_octDatabase); + + // set event dispatch mechanism + select (tsp_EPTF_HTTP_dispatchLevel) { + case (Class) { vf_EPTF_HTTP_dispatchFn := refers(f_EPTF_HTTP_reportClassEvent); } + case (Detailed) { vf_EPTF_HTTP_dispatchFn := refers(f_EPTF_HTTP_reportDetailedEvent); } + case else { } + } + + + f_EPTF_HTTP_declareStepsAndEvent(); + + f_EPTF_HTTP_initStats(); + + v_EPTF_HTTP_authData := c_EPTF_HTTP_initAuthData; + + f_EPTF_HTTP_generateNonceValues(tsp_EPTF_HTTP_nofNonceValues, v_EPTF_HTTP_authData.nonceValues) + + //Declare external template types + v_EPTF_HTTP_extTemplType_customHeader := f_EPTF_LGenBase_declareTemplateType( + {behaviourType:=c_EPTF_HTTP_myBName, templateName:=c_EPTF_HTTP_templName_CustomHeader}, + {"method"}, {"requestURI","versionMajor","versionMinor","customHeader","contentLength"} ); + + v_EPTF_HTTP_extTemplType_customHeaderResponse := f_EPTF_LGenBase_declareTemplateType( + {behaviourType:=c_EPTF_HTTP_myBName, templateName:=c_EPTF_HTTP_templName_CustomHeaderResponse}, + {}, {"status","versionMajor","versionMinor","contentLength"} ); + + v_EPTF_HTTP_extTemplType_customBody := f_EPTF_LGenBase_declareTemplateType( + {behaviourType:=c_EPTF_HTTP_myBName, templateName:=c_EPTF_HTTP_templName_CustomBody}, + {}, {} ); + + v_EPTF_HTTP_initialized := true; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getContextIndex + // + // Purpose: + // Function to add new entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // *integer* - index of the entity context + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getContextIndex( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return integer + { + return f_EPTF_LGenBase_getBehaviorCtxItem(pl_eIdx, v_EPTF_HTTP_myBIdx, 0); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_initStats + // + // Purpose: + // Function to initialize HTTP statistics + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_initStats() + runs on EPTF_HTTP_LGen_CT + { + var charstring vl_prefix := + v_EPTF_HTTP_selfName & "." & int2str(v_EPTF_HTTP_selfId) & "."; + + // incoming methods + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncRequests, 0, + v_EPTF_HTTP_stats.incoming.requests_k); + f_EPTF_Var_setSubsCanAdjust(v_EPTF_HTTP_stats.incoming.requests_k, false) + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncOptionMessages, 0, + v_EPTF_HTTP_stats.incoming.method.options_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncGetMessages, 0, + v_EPTF_HTTP_stats.incoming.method.get_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncHeadMessages, 0, + v_EPTF_HTTP_stats.incoming.method.head_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncPostMessages, 0, + v_EPTF_HTTP_stats.incoming.method.post_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncPutMessages, 0, + v_EPTF_HTTP_stats.incoming.method.put_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncDeleteMessages, 0, + v_EPTF_HTTP_stats.incoming.method.delete_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncTraceMessages, 0, + v_EPTF_HTTP_stats.incoming.method.trace_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncConnectMessages, 0, + v_EPTF_HTTP_stats.incoming.method.connect_k); + + // outgoing methods + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutRequests, 0, + v_EPTF_HTTP_stats.outgoing.requests_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutOptionMessages, 0, + v_EPTF_HTTP_stats.outgoing.method.options_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutGetMessages, 0, + v_EPTF_HTTP_stats.outgoing.method.get_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutHeadMessages, 0, + v_EPTF_HTTP_stats.outgoing.method.head_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutPostMessages, 0, + v_EPTF_HTTP_stats.outgoing.method.post_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutPutMessages, 0, + v_EPTF_HTTP_stats.outgoing.method.put_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutDeleteMessages, 0, + v_EPTF_HTTP_stats.outgoing.method.delete_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutTraceMessages, 0, + v_EPTF_HTTP_stats.outgoing.method.trace_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutConnectMessages, 0, + v_EPTF_HTTP_stats.outgoing.method.connect_k); + + // incoming status codes + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofIncResponses, 0, + v_EPTF_HTTP_stats.incoming.responses_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc100StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code100_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc101StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code101_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc200StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code200_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc201StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code201_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc202StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code202_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc203StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code203_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc204StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code204_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc205StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code205_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc206StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code206_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc300StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code300_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc301StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code301_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc302StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code302_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc303StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code303_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc304StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code304_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc305StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code305_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc306StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code306_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc307StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code307_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc400StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code400_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc401StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code401_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc402StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code402_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc403StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code403_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc404StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code404_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc405StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code405_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc406StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code406_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc407StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code407_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc408StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code408_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc409StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code409_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc410StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code410_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc411StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code411_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc412StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code412_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc413StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code413_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc414StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code414_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc415StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code415_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc416StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code416_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc417StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code417_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc500StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code500_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc501StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code501_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc502StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code502_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc503StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code503_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc504StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code504_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofInc505StatusCode, 0, + v_EPTF_HTTP_stats.incoming.status.code505_k); + + // outgoing status codes + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOutResponses, 0, + v_EPTF_HTTP_stats.outgoing.responses_k); + f_EPTF_Var_setSubsCanAdjust(v_EPTF_HTTP_stats.outgoing.responses_k, false) + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut100StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code100_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut101StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code101_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut200StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code200_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut201StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code201_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut202StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code202_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut203StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code203_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut204StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code204_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut205StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code205_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut206StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code206_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut300StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code300_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut301StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code301_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut302StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code302_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut303StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code303_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut304StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code304_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut305StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code305_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut306StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code306_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut307StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code307_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut400StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code400_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut401StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code401_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut402StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code402_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut403StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code403_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut404StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code404_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut405StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code405_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut406StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code406_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut407StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code407_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut408StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code408_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut409StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code409_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut410StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code410_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut411StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code411_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut412StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code412_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut413StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code413_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut414StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code414_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut415StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code415_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut416StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code416_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut417StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code417_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut500StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code500_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut501StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code501_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut502StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code502_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut503StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code503_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut504StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code504_k); + + f_EPTF_Var_newInt( + vl_prefix & c_EPTF_HTTP_Stat_nofOut505StatusCode, 0, + v_EPTF_HTTP_stats.outgoing.status.code505_k); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_resetStats + // + // Purpose: + // Function to reset HTTP statistics + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_resetStats() + runs on EPTF_HTTP_LGen_CT + { + // incoming methods + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.requests_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.method.options_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.method.get_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.method.head_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.method.post_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.method.put_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.method.delete_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.method.trace_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.method.connect_k, + { intVal := 0 }); + + // outgoing methods + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.requests_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.method.options_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.method.get_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.method.head_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.method.post_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.method.put_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.method.delete_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.method.trace_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.method.connect_k, + { intVal := 0 }); + + // incoming status codes + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.responses_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code100_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code101_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code200_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code201_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code202_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code203_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code204_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code205_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code206_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code300_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code301_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code302_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code303_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code304_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code305_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code306_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code307_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code400_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code401_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code402_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code403_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code404_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code405_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code406_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code407_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code408_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code409_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code410_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code411_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code412_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code413_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code414_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code415_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code416_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code417_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code500_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code501_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code502_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code503_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code504_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.incoming.status.code505_k, + { intVal := 0 }); + + // outgoing status codes + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.responses_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code100_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code101_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code200_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code201_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code202_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code203_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code204_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code205_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code206_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code300_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code301_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code302_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code303_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code304_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code305_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code306_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code307_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code400_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code401_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code402_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code403_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code404_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code405_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code406_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code407_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code408_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code409_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code410_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code411_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code412_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code413_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code414_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code415_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code416_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code417_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code500_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code501_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code502_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code503_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code504_k, + { intVal := 0 }); + + f_EPTF_Var_adjustContent( + v_EPTF_HTTP_stats.outgoing.status.code505_k, + { intVal := 0 }); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_updateStatistics + // + // Purpose: + // Function to update HTTP statistics + // + // Parameters: + // pl_in - *in* *boolean* - message direction (incoming/outgoing) + // pl_method - *in* *charstring* - HTTP method + // pl_code - *in* *integer* - HTTP response status code + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // If pl_in is true, incoming statistics is updated, else outgoing + // If pl_method is empty string then method statistics will not be updates + // If pl_code is -1 then statuscode statistics will not be updated + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_updateStatistics( + in boolean pl_in := true, + in charstring pl_method := "", + in integer pl_code := -1) + runs on EPTF_HTTP_LGen_CT + { + if (pl_in) + { + if ("" != pl_method) + { + // incoming methods + select (pl_method) + { + case ("OPTIONS") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.method.options_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.method.options_k) + 1 }); + } + case ("GET") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.method.get_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.method.get_k) + 1 }); + } + case ("HEAD") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.method.head_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.method.head_k) + 1 }); + } + case ("POST") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.method.post_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.method.post_k) + 1 }); + } + case ("PUT") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.method.put_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.method.put_k) + 1 }); + } + case ("DELETE") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.method.delete_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.method.delete_k) + 1 }); + } + case ("TRACE") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.method.trace_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.method.trace_k) + 1 }); + } + case ("CONNECT") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.method.connect_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.method.connect_k) + 1 }); + } + case else + { + f_EPTF_HTTP_error(%definitionId & + ": Unhandled HTTP method: " & pl_method); + } + } + + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.requests_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.requests_k) + 1 }); + + } + + if (-1 != pl_code) + { + // incoming status codes + select (pl_code) + { + case (100) + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code100_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code100_k) + 1 }); + } + case (101) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code101_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code101_k) + 1 }); + } + case (200) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code200_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code200_k) + 1 }); + } + case (201) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code201_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code201_k) + 1 }); + } + case (202) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code202_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code202_k) + 1 }); + } + case (203) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code203_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code203_k) + 1 }); + } + case (204) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code204_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code204_k) + 1 }); + } + case (205) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code205_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code205_k) + 1 }); + } + case (206) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code206_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code206_k) + 1 }); + } + case (300) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code300_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code300_k) + 1 }); + } + case (301) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code301_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code301_k) + 1 }); + } + case (302) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code302_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code302_k) + 1 }); + } + case (303) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code303_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code303_k) + 1 }); + } + case (304) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code304_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code304_k) + 1 }); + } + case (305) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code305_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code305_k) + 1 }); + } + case (306) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code306_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code306_k) + 1 }); + } + case (307) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code307_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code307_k) + 1 }); + } + case (400) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code400_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code400_k) + 1 }); + } + case (401) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code401_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code401_k) + 1 }); + } + case (402) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code402_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code402_k) + 1 }); + } + case (403) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code403_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code403_k) + 1 }); + } + case (404) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code404_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code404_k) + 1 }); + } + case (405) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code405_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code405_k) + 1 }); + } + case (406) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code406_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code406_k) + 1 }); + } + case (407) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code407_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code407_k) + 1 }); + } + case (408) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code408_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code408_k) + 1 }); + } + case (409) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code409_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code409_k) + 1 }); + } + case (410) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code410_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code410_k) + 1 }); + } + case (411) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code411_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code411_k) + 1 }); + } + case (412) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code412_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code412_k) + 1 }); + } + case (413) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code413_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code413_k) + 1 }); + } + case (414) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code414_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code414_k) + 1 }); + } + case (415) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code415_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code415_k) + 1 }); + } + case (416) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code416_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code416_k) + 1 }); + } + case (417) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code417_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code417_k) + 1 }); + } + case (500) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code500_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code500_k) + 1 }); + } + case (501) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code501_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code501_k) + 1 }); + } + case (502) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code502_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code502_k) + 1 }); + } + case (503) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code503_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code503_k) + 1 }); + } + case (504) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code504_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code504_k) + 1 }); + } + case (505) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.status.code505_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.status.code505_k) + 1 }); + } + } + + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.incoming.responses_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.incoming.responses_k) + 1 }); + } + } + else + { + if ("" != pl_method) + { + // outgoing method + select (pl_method) + { + case ("OPTIONS") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.method.options_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.method.options_k) + 1 }); + } + case ("GET") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.method.get_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.method.get_k) + 1 }); + } + case ("HEAD") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.method.head_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.method.head_k) + 1 }); + } + case ("POST") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.method.post_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.method.post_k) + 1 }); + } + case ("PUT") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.method.put_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.method.put_k) + 1 }); + } + case ("DELETE") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.method.delete_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.method.delete_k) + 1 }); + } + case ("TRACE") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.method.trace_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.method.trace_k) + 1 }); + } + case ("CONNECT") + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.method.connect_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.method.connect_k) + 1 }); + } + case else + { + f_EPTF_HTTP_error(%definitionId & + ": Unhandled HTTP method: " & pl_method); + } + } + + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.requests_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.requests_k) + 1 }); + } + if (-1 != pl_code) + { + // outgoing status codes + select (pl_code) + { + case (100) + { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code100_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code100_k) + 1 }); + } + case (101) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code101_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code101_k) + 1 }); + } + case (200) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code200_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code200_k) + 1 }); + } + case (201) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code201_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code201_k) + 1 }); + } + case (202) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code202_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code202_k) + 1 }); + } + case (203) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code203_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code203_k) + 1 }); + } + case (204) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code204_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code204_k) + 1 }); + } + case (205) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code205_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code205_k) + 1 }); + } + case (206) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code206_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code206_k) + 1 }); + } + case (300) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code300_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code300_k) + 1 }); + } + case (301) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code301_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code301_k) + 1 }); + } + case (302) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code302_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code302_k) + 1 }); + } + case (303) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code303_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code303_k) + 1 }); + } + case (304) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code304_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code304_k) + 1 }); + } + case (305) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code305_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code305_k) + 1 }); + } + case (306) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code306_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code306_k) + 1 }); + } + case (307) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code307_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code307_k) + 1 }); + } + case (400) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code400_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code400_k) + 1 }); + } + case (401) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code401_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code401_k) + 1 }); + } + case (402) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code402_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code402_k) + 1 }); + } + case (403) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code403_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code403_k) + 1 }); + } + case (404) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code404_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code404_k) + 1 }); + } + case (405) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code405_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code405_k) + 1 }); + } + case (406) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code406_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code406_k) + 1 }); + } + case (407) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code407_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code407_k) + 1 }); + } + case (408) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code408_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code408_k) + 1 }); + } + case (409) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code409_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code409_k) + 1 }); + } + case (410) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code410_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code410_k) + 1 }); + } + case (411) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code411_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code411_k) + 1 }); + } + case (412) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code412_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code412_k) + 1 }); + } + case (413) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code413_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code413_k) + 1 }); + } + case (414) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code414_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code414_k) + 1 }); + } + case (415) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code415_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code415_k) + 1 }); + } + case (416) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code416_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code416_k) + 1 }); + } + case (417) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code417_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code417_k) + 1 }); + } + case (500) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code500_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code500_k) + 1 }); + } + case (501) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code501_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code501_k) + 1 }); + } + case (502) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code502_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code502_k) + 1 }); + } + case (503) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code503_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code503_k) + 1 }); + } + case (504) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code504_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code504_k) + 1 }); + } + case (505) { + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.status.code505_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.status.code505_k) + 1 }); + } + } + + f_EPTF_Var_adjustContent(v_EPTF_HTTP_stats.outgoing.responses_k, + { intVal := f_EPTF_Var_getIntValue(v_EPTF_HTTP_stats.outgoing.responses_k) + 1 }); + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setConnectionOpenFunction + // + // Purpose: + // Function to set open connection callback function pointer + // + // Parameters: + // plf_connectionOpen - *in* <EPTF_HTTP_connectionOpen_FT> - connection + // open callback function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setConnectionOpenFunction ( + in EPTF_HTTP_connectionOpen_FT plf_connectionOpen) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_connectionOpen := plf_connectionOpen; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setConnectionCloseFunction + // + // Purpose: + // Function to set close connection callback function pointer + // + // Parameters: + // plf_connectionClose - *in* <EPTF_HTTP_connectionClose_FT> - connection + // close callback function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setConnectionCloseFunction ( + in EPTF_HTTP_connectionClose_FT plf_connectionClose) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_connectionClose := plf_connectionClose; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setConnectionHalfCloseFunction + // + // Purpose: + // Function to set half close connection callback function pointer + // + // Parameters: + // plf_connectionHalfClose - *in* <EPTF_HTTP_connectionClose_FT> - + // connection half close callback function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setConnectionHalfCloseFunction ( + in EPTF_HTTP_connectionClose_FT plf_connectionHalfClose) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_connectionHalfClose := plf_connectionHalfClose; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setSendRequestFunction + // + // Purpose: + // Function to set send message callback function pointer + // + // Parameters: + // pl_sendRequest_fp - <EPTF_HTTP_sendRequest_FT> - sendRequest function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setSendRequestFunction( + in EPTF_HTTP_messageProcessSend_FT pl_sendRequest_fp) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_sendRequest := pl_sendRequest_fp; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setClosePortOfUserFunction + // + // Purpose: + // Function to set close port of user callback function pointer + // + // Parameters: + // plf_cpou - *in* <EPTF_HTTP_SessionOperation_FT> - close port of + // user function reference + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setClosePortOfUserFunction ( + in EPTF_HTTP_SessionOperation_FT plf_cpou) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_closePortOfUser := plf_cpou; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setFreePortOfUserFunction + // + // Purpose: + // Function to set free port of user callback function pointer + // + // Parameters: + // plf_cpou - *in* <EPTF_HTTP_SessionOperation_FT> - close port of + // user function reference + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setFreePortOfUserFunction ( + in EPTF_HTTP_SessionOperation_FT plf_fpou) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_freePortOfUser := plf_fpou; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setClosePortFunction + // + // Purpose: + // Function to set close a port callback function pointer + // + // Parameters: + // plf_close - *in* <EPTF_HTTP_PortOperation_FT> - close port function reference + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setClosePortFunction( + in EPTF_HTTP_PortOperation_FT plf_close) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_closePort := plf_close; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setSendResponseFunction + // + // Purpose: + // Sets the response sender callback function. + // + // Parameters: + // plf_sendResponse - *in* <EPTF_HTTP_sendResponse_FT> - send response function reference + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setSendResponseFunction ( + in EPTF_HTTP_sendResponse_FT plf_sendResponse) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_sendResponse := plf_sendResponse; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setListenFunction + // + // Purpose: + // Sets the listen callback function. + // + // Parameters: + // plf_listen - *in* <EPTF_HTTP_Listen_FT> - listen function reference + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setListenFunction( + in EPTF_HTTP_Listen_FT plf_listen) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_listen := plf_listen; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setSearchContextFunction + // + // Purpose: + // Sets the entity searching callback function. + // + // Parameters: + // plf_search - *in* <EPTF_HTTP_searchEntity_FT> - entity searching function reference + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setSearchContextFunction( + in EPTF_HTTP_searchContext_FT plf_search) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_searchContext := plf_search; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setSearchContextFunction4Event + // + // Purpose: + // Sets the entity searching callback function for socket events. + // + // Parameters: + // plf_search - *in* <EPTF_HTTP_searchEntity_FT> - entity searching function reference + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setSearchContextFunction4Event( + in EPTF_HTTP_searchContext_FT plf_search) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_searchContext4Event := plf_search; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setSearchContextFunction4Error + // + // Purpose: + // Sets the entity searching callback function for socket error events. + // + // Parameters: + // plf_search - *in* <EPTF_HTTP_searchEntity_FT> - entity searching function reference + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setSearchContextFunction4Error( + in EPTF_HTTP_searchContext_FT plf_search) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_searchContext4Error := plf_search; + } + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContext + // + // Purpose: + // Function to set entity context + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be set + // pl_method - *charstring* - HTTP method + // pl_uri - *charstring* - HTTP URI + // pl_version_major - *integer* - HTTP major version number + // pl_version_minor - *integer* - HTTP minor version number + // pl_headerLines - <HeaderLines> - HTTP header lines + // pl_connId - *integer* - port group index beloning to the entity + // pl_authDetails - <EPTF_HTTP_AuthDetails> - authorization details + // pl_body - *charstring* - message body + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContext ( + in integer pl_eIdx, + in charstring pl_method, + in charstring pl_uri, + in integer pl_version_major, + in integer pl_version_minor, + in HeaderLines pl_headerlines, + in integer pl_connId := -1, + in EPTF_HTTP_AuthDetails pl_authDetails := c_EPTF_HTTP_initAuthDetails, + in EPTF_HTTP_CharOrOct pl_body := { charVal := "" }) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + var integer vl_bodyIdx := -1; + var integer vl_headerLinesIdx := -1; + + if (ischosen(pl_body.charVal)) + { + vl_bodyIdx := f_EPTF_HTTP_setCharEntityBody(pl_body.charVal); + }else{ + vl_bodyIdx := f_EPTF_HTTP_setOctEntityBody(pl_body.octVal); + } + + vl_headerLinesIdx := f_EPTF_HTTP_addNewHeaderLines(pl_headerlines); + + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx] := c_EPTF_HTTP_initCtx; + + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].method := pl_method; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].uri := pl_uri; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].version_major := pl_version_major; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].version_minor := pl_version_minor; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].headerLinesIdx := vl_headerLinesIdx; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].authDetails := pl_authDetails; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].connId := pl_connId; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].bodyId := vl_bodyIdx; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].headerGetterFn := refers(f_EPTF_HTTP_getHeaderContentForEntity); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].contentGetterFn := refers(f_EPTF_HTTP_getCharstringBodyContentForEntity); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].charBodyHandlerFn := refers(f_EPTF_HTTP_defaultCharstringBodyHandler); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].binaryBodyHandlerFn := refers(f_EPTF_HTTP_defaultBinaryBodyHandler); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextServer + // + // Purpose: + // Sets the entity context of a server entity. + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be set + // pl_statusCode - *integer* - status code of the response + // pl_statusText - *charstring* - status text of the response + // pl_version_major - *integer* - HTTP major version number + // pl_version_minor - *integer* - HTTP minor version number + // pl_headerLines - <HeaderLines> - HTTP header lines + // pl_connId - *integer* - port group index beloning to the entity + // pl_body - *charstring* - message body + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextServer ( + in integer pl_eIdx, + in integer pl_statusCode, + in charstring pl_statusText, + in integer pl_version_major, + in integer pl_version_minor, + in HeaderLines pl_headerlines, + in EPTF_HTTP_CharOrOct pl_body := { charVal := "" }) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + var integer vl_bodyIdx := -1; + var integer vl_headerLinesIdx := -1; + + if (ischosen(pl_body.charVal)) + { + vl_bodyIdx := f_EPTF_HTTP_setCharEntityBody(pl_body.charVal); + }else{ + vl_bodyIdx := f_EPTF_HTTP_setOctEntityBody(pl_body.octVal); + } + + vl_headerLinesIdx := f_EPTF_HTTP_addNewHeaderLines(pl_headerlines); + + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx] := c_EPTF_HTTP_initCtx; + + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].statusCode := pl_statusCode; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].statusText := pl_statusText; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].version_major := pl_version_major; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].version_minor := pl_version_minor; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].headerLinesIdx := vl_headerLinesIdx; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].bodyId := vl_bodyIdx; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].headerGetterFn := refers(f_EPTF_HTTP_getHeaderContentForEntity); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].contentGetterFn := refers(f_EPTF_HTTP_getCharstringBodyContentForEntity); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].charBodyHandlerFn := refers(f_EPTF_HTTP_defaultCharstringBodyHandler); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].binaryBodyHandlerFn := refers(f_EPTF_HTTP_defaultBinaryBodyHandler); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setCharstringBodyHandlerFunction4Entity + // + // Purpose: + // Function to set the HTTP charstring body handler function of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_bodySender - *in* <EPTF_HTTP_charstringBodyHandler_FT> - body handler function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setCharstringBodyHandlerFunction4Entity( + in integer pl_eIdx, + in EPTF_HTTP_charstringBodyHandler_FT pl_bodySender) + runs on EPTF_HTTP_LGen_CT + { + v_EPTF_HTTP_contexts[pl_eIdx].charBodyHandlerFn := pl_bodySender; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setBinaryBodyHandlerFunction4Entity + // + // Purpose: + // Function to set the HTTP binary body handler function of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_bodySender - *in* <EPTF_HTTP_binaryBodyHandler_FT> - body handler function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setBinaryBodyHandlerFunction4Entity( + in integer pl_eIdx, + in EPTF_HTTP_binaryBodyHandler_FT pl_bodySender) + runs on EPTF_HTTP_LGen_CT + { + v_EPTF_HTTP_contexts[pl_eIdx].binaryBodyHandlerFn := pl_bodySender; + } + + ///////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextMethod + // + // Purpose: + // Function to get the HTTP Method field of the entity context of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // *charstring* - method name + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextMethod ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return charstring + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + return v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].method; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextMethod + // + // Purpose: + // Function to set the HTTP Method field of the entity context of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_method - *in* *charstring* - HTTP method name + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextMethod ( + in integer pl_eIdx, + in charstring pl_method) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].method := pl_method; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextStatusCode + // + // Purpose: + // Gets the HTTP status code field from an entity context. + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // *integer* - status code + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextStatusCode ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return integer + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + return v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].statusCode; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextStatusCode + // + // Purpose: + // Sets the HTTP status code field in an entity context. + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_statusCode - *in* *charstring* - status code + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextStatusCode ( + in integer pl_eIdx, + in integer pl_statusCode) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].statusCode := pl_statusCode; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextStatusText + // + // Purpose: + // Gets the HTTP status text field from an entity context. + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // *charstring* - status text + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextStatusText ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return charstring + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + return v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].statusText; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextStatusText + // + // Purpose: + // Sets the HTTP status text field in an entity context. + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_statusText - *in* *charstring* - status text + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextStatusText ( + in integer pl_eIdx, + in charstring pl_statusText) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].statusText := pl_statusText; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextHeaderLinesIdx + // + // Purpose: + // Sets the header line index of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_headerLinesIdx - *in* *integer* - header line index + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextHeaderLinesIdx( + in integer pl_eIdx, + in integer pl_headerLinesIdx) + runs on EPTF_HTTP_LGen_CT + { + if (0 > pl_headerLinesIdx) {return;} + + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].headerLinesIdx := pl_headerLinesIdx; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_ETPF_HTTP_setEntityContextStatusCode + // + // Purpose: + // Sets the status code of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_statusCode - *in* *integer* - status code + // + /////////////////////////////////////////////////////////////////////////////// + function f_ETPF_HTTP_setEntityContextStatusCode( + in integer pl_eIdx, + in integer pl_statusCode) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].statusCode := pl_statusCode; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_ETPF_HTTP_setEntityContextStatusText + // + // Purpose: + // Sets the status text of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_statusText - *in* *charstring* - status text + // + /////////////////////////////////////////////////////////////////////////////// + function f_ETPF_HTTP_setEntityContextStatusText( + in integer pl_eIdx, + in charstring pl_statusText) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].statusText := pl_statusText; + } + ///////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextURI + // + // Purpose: + // Function to get the HTTP URI field of the entity context of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // *charstring* - URI + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextURI ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return charstring + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + return v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].uri; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextURI + // + // Purpose: + // Function to set the HTTP URI field of the entity context of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_uri - *in* *charstring* - HTTP URI + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextURI ( + in integer pl_eIdx, + in charstring pl_uri) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].uri := pl_uri; + } + + ///////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextVersionMajor + // + // Purpose: + // Function to get the major version number of HTTP + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // *integer* - major version number + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextVersionMajor ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return integer + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + return v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].version_major; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextVersionMajor + // + // Purpose: + // Function to set the major version number of HTTP + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_version_major - *in* *integer* - major version number + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextVersionMajor ( + in integer pl_eIdx, + in integer pl_version_major) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].version_major := pl_version_major; + } + + ///////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextVersionMinor + // + // Purpose: + // Function to get the minor version number of HTTP + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // *integer* - minor version number + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextVersionMinor ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return integer + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + return v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].version_minor; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextVersionMinor + // + // Purpose: + // Function to set the minor version number of HTTP + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_version_minor - *in* *integer* - minor version number + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextVersionMinor ( + in integer pl_eIdx, + in integer pl_version_minor) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].version_minor := pl_version_minor; + } + + ///////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextMessageHeader + // + // Purpose: + // Function to get the HTTP header lines of the entity context of an entity + // + // Parameters: + // pl_ctxIdx - *in* *integer* - entity index + // + // Return Value: + // *charstring* - URI + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextMessageHeader ( + in integer pl_ctxIdx) + runs on EPTF_HTTP_LGen_CT + return HeaderLines + { + //var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + var integer vl_headerLinesIdx := v_EPTF_HTTP_contexts[pl_ctxIdx].headerLinesIdx; + + return v_EPTF_HTTP_headerLinesList[vl_headerLinesIdx]; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextAddCustomHeader + // + // Purpose: + // Function to add a custom HTTP header to the entity context of an entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_uri - *in* *charstring* - HTTP URI + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextAddCustomHeader ( + in integer pl_eIdx, + in charstring pl_field_name, + in charstring pl_field_value) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + var integer vl_headerLinesIdx := v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].headerLinesIdx; + + if(vl_headerLinesIdx < 0) { return; } + v_EPTF_HTTP_headerLinesList[vl_headerLinesIdx][sizeof(v_EPTF_HTTP_headerLinesList[vl_headerLinesIdx])] := + { pl_field_name, pl_field_value } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextConnectionId + // + // Purpose: + // Function to get entity context connection Id + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be set + // Return Value: + // *integer* - connection id + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextConnectionId ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return integer + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + return v_EPTF_HTTP_contexts[myCtx].connId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextConnectionId + // + // Purpose: + // Function to set entity context + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be set + // pl_connId - *integer* - port group index beloning to the entity + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextConnectionId ( + in integer pl_eIdx, + in integer pl_connId) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + v_EPTF_HTTP_contexts[myCtx].connId := pl_connId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextBodyId + // + // Purpose: + // Function to get entity context body Id + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be get + // Return Value: + // *integer* - body id + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextBodyId ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return integer + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + return v_EPTF_HTTP_contexts[myCtx].bodyId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextBodyId + // + // Purpose: + // Function to set entity context + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be set + // pl_bodyId - *integer* - body index beloning to the entity + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextBodyId ( + in integer pl_eIdx, + in integer pl_bodyId) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + v_EPTF_HTTP_contexts[myCtx].bodyId := pl_bodyId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextPortId + // + // Purpose: + // Function to get entity context port Id + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be get + // Return Value: + // *integer* - port id + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextPortId ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return integer + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + return v_EPTF_HTTP_contexts[myCtx].portId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextPortId + // + // Purpose: + // Function to set entity context + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be set + // pl_portId - *integer* - port index beloning to the entity + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextPortId ( + in integer pl_eIdx, + in integer pl_portId) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + v_EPTF_HTTP_contexts[myCtx].portId := pl_portId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getEntityContextSeqNum + // + // Purpose: + // Function to get entity context sequence number + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be get + // Return Value: + // *integer* - sequence number + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getEntityContextSeqNum ( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return integer + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + return v_EPTF_HTTP_contexts[myCtx].seqNum; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextSeqNum + // + // Purpose: + // Function to set entity context + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be set + // pl_connId - *integer* - sequence number beloning to the entity + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextSeqNum ( + in integer pl_eIdx, + in integer pl_seqNum) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + v_EPTF_HTTP_contexts[myCtx].seqNum := pl_seqNum; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setCharEntityBody + // + // Purpose: + // Function to set the charstring body of an entity + // + // Parameters: + // pl_connId - *integer* - port group index beloning to the entity + // + // Return Value: + // *integer* - database index + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setCharEntityBody( + in charstring pl_val) + runs on EPTF_HTTP_LGen_CT return integer + { + var integer vl_dbIdx; + + if (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_charDB, pl_val, vl_dbIdx)) + { + f_EPTF_HTTP_debug(%definitionId & + ": CHAR Body already exists at index: " & int2str(vl_dbIdx)); + } + else + { + vl_dbIdx := sizeof(v_EPTF_HTTP_charBodyDB); + + f_EPTF_str2int_HashMap_Insert(v_EPTF_HTTP_charDB, pl_val, vl_dbIdx); + v_EPTF_HTTP_charBodyDB[vl_dbIdx] := pl_val; + + f_EPTF_HTTP_debug(%definitionId & + ": CHAR Body does not exists, now added: " & int2str(vl_dbIdx)); + } + + return vl_dbIdx; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setOctEntityBody + // + // Purpose: + // Function to set the octetstring body of an entity + // + // Parameters: + // pl_connId - *integer* - port group index beloning to the entity + // + // Return Value: + // *integer* - database index + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setOctEntityBody( + in octetstring pl_val) + runs on EPTF_HTTP_LGen_CT return integer + { + var integer vl_dbIdx; + + if (f_EPTF_oct2int_HashMap_Find(v_EPTF_HTTP_octDB, pl_val, vl_dbIdx)) + { + f_EPTF_HTTP_debug(%definitionId & + ": OCT Body already exists at index: " & int2str(vl_dbIdx)); + } + else + { + vl_dbIdx := sizeof(v_EPTF_HTTP_binBodyDB); + + f_EPTF_oct2int_HashMap_Insert(v_EPTF_HTTP_octDB, pl_val, vl_dbIdx); + v_EPTF_HTTP_binBodyDB[vl_dbIdx] := pl_val; + + f_EPTF_HTTP_debug(%definitionId & + ": OCT Body does not exists, now added: " & int2str(vl_dbIdx)); + } + + return vl_dbIdx; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getHeaderContentForEntity + // + // Purpose: + // Get HTTP header content for an entity + // + // Parameters: + // pl_pars - *in* <EPTF_IntegerList> - parameter list, element #0 is the entity context index + // pl_headerLines - *inout* <HeaderLines> - header content + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getHeaderContentForEntity( + in EPTF_IntegerList pl_pars, + inout HeaderLines pl_headerLines) + runs on EPTF_HTTP_LGen_CT + { + pl_headerLines := f_EPTF_HTTP_getEntityContextMessageHeader(pl_pars[0]); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getCharstringBodyContentForEntity + // + // Purpose: + // Get HTTP body content for an entity + // + // Parameters: + // pl_pars - *in* <EPTF_IntegerList> - parameter list, element #0 is the entity context index + // pl_body - *inout* <EPTF_HTTP_CharOrOct> - charstring or binary body content + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getCharstringBodyContentForEntity( + in EPTF_IntegerList pl_pars, + inout EPTF_HTTP_CharOrOct pl_body) + runs on EPTF_HTTP_LGen_CT + { + pl_body := { charVal := v_EPTF_HTTP_charBodyDB[v_EPTF_HTTP_contexts[pl_pars[0]].bodyId] }; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getCharstringBodyContentForEntity + // + // Purpose: + // Get HTTP body content for an entity + // + // Parameters: + // pl_pars - *in* <EPTF_IntegerList> - parameter list, element #0 is the entity context index + // pl_body - *inout* <EPTF_HTTP_CharOrOct> - charstring or binary body content + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getBinaryBodyContentForEntity( + in EPTF_IntegerList pl_pars, + inout EPTF_HTTP_CharOrOct pl_body) + runs on EPTF_HTTP_LGen_CT + { + pl_body := { octVal := v_EPTF_HTTP_binBodyDB[v_EPTF_HTTP_contexts[pl_pars[0]].bodyId] }; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getBodyContentForEntity + // + // Purpose: + // Get HTTP body for an entity (entity context) + // + // Parameters: + // pl_ctxIdx - *in* *integer* - entity context + // pl_body - *inout* <EPTF_HTTP_CharOrOct> - charstring or binary body content + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getBodyContentForEntity( + in integer pl_ctxIdx, + inout EPTF_HTTP_CharOrOct pl_body) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_Base_assert( + %definitionId & ": Content getter function is null!", + v_EPTF_HTTP_contexts[pl_ctxIdx].contentGetterFn != null); + + f_EPTF_Base_assert( + %definitionId & ": Content getter function is unbound!", + isvalue(v_EPTF_HTTP_contexts[pl_ctxIdx].contentGetterFn)); + + v_EPTF_HTTP_contexts[pl_ctxIdx].contentGetterFn.apply( + {pl_ctxIdx}, pl_body) + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getHeaderForEntity + // + // Purpose: + // Get HTTP header for an entity (entity context) + // + // Parameters: + // pl_ctxIdx - *in* *integer* - entity context + // pl_headerLines - *inout* <HeaderLines> - header content + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getHeaderForEntity( + in integer pl_ctxIdx, + inout HeaderLines pl_headerLines) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_Base_assert( + %definitionId & ": Header content getter function is null!", + v_EPTF_HTTP_contexts[pl_ctxIdx].headerGetterFn != null); + + f_EPTF_Base_assert( + %definitionId & ": Header content getter function is unbound!", + isvalue(v_EPTF_HTTP_contexts[pl_ctxIdx].headerGetterFn)); + + v_EPTF_HTTP_contexts[pl_ctxIdx].headerGetterFn.apply( + {pl_ctxIdx}, pl_headerLines) + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getRawHeaderForEntity + // + // Purpose: + // Get HTTP raw header for an entity (entity context) + // + // Parameters: + // pl_ctxIdx - *in* *integer* - entity context + // pl_body - *inout* <EPTF_HTTP_CharOrOct> - charstring or binary body content + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getRawHeaderForEntity( + in integer pl_ctxIdx, + inout octetstring pl_rawHeader) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_Base_assert( + %definitionId & ": Raw header content getter function is null!", + v_EPTF_HTTP_contexts[pl_ctxIdx].rawHeaderGetterFn != null); + + f_EPTF_Base_assert( + %definitionId & ": Raw header content getter function is unbound!", + isvalue(v_EPTF_HTTP_contexts[pl_ctxIdx].rawHeaderGetterFn)); + + v_EPTF_HTTP_contexts[pl_ctxIdx].rawHeaderGetterFn.apply( + {pl_ctxIdx}, pl_rawHeader) + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setEntityContextMessageBody + // + // Purpose: + // Get HTTP body for an entity (entity context) + // + // Parameters: + // pl_eIdx - *in* *integer* - index of entity whose context + // database is to be set + // pl_body - *inout* <EPTF_HTTP_CharOrOct> - charstring or binary body content + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setEntityContextMessageBody( + in integer pl_eIdx, + inout EPTF_HTTP_CharOrOct pl_body) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + if(ischosen(pl_body.charVal)) + { + v_EPTF_HTTP_contexts[vl_myCtx].bodyId := f_EPTF_HTTP_setCharEntityBody(pl_body.charVal); + } + else + { + v_EPTF_HTTP_contexts[vl_myCtx].bodyId := f_EPTF_HTTP_setOctEntityBody(pl_body.octVal); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_reportEvent + // + // Purpose: + // Function to report an event on the initially set reporting level + // + // Parameters: + // pl_statusCode - *in* *integer* - status code of the message + // pl_eIdx - *in* *integer* - index of the entity + // pl_fsmIdx - *in* *integer* - index of the fsm of the entity + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_reportEvent( + in integer pl_statusCode, + in integer pl_eIdx, + in integer pl_fsmIdx) + runs on EPTF_HTTP_LGen_CT + { + if (vf_EPTF_HTTP_dispatchFn != null) { + vf_EPTF_HTTP_dispatchFn.apply(pl_statusCode, pl_eIdx, pl_fsmIdx); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_convertEvent + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_convertEvent( + in EPTF_LGenBase_ReportedEventDescriptor pl_eventIN, + inout EPTF_LGenBase_ReportedEventDescriptor pl_eventOUT) + { + pl_eventOUT := pl_eventIN; + + if (omit != pl_eventIN.event.target) + { + if (0 > pl_eventIN.event.target.eIdx) + { + pl_eventOUT.event.target := omit; + }else if (0 > pl_eventIN.event.target.fsmCtxIdx) + { + pl_eventOUT.event.target.fsmCtxIdx := omit; + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_dispatchEvent + // + // Purpose: + // HTTP dispatch function + // + // Parameters: + // pl_event - *in* <EPTF_LGenBase_ReportedEventDescriptor> - status code of the message + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_dispatchEvent(in EPTF_LGenBase_ReportedEventDescriptor pl_event) + runs on EPTF_HTTP_LGen_CT + { + var EPTF_LGenBase_ReportedEventDescriptor vl_local; + + f_EPTF_HTTP_convertEvent(pl_event, vl_local); + + f_EPTF_LGenBase_dispatchEvent(vl_local); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_postEvent + // + // Purpose: + // HTTP post function + // + // Parameters: + // pl_event - *in* <EPTF_LGenBase_ReportedEventDescriptor> - status code of the message + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_postEvent(in EPTF_LGenBase_ReportedEventDescriptor pl_event) + runs on EPTF_HTTP_LGen_CT + { + var EPTF_LGenBase_ReportedEventDescriptor vl_local; + + f_EPTF_HTTP_convertEvent(pl_event, vl_local); + + f_EPTF_LGenBase_postEvent(vl_local); + + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_reportClassEvent + // + // Purpose: + // Function to report an event to an entity/fsm (class reporting level) + // + // Parameters: + // pl_statusCode - *in* *integer* - status code of the message + // pl_eIdx - *in* *integer* - index of the entity + // pl_fsmIdx - *in* *integer* - index of the fsm of the entity + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_reportClassEvent( + in integer pl_statusCode, + in integer pl_eIdx, + in integer pl_fsmIdx) + runs on EPTF_HTTP_LGen_CT + { + if (pl_statusCode < 100 or pl_statusCode > 599) + { + f_EPTF_HTTP_warning(%definitionId & + ": Status code of incoming message is invalid: " & + int2str(pl_statusCode)); + + return; + } + + if (pl_statusCode < 200) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response100class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + } + else + if (pl_statusCode < 300) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response200class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + } + else + if (pl_statusCode < 400) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + } + else + if (pl_statusCode < 500) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + } + else + if (pl_statusCode < 600) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response500class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_reportDetailedEvent + // + // Purpose: + // Function to report an event to an entity/fsm (detailed reporting level) + // + // Parameters: + // pl_statusCode - *in* *integer* - status code of the message + // pl_eIdx - *in* *integer* - index of the entity + // pl_fsmIdx - *in* *integer* - index of the fsm of the entity + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_reportDetailedEvent( + in integer pl_statusCode, + in integer pl_eIdx, + in integer pl_fsmIdx) + runs on EPTF_HTTP_LGen_CT + { + // do reporting + select (pl_statusCode) + { + case (100) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response100class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response100Continue,{pl_eIdx,pl_fsmIdx}, omit},{}}); + } + case (101) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response100class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response101SwitchingProtocols,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (200) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response200class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response200OK,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (201) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response200class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response201Created,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (202) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response200class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response202Accepted,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (203) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response200class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response203NonAuthoritativeInformation,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (204) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response200class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response204NoContent,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (205) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response200class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response205ResetContent,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (206) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response200class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response206PartialContent,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (300) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300MultipleChoices,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (301) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response301MovedPermanently,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (302) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response302Found,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (303) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response303SeeOther,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (304) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response304NotModified,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (305) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response305UseProxy,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (306) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response306Unused,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (307) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response300class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response307TemporaryRedirect,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (400) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400BadRequest,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (401) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response401Unauthorized,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (402) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response402PaymentRequired,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (403) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response403Forbidden,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (404) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response404NotFound,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (405) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response405MethodNotAllowed,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (406) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response406NotAcceptable,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (407) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response407ProxyAuthenticationRequired,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (408) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response408RequestTimeout,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (409) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response409Conflict,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (410) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response410Gone,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (411) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response411LengthRequired,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (412) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response412PreconditionFailed,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (413) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response413RequestEntityTooLarge,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (414) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response414RequestURITooLong,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (415) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response415UnsupportedMediaType,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (416) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response416RequestedRangeNotSatisfiable,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (417) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response400class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response417ExpectationFailed,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (500) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response500class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response500InternalServerError,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (501) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response500class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response501NotImplemented,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (502) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response500class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response502BadGateway,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (503) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response500class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response503ServiceUnavailable,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (504) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response500class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response504GatewayTimeout,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + case (505) { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response500class,{pl_eIdx,pl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_response505HTTPVersionNotSupported,{pl_eIdx,pl_fsmIdx}, omit},{}}) ; + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_messageReceived + // + // Purpose: + // Function to handle received message + // + // Parameters: + // pl_message - *in* <EPTF_HTTP_IncomingMessage> - incoming message from the transport layer + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_messageReceived( + in EPTF_HTTP_IncomingMessage pl_message) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug(%definitionId & ": Message received!"); + + f_EPTF_HTTP_debug(%definitionId & ": Session id and entity offset: " & + int2str(pl_message.sessionId) & " / " & int2str(v_EPTF_HTTP_EntityOffset)); + + var integer vl_fsmIdx, vl_eIdx := pl_message.sessionId - v_EPTF_HTTP_EntityOffset; + + if (vl_eIdx < 0) { + f_EPTF_HTTP_warning(%definitionId & + ": Entity cannot be determined to message on session: " & + int2str(pl_message.sessionId)) + + return; + }; + + f_EPTF_Base_assert(%definitionId & ": Invalid entity index (" & + int2str(vl_eIdx) & + ") applied to connId -> fsm index database!", + isvalue(v_EPTF_HTTP_ConnId2FIdx[vl_eIdx])); + + vl_fsmIdx := v_EPTF_HTTP_ConnId2FIdx[vl_eIdx]; + //v_EPTF_HTTP_ConnId2FIdx[vl_fsmIdx] := -1; + + f_EPTF_HTTP_debug(%definitionId & ": Fsm index: " & + int2str(vl_fsmIdx) & " acquired for entity id: " & + int2str(vl_eIdx)); + + v_intNoWarningLG := dec_HTTPMessage(pl_message.httpMessage, v_EPTF_HTTP_incomingMessage); + + if (vf_EPTF_HTTP_messageReceivedHook != null) { + vf_EPTF_HTTP_messageReceivedHook.apply(vl_eIdx, v_EPTF_HTTP_incomingMessage); + } + + + if (ischosen(v_EPTF_HTTP_incomingMessage.request)) + { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_requestCharReceived, {vl_eIdx,vl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_updateStatistics(true, + v_EPTF_HTTP_incomingMessage.request.method, -1); + + var integer myctx := f_EPTF_HTTP_getContextIndex(vl_eIdx); + v_EPTF_HTTP_contexts[myctx].charBodyHandlerFn.apply( vl_eIdx, v_EPTF_HTTP_incomingMessage.request.body); + } + else + if (ischosen(v_EPTF_HTTP_incomingMessage.request_binary)) + { + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_requestOctReceived, {vl_eIdx,vl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_updateStatistics(true, + v_EPTF_HTTP_incomingMessage.request_binary.method, -1); + + var integer myctx := f_EPTF_HTTP_getContextIndex(vl_eIdx); + v_EPTF_HTTP_contexts[myctx].binaryBodyHandlerFn.apply( vl_eIdx, v_EPTF_HTTP_incomingMessage.request_binary.body); + } + else + if (ischosen(v_EPTF_HTTP_incomingMessage.response)) + { + var integer myctx := f_EPTF_HTTP_getContextIndex(vl_eIdx); + + // do automatic adminsitration + if (v_EPTF_HTTP_contexts[myctx].requestPending) + { + v_EPTF_HTTP_contexts[myctx].requestPending := false; // request is not pending after answer + + f_EPTF_HTTP_createAuthorizationDataFromMessage(myctx); // store auth data into entity context + } + + if( v_EPTF_HTTP_contexts[myctx].uri != "") + { + v_EPTF_HTTP_contexts[myctx].etag:=""; + var integer vl_size := sizeof(v_EPTF_HTTP_incomingMessage.response.header); + for(var integer vl_i := 0; vl_i < vl_size; vl_i := vl_i + 1) + { + if(v_EPTF_HTTP_incomingMessage.response.header[vl_i].header_name == "ETag") + { + var charstring vl_etag := v_EPTF_HTTP_incomingMessage.response.header[vl_i].header_value; + var integer vl_length := lengthof(vl_etag); + if(vl_etag[0] == "\"" and vl_etag[vl_length-1] == "\"") + { + vl_etag := substr(vl_etag,1,vl_length-2); + } + v_EPTF_HTTP_contexts[myctx].etag := vl_etag; + break; + } + } + } + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_responseCharReceived,{vl_eIdx,vl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_reportEvent( + v_EPTF_HTTP_incomingMessage.response.statuscode, + vl_eIdx, vl_fsmIdx) + + f_EPTF_HTTP_updateStatistics(true, "", + v_EPTF_HTTP_incomingMessage.response.statuscode); + + v_EPTF_HTTP_contexts[myctx].charBodyHandlerFn.apply( vl_eIdx,v_EPTF_HTTP_incomingMessage.response.body); + } + else if (ischosen(v_EPTF_HTTP_incomingMessage.response_binary)) + { + var integer myctx := f_EPTF_HTTP_getContextIndex(vl_eIdx); + + // do automatic adminsitration + if (v_EPTF_HTTP_contexts[myctx].requestPending) + { + v_EPTF_HTTP_contexts[myctx].requestPending := false; // request is not pending after answer + + f_EPTF_HTTP_createAuthorizationDataFromMessage(myctx); // store auth data into entity context + } + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + c_EPTF_HTTP_inputIdx_responseOctReceived,{vl_eIdx,vl_fsmIdx}, omit},{}}); + + f_EPTF_HTTP_reportEvent( + v_EPTF_HTTP_incomingMessage.response_binary.statuscode, + vl_eIdx, vl_fsmIdx) + + f_EPTF_HTTP_updateStatistics(true, "", + v_EPTF_HTTP_incomingMessage.response_binary.statuscode); + + v_EPTF_HTTP_contexts[myctx].binaryBodyHandlerFn.apply( vl_eIdx, v_EPTF_HTTP_incomingMessage.response_binary.body); + } + else // not response + { + f_EPTF_HTTP_debug(%definitionId & ": Unhandled message type received: " & + log2str(v_EPTF_HTTP_incomingMessage)); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_eventReceived + // + // Purpose: + // Function to handle received events + // + // Parameters: + // pl_sessionId - *integer* - session id of received event + // pl_type - *integer* - event type + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_eventReceived( + in EPTF_HTTP_Event pl_event) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug(%definitionId & ": Event received!"); + + f_EPTF_HTTP_debug(%definitionId & ": Session id and entity offset: " & + int2str(pl_event.sessionId) & " / " & int2str(v_EPTF_HTTP_EntityOffset)); + + var integer vl_fsmIdx, vl_eIdx := pl_event.sessionId - v_EPTF_HTTP_EntityOffset; + + if (vl_eIdx < 0) { + f_EPTF_HTTP_debug(%definitionId & + ": Entity cannot be determined to event: " & + int2str(pl_event.eventType) & " on session: " & + int2str(pl_event.sessionId) & ", dispatching generic event"); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + pl_event.eventType, omit, omit},{}}) ; + + return; + }; + + f_EPTF_Base_assert(%definitionId & ": Invalid connection id (" & + int2str(vl_eIdx) & + ") applied to connId -> fsm index database!", + isvalue(v_EPTF_HTTP_ConnId2FIdx[vl_eIdx])); + + vl_fsmIdx := v_EPTF_HTTP_ConnId2FIdx[vl_eIdx]; + + //v_EPTF_HTTP_ConnId2FIdx[vl_eIdx] := -1; + + f_EPTF_HTTP_debug(%definitionId & ": Fsm index: " & + int2str(vl_fsmIdx) & " acquired for entity id: " & + int2str(vl_eIdx)); + + f_EPTF_HTTP_dispatchEvent({{v_EPTF_HTTP_myBIdx, + pl_event.eventType,{vl_eIdx,vl_fsmIdx}, omit},{}}) ; + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_socketErrorReceived + // + // Purpose: + // Function to handle received socket errors + // + // Parameters: + // pl_error - *in* <EPTF_HTTP_EventError> - error received from the transport layer + // + // Detailed Comments: + // This function handles received socket error messages and events and sends a socketError event + // with LGenbase postEvent method. This is a private function. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_socketErrorReceived( + in EPTF_HTTP_EventError pl_error) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug(%definitionId & ": Socket Error received!"); + if(ispresent(pl_error.transportError.errorCode)) { + f_EPTF_HTTP_debug(%definitionId & ": Socket Error result: " & log2str(pl_error.transportError)); + + f_EPTF_HTTP_debug(%definitionId & ": Session id and entity offset: " & + int2str(pl_error.sessionId) & " / " & int2str(v_EPTF_HTTP_EntityOffset)); + + var EPTF_IntegerList vl_reportedArgs := { enum2int(pl_error.transportError.errorCode), -1 }; + if(ispresent(pl_error.transportError.os_error_code)) { vl_reportedArgs[1] := pl_error.transportError.os_error_code; } + + var integer vl_fsmIdx, vl_eIdx := pl_error.sessionId - v_EPTF_HTTP_EntityOffset; + + if (vl_eIdx < 0) { + //if connection opened with f_EPTF_HTTP_LocalTransport_newPortGroup() with no instant connection open sessionId cannot be determined + f_EPTF_HTTP_debug(%definitionId & + ": Entity cannot be determined to socket Error on session: " & + int2str(pl_error.sessionId)); + + f_EPTF_HTTP_postEvent({{v_EPTF_HTTP_myBIdx,c_EPTF_HTTP_inputIdx_responseSocketError, + omit,omit},vl_reportedArgs}); + + return; + }; + + f_EPTF_Base_assert(%definitionId & ": Invalid connection id (" & + int2str(vl_eIdx) & + ") applied to connId -> fsm index database!", + isvalue(v_EPTF_HTTP_ConnId2FIdx[vl_eIdx])); + + vl_fsmIdx := v_EPTF_HTTP_ConnId2FIdx[vl_eIdx]; + + f_EPTF_HTTP_debug(%definitionId & ": Fsm index: " & + int2str(vl_fsmIdx) & " acquired for entity id: " & + int2str(vl_eIdx)); + + // generating postEvent for socket error + f_EPTF_HTTP_postEvent({{v_EPTF_HTTP_myBIdx,c_EPTF_HTTP_inputIdx_responseSocketError, + {vl_eIdx,vl_fsmIdx},omit},vl_reportedArgs}); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_messageReceivedServer + // + // Purpose: + // Function to handle received message in a server + // + // Parameters: + // pl_message - *in* <EPTF_HTTP_IncomingMessage> - incoming message from the transport layer + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_messageReceivedServer( + in EPTF_HTTP_IncomingMessage pl_message) + runs on EPTF_HTTP_LGen_CT + { + v_intNoWarningLG := dec_HTTPMessage(pl_message.httpMessage, v_EPTF_HTTP_incomingMessage); + + v_EPTF_HTTP_lastReceivedGroupId := pl_message.groupId; + v_EPTF_HTTP_lastReceivedPortId := pl_message.sessionId; + v_EPTF_HTTP_lastReceivedSeqNum := pl_message.seqNum; + + f_EPTF_HTTP_debug(%definitionId & ": Message received!"); + + var integer vl_eIdx := -1; + var integer vl_fsmCtx := -1; + var integer vl_eventIdx := -1; + + if (null != vf_EPTF_HTTP_searchContext) + { + vf_EPTF_HTTP_searchContext.apply(vl_eIdx, vl_fsmCtx); + } + + if (ischosen(v_EPTF_HTTP_incomingMessage.request)) + { + vl_eventIdx := c_EPTF_HTTP_inputIdx_requestCharReceived; + + f_EPTF_HTTP_updateStatistics(true, + v_EPTF_HTTP_incomingMessage.request.method, -1); + } + else + if (ischosen(v_EPTF_HTTP_incomingMessage.request_binary)) + { + vl_eventIdx := c_EPTF_HTTP_inputIdx_requestOctReceived; + + f_EPTF_HTTP_updateStatistics(true, + v_EPTF_HTTP_incomingMessage.request_binary.method, -1); + } + else // not response + { + f_EPTF_HTTP_warning(%definitionId & ": Unhandled message type received: " & + log2str(v_EPTF_HTTP_incomingMessage)); + return; + } + + f_EPTF_HTTP_dispatchEvent( {{v_EPTF_HTTP_myBIdx, vl_eventIdx, + {vl_eIdx,vl_fsmCtx}, omit},{}}); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_eventReceivedServer + // + // Purpose: + // Function to handle received events in a server + // + // Parameters: + // pl_sessionId - *in* <EPTF_HTTP_Event> - event received from the transport layer + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_eventReceivedServer( + in EPTF_HTTP_Event pl_event) + runs on EPTF_HTTP_LGen_CT + { + v_EPTF_HTTP_event := pl_event; + + var integer vl_eIdx := -1; + var integer vl_fsmCtx := -1; + + if (null != vf_EPTF_HTTP_searchContext4Event) + { + vf_EPTF_HTTP_searchContext4Event.apply(vl_eIdx, vl_fsmCtx); + } + + f_EPTF_HTTP_dispatchEvent( {{v_EPTF_HTTP_myBIdx, pl_event.eventType, + {vl_eIdx,vl_fsmCtx}, omit},{}}); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_socketErrorReceivedServer + // + // Purpose: + // Function to handle received socket errors + // + // Parameters: + // pl_error - *in* <EPTF_HTTP_EventError> - error received from the transport layer + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_socketErrorReceivedServer( + in EPTF_HTTP_EventError pl_error) + runs on EPTF_HTTP_LGen_CT + { + v_EPTF_HTTP_error := pl_error; + + var integer vl_eIdx := -1; + var integer vl_fsmCtx := -1; + + if (null != vf_EPTF_HTTP_searchContext4Error) + { + vf_EPTF_HTTP_searchContext4Error.apply(vl_eIdx, vl_fsmCtx); + } + + var EPTF_IntegerList vl_reportedArgs := { -1, -1 }; + if(ispresent(pl_error.transportError.errorCode)) { vl_reportedArgs[0] := enum2int(pl_error.transportError.errorCode); } + if(ispresent(pl_error.transportError.os_error_code)) { vl_reportedArgs[1] := pl_error.transportError.os_error_code; } + + f_EPTF_HTTP_postEvent( {{v_EPTF_HTTP_myBIdx, c_EPTF_HTTP_inputIdx_responseSocketError, + {vl_eIdx,vl_fsmCtx}, omit},vl_reportedArgs} ); + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_sendRequest + // + // Purpose: + // Function to send HTTP message + // + // Parameters: + // pl_connId - *integer* - port group index on which the message is + // intended to be sent + // pl_sessionId - *integer* - session id + // pl_message - *octetstring* - message to send + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_sendRequest( + in integer pl_connId, + in integer pl_sessionId, + in octetstring pl_message) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_sendRequest.apply(pl_connId, pl_sessionId, pl_message); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_closeConnection + // + // Purpose: + // Function to close connection + // + // Parameters: + // pl_connId - *integer* - port group index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Closes all open conection in a port group + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_closeConnection( + in integer pl_connId) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_connectionClose.apply(pl_connId); + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_closeHalfConnection + // + // Purpose: + // Function to half close connection + // + // Parameters: + // pl_connId - *integer* - port group index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Half closes all open connections in a port group + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_closeHalfConnection( + in integer pl_connId) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_connectionHalfClose.apply(pl_connId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_openConnection + // + // Purpose: + // Function to open connection + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Open all idle connections in a port group + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_openConnection( + in integer pl_connId, + in integer pl_sessionId) + runs on EPTF_HTTP_LGen_CT return boolean + { + return vf_EPTF_HTTP_connectionOpen.apply(pl_connId, pl_sessionId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_closePortOfUser + // + // Purpose: + // Function to close port of user + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_closePortOfUser( + in integer pl_groupId, + in integer pl_sessionId) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_closePortOfUser.apply(pl_groupId, pl_sessionId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_freePortOfUser + // + // Purpose: + // Function to free port of user + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_freePortOfUser( + in integer pl_groupId, + in integer pl_sessionId) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_freePortOfUser.apply(pl_groupId, pl_sessionId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_sendResponse + // + // Purpose: + // Sends the response. + // + // Parameters: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_sendResponse( + in integer pl_groupId, + in integer pl_portId, + in integer pl_seqNum, + in octetstring pl_message) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_sendResponse.apply(pl_groupId, pl_portId, pl_seqNum, pl_message); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_listen + // + // Purpose: + // Opens a listen port + // + // Parameters: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_listen( + in integer pl_groupId) + runs on EPTF_HTTP_LGen_CT + return integer + { + return vf_EPTF_HTTP_listen.apply(pl_groupId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_closePort + // + // Purpose: + // Closes a port in a server port group. + // + // Parameters: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_closePort( + in integer pl_groupId, + in integer pl_portId + ) + runs on EPTF_HTTP_LGen_CT + { + vf_EPTF_HTTP_closePort.apply(pl_groupId, pl_portId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setAuthData + // + // Purpose: + // Sets the authentication data for the server. + // + // Parameters: + // pl_authData - *in* <EPTF_HTTP_setAuthData> - authentication data + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setAuthData(in EPTF_HTTP_setAuthData pl_authData) + runs on EPTF_HTTP_LGen_CT + { + v_EPTF_HTTP_authData.method := pl_authData.method; + v_EPTF_HTTP_authData.algorithm := pl_authData.algorithm; + v_EPTF_HTTP_authData.realm := pl_authData.realm; + v_EPTF_HTTP_authData.domain := pl_authData.domain; + v_EPTF_HTTP_authData.qopOptions := pl_authData.qopOptions; + v_EPTF_HTTP_authData.password := pl_authData.password; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_genAuthResponse + // + // Purpose: + // Generates authentication response data. + // + // Parameters: + // pl_authResp - *inout* *charstring* - authentication data + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_genAuthResponse(inout charstring pl_authResp) + runs on EPTF_HTTP_LGen_CT + { + var charstring vl_nonce := f_EPTF_HTTP_getNonceValue(v_EPTF_HTTP_authData); + + pl_authResp := v_EPTF_HTTP_authData.method & + " realm=\"" & v_EPTF_HTTP_authData.realm & "\"" & + ",nonce=\"" & vl_nonce & "\"" & + ",algorithm=" & v_EPTF_HTTP_authData.algorithm & + ",qop=\"" & v_EPTF_HTTP_authData.qopOptions &"\""; + + if (ispresent(v_EPTF_HTTP_authData.domain)) + { + pl_authResp := pl_authResp & ",domain=\"" & v_EPTF_HTTP_authData.domain & "\""; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_checkAuthData + // + // Purpose: + // Checks authorization data. + // + // Parameters: + // pl_method - *in* *charstring* - HTTP request method + // pl_authData - *in* *charstring* - the Authorization header value + // pl_entityBody - *in* *charstring* - the entity body + // + // Return value: + // boolean - check result + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_checkAuthData(in charstring pl_httpMethod, in charstring pl_authData, in charstring pl_entityBody) + runs on EPTF_HTTP_LGen_CT + return boolean + { + var EPTF_HTTP_AuthDetails vl_authDetails := c_EPTF_HTTP_initAuthDetails; + + f_EPTF_HTTP_getAuthParams(pl_authData, vl_authDetails); + + f_EPTF_HTTP_debug(log2str(%definitionId, ": Authentication details: ", vl_authDetails)); + + var charstring vl_response := f_calculateDigestResponse( + vl_authDetails.nonce, + vl_authDetails.cnonce, + vl_authDetails.username, + vl_authDetails.realm, + v_EPTF_HTTP_authData.password, + vl_authDetails.algorithm, + vl_authDetails.nonceCount, + pl_httpMethod, + vl_authDetails.qop, + vl_authDetails.uri, + f_calculateMD5(pl_entityBody)); + + return vl_response == vl_authDetails.response; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_addNewHeaderLines + // + // Purpose: + // Add header lines to the header lines database + // + // Parameters: + // pl_headerLines - *in* <HeaderLines> - header lines to add + // + // Return Value: + // *integer* - index of HTTP header lines database where new data is + // found or inserted + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_addNewHeaderLines ( + in HeaderLines pl_headerLines) + runs on EPTF_HTTP_LGen_CT + return integer + { + + var integer pl_headerLinesIdx := f_EPTF_HTTP_existHeaderLines(pl_headerLines); + + if (pl_headerLinesIdx > -1) { + + return pl_headerLinesIdx; + } + else { + var integer pl_size := sizeof(v_EPTF_HTTP_headerLinesList); + + v_EPTF_HTTP_headerLinesList[pl_size] := pl_headerLines; + + return pl_size; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setHeaderValue + // + // Purpose: + // Sets a header value for an element in the HeaderLines list. + // + // Parameters: + // pl_headerLinesIdx - *in* *integer* - header line index + // pl_headerName - *in* *charstring* - header name + // pl_headerValue - *in* *charstring* - header value + // + // Detailed comments: + // If the header does not exist, the value is NOT added. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setHeaderValue( + in integer pl_headerLinesIdx, + in charstring pl_headerName, + in charstring pl_headerValue) + runs on EPTF_HTTP_LGen_CT + { + for (var integer i := 0; i < sizeof(v_EPTF_HTTP_headerLinesList[pl_headerLinesIdx]); i := i + 1) + { + if (pl_headerName == v_EPTF_HTTP_headerLinesList[pl_headerLinesIdx][i].header_name) + { + v_EPTF_HTTP_headerLinesList[pl_headerLinesIdx][i].header_value := pl_headerValue; + break; + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setCharBody + // + // Purpose: + // Sets the charstring body of an entity. All of the entities referencing this + /// charstring body entry will be affected. + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_body - *in* *charstring* - body value + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setCharBody( + in integer pl_eIdx, + in charstring pl_body + ) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_ctx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + var integer vl_bodyId := v_EPTF_HTTP_contexts[vl_ctx].bodyId; + + v_EPTF_HTTP_charBodyDB[vl_bodyId] := pl_body; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_createContextLengthHeaderLine + // + // Purpose: + // Create header lines containing only content length header line + // + // Parameters: + // pl_body - *in* *charstring* - message body + // + // Return Value: + // <HeaderLines> - created header lines + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_createContextLengthHeaderLine( + in charstring pl_body) + runs on EPTF_HTTP_LGen_CT + return HeaderLines + { + var HeaderLines vl_hl; + + vl_hl := { { "Content-Length", int2str(lengthof(pl_body)) } }; + + return vl_hl; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_addOptTempParamNumber + // + // Purpose: + // Sets the variable that holds the user added optional template parameters. + // + // Parameters: + // pl_number - *in* *integer* - the number of the optional template parameters + // + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_addOptTempParamNumber(in integer pl_number) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_sizeof := sizeof(v_EPTF_HTTP_optionalTempParams) + for (var integer i := vl_sizeof; i < pl_number; i := i + 1) + { + v_EPTF_HTTP_optionalTempParams[i] := ""; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setOptTempParam + // + // Purpose: + // Sets the user added optional template parameter value + // + // Parameters: + // pl_idx - *in* *integer* - the index of the optional template parameter + // pl_paramValue - *in* *charstring* - parameter value + // + // Detailed Comments: + // The index must be the same as the index of the parameter + // when calling f_EPTF_LGenBase_extendTemplateType. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setOptTempParam(in integer pl_idx, in charstring pl_paramValue) + runs on EPTF_HTTP_LGen_CT + { + if (pl_idx >= sizeof(v_EPTF_HTTP_optionalTempParams) or 0 > pl_idx) + { + f_EPTF_HTTP_warning(%definitionId & + ": Setting invalid template parameter: " & int2str(pl_idx)); + return; + } + + v_EPTF_HTTP_optionalTempParams[pl_idx] := pl_paramValue; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_cleanupContext + // + // Purpose: + // Cleans up entity context. All the value set by f_EPTF_HTTP_setEntityContextServer + // or f_EPTF_HTTP_setEntityContext remains unchanged. + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_cleanupContext(in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].requestPending := c_EPTF_HTTP_initCtx.requestPending; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].portId := c_EPTF_HTTP_initCtx.portId; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].httpMessage := omit;//c_EPTF_HTTP_initCtx.httpMessage; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].seqNum := c_EPTF_HTTP_initCtx.seqNum; + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx].connId := c_EPTF_HTTP_initCtx.connId; + + v_EPTF_HTTP_ConnId2FIdx[pl_eIdx] := -1; + } +} //EPTF_HTTP_PublicFunctions + + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_PrivateFunctions +// +// Purpose: +// The functions of the EPTF HTTP Private Functions +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_PrivateFunctions { + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_cleanup_CT + // + // Purpose: + // The HTTP HTTP cleanup function + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + private function f_EPTF_HTTP_cleanup_CT() + runs on EPTF_HTTP_LGen_CT + { + if (not v_EPTF_HTTP_initialized) + { + return; + } + v_EPTF_HTTP_initialized := false; + + f_EPTF_str2int_HashMap_Delete(c_EPTF_HTTP_HashMap_charDatabase); + f_EPTF_oct2int_HashMap_Delete(c_EPTF_HTTP_HashMap_octDatabase); + + v_EPTF_HTTP_charDB := -1; + v_EPTF_HTTP_octDB := -1; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_declareStepsAndEvent + // + // Purpose: + // Function to declare the steps and events + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_declareStepsAndEvent( ) + runs on EPTF_HTTP_LGen_CT + { + + if( //steps + c_EPTF_HTTP_stepIdx_sendRequest != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_sendRequest,refers(f_EPTF_HTTP_step_sendRequest)}) + or c_EPTF_HTTP_stepIdx_handleTimeout != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_handleTimeout,refers(f_EPTF_HTTP_step_handleTimeout)}) + or c_EPTF_HTTP_stepIdx_responseReceived != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_responseReceived,refers(f_EPTF_HTTP_step_processResponse)}) + or c_EPTF_HTTP_stepIdx_openConnection != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_openConnection,refers(f_EPTF_HTTP_step_sendConnect)}) + or c_EPTF_HTTP_stepIdx_closeConnection != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_closeConnection,refers(f_EPTF_HTTP_step_sendClose)}) + or c_EPTF_HTTP_stepIdx_halfCloseConnection != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_halfCloseConnection,refers(f_EPTF_HTTP_step_sendHalfClose)}) + or c_EPTF_HTTP_stepIdx_closePortOfUser != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_closePortOfUser,refers(f_EPTF_HTTP_step_closePortOfUser)}) + or c_EPTF_HTTP_stepIdx_freePortOfUser != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_freePortOfUser,refers(f_EPTF_HTTP_step_freePortOfUser)}) + or c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodCONNECT != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_setEntityContextHTTPMethodCONNECT,refers(f_EPTF_HTTP_step_setEntityContextHTTPMethodCONNECT)}) + or c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodDELETE != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_setEntityContextHTTPMethodDELETE,refers(f_EPTF_HTTP_step_setEntityContextHTTPMethodDELETE)}) + or c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodGET != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_setEntityContextHTTPMethodGET,refers(f_EPTF_HTTP_step_setEntityContextHTTPMethodGET)}) + or c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodHEAD != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_setEntityContextHTTPMethodHEAD,refers(f_EPTF_HTTP_step_setEntityContextHTTPMethodHEAD)}) + or c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodOPTIONS != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_setEntityContextHTTPMethodOPTIONS,refers(f_EPTF_HTTP_step_setEntityContextHTTPMethodOPTIONS)}) + or c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodPOST != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_setEntityContextHTTPMethodPOST,refers(f_EPTF_HTTP_step_setEntityContextHTTPMethodPOST)}) + or c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodPUT != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_setEntityContextHTTPMethodPUT,refers(f_EPTF_HTTP_step_setEntityContextHTTPMethodPUT)}) + or c_EPTF_HTTP_stepIdx_setEntityContextHTTPMethodTRACE != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_setEntityContextHTTPMethodTRACE,refers(f_EPTF_HTTP_step_setEntityContextHTTPMethodTRACE)}) + or c_EPTF_HTTP_stepIdx_handleRequest != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName,{c_EPTF_HTTP_stepName_handleRequest,refers(f_EPTF_HTTP_step_handleRequest)}) + or c_EPTF_HTTP_stepIdx_sendResponse != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName,{c_EPTF_HTTP_stepName_sendResponse,refers(f_EPTF_HTTP_step_sendResponse)}) + or c_EPTF_HTTP_stepIdx_closePort != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_closePort, refers(f_EPTF_HTTP_step_closePort)}) + or c_EPTF_HTTP_stepIdx_cleanUpContext != f_EPTF_LGenBase_declareStep(c_EPTF_HTTP_myBName, {c_EPTF_HTTP_stepName_cleanUpContext, refers(f_EPTF_HTTP_step_cleanUp)}) + + //inputs + or c_EPTF_HTTP_inputIdx_response100Continue != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response100Continue) + or c_EPTF_HTTP_inputIdx_response101SwitchingProtocols != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response101SwitchingProtocols) + or c_EPTF_HTTP_inputIdx_response200OK != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response200OK) + or c_EPTF_HTTP_inputIdx_response201Created != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response201Created) + or c_EPTF_HTTP_inputIdx_response202Accepted != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response202Accepted) + or c_EPTF_HTTP_inputIdx_response203NonAuthoritativeInformation != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response203NonAuthoritativeInformation) + or c_EPTF_HTTP_inputIdx_response204NoContent != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response204NoContent) + or c_EPTF_HTTP_inputIdx_response205ResetContent != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response205ResetContent) + or c_EPTF_HTTP_inputIdx_response206PartialContent != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response206PartialContent) + or c_EPTF_HTTP_inputIdx_response300MultipleChoices != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response300MultipleChoices) + or c_EPTF_HTTP_inputIdx_response301MovedPermanently != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response301MovedPermanently) + or c_EPTF_HTTP_inputIdx_response302Found != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response302Found) + or c_EPTF_HTTP_inputIdx_response303SeeOther != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response303SeeOther) + or c_EPTF_HTTP_inputIdx_response304NotModified != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response304NotModified) + or c_EPTF_HTTP_inputIdx_response305UseProxy != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response305UseProxy) + or c_EPTF_HTTP_inputIdx_response306Unused != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response306Unused) + or c_EPTF_HTTP_inputIdx_response307TemporaryRedirect != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response307TemporaryRedirect) + or c_EPTF_HTTP_inputIdx_response400BadRequest != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response400BadRequest) + or c_EPTF_HTTP_inputIdx_response401Unauthorized != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response401Unauthorized) + or c_EPTF_HTTP_inputIdx_response402PaymentRequired != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response402PaymentRequired) + or c_EPTF_HTTP_inputIdx_response403Forbidden != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response403Forbidden) + or c_EPTF_HTTP_inputIdx_response404NotFound != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response404NotFound) + or c_EPTF_HTTP_inputIdx_response405MethodNotAllowed != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response405MethodNotAllowed) + or c_EPTF_HTTP_inputIdx_response406NotAcceptable != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response406NotAcceptable) + or c_EPTF_HTTP_inputIdx_response407ProxyAuthenticationRequired != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response407ProxyAuthenticationRequired) + or c_EPTF_HTTP_inputIdx_response408RequestTimeout != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response408RequestTimeout) + or c_EPTF_HTTP_inputIdx_response409Conflict != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response409Conflict) + or c_EPTF_HTTP_inputIdx_response410Gone != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response410Gone) + or c_EPTF_HTTP_inputIdx_response411LengthRequired != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response411LengthRequired) + or c_EPTF_HTTP_inputIdx_response412PreconditionFailed != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response412PreconditionFailed) + or c_EPTF_HTTP_inputIdx_response413RequestEntityTooLarge != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response413RequestEntityTooLarge) + or c_EPTF_HTTP_inputIdx_response414RequestURITooLong != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response414RequestURITooLong) + or c_EPTF_HTTP_inputIdx_response415UnsupportedMediaType != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response415UnsupportedMediaType) + or c_EPTF_HTTP_inputIdx_response416RequestedRangeNotSatisfiable != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response416RequestedRangeNotSatisfiable) + or c_EPTF_HTTP_inputIdx_response417ExpectationFailed != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response417ExpectationFailed) + or c_EPTF_HTTP_inputIdx_response500InternalServerError != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response500InternalServerError) + or c_EPTF_HTTP_inputIdx_response501NotImplemented != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response501NotImplemented) + or c_EPTF_HTTP_inputIdx_response502BadGateway != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response502BadGateway) + or c_EPTF_HTTP_inputIdx_response503ServiceUnavailable != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response503ServiceUnavailable) + or c_EPTF_HTTP_inputIdx_response504GatewayTimeout != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response504GatewayTimeout) + or c_EPTF_HTTP_inputIdx_response505HTTPVersionNotSupported != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response505HTTPVersionNotSupported) + or c_EPTF_HTTP_inputIdx_response100class != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response100class) + or c_EPTF_HTTP_inputIdx_response200class != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response200class) + or c_EPTF_HTTP_inputIdx_response300class != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response300class) + or c_EPTF_HTTP_inputIdx_response400class != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response400class) + or c_EPTF_HTTP_inputIdx_response500class != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_response500class) + or c_EPTF_HTTP_inputIdx_connectionOpened != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_connectionOpened) + or c_EPTF_HTTP_inputIdx_connectionClosed != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_connectionClosed) + or c_EPTF_HTTP_inputIdx_errorReceived != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_errorReceived) + or c_EPTF_HTTP_inputIdx_OKReceived != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_OKReceived) + or c_EPTF_HTTP_inputIdx_responseCharReceived != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_responseCharReceived) + or c_EPTF_HTTP_inputIdx_requestCharReceived != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_requestCharReceived) + or c_EPTF_HTTP_inputIdx_responseOctReceived != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_responseOctReceived) + or c_EPTF_HTTP_inputIdx_requestOctReceived != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_requestOctReceived) + or c_EPTF_HTTP_inputIdx_responseSocketError != f_EPTF_LGenBase_declareFsmEvent(c_EPTF_HTTP_myBName,c_EPTF_HTTP_inputName_responseSocketError) + ) + { + f_EPTF_HTTP_error(%definitionId&": error"); + mtc.stop; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_bindEntity4Behavior + // + // Purpose: + // Function to bind entity for the behaviour + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // <EPTF_IntegerList> - behaviour integer list + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_bindEntity4Behavior( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + return EPTF_IntegerList + { + var integer vl_EPTF_HTTP_index := sizeof(v_EPTF_HTTP_contexts); + + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_index] := c_EPTF_HTTP_initCtx; + + return {vl_EPTF_HTTP_index}; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setContentGetterFunction4Entity + // + // Purpose: + // Function to set content getter function to the entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_contentGetter - *in* <EPTF_HTTP_bodyContentGetter_FT> - the content getter function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setContentGetterFunction4Entity( + in integer pl_eIdx, + in EPTF_HTTP_bodyContentGetter_FT pl_contentGetter) + runs on EPTF_HTTP_LGen_CT { + + + v_EPTF_HTTP_contexts[pl_eIdx].contentGetterFn := pl_contentGetter; + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setContentGetterFunction4Entities + // + // Purpose: + // Function to set content getter function to the entities + // + // Parameters: + // pl_contentGetter - *in* <EPTF_HTTP_bodyContentGetter_FT> - the content getter function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setContentGetterFunction4Entities( + in EPTF_HTTP_bodyContentGetter_FT pl_contentGetter) + runs on EPTF_HTTP_LGen_CT { + + for (var integer i := 0; i < sizeof(v_EPTF_HTTP_contexts); i := i + 1) { + v_EPTF_HTTP_contexts[i].contentGetterFn := pl_contentGetter; + } + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setHeaderContentGetterFunction4Entity + // + // Purpose: + // Function to set header content getter function to the entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_headerContentGetter - *in* <EPTF_HTTP_headerContentGetter_FT> - the header content getter function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setHeaderContentGetterFunction4Entity( + in integer pl_eIdx, + in EPTF_HTTP_headerContentGetter_FT pl_headerContentGetter) + runs on EPTF_HTTP_LGen_CT { + + v_EPTF_HTTP_contexts[pl_eIdx].headerGetterFn := pl_headerContentGetter; + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setHeaderContentGetterFunction4Entities + // + // Purpose: + // Function to set header content getter function to the entities + // + // Parameters: + // pl_headerContentGetter - *in* <EPTF_HTTP_headerContentGetter_FT> - the header content getter function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setHeaderContentGetterFunction4Entities( + in EPTF_HTTP_headerContentGetter_FT pl_headerContentGetter) + runs on EPTF_HTTP_LGen_CT { + + for (var integer i := 0; i < sizeof(v_EPTF_HTTP_contexts); i := i + 1) { + v_EPTF_HTTP_contexts[i].headerGetterFn := pl_headerContentGetter; + } + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setRawHeaderContentGetterFunction4Entity + // + // Purpose: + // Function to set raw header content getter function to the entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // pl_rawHeaderContentGetter - *in* <EPTF_HTTP_rawHeaderContentGetter_FT> - the raw header content getter function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setRawHeaderContentGetterFunction4Entity( + in integer pl_eIdx, + in EPTF_HTTP_rawHeaderContentGetter_FT pl_rawHeaderContentGetter) + runs on EPTF_HTTP_LGen_CT { + + v_EPTF_HTTP_contexts[pl_eIdx].rawHeaderGetterFn := pl_rawHeaderContentGetter; + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setRawHeaderContentGetterFunction4Entities + // + // Purpose: + // Function to set raw header content getter function to the entities + // + // Parameters: + // pl_rawHeaderContentGetter - *in* <EPTF_HTTP_rawHeaderContentGetter_FT> - the raw header content getter function + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setRawHeaderContentGetterFunction4Entities( + in EPTF_HTTP_rawHeaderContentGetter_FT pl_rawHeaderContentGetter) + runs on EPTF_HTTP_LGen_CT { + + for (var integer i := 0; i < sizeof(v_EPTF_HTTP_contexts); i := i + 1) { + v_EPTF_HTTP_contexts[i].rawHeaderGetterFn := pl_rawHeaderContentGetter; + } + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_unbindEntity4Behavior + // + // Purpose: + // Function to unbind entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_unbindEntity4Behavior( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT { + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_resetEntity4Behavior + // + // Purpose: + // Function to reset entity + // + // Parameters: + // pl_eIdx - *in* *integer* - entity index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_resetEntity4Behavior( + in integer pl_eIdx) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_EPTF_HTTP_myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + v_EPTF_HTTP_contexts[vl_EPTF_HTTP_myCtx] := { + method := "", + uri:= "", + headerLinesIdx := -1 + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_initializeExtendedComponents + // + // Purpose: + // Function to initialize the extended components + // + // Parameters: + // pl_selfName - *charstring* - component self name + // pl_numEntities - *integer* - number of entities + // pl_entityNamePrefix - *charstring* - entity name prefix + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_initializeExtendedComponents( + in charstring pl_selfName, + in integer pl_numEntities := 0, + in charstring pl_entityNamePrefix) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_LGenBase_init(pl_selfName,pl_numEntities,pl_entityNamePrefix); + f_EPTF_Var_init_CT(pl_selfName); + f_EPTF_Logging_init_CT(pl_selfName); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_existHeaderLines + // + // Purpose: + // Check if header lines exist in header lines database + // + // Parameters: + // pl_headerLines - *in* <HeaderLines> - header lines to check + // + // Return Value: + // *integer* - database index if header lines exist, otherwise -1 + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_existHeaderLines( + in HeaderLines pl_headerLines) + runs on EPTF_HTTP_LGen_CT + return integer + { + for (var integer i := 0; i < sizeof(v_EPTF_HTTP_headerLinesList); i := i + 1){ + if (pl_headerLines == v_EPTF_HTTP_headerLinesList[i]) { + return i; + } + } + + return -1; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setAuthDetails4Entity + // + // Purpose: + // Function to set authorization details for entity such as password + // + // Parameters: + // pl_eIdx - *integer* - entity index + // pl_algorithm - *charstring* - used algorithm eg: MD5 + // pl_password - *charstring* - used password + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // This function can be used to set authorization details for entity such as password, algorithm... + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setAuthDetails4Entity( + in integer pl_eIdx, + in charstring pl_algorithm, + in charstring pl_password) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_eIdx); + + v_EPTF_HTTP_contexts[myCtx].authDetails.algorithm := pl_algorithm; + v_EPTF_HTTP_contexts[myCtx].authDetails.password := pl_password; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getHeaderIndex + // + // Purpose: + // This function retrieves the index of a given header + // + // Parameters: + // pl_headerName - *in* *charstring* - the name of the header + // pl_headerList - *inout* <HeaderLines> - the HTTP header + // + // Return Value: + // *integer* - the header index + // + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getHeaderIndex( + in charstring pl_headerName, + inout HeaderLines pl_headerList) + return integer + { + var integer vl_headerIdx := -1; + var integer vl_headers := sizeof(pl_headerList); + + for(var integer i := 0; i < vl_headers; i:=i+1) + { + if (pl_headerList[i].header_name == pl_headerName) { + vl_headerIdx := i; + break; + } + } + + return vl_headerIdx; + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_isWhiteSpace + // + // Purpose: + // Function to decide wether a character is a whitespace. + // + // Parameters: + // pl_char - *in* *integer* - the character + // + // Return Value: + // *boolean* - the result + // + // Errors: + // - + // + // Detailed Comments: + // - + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_isWhiteSpace( + in integer pl_char) + return boolean{ + return (pl_char == 32 /* SP */ or pl_char == 9 /* TAB */); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_isWSBeforeEq + // + // Purpose: + // Function to decide wether a whitespace is before an equal sign. + // + // Parameters: + // pl_char - *in* *integer* - the whistspace character + // + // Return Value: + // *boolean* - the result + // + // Errors: + // - + // + // Detailed Comments: + // - + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_isWSBeforeEq( + in charstring pl_string, + inout integer pl_pos, + out charstring pl_segment) + return boolean + { + pl_segment := ""; + while (pl_pos<lengthof(pl_string)) { + var integer ch := char2int(pl_string[pl_pos]); + pl_segment := pl_segment & int2char(ch); + if (not f_EPTF_HTTP_isWhiteSpace(ch)) { + if (ch == 61 /* = */) { + return true; + } else { + return false; + } + } + pl_pos:=pl_pos+1; + } + return false; + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getNextAttribute + // + // Purpose: + // Function to process the next header field parameter. + // + // Parameters: + // pl_char - *in* *integer* - the whistspace character + // pl_authenticateHeader - *in* *charstring* - the header field string + // pl_pos - *inout* *integer* - the actual position in the proccessing + // pl_errpos - *out* *integer* - the character position where the error occured + // pl_key - *out* *charstring* - the recevied parameter key + // pl_value - *out* *charstring* - the recevied parameter value + // + // Return Value: + // *boolean* - true if there is more parameters + // + // Errors: + // - + // + // Detailed Comments: + // - + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getNextAttribute( + in charstring pl_authenticateHeader, + inout integer pl_pos, + out integer pl_errpos, + out charstring pl_key, + out charstring pl_value) + return boolean{ + + const integer cl_WSKEY := 0; + const integer cl_KEY := 1; + const integer cl_EQ := 2; + const integer cl_WSVALUE := 3; + const integer cl_VALUE := 4; + const integer cl_WSCOMMA := 5; + + var integer vl_state := cl_WSKEY; + var boolean vl_woqoute := false; + pl_key := ""; + pl_value := ""; + pl_errpos := -1; + + for(var integer i:=pl_pos; i<lengthof(pl_authenticateHeader); i:=i+1) { + // action("pl_authenticateHeader[",i,"] := ", pl_authenticateHeader[i]) + var integer ch := char2int(pl_authenticateHeader[i]); + select (vl_state) { + case (cl_WSKEY) { + if (not f_EPTF_HTTP_isWhiteSpace(ch)) { + vl_state := cl_KEY; + pl_key := pl_key & int2char(ch); + } + } case (cl_KEY) { + if (f_EPTF_HTTP_isWhiteSpace(ch)) { + var charstring vl_segment; + if (f_EPTF_HTTP_isWSBeforeEq(pl_authenticateHeader, i, vl_segment)) { + // action("f_isWSBeforeEq():true -> ", vl_segment); + vl_state := cl_WSVALUE; + } else { + // action("f_isWSBeforeEq():false -> ", vl_segment); + pl_key := pl_key & vl_segment; + } + } else if (ch == 61 /* = */) { + vl_state := cl_EQ; + } else { + pl_key := pl_key & int2char(ch); + } + } case (cl_EQ) { + if (f_EPTF_HTTP_isWhiteSpace(ch)) { + vl_state := cl_WSVALUE; + } else if (ch==34 /* " */) { + vl_state := cl_VALUE; + } else if (ch==44 /* , */) { + pl_pos := i+1; + return true; + } else { + vl_woqoute := true; // value wo qoute + pl_value := pl_value & int2char(ch); + vl_state := cl_VALUE; + } + } case (cl_WSVALUE) { + if (ch == 34 /* " */) { + vl_state := cl_VALUE; + } else if (ch == 44 /* , */) { + pl_pos := i+1; + return true; + } else if (not f_EPTF_HTTP_isWhiteSpace(ch)) { + vl_woqoute := true; // value wo qoute + pl_value := pl_value & int2char(ch); + vl_state := cl_VALUE; + } + } case (cl_VALUE) { + if (vl_woqoute) { + if (ch == 44 /* , */) { + pl_pos := i+1; + return true; + } else { + pl_value := pl_value & int2char(ch); + } + } else { + if (ch == 34 /* " */) { + vl_state := cl_WSCOMMA; + } else { + pl_value := pl_value & int2char(ch); + } + } + } case (cl_WSCOMMA) { + if (ch == 44 /* , */) { + pl_pos := i+1; + return true; + } + } + } + } + // action ("pl_key := ", pl_key, "; pl_value := ", pl_value); + return false; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setAuthorizationDataToContextFromMessage + // + // Purpose: + // This function acquires authentication data from a message + // + // Parameters: + // pl_myCtx - *in* *integer* - the index of the context + // pl_authHeader - *in* *charstring* - authentication header + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setAuthorizationDataToContextFromMessage( + in integer pl_myCtx, + in charstring pl_authHeader) + runs on EPTF_HTTP_LGen_CT + { + var boolean vl_hasParameter := false; + var integer vl_pos := 0; + var integer vl_errpos := 0; + var charstring vl_key := ""; + var charstring vl_value := ""; + do + { + vl_hasParameter := f_EPTF_HTTP_getNextAttribute(pl_authHeader, vl_pos, vl_errpos, vl_key, vl_value); + if (vl_errpos != -1) { + f_EPTF_Logging_warning(tsp_EPTF_HTTP_logEnabled,%definitionId& + ": Parsing WWW-Authenticate header failed on position: "& + int2str(vl_errpos)&" in """&pl_authHeader&""""); + } + if (vl_key == "Digest realm"){ + v_EPTF_HTTP_contexts[pl_myCtx].authDetails.realm := vl_value; + } else if (vl_key == "qop"){ + v_EPTF_HTTP_contexts[pl_myCtx].authDetails.qop := vl_value; + } else if (vl_key == "nonce"){ + v_EPTF_HTTP_contexts[pl_myCtx].authDetails.nonce := vl_value; + } else if (vl_key == "opaque"){ + v_EPTF_HTTP_contexts[pl_myCtx].authDetails.opaque := vl_value; + } + } while ( vl_hasParameter ) + + f_EPTF_HTTP_debug(%definitionId& + ": Authentication data stored: realm -> " & + v_EPTF_HTTP_contexts[pl_myCtx].authDetails.realm & + " qop-> "&v_EPTF_HTTP_contexts[pl_myCtx].authDetails.qop & + " nonce-> "&v_EPTF_HTTP_contexts[pl_myCtx].authDetails.nonce & + " opaque-> "&v_EPTF_HTTP_contexts[pl_myCtx].authDetails.opaque); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_createAuthorizationDataFromMessage + // + // Purpose: + // This function generates the authorization data header + // + // Parameters: + // pl_myCtx - *in* *integer* - the index of the context + // pl_userName - *in* *charstring* - the username + // pl_requestUri - *in* *charstring* - HTTP requestUri + // pl_method - *charstring* - HTTP method + // + // Return Value: + // *charstring* - the generated authorization data + // + // Errors: + // - + // + // Detailed Comments: + // This function generates the authorization data to the header if the authorization details exists + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_createAuthorizationDataFromMessage( + in integer pl_myctx) + runs on EPTF_HTTP_LGen_CT + { + var integer vl_hIdx := -1; + + if (ischosen(v_EPTF_HTTP_incomingMessage.response)) + { + vl_hIdx := f_EPTF_HTTP_getHeaderIndex("WWW-Authenticate", + v_EPTF_HTTP_incomingMessage.response.header); + + if (vl_hIdx != -1) { + f_EPTF_HTTP_setAuthorizationDataToContextFromMessage(pl_myctx, + v_EPTF_HTTP_incomingMessage.response.header[vl_hIdx].header_value); + } + } + else { + vl_hIdx := f_EPTF_HTTP_getHeaderIndex("WWW-Authenticate", + v_EPTF_HTTP_incomingMessage.response_binary.header); + + if (vl_hIdx != -1) { + f_EPTF_HTTP_setAuthorizationDataToContextFromMessage(pl_myctx, + v_EPTF_HTTP_incomingMessage.response_binary.header[vl_hIdx].header_value); + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_createAuthorizationData + // + // Purpose: + // This function generates the authorization data header + // + // Parameters: + // pl_myCtx - *in* *integer* - the index of the context + // pl_userName - *in* *charstring* - the username + // pl_requestUri - *in* *charstring* - HTTP requestUri + // pl_method - *charstring* - HTTP method + // + // Return Value: + // *charstring* - the generated authorization data + // + // Errors: + // - + // + // Detailed Comments: + // This function generates the authorization data to the header if the authorization details exists + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_createAuthorizationData( + in integer pl_myCtx, + in charstring pl_userName, + in charstring pl_requestUri, + in charstring pl_method) + runs on EPTF_HTTP_LGen_CT return charstring + { + // MD5 hash of empty entity body for qop=auth, for qop=auth-int a new hash for the body must be calculated). + const charstring hEntity := ""; //"d41d8cd98f00b204e9800998ecf8427e"; //hash for empty string + var charstring cnonce := "01234567890abcdef01234567890abcdef"; + + var charstring realm := v_EPTF_HTTP_contexts[pl_myCtx].authDetails.realm; + var charstring qop := v_EPTF_HTTP_contexts[pl_myCtx].authDetails.qop; + var charstring nonce := v_EPTF_HTTP_contexts[pl_myCtx].authDetails.nonce; + var charstring opaque := v_EPTF_HTTP_contexts[pl_myCtx].authDetails.opaque; + + var charstring password := v_EPTF_HTTP_contexts[pl_myCtx].authDetails.password; + var charstring algorithm := v_EPTF_HTTP_contexts[pl_myCtx].authDetails.algorithm; + var charstring nonceCount := v_EPTF_HTTP_contexts[pl_myCtx].authDetails.nonceCount; + + v_EPTF_HTTP_contexts[pl_myCtx].authDetails.nonceCount := f_putInLowercase( + hex2str(int2hex( hex2int( str2hex(nonceCount) ) + 1, 8 ) )); //nonce count +1 + + var charstring response := f_calculateDigestResponse( + nonce, cnonce, pl_userName, realm, password, algorithm, nonceCount, + pl_method, qop, pl_requestUri, hEntity); + + var charstring vl_authData := + "Authorization: Digest username=\""&pl_userName&"\""& + ", realm=\""&realm&"\""& + ", nonce=\""&nonce&"\""& + ", uri=\""&pl_requestUri&"\""& + ", response=\""&response&"\""; + if(algorithm != "") { vl_authData := vl_authData & ", algorithm=\""&algorithm&"\"" } + vl_authData := vl_authData & + ", qop="&qop& // qop is without quotes, see rfc + ", nc="&nonceCount& // nc is without quotes, see rfc + ", cnonce=\""&cnonce&"\""& + ", opaque=\""&opaque&"\"" & + "\r\n"; + + f_EPTF_HTTP_debug(%definitionId & "Authorization data: " & + vl_authData); + + return vl_authData; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_contentLength + // + // Purpose: + // Function to calculate the length of the given string + // + // Parameters: + // p_str - *in* *charstring* - content + // + // Return Value: + // *charstring* - the length of the content in charstring + // + // Errors: + // - + // + // Detailed Comments: + // - + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_contentLength ( + in charstring p_str) + return charstring + { + return int2str(lengthof(p_str)); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_encodeHeader + // + // Purpose: + // Function to encode header + // + // Parameters: + // pl_myCtx - *in* *integer* - the index of the context + // pl_templSetIdx - *in* *integer* - the index of the template set + // pl_templItemIdxHeader - *in* *integer* - the index of the template item holding the header + // pl_content_length - *in* *charstring* - content length + // pl_headerOct - *inout* *octetstring* - encoded header + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_encodeHeader( + in integer pl_myCtx, + in integer pl_templSetIdx, + in integer pl_templItemIdxHeader, + in charstring pl_content_length, + inout octetstring pl_headerOct) + runs on EPTF_HTTP_LGen_CT + { + + var boolean isRawheader := (v_EPTF_HTTP_contexts[pl_myCtx].rawHeaderGetterFn != null) and + isvalue(v_EPTF_HTTP_contexts[pl_myCtx].rawHeaderGetterFn); + + var boolean isExternalTemplate := pl_templItemIdxHeader > -1; + var charstring vl_method := v_EPTF_HTTP_contexts[pl_myCtx].method; + var charstring vl_uri := v_EPTF_HTTP_contexts[pl_myCtx].uri; + var charstring vl_version_major := int2str(v_EPTF_HTTP_contexts[pl_myCtx].version_major); + var charstring vl_version_minor := int2str(v_EPTF_HTTP_contexts[pl_myCtx].version_minor); + var HeaderLines vl_headerlines; + + + if(isExternalTemplate) + { + var charstring vl_context_header := ""; + var charstring vl_message_header; + + // custom header from entity context + f_EPTF_HTTP_getHeaderForEntity(pl_myCtx, vl_headerlines); + + for(var integer i := 0; i < sizeof(vl_headerlines); i := i + 1) + { + if(vl_headerlines[i].header_name == "" or vl_headerlines[i].header_value == "") { continue;} + vl_context_header := vl_context_header & + vl_headerlines[i].header_name & ": " & + vl_headerlines[i].header_value; + // There is a newline character after the customHeader parameter in each template. + if(i < sizeof(vl_headerlines) - 1) + { + vl_context_header := vl_context_header & "\n"; + } + } // => $(customHeader) + \n + + v_boolNoWarningLG := f_EPTF_LGenBase_getTemplateContentFast(pl_templSetIdx, pl_templItemIdxHeader, + { vl_method, vl_uri, vl_version_major, vl_version_minor, vl_context_header, pl_content_length }, + vl_message_header ); + + //external template resolves crlf conversion + //vl_message_header := f_replaceEveryOccurenceOfSubstring(vl_message_header,"\n","\r\n"); + + pl_headerOct := char2oct(vl_message_header); + + f_EPTF_Logging_debug(v_EPTF_HTTP_logEnabled, + %definitionId&": "& + "SendMessage, header: "&vl_message_header); + } + else if(isRawheader) + { + f_EPTF_HTTP_getRawHeaderForEntity(pl_myCtx, pl_headerOct); + } + else // inner template + { + f_EPTF_HTTP_getHeaderForEntity(pl_myCtx, vl_headerlines); + if (pl_content_length != "0") { + vl_headerlines[sizeof(vl_headerlines)] := { "Content-Length", pl_content_length }; + } + var HTTPMessage vl_outgoingMessage := valueof(t_EPTF_HTTP_HTTPdistr_request( + vl_method, + vl_uri, + v_EPTF_HTTP_contexts[pl_myCtx].version_major, + v_EPTF_HTTP_contexts[pl_myCtx].version_minor, + vl_headerlines, + "" + )); + var octetstring temp := enc_HTTPMessage(vl_outgoingMessage); + + // cutting trailing /r/n + pl_headerOct := substr(temp, 0, lengthof(temp)-2); + + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_encodeHeaderResponse + // + // Purpose: + // Encodes response header. + // + // Parameters: + // pl_myCtx - *in* *integer* - the index of the context + // pl_templSetIdx - *in* *integer* - the index of the template set + // pl_templItemIdxHeader - *in* *integer* - the index of the template item holding the header + // pl_content_length - *in* *charstring* - content length + // pl_headerOct - *inout* *octetstring* - encoded header + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_encodeHeaderResponse( + in integer pl_myCtx, + in integer pl_templSetIdx, + in integer pl_templItemIdxHeader, + in charstring pl_content_length, + inout octetstring pl_headerOct, + in EPTF_CharstringList pl_optParams := {}) + runs on EPTF_HTTP_LGen_CT + { + + var boolean isRawheader := (v_EPTF_HTTP_contexts[pl_myCtx].rawHeaderGetterFn != null) and + isvalue(v_EPTF_HTTP_contexts[pl_myCtx].rawHeaderGetterFn); + + var boolean isExternalTemplate := pl_templItemIdxHeader > -1; + + + if(isExternalTemplate) + { + var charstring vl_version_major := int2str(v_EPTF_HTTP_contexts[pl_myCtx].version_major); + var charstring vl_version_minor := int2str(v_EPTF_HTTP_contexts[pl_myCtx].version_minor); + var charstring vl_status := int2str(v_EPTF_HTTP_contexts[pl_myCtx].statusCode) & " " & v_EPTF_HTTP_contexts[pl_myCtx].statusText; + var charstring vl_message_header; + + var EPTF_CharstringList vl_paramListDef := { vl_status, vl_version_major, vl_version_minor, pl_content_length } ; + var EPTF_CharstringList vl_paramListOpt + if(pl_optParams == {}) { + vl_paramListOpt := v_EPTF_HTTP_optionalTempParams; + } + else { + vl_paramListOpt := pl_optParams; + } + + v_boolNoWarningLG := f_EPTF_LGenBase_getTemplateContentFast(pl_templSetIdx, pl_templItemIdxHeader, + vl_paramListDef & vl_paramListOpt, + vl_message_header ); + + pl_headerOct := char2oct(vl_message_header); + + f_EPTF_Logging_debug(v_EPTF_HTTP_logEnabled, + %definitionId&": "& + "SendMessage, header: "&vl_message_header); + + return; + } + + if(isRawheader) + { + f_EPTF_HTTP_getRawHeaderForEntity(pl_myCtx, pl_headerOct); + return; + } + + var HeaderLines vl_headerlines := {}; + + f_EPTF_HTTP_getHeaderForEntity(pl_myCtx, vl_headerlines); + if (pl_content_length != "0") { + vl_headerlines[sizeof(vl_headerlines)] := { "Content-Length", pl_content_length }; + } + var HTTPMessage vl_outgoingMessage := { + response :={ + client_id := omit, + version_major := v_EPTF_HTTP_contexts[pl_myCtx].version_major, + version_minor := v_EPTF_HTTP_contexts[pl_myCtx].version_minor, + statuscode := v_EPTF_HTTP_contexts[pl_myCtx].statusCode, + statustext := v_EPTF_HTTP_contexts[pl_myCtx].statusText, + header := vl_headerlines, + body := "" + } + } + var octetstring temp := enc_HTTPMessage(vl_outgoingMessage); + + // cutting trailing /r/n + pl_headerOct := substr(temp, 0, lengthof(temp)-2); + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_encodeBody + // + // Purpose: + // Function to encode body + // + // Parameters: + // pl_myCtx - *in* *integer* - the index of the context + // pl_templSetIdx - *in* *integer* - the index of the template set + // pl_templItemIdxBody - *in* *integer* - the index of the template item holding the body + // pl_content_length - *inout* *charstring* - content length + // pl_bodyOct - *inout* *octetstring* - encoded body + // pl_templParamList - *in* *EPTF_CharstringList* - extra optional parameters for the body template + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_encodeBody( + in integer pl_myCtx, + in integer pl_templSetIdx, + in integer pl_templItemIdxBody, + inout charstring pl_content_length, + inout octetstring pl_bodyOct, + in EPTF_CharstringList pl_templParamList := {}) + runs on EPTF_HTTP_LGen_CT + { + + var boolean isExternalTemplate := pl_templItemIdxBody > -1; + + if(isExternalTemplate) + { + var charstring vl_message_body; + + v_boolNoWarningLG := f_EPTF_LGenBase_getTemplateContentFast(pl_templSetIdx, pl_templItemIdxBody, + pl_templParamList, vl_message_body ); + + //external template resolves crlf conversion + //vl_message_body := f_replaceEveryOccurenceOfSubstring(vl_message_body,"\n","\r\n"); + + pl_bodyOct := char2oct(vl_message_body); + pl_content_length := int2str(lengthof(pl_bodyOct)); + } + else // inner template + { + var EPTF_HTTP_CharOrOct vl_body; + f_EPTF_HTTP_getBodyContentForEntity(pl_myCtx, vl_body); + if (ischosen(vl_body.charVal)) + { + pl_bodyOct := char2oct(vl_body.charVal); + } + else + { + pl_bodyOct := vl_body.octVal; + } + pl_content_length := int2str(lengthof(pl_bodyOct)); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getNonceValue + // + // Purpose: + // Generates a nonce value. + // + // Parameters: + // pl_authData - *inout* <EPTF_HTTP_AuthData> - the generated nonce values + // + // Return value: + // charstring - nonce value + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getNonceValue(inout EPTF_HTTP_AuthDataServer pl_authData) + return charstring + { + if (0 == sizeof(pl_authData.nonceValues)) + { + return ""; + } + + var integer vl_currentNonce := pl_authData.currentNonce; + pl_authData.currentNonce := (pl_authData.currentNonce + 1) mod sizeof(pl_authData.nonceValues); + + + return pl_authData.nonceValues[vl_currentNonce]; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getAuthParams + // + // Purpose: + // Retrieves the authentication data from the Authorization request header. + // + // Parameters: + // pl_authData - *in* *charstring* - the Authorization header value + // pl_authParams - *inout* <EPTF_HTTP_AuthDetails> - the retreived paramters + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_getAuthParams(in charstring pl_authData, inout EPTF_HTTP_AuthDetails pl_authParams) + { + var EPTF_CharstringList vl_list := {}; + var EPTF_CharstringList vl_paramValues := {}; + var EPTF_HTTP_ParamValue_List vl_params := {}; + var charstring vl_paramValue := ""; + + f_EPTF_HTTP_Tokenize(pl_authData, " ,", vl_list); + for (var integer i := 0; i < sizeof(vl_list); i := i + 1) + { + f_EPTF_HTTP_Tokenize(vl_list[i], "=", vl_paramValues); + if (sizeof(vl_paramValues) == 1) + { + vl_params[sizeof(vl_params)] := {vl_paramValues[0], ""}; + }else + { + vl_paramValue := vl_paramValues[1]; + if (lengthof(vl_paramValue) > 2) + { + if ("\"" == vl_paramValue[0] and "\"" == vl_paramValue[lengthof(vl_paramValue) - 1]) + { + vl_paramValue := substr(vl_paramValue, 1, lengthof(vl_paramValue) - 2); + } + }else{ + vl_paramValue := ""; + } + vl_params[sizeof(vl_params)] := {vl_paramValues[0], vl_paramValue}; + } + vl_paramValues := {} + } + + for (var integer i := 0; i < sizeof(vl_params); i := i + 1) + { + if ("nonce" == vl_params[i].paramName) + { + pl_authParams.nonce := vl_params[i].paramValue; + continue; + } + + if ("algorithm" == vl_params[i].paramName) + { + pl_authParams.algorithm := vl_params[i].paramValue; + continue; + } + + if ("cnonce" == vl_params[i].paramName) + { + pl_authParams.cnonce := vl_params[i].paramValue; + continue; + } + + if ("nc" == vl_params[i].paramName) + { + pl_authParams.nonceCount := vl_params[i].paramValue; + continue; + } + + if ("realm" == vl_params[i].paramName) + { + pl_authParams.realm := vl_params[i].paramValue; + continue; + } + + if ("qop" == vl_params[i].paramName) + { + pl_authParams.qop := vl_params[i].paramValue; + continue; + } + + if ("response" == vl_params[i].paramName) + { + pl_authParams.response := vl_params[i].paramValue; + continue; + } + + if ("uri" == vl_params[i].paramName) + { + pl_authParams.uri := vl_params[i].paramValue; + continue; + } + + if ("username" == vl_params[i].paramName) + { + pl_authParams.username := vl_params[i].paramValue; + continue; + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Tokenize + // + // Purpose: + // Breaks a string into a sequence of tokens, each of which is delimited by + // one or more characters. + // + // Parameters: + // pl_string - *in* *charstring* - the string to break into tokens + // pl_delimiters - *in* *charstring* - the delimiter characters + // pl_tokens - *in* <EPTF_CharstringList> - the tokens + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Tokenize(in charstring pl_string, in charstring pl_delimiters, inout EPTF_CharstringList pl_tokens) + { + var integer vl_state := 0; //0: not delim; 1: delim; 2: quoted + var boolean vl_isDelim := false; + var charstring vl_value := ""; + + for (var integer i := 0; i < lengthof(pl_string); i := i + 1) + { + vl_isDelim := false; + + if (0 == vl_state) + { + for (var integer ii := 0; ii < lengthof(pl_delimiters) and not vl_isDelim; ii := ii + 1) + { + vl_isDelim := pl_delimiters[ii] == pl_string[i]; + } + + if (vl_isDelim) + { + if (vl_value != "") + { + pl_tokens[sizeof(pl_tokens)] := vl_value; + } + vl_state := 1 + }else{ + vl_value := vl_value & pl_string[i]; + if (pl_string[i] == "\"") + { + vl_state := 2; + } + } + }else if (1 == vl_state) + { + for (var integer ii := 0; ii < lengthof(pl_delimiters) and not vl_isDelim; ii := ii + 1) + { + vl_isDelim := pl_delimiters[ii] == pl_string[i]; + } + + if (vl_isDelim) + {/*do nothing*/} + else{ + vl_state := 0; + vl_value := pl_string[i]; + if (pl_string[i] == "\"") + { + vl_state := 2; + } + } + }else if (2 == vl_state) + { + vl_value := vl_value & pl_string[i]; + if (pl_string[i] == "\"") + { + vl_state := 0; + } + } + } + + if (vl_value != ""){pl_tokens[sizeof(pl_tokens)] := vl_value;} + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_generateNonceValues + // + // Purpose: + // Generates nonce values for the server + // + // Parameters: + // pl_number - *in* *integer* - number of nonce values to generate + // pl_nonceValues - *in* <EPTF_CharstringList> - generated nonce values + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_generateNonceValues(in integer pl_number, inout EPTF_CharstringList pl_nonceValues) + { + for (var integer i := 0; i < pl_number; i := i + 1) + { + pl_nonceValues[sizeof(pl_nonceValues)] := f_calculateMD5(int2str(f_time())); + } + } +} //EPTF_HTTP_PrivateFunctions + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_TestSteps +// +// Purpose: +// The functions of the EPTF HTTP Test Steps +// +// Test Steps: +// f_EPTF_HTTP_step_handleTimeout - +// f_EPTF_HTTP_step_sendRequest - +// f_EPTF_HTTP_step_closePortOfUser - +// f_EPTF_HTTP_step_freePortOfUser - +// f_EPTF_HTTP_step_processResponse - +// f_EPTF_HTTP_step_sendConnect - +// f_EPTF_HTTP_step_sendClose - +// f_EPTF_HTTP_step_sendHalfClose - +// f_EPTF_HTTP_step_setEntityContextHTTPMethodCONNECT - +// f_EPTF_HTTP_step_setEntityContextHTTPMethodDELETE - +// f_EPTF_HTTP_step_setEntityContextHTTPMethodGET - +// f_EPTF_HTTP_step_setEntityContextHTTPMethodHEAD - +// f_EPTF_HTTP_step_setEntityContextHTTPMethodOPTIONS - +// f_EPTF_HTTP_step_setEntityContextHTTPMethodPOST - +// f_EPTF_HTTP_step_setEntityContextHTTPMethodPUT - +// f_EPTF_HTTP_step_setEntityContextHTTPMethodTRACE - +// f_EPTF_HTTP_step_handleRequest - +// f_EPTF_HTTP_step_sendResponse - +// f_EPTF_HTTP_step_closePort - +// f_EPTF_HTTP_step_cleanUp - +// +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_TestSteps +{ + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_handleTimeout + // + // Purpose: + // This function implements handle timeout test step + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_handleTimeout( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + var integer fCtx := pl_ptr.refContext.fCtxIdx; + + f_EPTF_HTTP_debug(%definitionId& + ": Timed Out: cIdx-> "&int2str(myCtx)& + " fCtx-> "&int2str(fCtx)); + + // Update The Statistics + + // Delete the entity context and databases + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_sendRequest + // + // Purpose: + // This function implements send request test step + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // stepArgs first element holds the desired callType + // stepArgs second element holds the fsm to report events up + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_sendRequest( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + var integer fCtx := pl_ptr.refContext.fCtxIdx; + var integer vl_connId := v_EPTF_HTTP_contexts[myCtx].connId; // port group id + var integer vl_templSetIdx := f_EPTF_LGenBase_templateSetIdxOfStep(pl_ptr); + var integer vl_templItemIdxHeader := -1; + var integer vl_templItemIdxBody := -1; + var charstring vl_content_length; + + var octetstring vl_outgoingMessage; + + f_EPTF_HTTP_debug(%definitionId & ": " & + " myCtx-> "&int2str(myCtx)& + " pl_ptr.eIdx-> "&int2str(pl_ptr.eIdx)& + " fCtx-> "&int2str(fCtx)//& + //" vl_tcIdx-> "&int2str(vl_tcIdx) + ); + + if(vl_templSetIdx>-1) { // if template set exists + vl_templItemIdxHeader := f_EPTF_LGenBase_getTemplateItemIdxFromSet( + vl_templSetIdx, v_EPTF_HTTP_extTemplType_customHeader ); + vl_templItemIdxBody := f_EPTF_LGenBase_getTemplateItemIdxFromSet( + vl_templSetIdx, v_EPTF_HTTP_extTemplType_customBody ); + } + + var octetstring vl_headerOct; + var octetstring vl_bodyOct; + + f_EPTF_HTTP_encodeBody(myCtx, vl_templSetIdx, vl_templItemIdxBody, vl_content_length, vl_bodyOct); + f_EPTF_HTTP_encodeHeader(myCtx, vl_templSetIdx, vl_templItemIdxHeader, vl_content_length, vl_headerOct); + + + vl_outgoingMessage := vl_headerOct & '0D0A'O & vl_bodyOct; + + f_EPTF_HTTP_debug(%definitionId & ": sending message: " & + log2str(vl_outgoingMessage)); + + //v_EPTF_HTTP_ConnId2EIdx[vl_connId] := pl_ptr.eIdx; + v_EPTF_HTTP_ConnId2FIdx[pl_ptr.eIdx] := pl_ptr.refContext.fCtxIdx; + + f_EPTF_HTTP_debug(%definitionId & ": Entity and Fsm index: " & + int2str(pl_ptr.eIdx) & " / " & + int2str(v_EPTF_HTTP_ConnId2FIdx[pl_ptr.eIdx]) & + " set for connection id: " & int2str(vl_connId)); + + f_EPTF_HTTP_sendRequest(vl_connId, + v_EPTF_HTTP_EntityOffset + pl_ptr.eIdx, + vl_outgoingMessage); + + v_EPTF_HTTP_contexts[myCtx].requestPending := true; // if request sent out, message is pending + + f_EPTF_HTTP_updateStatistics(false, v_EPTF_HTTP_contexts[myCtx].method); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_sendResponse + // + // Purpose: + // This function implements send response test step + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_sendResponse( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + var integer fCtx := pl_ptr.refContext.fCtxIdx; + + var integer vl_connId := v_EPTF_HTTP_contexts[myCtx].connId; // port group id + var integer vl_portId := v_EPTF_HTTP_contexts[myCtx].portId; + var integer vl_seqNum := v_EPTF_HTTP_contexts[myCtx].seqNum; + + var integer vl_templSetIdx := f_EPTF_LGenBase_templateSetIdxOfStep(pl_ptr); + var integer vl_templItemIdxHeader := -1; + var integer vl_templItemIdxBody := -1; + var charstring vl_content_length; + + var octetstring vl_outgoingMessage; + + var octetstring vl_headerOct; + var octetstring vl_bodyOct; + + f_EPTF_HTTP_debug(%definitionId & ": " & + " myCtx-> "&int2str(myCtx)& + " pl_ptr.eIdx-> "&int2str(pl_ptr.eIdx)& + " fCtx-> "&int2str(fCtx)//& + //" vl_tcIdx-> "&int2str(vl_tcIdx) + ); + + if(vl_templSetIdx>-1) { // if template set exists + vl_templItemIdxHeader := f_EPTF_LGenBase_getTemplateItemIdxFromSet( + vl_templSetIdx, v_EPTF_HTTP_extTemplType_customHeaderResponse ); + vl_templItemIdxBody := f_EPTF_LGenBase_getTemplateItemIdxFromSet( + vl_templSetIdx, v_EPTF_HTTP_extTemplType_customBody ); + } + + f_EPTF_HTTP_encodeBody(myCtx, vl_templSetIdx, vl_templItemIdxBody, vl_content_length, vl_bodyOct); + f_EPTF_HTTP_encodeHeaderResponse(myCtx, vl_templSetIdx, vl_templItemIdxHeader, vl_content_length, vl_headerOct); + + vl_outgoingMessage := vl_headerOct & '0D0A'O & vl_bodyOct; + + f_EPTF_HTTP_debug(%definitionId & ": sending message: " & + log2str(vl_outgoingMessage)); + + f_EPTF_HTTP_debug(%definitionId & ": Entity index: " & + int2str(pl_ptr.eIdx) & + " set for group id: " & int2str(vl_connId)); + + f_EPTF_HTTP_sendResponse(vl_connId, + vl_portId, + vl_seqNum, + vl_outgoingMessage); + + f_EPTF_HTTP_updateStatistics(false, "", v_EPTF_HTTP_contexts[myCtx].statusCode); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_closePortOfUser + // + // Purpose: + // This function implements the close port of user test step + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_closePortOfUser( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + //var integer fCtx := pl_ptr.refContext.fCtxIdx; + //var integer vl_tcIdx := f_EPTF_LGenBase_tcIdxOfStep(pl_ptr); + var integer vl_connId := v_EPTF_HTTP_contexts[myCtx].connId; // port group id + + f_EPTF_HTTP_debug(%definitionId & ": " & + " myCtx-> "&int2str(myCtx)//& + //" fCtx-> "&int2str(fCtx)& + //" vl_tcIdx-> "&int2str(vl_tcIdx) + ); + + f_EPTF_HTTP_closePortOfUser(vl_connId, + v_EPTF_HTTP_EntityOffset + pl_ptr.eIdx); + + v_EPTF_HTTP_contexts[myCtx].requestPending := false; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_freePortOfUser + // + // Purpose: + // This function implements the free port of user test step + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_freePortOfUser( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + //var integer fCtx := pl_ptr.refContext.fCtxIdx; + //var integer vl_tcIdx := f_EPTF_LGenBase_tcIdxOfStep(pl_ptr); + var integer vl_connId := v_EPTF_HTTP_contexts[myCtx].connId; // port group id + + f_EPTF_HTTP_debug(%definitionId & ": " & + " myCtx-> "&int2str(myCtx)//& + //" fCtx-> "&int2str(fCtx)& + //" vl_tcIdx-> "&int2str(vl_tcIdx) + ); + + f_EPTF_HTTP_freePortOfUser(vl_connId, + v_EPTF_HTTP_EntityOffset + pl_ptr.eIdx); + + v_EPTF_HTTP_contexts[myCtx].requestPending := false; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_processResponse + // + // Purpose: + // This function implements processing of HTTP responses + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_processResponse( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + + f_EPTF_HTTP_debug(%definitionId & + ": Request arrived for entity context: " & int2str(myCtx)); + + //var integer fCtx := pl_ptr.refContext.fCtxIdx; + //var integer vl_tcIdx := f_EPTF_LGenBase_tcIdxOfStep(pl_ptr); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_sendConnect + // + // Purpose: + // This function implements connect request test step + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_sendConnect( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + + v_boolNoWarningLG := + f_EPTF_HTTP_openConnection(v_EPTF_HTTP_contexts[myCtx].connId, v_EPTF_HTTP_EntityOffset + pl_ptr.eIdx); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_sendClose + // + // Purpose: + // This function implements close request test step + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_sendClose( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + + f_EPTF_HTTP_closeConnection(v_EPTF_HTTP_contexts[myCtx].connId); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_sendHalfClose + // + // Purpose: + // This function implements half close request test step + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_sendHalfClose( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer myCtx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + + f_EPTF_HTTP_closeHalfConnection(v_EPTF_HTTP_contexts[myCtx].connId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_handleRequest + // + // Purpose: + // Handles the incoming HTTP requests + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Detailed Comments: + // Handles the following events: c_EPTF_HTTP_inputIdx_requestCharReceived, + // c_EPTF_HTTP_inputIdx_requestOctReceived. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_handleRequest( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer v_ctx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + + v_EPTF_HTTP_contexts[v_ctx].httpMessage := v_EPTF_HTTP_incomingMessage; + + v_EPTF_HTTP_contexts[v_ctx].connId := v_EPTF_HTTP_lastReceivedGroupId; + v_EPTF_HTTP_contexts[v_ctx].portId := v_EPTF_HTTP_lastReceivedPortId; + v_EPTF_HTTP_contexts[v_ctx].seqNum := v_EPTF_HTTP_lastReceivedSeqNum; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_setEntityContextHTTPMethodCONNECT + // + // Purpose: + // This function sets the HTTP method of the entity context to CONNECT. + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_setEntityContextHTTPMethodCONNECT( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_setEntityContextMethod(pl_ptr.eIdx, "CONNECT"); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_setEntityContextHTTPMethodDELETE + // + // Purpose: + // This function sets the HTTP method of the entity context to DELETE. + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_setEntityContextHTTPMethodDELETE( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_setEntityContextMethod(pl_ptr.eIdx, "DELETE"); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_setEntityContextHTTPMethodGET + // + // Purpose: + // This function sets the HTTP method of the entity context to GET. + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_setEntityContextHTTPMethodGET( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_setEntityContextMethod(pl_ptr.eIdx, "GET"); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_setEntityContextHTTPMethodHEAD + // + // Purpose: + // This function sets the HTTP method of the entity context to HEAD. + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_setEntityContextHTTPMethodHEAD( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_setEntityContextMethod(pl_ptr.eIdx, "HEAD"); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_setEntityContextHTTPMethodOPTIONS + // + // Purpose: + // This function sets the HTTP method of the entity context to OPTIONS. + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_setEntityContextHTTPMethodOPTIONS( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_setEntityContextMethod(pl_ptr.eIdx, "OPTIONS"); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_setEntityContextHTTPMethodPOST + // + // Purpose: + // This function sets the HTTP method of the entity context to POST. + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_setEntityContextHTTPMethodPOST( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_setEntityContextMethod(pl_ptr.eIdx, "POST"); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_setEntityContextHTTPMethodPUT + // + // Purpose: + // This function sets the HTTP method of the entity context to PUT. + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_setEntityContextHTTPMethodPUT( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_setEntityContextMethod(pl_ptr.eIdx, "PUT"); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_setEntityContextHTTPMethodTRACE + // + // Purpose: + // This function sets the HTTP method of the entity context to TRACE. + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_setEntityContextHTTPMethodTRACE( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_setEntityContextMethod(pl_ptr.eIdx, "TRACE"); + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_step_closePort + // + // Purpose: + // Test step wrapper for <f_EPTF_HTTP_closePort> + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_closePort( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + var integer v_ctx := f_EPTF_HTTP_getContextIndex(pl_ptr.eIdx); + + f_EPTF_HTTP_closePort(v_EPTF_HTTP_contexts[v_ctx].connId, v_EPTF_HTTP_contexts[v_ctx].portId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: EPTF_LGenBase_TestStepArgs + // + // Purpose: + // Test step wrapper for <f_EPTF_HTTP_cleanupContext> + // + // Parameters: + // pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step args + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_step_cleanUp( + in EPTF_LGenBase_TestStepArgs pl_ptr) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_cleanupContext(pl_ptr.eIdx); + } + +} //EPTF_HTTP_TestSteps + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_DefaultFunctions +// +// Purpose: +// The functions of the EPTF HTTP Default Functions +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_DefaultFunctions { + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultSendRequest + // + // Purpose: + // This function is the default send request function + // + // Parameters: + // pl_Message - *in* <EPTF_HTTP_Message> - the outgoing HTTP message + // pl_result - *out* <Result> - the result of send + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultSendRequest( + in integer pl_connId, + in integer pl_sessionId, + in octetstring pl_message) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug(%definitionId&": "& + "You should set your sender function with f_EPTF_HTTP_setSendRequestFunction"); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultConnectionOpen + // + // Purpose: + // This function is the default connection open function + // + // Parameters: + // pl_connId - *in* *integer* - the ID of the opened connection + // pl_sessionId - *in* *integer* - session id + // + // Return Value: + // *boolean* - success result of operation + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultConnectionOpen ( + in integer pl_connId, + in integer pl_sessionId) + runs on EPTF_HTTP_LGen_CT return boolean + { + f_EPTF_HTTP_debug("Default Connection Open fucntion has been called"); + + return true; + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultConnectionClose + // + // Purpose: + // This function is the default connection close function + // + // Parameters: + // pl_connId - *in* *integer* - the connection ID + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultConnectionClose ( + in integer pl_connId) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug("Default Connection Close fucntion has been called"); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultConnectionHalfClose + // + // Purpose: + // This function is the default connection half close function + // + // Parameters: + // pl_connId - *in* *integer* - the connection ID + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultConnectionHalfClose ( + in integer pl_connId) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug("Default Connection Half Close function has been called"); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultClosePortOfUser + // + // Purpose: + // This function is the default close port of user function + // + // Parameters: + // pl_groupId - *in* *integer* - group id + // pl_sessionId - *in* *integer* - session id + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultClosePortOfUser ( + in integer pl_groupId, + in integer pl_sessionId) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug("Default Close Port of User function has been called"); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultFreePortOfUser + // + // Purpose: + // This function is the default free port of user function + // + // Parameters: + // pl_groupId - *in* *integer* - group id + // pl_sessionId - *in* *integer* - session id + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultFreePortOfUser ( + in integer pl_groupId, + in integer pl_sessionId) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug("Default Free Port of User function has been called"); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultClosePort + // + // Purpose: + // This function is the default free port of user function + // + // Parameters: + // pl_groupId - *in* *integer* - group id + // pl_portId - *in* *integer* - session id + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultClosePort( + in integer pl_groupId, + in integer pl_portId) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug("Default connection close function has been called"); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultSendResponse + // + // Purpose: + // This function is the default send response function + // + // Parameters: + // pl_groupId - *in* *integer* - group identifier to send the response + // pl_portId - *out* *integer* - unique port identifier in the port group + // pl_message - *out* *integer* - the message to send + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultSendResponse( + in integer pl_groupId, + in integer pl_portId, + in integer pl_seqNum, + in octetstring pl_message) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug(%definitionId&": "& + "You should set your sender function with f_EPTF_HTTP_setSendResponseFunction"); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultListen + // + // Purpose: + // This function is the default listen function + // + // Parameters: + // pl_groupId - *in* *integer* - group identifier to send the response + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultListen( + in integer pl_groupId) + runs on EPTF_HTTP_LGen_CT + return integer + { + f_EPTF_HTTP_debug(%definitionId&": "& + "You should set your sender function with f_EPTF_HTTP_setListenFunction"); + return -1; + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultSearch + // + // Purpose: + // The default context searching function + // + // Parameters: + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultSearch( + inout integer pl_eIdx, + inout integer pl_fsmCtx) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_HTTP_debug(%definitionId&": "& + "You should set your sender function with f_EPTF_HTTP_setSearchContextFunction"); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultCharstringBodyHandler + // + // Purpose: + // The default charstring body handler function + // + // Parameters: + // pl_eIdx - *in* *integer* - group id + // pl_bodyMessage - *in* *charstring* - the body message + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultCharstringBodyHandler ( + in integer pl_eIdx, + in charstring pl_bodyMessage) + runs on EPTF_HTTP_LGen_CT + { + //f_EPTF_HTTP_debug(pl_bodyMessage); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_defaultBinaryBodyHandler + // + // Purpose: + // The default binary body handler function + // + // Parameters: + // pl_eIdx - *in* *integer* - group id + // pl_bodyMessage - *in* *octetstring* - the body message + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_defaultBinaryBodyHandler ( + in integer pl_eIdx, + in octetstring pl_bodyMessage) + runs on EPTF_HTTP_LGen_CT + { + //f_EPTF_HTTP_debug(pl_bodyMessage); + } + +} //EPTF_HTTP_DefaultFunctions + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Logging +// +// Purpose: +// The functions of the EPTF HTTP Logging +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Logging +{ + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_error + // + // Purpose: + // Function to log an error from StatMeasure feature. + // + // Parameters: + // - pl_message - *in* *charstring* - the message to log + // + // Return Value: + // - + // + // Errors & assertions: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_error( + in @lazy charstring pl_message) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_Logging_errorV2(pl_message, + v_EPTF_HTTP_loggingMaskId, + {c_EPTF_HTTP_loggingClassIdx_Error}); + f_EPTF_Base_stopAll(); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_warning + // + // Purpose: + // Function to log a warning from StatMeasure feature. + // + // Parameters: + // - pl_message - *in* *charstring* - the message to log + // + // Return Value: + // - + // + // Errors & assertions: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_warning( + in @lazy charstring pl_message) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_Logging_warningV2(pl_message, + v_EPTF_HTTP_loggingMaskId, + {c_EPTF_HTTP_loggingClassIdx_Warning}); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_debug + // + // Purpose: + // Function to log a debug message from StatMeasure feature. + // + // Parameters: + // - pl_message - *in* *charstring* - the message to log + // + // Return Value: + // - + // + // Errors & assertions: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_debug( + in @lazy charstring pl_message) + runs on EPTF_HTTP_LGen_CT + { + f_EPTF_Logging_debugV2(pl_message, + v_EPTF_HTTP_loggingMaskId, + {c_EPTF_HTTP_loggingClassIdx_Debug}); + } + + /////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_debugEnabled + // + // Purpose: + // Function to check if debug is enabled for StatMeasure + // + // Parameters: + // - + // + // Return Value: + // *boolean* - true if debug enalbed + // + // Errors & assertions: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////// + function f_EPTF_HTTP_debugEnabled() + runs on EPTF_HTTP_LGen_CT + return boolean + { + return f_EPTF_Logging_isEnabled( + v_EPTF_HTTP_loggingMaskId, + c_EPTF_HTTP_loggingClassIdx_Debug); + } +} // group Logging + +}//end of module +with { +extension "version <RnXnn>" +} + diff --git a/src/LoadGen/EPTF_HTTP_LoadGen.grp b/src/LoadGen/EPTF_HTTP_LoadGen.grp new file mode 100644 index 0000000..c0a61d4 --- /dev/null +++ b/src/LoadGen/EPTF_HTTP_LoadGen.grp @@ -0,0 +1,25 @@ +<!-- +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_LoadGen.grp +// Description: FileGroup file for EPTF Applib HTTP LoadGen +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-03-11 +// Contact: http://ttcn.ericsson.se +// + +--> +<!DOCTYPE TITAN_GUI_FileGroup_file> +<File_Group name="EPTF_HTTP_LoadGen" > + <File path="EPTF_HTTP_Definitions.ttcn" /> + <File path="EPTF_HTTP_Functions.ttcn" /> +</File_Group> diff --git a/src/Logger/EPTF_HTTP_Logger.grp b/src/Logger/EPTF_HTTP_Logger.grp new file mode 100644 index 0000000..ba5bd93 --- /dev/null +++ b/src/Logger/EPTF_HTTP_Logger.grp @@ -0,0 +1,25 @@ +<!-- +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_Logger.grp +// Description: FileGroup file for EPTF Applib HTTP Logger +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-03-11 +// Contact: http://ttcn.ericsson.se +// + +--> +<!DOCTYPE TITAN_GUI_FileGroup_file> +<File_Group name="EPTF_HTTP_Logger" > + <File path="EPTF_HTTP_Logger_Definitions.ttcn" /> + <File path="EPTF_HTTP_Logger_Functions.ttcn" /> +</File_Group> diff --git a/src/Logger/EPTF_HTTP_Logger_Definitions.ttcn b/src/Logger/EPTF_HTTP_Logger_Definitions.ttcn new file mode 100644 index 0000000..97a2503 --- /dev/null +++ b/src/Logger/EPTF_HTTP_Logger_Definitions.ttcn @@ -0,0 +1,118 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_Logger_Definitions.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2012-11-28 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +// Module: EPTF_HTTP_Logger_Definitions +// +// Purpose: +// This module contains the definitions used by the EPTF_HTTP_Logger_CT +// component. +// +// Module Parameters: +// - +// +// Module depends on: +// <EPTF_CLL_Base_Definitions> +// +// <HTTPmsg_Types> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2008-01-09 +/////////////////////////////////////////////////////////// +module EPTF_HTTP_Logger_Definitions { + +//========================================================================= +// Import Part +//========================================================================= +import from EPTF_CLL_Base_Definitions all; +import from HTTPmsg_Types all; + +/////////////////////////////////////////////////////////// +// Type: EPTF_HTTP_LoggerClient_FT +// +// Purpose: +// Function type to register LoggerClient send function +// +// Elements: +// pl_message - *in* - *octetstring* - the outgoing octetstring message +// +/////////////////////////////////////////////////////////// +type function EPTF_HTTP_LoggerClient_FT ( + in charstring pl_message) +runs on self; + +/////////////////////////////////////////////////////////// +// Type: EPTF_HTTP_LoggerClient_CT +// +// Purpose: +// The type definition of the LoggerClient component +// +// Extends: +// EPTF_Base_CT +// +// Elements: +// HTTP_LoggerClient_PCO - <EPTF_HTTP_Logger_PT> - Communiucation port between the LoggerClient and The Logger components +// vf_EPTF_HTTP_LoggerClient_sendFunction - <EPTF_HTTP_LoggerClient_FT> - Function to reference the logging send function +// vc_EPTF_HTTP_LoggerClient_loggerComponent - <EPTF_HTTP_Logger_CT> - The Logger component +// v_EPTF_HTTP_LoggerClient_initialized - *boolean* - The component initialized variable +/////////////////////////////////////////////////////////// +type component EPTF_HTTP_LoggerClient_CT extends + EPTF_Base_CT +{ + port EPTF_HTTP_Logger_PT HTTP_LoggerClient_PCO; + var EPTF_HTTP_LoggerClient_FT vf_EPTF_HTTP_LoggerClient_sendFunction := null; + var EPTF_HTTP_Logger_CT vc_EPTF_HTTP_LoggerClient_loggerComponent; + var boolean v_EPTF_HTTP_LoggerClient_initialized := false; +} + +/////////////////////////////////////////////////////////// +// Type: EPTF_HTTP_Logger_PT +// +// Purpose: +// HTTP Logger port type +// +// Detailed Comments: +// The port receives a HTTP message as octetstring +// +/////////////////////////////////////////////////////////// +type port EPTF_HTTP_Logger_PT message { + inout octetstring +} with { extension "internal" }; + +/////////////////////////////////////////////////////////// +// Type: EPTF_HTTP_Logger_CT +// +// Purpose: +// HTTP Logger component type +// +// Detailed Comments: +// +/////////////////////////////////////////////////////////// +type component EPTF_HTTP_Logger_CT { + port EPTF_HTTP_Logger_PT HTTP_Logger_PCO; + var octetstring v_EPTF_HTTP_Logger_incomingMsg; + var HTTPMessage v_EPTF_HTTP_Logger_decodedMessage; +} + +}//end of module +with { +extension "version <RnXnn>" +} + diff --git a/src/Logger/EPTF_HTTP_Logger_Functions.ttcn b/src/Logger/EPTF_HTTP_Logger_Functions.ttcn new file mode 100644 index 0000000..fe63c55 --- /dev/null +++ b/src/Logger/EPTF_HTTP_Logger_Functions.ttcn @@ -0,0 +1,180 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_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>" +} + diff --git a/src/Transport/EPTF_HTTP_Transport.grp b/src/Transport/EPTF_HTTP_Transport.grp new file mode 100644 index 0000000..b6ae3b2 --- /dev/null +++ b/src/Transport/EPTF_HTTP_Transport.grp @@ -0,0 +1,25 @@ +<!-- +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_Transport.grp +// Description: FileGroup file for EPTF Applib HTTP Transport +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-03-11 +// Contact: http://ttcn.ericsson.se +// + +--> +<!DOCTYPE TITAN_GUI_FileGroup_file> +<File_Group name="EPTF_HTTP_Transport" > + <File path="EPTF_HTTP_Transport_Definitions.ttcn" /> + <File path="EPTF_HTTP_Transport_Functions.ttcn" /> +</File_Group> diff --git a/src/Transport/EPTF_HTTP_Transport_Definitions.ttcn b/src/Transport/EPTF_HTTP_Transport_Definitions.ttcn new file mode 100644 index 0000000..b46be44 --- /dev/null +++ b/src/Transport/EPTF_HTTP_Transport_Definitions.ttcn @@ -0,0 +1,2092 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_Transport_Definitions.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2014-03-21 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +// Module: EPTF_HTTP_Transport_Definitions +// +// Purpose: +// This module contains the definitions to the HTTP Transport +// +// Module Parameters: +// tsp_EPTF_HTTP_Transport_loggingComponentMask - *charstring* - logging component mask id +// tsp_EPTF_HTTP_Transport_loggingEnable - *boolean* - enable/disable the transport logging +// +// Module depends on: +// <EPTF_HTTP_Definitions> +// +// <EPTF_CLL_Common_Definitions> +// +// <EPTF_CLL_Base_Definitions> +// +// <EPTF_CLL_LGenBase_Definitions> +// +// <EPTF_HTTP_Logger_Definitions> +// +// <EPTF_CLL_FBQ_Definitions> +// +// <EPTF_CLL_TransportDefinitions> +// +// <EPTF_CLL_TransportMessageBufferManager_Definitions> +// +// <EPTF_CLL_Logging_Definitions> +// +// <EPTF_CLL_TransportCommPortIPL4_Definitions> +// +// <IPL4asp_Types> +// +// <TCCMaths_GenericTypes> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-08-10 +// +// Detailed Comments: +// - +// +/////////////////////////////////////////////////////////// + +module EPTF_HTTP_Transport_Definitions { + +//============================================================================= +// Imports +//============================================================================= +import from EPTF_CLL_Common_Definitions all; +import from EPTF_CLL_Base_Definitions all; +//import from EPTF_CLL_LGenBase_Definitions all; +import from EPTF_CLL_FBQ_Definitions all; +import from EPTF_CLL_TransportRouting_Definitions all; +import from EPTF_CLL_TransportMessageBufferManager_Definitions all; +import from EPTF_CLL_Logging_Definitions all; +import from EPTF_CLL_TransportCommPortIPL4_Definitions all; +import from EPTF_CLL_HashMap_Definitions all; + +import from EPTF_HTTP_Definitions all; + +import from IPL4asp_Types all; + +import from TCCMaths_GenericTypes all; + +//============================================================================= +// Module parameters +//============================================================================= + +modulepar charstring tsp_EPTF_HTTP_Transport_loggingComponentMask := "EPTF_HTTP_Transport"; +modulepar boolean tsp_EPTF_HTTP_Transport_loggingEnable := false; +modulepar boolean tsp_EPTF_HTTP_Transport_bufferLogEnable := false; +modulepar boolean tsp_EPTF_HTTP_Transport_messageBufferEnable := false; +modulepar integer tsp_EPTF_HTTP_bufferSize := 100; + +//============================================================================= +// Data types +//============================================================================= + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Transport +// +// Purpose: +// The definitions of the EPTF HTTP Transport +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Transport { + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_ConnectionState + // + // Purpose: + // HTTP states + // + // Elements: + // IDLE(0), + // OPENED(1) + // HALFCLOSED(2) + // CLOSED(3) + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type enumerated EPTF_HTTP_Transport_ConnectionState { + IDLE, + OPENED, + HALFCLOSED, + CLOSED + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_PortType + // + // Purpose: + // Port type + // + // Elements: + // LISTENING(0) - + // INCOMING_PORT(1) - + // OUTGOING_PORT(2) - + // + /////////////////////////////////////////////////////////////////////////////// + type enumerated EPTF_HTTP_Transport_PortType{ + LISTENING_PORT, + INCOMING_PORT, + OUTGOING_PORT + } + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_GroupOperation_FT + // + // Purpose: + // Function type to a registerable callback functions to + // add/remove ports to/from a port group + // + // Elements: + // pl_group - *in* *integer* - port group index + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_GroupOperation_FT( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return boolean; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_SelectPort_FT + // + // Purpose: + // Function type to a registerable callback functions to + // select a port for sending within a port group + // + // Elements: + // pl_group - *in* *integer* - port group index + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_SelectPort_FT( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return integer; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_SessionOperation_FT + // + // Purpose: + // Function type to a registerable callback functions to + // provide a session operation on a group + // + // Elements: + // pl_group - *in* *integer* - port group index + // pl_sessionId - *in* *integer* - session id + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_SessionOperation_FT( + in integer pl_group, + in integer pl_sessionId) + runs on EPTF_HTTP_LocalTransport_CT; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_PortOperation_FT + // + // Purpose: + // Function type to a registerable callback functions to + // provide a session operation on a group + // + // Elements: + // pl_group - *in* *integer* - port group index + // pl_portId - *in* *integer* - port id + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_PortOperation_FT( + in integer pl_group, + in integer pl_portId) + runs on EPTF_HTTP_LocalTransport_CT; + + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_GetGroupAndPort_FT + // + // Purpose: + // Function type to a registerable callback functions to + // acquire port group and port index for a connection id + // + // Elements: + // pl_connId - *in* *integer* -connection id + // pl_group - *inout* *integer* - port group index + // pl_port - *inout* *integer* - port index + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_GetGroupAndPort_FT( + in integer pl_connId, + inout integer pl_group, + inout integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT return boolean; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_GetGroup_FT + // + // Purpose: + // Function type to a registerable callback functions to + // acquire port group ndex for a connection id + // + // Elements: + // pl_connId - *in* *integer* -connection id + // pl_groupId - *inout* *integer* - port group index + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_GetGroup_FT( + in integer pl_connId, + inout integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT return boolean; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_SendFunction_FT + // + // Purpose: + // Function type to a registerable callback functions to + // send an encoded message over a port group + // + // Elements: + // pl_group - *in* *integer* - port group index + // pl_sessionId - *in* *integer* - session id for sending + // pl_msg - *in* *octetstring* - message to send + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_SendFunction_FT( + in integer pl_group, + in integer pl_sessionId, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_SendResponse_FT + // + // Purpose: + // Function type to a registerable callback functions to + // send an encoded response over a port group + // + // Elements: + // pl_group - *in* *integer* - port group index + // pl_portId - *in* *integer* - port id for sending + // pl_seqNum - *in* *integer* - sequence number of the response + // pl_msg - *in* *octetstring* - response to send + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_SendResponse_FT( + in integer pl_group, + in integer pl_portId, + in integer pl_seqNum, + in octetstring pl_msg + ) + runs on EPTF_HTTP_LocalTransport_CT; + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_OpenConnection_FT + // + // Purpose: + // Function type to a registerable callback functions to + // open port / port group connection + // + // Elements: + // pl_group - *in* *integer* - port group index + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_OpenConnection_FT( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return boolean; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_CloseConnection_FT + // + // Purpose: + // Function type to a registerable callback functions to + // cloase port / port group connection + // + // Elements: + // pl_group - *in* *integer* - port group index + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_CloseConnection_FT( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_ReceiveMessage_FT + // + // Purpose: + // Function type to a registerable callback functions to + // handle a received message + // + // Elements: + // pl_group - *in* *integer* - port group index + // pl_port - *in* *integer* - port index + // pl_msg - *in* *octetstring* - message to send + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_ReceiveMessage_FT( + in integer pl_group, + in integer pl_port, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_ReceiveEvent_FT + // + // Purpose: + // Function type to a registerable callback functions to + // handle a received message + // + // Elements: + // pl_group - *in* *integer* - port group index + // pl_port - *in* *integer* - port index + // pl_type - *in* *integer* - event type + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_ReceiveEvent_FT ( + in integer pl_group, + in integer pl_port, + in integer pl_type) + runs on EPTF_HTTP_LocalTransport_CT; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Listen_FT + // + // Purpose: + // Function type to a registerable callback function for + // opening a listen port + // + // Elements: + // pl_group - *in* *integer* - port group index + // + // Return value: + // boolean - open result + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_Listen_FT( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return integer; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_CreateIncomingConn_FT + // + // Purpose: + // Function type to a registerable callback functions to + // store an incoming connection + // + // Elements: + // pl_group - *in* *integer* - port group index + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_CreateIncomingConn_FT( + in integer pl_group, + in ConnectionOpenedEvent pl_connOpened, + inout integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT return boolean; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_RemoveIncomingConn_FT + // + // Purpose: + // Function type to a registerable callback functions to + // remove an incoming connection + // + // Elements: + // pl_group - *in* *integer* - port group index + // pl_port - *in* *integer* - port index in the group + // + /////////////////////////////////////////////////////////////////////////////// + type function EPTF_HTTP_Transport_RemoveIncomingConn_FT( + in integer pl_group, + in integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_UserFunctions + // + // Purpose: + // Record to store function referencies for a port group + // + // Elements: + // addPort - <EPTF_HTTP_Transport_GroupOperation_FT> *optional* - add port function ref + // removePort - <EPTF_HTTP_Transport_GroupOperation_FT> *optional* - remove port function ref + // selectPort - <EPTF_HTTP_Transport_SelectPort_FT> *optional* - select port function ref + // sendMessage - <EPTF_HTTP_Transport_SendFunction_FT> *optional* - send message function ref + // closePortOfUser - <EPTF_HTTP_Transport_SessionOperation_FT> - close port of user function ref + // freePortOfUser - <EPTF_HTTP_Transport_SessionOperation_FT> - free port of user function ref + // openPort - <EPTF_HTTP_Transport_OpenConnection_FT> *optional* - open port function ref + // closeConnection - <EPTF_HTTP_Transport_CloseConnection_FT> *optional* - close port function ref + // halfClosePort - <EPTF_HTTP_Transport_CloseConnection_FT> *optional* - half close port function ref + // receiveMessage - <EPTF_HTTP_Transport_ReceiveMessage_FT> *optional* - receive message function ref + // receiveEvent - <EPTF_HTTP_Transport_ReceiveEvent_FT> *optional* - receive event function ref + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_UserFunctions + { + EPTF_HTTP_Transport_GroupOperation_FT addPort optional, + EPTF_HTTP_Transport_GroupOperation_FT removePort optional, + EPTF_HTTP_Transport_SelectPort_FT selectPort optional, + EPTF_HTTP_Transport_SendFunction_FT sendMessage optional, + EPTF_HTTP_Transport_SessionOperation_FT closePortOfUser optional, + EPTF_HTTP_Transport_SessionOperation_FT freePortOfUser optional, + EPTF_HTTP_Transport_OpenConnection_FT openPort optional, + EPTF_HTTP_Transport_CloseConnection_FT closeConnection optional, + EPTF_HTTP_Transport_CloseConnection_FT halfClosePort optional, + EPTF_HTTP_Transport_ReceiveMessage_FT receiveMessage optional, + EPTF_HTTP_Transport_ReceiveEvent_FT receiveEvent optional + } + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_initUserFunctions + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_Transport_UserFunctions c_EPTF_HTTP_initUserFunctions :={ + omit, + omit, + omit, + omit, + omit, + omit, + omit, + omit, + omit, + omit, + omit + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_ServerUserFunctions + // + // Purpose: + // Record to store function referencies for a server port group + // + // Elements: + // removePort - <EPTF_HTTP_Transport_GroupOperation_FT> *optional* - remove port function ref + // listen - <EPTF_HTTP_Transport_Listen_FT> *optional* - open a listen port function ref + // createIncomingConn - <EPTF_HTTP_Transport_CreateIncomingConn_FT> *optional* - create incoming connection function ref + // removeIncomingConn - <EPTF_HTTP_Transport_RemoveIncomingConn_FT> *optional* - remove incoming connection function ref + // sendResponse - <EPTF_HTTP_Transport_SendResponse_FT> *optional* - send response function ref + // receiveMessage - <EPTF_HTTP_Transport_ReceiveMessage_FT> *optional* - receive message function ref + // receiveEvent - <EPTF_HTTP_Transport_ReceiveEvent_FT> *optional* - receive event function ref + // closePort - <EPTF_HTTP_Transport_PortOperation_FT> - close connection function ref + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_ServerUserFunctions + { + EPTF_HTTP_Transport_GroupOperation_FT removePort optional, + EPTF_HTTP_Transport_Listen_FT listen optional, + EPTF_HTTP_Transport_CreateIncomingConn_FT createIncomingConn optional, + EPTF_HTTP_Transport_RemoveIncomingConn_FT removeIncomingConn optional, + EPTF_HTTP_Transport_SendResponse_FT sendResponse optional, + EPTF_HTTP_Transport_ReceiveMessage_FT receiveMessage optional, + EPTF_HTTP_Transport_ReceiveEvent_FT receiveEvent optional, + EPTF_HTTP_Transport_PortOperation_FT closePort optional + } + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_initUserFunctions + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_Transport_ServerUserFunctions c_EPTF_HTTP_initServerUserFunctions :={ + removePort := omit, + listen := omit, + createIncomingConn := omit, + removeIncomingConn := omit, + sendResponse := omit, + receiveMessage := omit, + receiveEvent := omit, + closePort := omit + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_GroupMode + // + // Purpose: + // Record to store information on a port group + // + // Elements: + // name - *charstring* *optional* - unique name of the group + // localHostInformation - <EPTF_HTTP_HostInformation> - local IP address + // and port + // remoteHostInformation - <EPTF_HTTP_HostInformation> - remote IP address + // and port + // numberOfPorts - *integer* - number of ports within the group to be + // created + // localportStep - *integer* - step of local port number after creation + // of each port + // remoteportStep - *integer* - step of remote port number after creation + // of each port + // instantConnOpen - *boolean* - instant connection open mode + // instantConnClose - *boolean* - instant connection close mode + // useSSL - *boolean* - use ssl mode + // userFunctions - <EPTF_HTTP_Transport_UserFunctions> *optional* - + // function references of group callback functions if needed + // + // Detailed Comments: + // Used for port group creation + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_GroupMode { + charstring name optional, + + EPTF_HTTP_HostInformation localHostInformation, + EPTF_HTTP_HostInformation remoteHostInformation, + integer numberOfPorts, + integer localportStep, + integer remoteportStep, + + boolean instantConnOpen, + boolean instantConnClose, + boolean useSSL, + + EPTF_HTTP_Transport_UserFunctions userFunctions optional + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_PortMode + // + // Purpose: + // Record to store information on a port group + // + // Elements: + // name - *charstring* *optional* - unique name of the port + // localHostInformation - <EPTF_HTTP_HostInformation> - local IP address + // and port + // remoteHostInformation - <EPTF_HTTP_HostInformation> - remote IP address + // and port + // instantConnOpen - *boolean* - instant connection open mode + // instantConnClose - *boolean* - instant connection close mode + // useSSL - *boolean* - use ssl mode + // userFunctions - <EPTF_HTTP_Transport_UserFunctions> *optional* - + // function references of group callback functions if needed + // + // Detailed Comments: + // Used for port creation + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_PortMode { + charstring name optional, + + EPTF_HTTP_HostInformation localHostInformation, + EPTF_HTTP_HostInformation remoteHostInformation, + + boolean instantConnOpen, + boolean instantConnClose, + boolean useSSL, + + EPTF_HTTP_Transport_UserFunctions userFunctions optional + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_ServerPortMode + // + // Purpose: + // Contains information to create a new listening port group. + // + // Elements: + // name - *charstring* - unique name of the port + // localHostInformation - <EPTF_HTTP_HostInformation> - local IP address + // and port + // instantConnClose - *boolean* - instant connection close mode + // userFunctions - <EPTF_HTTP_Transport_ListeningUserFunctions> *optional* - + // function references of group callback functions if needed + // buffer - *boolean* - buffering mode + // useSSL - *boolean* - use SSL socket + // + // Detailed Comments: + // Used for port creation + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_ServerPortMode{ + charstring name, + + EPTF_HTTP_HostInformation localHostInformation, + boolean instantConnClose, + + EPTF_HTTP_Transport_ServerUserFunctions userFunctions optional, + boolean buffer, + boolean useSSL optional + } + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_initServerPortMode + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_Transport_ServerPortMode c_EPTF_HTTP_initServerPortMode :={ + name := "", + localHostInformation := {"", -1}, + instantConnClose := false, + userFunctions := omit, + buffer := false, + useSSL := omit + } + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Function + // + // Purpose: + // Record to store an element of the function group database + // + // Elements: + // addPort - <EPTF_HTTP_Transport_GroupOperation_FT> - add port function ref + // removePort - <EPTF_HTTP_Transport_GroupOperation_FT> - remove port function ref + // selectPort - <EPTF_HTTP_Transport_SelectPort_FT> - select port function ref + // sendMessage - <EPTF_HTTP_Transport_SendFunction_FT> - send message function ref + // closePortOfUser - <EPTF_HTTP_Transport_SessionOperation_FT> - close port of user function ref + // freePortOfUser - <EPTF_HTTP_Transport_SessionOperation_FT> - free port of user function ref + // openPort - <EPTF_HTTP_Transport_OpenConnection_FT> - open port function ref + // closeConnection - <EPTF_HTTP_Transport_CloseConnection_FT> - close port function ref + // halfClosePort - <EPTF_HTTP_Transport_CloseConnection_FT> - half close port function ref + // receiveMessage - <EPTF_HTTP_Transport_ReceiveMessage_FT> - receive message function ref + // receiveEvent - <EPTF_HTTP_Transport_ReceiveEvent_FT> - receive event function ref + // listen - <EPTF_HTTP_Transport_Listen_FT> - open a listen port function ref + // createIncomingConn - <EPTF_HTTP_Transport_CreateIncomingConn_FT> - create incoming connection function ref + // removeIncomingConn - <EPTF_HTTP_Transport_RemoveIncomingConn_FT> *optional* - remove incoming connection function ref + // closePort - <EPTF_HTTP_Transport_PortOperation_FT> - close connection function ref + // + // Detailed Comments: + // A port group has a number of registerable and stateless callback + // functions to handle communication. These kind of function sets can + // be registered into the function database. This element contains + // one functions set. + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_Function + { + EPTF_HTTP_Transport_GroupOperation_FT addPort, + EPTF_HTTP_Transport_GroupOperation_FT removePort, + EPTF_HTTP_Transport_SelectPort_FT selectPort, + EPTF_HTTP_Transport_SendFunction_FT sendMessage, + EPTF_HTTP_Transport_SendResponse_FT sendResponse, + EPTF_HTTP_Transport_SessionOperation_FT closePortOfUser, + EPTF_HTTP_Transport_SessionOperation_FT freePortOfUser, + EPTF_HTTP_Transport_OpenConnection_FT openPort, + EPTF_HTTP_Transport_CloseConnection_FT closeConnection, + EPTF_HTTP_Transport_CloseConnection_FT halfClosePort, + EPTF_HTTP_Transport_ReceiveMessage_FT receiveMessage, + EPTF_HTTP_Transport_ReceiveEvent_FT receiveEvent, + EPTF_HTTP_Transport_Listen_FT listen, + EPTF_HTTP_Transport_CreateIncomingConn_FT createIncomingConn, + EPTF_HTTP_Transport_RemoveIncomingConn_FT removeIncomingConn, + EPTF_HTTP_Transport_PortOperation_FT closePort + } + + /////////////////////////////////////////////////////////////////////////////// + // const: c_HTTP_Transport_initFunction + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_Transport_Function c_HTTP_Transport_initFunction:= + { + addPort := null, + removePort := null, + selectPort := null, + sendMessage := null, + sendResponse := null, + closePortOfUser := null, + freePortOfUser := null, + openPort := null, + closeConnection := null, + halfClosePort := null, + receiveMessage := null, + receiveEvent := null, + listen := null, + createIncomingConn := null, + removeIncomingConn := null, + closePort := null + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_FunctionList + // + // Purpose: + // Function database for port groups + // + // Elements: + // record of <EPTF_HTTP_Transport_Function> + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_Transport_Function EPTF_HTTP_Transport_FunctionList; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_PortInfo + // + // Purpose: + // A port connection database element + // + // Elements: + // groupIndex - *integer* - index of the port group in which the + // port is situated + // portIndex - *integer* - self index of the port within the port + // connection database + // connectionId - *integer* - connection id of the current port + // localhostInfoIdx - *integer* - localhost information database index to + // acquire local IP adress and port number + // remotehostInfoIdx - *integer* - remotehost information database index to + // acquire remote IP adress and port number + // state - <EPTF_HTTP_Transport_ConnectionState> - state of current port + // portType - <EPTF_HTTP_Transport_PortType> - port type + // buffer - *boolean* - buffering mode + // mesageBuffer - <EPTF_HTTP_Buffer> - buffer for sequencing outgoing responses + // + // Detailed Comments: + // A port group has a number of registerable and stateless callback + // functions to handle communication. These kind of function sets can + // be registered into the function database. This element contains + // one functions set. + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_PortInfo { + integer groupIndex, + integer portIndex, + integer connectionId, + integer sessionId, + integer portId, + integer localhostInfoIdx, + integer remotehostInfoIdx, + EPTF_HTTP_Transport_ConnectionState state, + EPTF_HTTP_Transport_PortType portType, + boolean buffer, + EPTF_HTTP_MessageBuffer messageBuffer optional + } + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_LocalTransport_initPortInfo + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_Transport_PortInfo c_EPTF_HTTP_LocalTransport_initPortInfo :={ + groupIndex := -1, + portIndex := -1, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := -1, + remotehostInfoIdx := -1, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_MessageBuffer + // + // Purpose: + // Message buffer for response sequencing. + // + // Elements: + // seqNums - <EPTF_HTTP_SeqNumMgmt> - sequence number management + // seqNum2messageIdxHM - *integer* - hashmap reference to map a sequence number to a message queue index + // messageQueue - <EPTF_FreeBusyQueue> - index management for the message queue + // httpMessages - <EPTF_OctetstringList> - http messages in the buffer + // + // Detailed Comments: + // In case of a pipelining on a persistent connection the server MUST send its + // responses to the requests in the same order that the requests were received. + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_MessageBuffer + { + EPTF_HTTP_RingBuffer seqNums, + integer seqNum2messageIdxHM, + EPTF_FreeBusyQueue messageQueue, + OctetStringList httpMessages + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_RingBuffer + // + // Purpose: + // Handles sequence numbers of the responses + // + // Elements: + // isSlotBusyHM - *integer* - to decide if a given slot is busy + // nextSeqNum - *integer* - the sequence number of the next incoming request + // waitForSeqNum - *integer* - the sequence number of the next response to send out + // usedSlots - *integer* - number of used slowts in the buffer + // maxSize - *integer* - maximum size of the buffer + // + // Detailed Comments: + // In case of a pipelining on a persistent connection the server MUST send its + // responses to the requests in the same order that the requests were received. + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_RingBuffer{ + integer isSlotBusyHM, + integer nextSeqNum, + integer waitForSeqNum, + integer usedSlots, + integer maxSize + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_PortInfoList + // + // Purpose: + // Port connection database of a port group + // + // Elements: + // record of <EPTF_HTTP_Transport_PortInfo> + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_Transport_PortInfo EPTF_HTTP_Transport_PortInfoList; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_PortGroup + // + // Purpose: + // An element of the port group database of the HTTP transport component + // + // Elements: + // name - *charstring* - unique name of the port group + // localHostInformation - <EPTF_HTTP_HostInformation> - base local IP + // address and port + // remoteHostInformation - <EPTF_HTTP_HostInformation> - base remote IP + // address and port + // currentPortId - *integer* - used to generate unique portId + // numberOfPorts - *integer* - number of ports within the group to be + // created + // localportStep - *integer* - step of local port number after creation + // of each port + // remoteportStep - *integer* - step of remote port number after creation + // of each port + // portDatabase - <EPTF_HTTP_Transport_PortInfoList> - port connection + // database of the group + // listeningPort - <EPTF_HTTP_Transport_PortInfo> *optional* - listening port info + // defaultFIdx - *integer* - function group database pointer + // portQueue - <EPTF_FreeBusyQueue> - FBQ to maintain status of ports + // within the group + // portStateQueue - <EPTF_FreeBusyQueue> - FBQ to maintain sending status + // of ports within the group + // useSSL - *boolean* - use ssl mode + // instantConnOpen - *boolean* - instant connection open mode + // instantConnClose - *boolean* - instant connection close mode + // buffer - *boolean* - buffer mode + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_PortGroup { + charstring name, + + EPTF_HTTP_HostInformation baseLocalHostInformation, + EPTF_HTTP_HostInformation baseRemoteHostInformation, + integer currentPortId, + integer numberOfPorts, + integer localportStep, + integer remoteportStep, + + EPTF_HTTP_Transport_PortInfoList portDatabase, + integer listeningPortIdx, + + integer defaultFIdx, + + EPTF_FreeBusyQueue portQueue, + EPTF_FreeBusyQueue portStateQueue, + boolean useSSL, + boolean instantConnOpen, + boolean instantConnClose, + boolean buffer + } + + /////////////////////////////////////////////////////////////////////////////// + // const: c_HTTP_Transport_initPortGroup + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_Transport_PortGroup c_HTTP_Transport_initPortGroup := + { + name := "", + baseLocalHostInformation := {"", -1}, + baseRemoteHostInformation := {"", -1}, + currentPortId := 0, + numberOfPorts := 0, + localportStep := -1, + remoteportStep := -1, + portDatabase := {}, + listeningPortIdx := -1, + defaultFIdx := -1, + portQueue := c_EPTF_emptyFreeBusyQueue, + portStateQueue := c_EPTF_emptyFreeBusyQueue, + useSSL := false, + instantConnOpen := false, + instantConnClose := false, + buffer := false + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_PortGroupList + // + // Purpose: + // Port group database of the HTTP transport component + // + // Elements: + // record of <EPTF_HTTP_Transport_PortGroup> + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_Transport_PortGroup EPTF_HTTP_Transport_PortGroupList; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_NewPortGroup + // + // Purpose: + // Remote transport ASP API element for port group creation + // + // Elements: + // groupInfo - <EPTF_HTTP_Transport_GroupMode> - port group info + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_NewPortGroup { + EPTF_HTTP_Transport_GroupMode groupInfo + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_DeletePortGroup + // + // Purpose: + // Remote transport ASP API element for port group deletion + // + // Elements: + // groupId - *integer* - port group index of created port group + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_DeletePortGroup { + integer groupId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_NewPort + // + // Purpose: + // Remote transport ASP API element for port creation + // + // Elements: + // portInfo - <EPTF_HTTP_Transport_PortMode> - port info + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_NewPort { + EPTF_HTTP_Transport_PortMode portInfo + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_NewServerPort + // + // Purpose: + // Remote transport ASP API element for a server port creation + // + // Elements: + // portInfo - <EPTF_HTTP_Transport_ServerPortMode> - server port info + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_NewServerPort { + EPTF_HTTP_Transport_ServerPortMode portInfo + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_DeletePort + // + // Purpose: + // Remote transport ASP API element for port deletion + // + // Elements: + // portId - *integer* - port group index of port to be deleted + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_DeletePort { + integer portId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_AddPort + // + // Purpose: + // Remote transport ASP API element for add port to a port group + // + // Elements: + // groupId - *integer* - port group index of group to which a new port + // is to be added + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_AddPort { + integer groupId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_RemovePort + // + // Purpose: + // Remote transport ASP API element for remove port from a port group + // + // Elements: + // groupId - *integer* - port group index of group from which a port + // is to be removed + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_RemovePort { + integer groupId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Send + // + // Purpose: + // Remote transport ASP API element for send a message + // + // Elements: + // groupId - *integer* - the ID of the group on which the message + // should be sent + // sessionId - *integer* - entity index as session id for current send + // outgoingMessage - *octetstring* - outgoing message + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_Send { + integer groupId, + integer sessionId, + octetstring outgoingMessage + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_ClosePortOfUser + // + // Purpose: + // Remote transport ASP API element for close port of user + // + // Elements: + // groupId - *integer* - the ID of the group on which the message + // should be sent + // sessionId - *integer* - entity index as session id for current send + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_ClosePortOfUser { + integer groupId, + integer sessionId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_FreePortOfUser + // + // Purpose: + // Remote transport ASP API element for free port of user + // + // Elements: + // groupId - *integer* - the ID of the group on which the message + // should be sent + // sessionId - *integer* - entity index as session id for current send + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_FreePortOfUser { + integer groupId, + integer sessionId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Connect + // + // Purpose: + // Remote transport ASP API element for open a connection + // + // Elements: + // groupId - *integer* - the ID of the group whose connections should + // be opened + // sessionId - *integer* - entity index as session id for current open + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_Connect { + integer groupId, + integer sessionId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Close + // + // Purpose: + // Remote transport ASP API element for close a connection + // + // Elements: + // groupId - *integer* - the ID of the group whose connections should + // be closed + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_Close { + integer groupId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_HalfClose + // + // Purpose: + // Remote transport ASP API element for half close a connection + // + // Elements: + // groupId - *integer* - the ID of the group whose connections should + // be half closed + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_HalfClose { + integer groupId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Listen + // + // Purpose: + // Remote transport ASP API element for opening a listen connection + // + // Elements: + // groupId - *integer* - the ID of the server group + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_Listen { + integer groupId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_closePort + // + // Purpose: + // Remote transport ASP API element for closing a port + // + // Elements: + // groupId - *integer* - the ID of the group + // portId - *integer* - the port identifier + // + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_closePort{ + integer groupId, + integer portId + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_SendResponse + // + // Purpose: + // Remote transport ASP API element for send a response. + // + // Elements: + // groupId - *integer* - the ID of the group on which the message + // should be sent + // portId - *integer* - the unique port identifier of the request + // msg - *octetstring* - outgoing response + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_SendResponse{ + integer groupId, + integer portId, + integer seqNum, + octetstring msg + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Result + // + // Purpose: + // Remote transport ASP API element for result notification + // + // Elements: + // groupId - *integer* - the ID of the group whose port got the event + // resultType - *integer* - event type + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_Result { + integer groupId, + integer sessionId, + integer resultType + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Receive + // + // Purpose: + // Remote transport ASP API element for message reception handling + // + // Elements: + // groupId - *integer* - port group identifier of the request + // sessionId - *integer* - unique id of the request + // seqNum- *integer* - sequence number of the request + // reveivedMessage - *octetstring* - received message + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_Receive { + integer groupId, + integer sessionId, + integer seqNum, + octetstring reveivedMessage + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Error + // + // Purpose: + // Remote transport ASP API element for error socket notification + // + // Elements: + // groupId - *integer* - the ID of the group whose port got the event + // result - <Result> - Contains IPL4 Result message + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_Error { + integer groupId, + integer sessionId, + Result result + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_ListenEvent + // + // Purpose: + // Remote transport ASP API element for listen socket event notification + // + // Elements: + // groupId - *integer* - port group ID + // hostInfo - <EPTF_HTTP_HostInformation> - listening address and port + // eventType - *integer* - event type + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_ListenEvent{ + integer groupId, + EPTF_HTTP_HostInformation hostInfo, + integer eventType + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_ListenError + // + // Purpose: + // Remote transport ASP API element for listen socket error notification + // + // Elements: + // groupId - *integer* - port group ID + // hostInfo - <EPTF_HTTP_HostInformation> - listening address and port + // transportError - <EPTF_HTTP_Error> - error + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Transport_ListenError{ + integer groupId, + EPTF_HTTP_HostInformation hostInfo, + EPTF_HTTP_Error transportError + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_PT + // + // Purpose: + // EPTF HTTP internal communication port + // + // Elements: + // EPTF_HTTP_Transport_NewPortGroup + // EPTF_HTTP_Transport_NewPort + // EPTF_HTTP_Transport_NewServerPort + // EPTF_HTTP_Transport_DeletePortGroup + // EPTF_HTTP_Transport_DeletePort + // EPTF_HTTP_Transport_AddPort + // EPTF_HTTP_Transport_RemovePort + // EPTF_HTTP_Transport_Send + // EPTF_HTTP_Transport_ClosePortOfUser + // EPTF_HTTP_Transport_FreePortOfUser + // EPTF_HTTP_Transport_Connect + // EPTF_HTTP_Transport_Close + // EPTF_HTTP_Transport_HalfClose + // EPTF_HTTP_Transport_Listen + // EPTF_HTTP_Transport_SendResponse + // EPTF_HTTP_Transport_Result + // EPTF_HTTP_Transport_Receive + // EPTF_HTTP_Transport_Error + // EPTF_HTTP_Transport_ListenEvent + // EPTF_HTTP_Transport_ListenError + // EPTF_HTTP_Transport_closePort + // integer + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type port EPTF_HTTP_Transport_PT message + { + inout EPTF_HTTP_Transport_NewPortGroup; + inout EPTF_HTTP_Transport_NewPort; + inout EPTF_HTTP_Transport_NewServerPort; + inout EPTF_HTTP_Transport_DeletePortGroup; + inout EPTF_HTTP_Transport_DeletePort; + inout EPTF_HTTP_Transport_AddPort; + inout EPTF_HTTP_Transport_RemovePort; + inout EPTF_HTTP_Transport_Send; + inout EPTF_HTTP_Transport_ClosePortOfUser; + inout EPTF_HTTP_Transport_FreePortOfUser; + inout EPTF_HTTP_Transport_Connect; + inout EPTF_HTTP_Transport_Close; + inout EPTF_HTTP_Transport_HalfClose; + inout EPTF_HTTP_Transport_Listen; + inout EPTF_HTTP_Transport_SendResponse + inout EPTF_HTTP_Transport_Result; + inout EPTF_HTTP_Transport_Receive; + inout EPTF_HTTP_Transport_Error; + inout EPTF_HTTP_Transport_ListenEvent; + inout EPTF_HTTP_Transport_ListenError; + inout EPTF_HTTP_Transport_closePort; + inout integer; + } with {extension "internal"} + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Base_CTList + // + // Purpose: + // Routing component CT list + // + // Elements: + // record of <EPTF_Base_CT> + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record of EPTF_Base_CT EPTF_HTTP_Base_CTList; +} + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_LocalTransport +// +// Purpose: +// The definitions of the EPTF HTTP Local Transport +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_LocalTransport { + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_LocalTransport_CT + // + // Purpose: + // EPTF HTTP local transport component + // + // Extends: + // EPTF_MessageBufferManager_CT + // + // EPTF_HTTP_LoggerClient_CT + // + // EPTF_HTTP_Transport_Logging_CT (this extends EPTF_Logging_CT) + // + // EPTF_CommPort_IPL4_CT + // + // EPTF_Base_CT + // + // Ports: + // pf_EPTF_HTTP_LocalTransport_commPort - <EPTF_HTTP_Transport_PT> - local transport communication port + // + // Timers: + // - + // + // Elements: + // vf_EPTF_HTTP_LocalTransport_receive - <EPTF_HTTP_messageProcess_FT> - + // receive message callback function pointer + // vf_EPTF_HTTP_LocalTransport_eventReceive - <EPTF_HTTP_eventReceive_FT> - + // receive event callback function pointer + // vf_EPTF_HTTP_LocalTransport_socketErrorReceive - <EPTF_HTTP_socketErrorReceive_FT> - + // receive socket error callback function pointer + // vf_EPTF_HTTP_LocalTransport_listenSocketEvent - <EPTF_HTTP_listenSocketEvent_FT> - + // receive lisent socket event callback function pointer + // vf_EPTF_HTTP_LocalTransport_listenSocketError - <EPTF_HTTP_listenSocketError_FT> - + // receive lisent socket error callback function pointer + // vf_EPTF_HTTP_messageSentHook - <fcb_EPTF_HTTP_messageSentHook> - + // callback function that is invoked after each HTTP message is sent + // + // v_EPTF_HTTP_LocalTransport_loggingEnabled - *integer* - + // the Variable of the GUI logging + // v_EPTF_HTTP_LocalTransport_guiEnabled - *boolean* - GUI Logging enabled + // v_EPTF_HTTP_LocalTransport_initialized - *boolean* - + // The component initialized variable + // v_EPTF_HTTPLocalTransport_lengthCalculationFunctions - <EPTF_HTTP_LocalTransport_MessageLengthCalculationFunctionList> - + // message length calcualtion function list + // + // v_EPTF_HTTP_LocalTransport_selfName - *charstring* - self name of the component + // v_EPTF_HTTP_Transport_groupQueue - <EPTF_FreeBusyQueue> - FBQ to maintain port groups + // v_EPTF_HTTP_Transport_portDB - <EPTF_HTTP_Transport_PortGroupList> - port group database + // v_EPTF_HTTP_Transport_functionDB - <EPTF_HTTP_Transport_FunctionList> - function database + // + // v_EPTF_HTTP_Transport_groupName2Idx_HM - *integer* - group name to group index hash map handle + // v_EPTF_HTTP_Transport_functions2Idx_HM - *integer* - function set to function database hash map handle + // v_EPTF_HTTP_Transport_remoteHostHashMap - *integer* - remote host hash map handle + // v_EPTF_HTTP_Transport_localHostHashMap - *integer* - local host hash map handle + // v_EPTF_HTTP_Transport_connId2GroupId_HM - *integer* - connection id to group index hash map handle + // v_EPTF_HTTP_Transport_connId2PortId_HM - *integer* - connection id to port index hash map handle + // + // v_nameIdx - *integer* - variable to store current highest port group name index + // + // v_resultNoWarning - <Result> - dummy variable to suppress warnings + // v_boolNoWarning - *boolean* - dummy variable to suppress warnings + // v_intNoWarning - *integer* - dummy variable to suppress warnings + // + // v_EPTF_HTTP_Transport_localHostInformationList - <EPTF_HTTP_HostInformationList> - local host + // information database + // v_EPTF_HTTP_Transport_remoteHostInformationList - <EPTF_HTTP_HostInformationList> - remote + // host information database + // + // v_EPTF_HTTP_Transport_OutgoingMessage - <EPTF_CommPort_IPL4_ASP_OutgoingMessage> - + // outgoing message + // + /////////////////////////////////////////////////////////////////////////////// + type component EPTF_HTTP_LocalTransport_CT extends + EPTF_MessageBufferManager_CT, + EPTF_HTTP_Transport_Logging_CT, + EPTF_CommPort_IPL4_CT, + EPTF_Base_CT + { + var EPTF_HTTP_messageProcess_FT vf_EPTF_HTTP_LocalTransport_receive := null; + var EPTF_HTTP_eventReceive_FT vf_EPTF_HTTP_LocalTransport_eventReceive := null; + var EPTF_HTTP_socketErrorReceive_FT vf_EPTF_HTTP_LocalTransport_socketErrorReceive := null; + + var EPTF_HTTP_listenSocketEvent_FT vf_EPTF_HTTP_LocalTransport_listenSocketEvent := null; + var EPTF_HTTP_listenSocketError_FT vf_EPTF_HTTP_LocalTransport_listenSocketError := null + var fcb_EPTF_HTTP_messageSentHook vf_EPTF_HTTP_messageSentHook := null; + + var integer v_EPTF_HTTP_LocalTransport_loggingEnabled := -1; + var boolean v_EPTF_HTTP_LocalTransport_guiEnabled := false; + var boolean v_EPTF_HTTP_LocalTransport_initialized := false; + var EPTF_HTTP_LocalTransport_MessageLengthCalculationFunctionList v_EPTF_HTTPLocalTransport_lengthCalculationFunctions := {}; + + var EPTF_HTTP_Transport_GetGroupAndPort_FT vf_getGroupAndPort := null; + var EPTF_HTTP_Transport_GetGroup_FT vf_getGroup := null; + + + var charstring v_EPTF_HTTP_LocalTransport_selfName := "EPTF_HTTP_Transport"; + + var EPTF_FreeBusyQueue v_EPTF_HTTP_Transport_groupQueue; + var EPTF_HTTP_Transport_PortGroupList v_EPTF_HTTP_Transport_portDB := {}; + var integer v_EPTF_HTTP_Transport_groupName2Idx_HM := -1; + + var EPTF_HTTP_Transport_FunctionList v_EPTF_HTTP_Transport_functionDB := {}; + var integer v_EPTF_HTTP_Transport_functions2Idx_HM := -1; + + var integer v_EPTF_HTTP_Transport_connId2GroupId_HM := -1; + var integer v_EPTF_HTTP_Transport_connId2PortId_HM := -1; + var integer v_EPTF_HTTP_Transport_sessId2PortId_HM := -1; + var integer v_EPTF_HTTP_Transport_portId2Idx_HM := -1; + + var integer v_nameIdx := 0; + var Result v_resultNoWarning; + var boolean v_boolNoWarning; + var integer v_intNoWarning; + + var EPTF_HTTP_HostInformationList v_EPTF_HTTP_Transport_localHostInformationList := {}; + var integer v_EPTF_HTTP_Transport_localHostHashMap := -1; + + var EPTF_HTTP_HostInformationList v_EPTF_HTTP_Transport_remoteHostInformationList := {}; + var integer v_EPTF_HTTP_Transport_remoteHostHashMap := -1; + + var integer v_EPTF_HTTP_Transport_lastReceivedGroup := -1; + var EPTF_CommPort_IPL4_ASP_OutgoingMessage v_EPTF_HTTP_Transport_OutgoingMessage; + + var integer v_EPTF_HTTP_Transport_bufferSize := tsp_EPTF_HTTP_bufferSize; + + port EPTF_HTTP_Transport_PT pf_EPTF_HTTP_LocalTransport_commPort; + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_LocalTransport_CTList + // + // Purpose: + // Remote transport CT list + // + // Elements: + // record of <EPTF_HTTP_LocalTransport_CT> + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_LocalTransport_CT EPTF_HTTP_LocalTransport_CTList; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_LocalTransport_MessageLengthCalculationFunctionList + // + // Purpose: + // Message length calculation function database + // + // Elements: + // record of <f_IPL4_getMsgLen> + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record of f_IPL4_getMsgLen + EPTF_HTTP_LocalTransport_MessageLengthCalculationFunctionList; + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_LocalTransport_idx_getMessageLength + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_LocalTransport_idx_getMessageLength := 0; + + /////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_LocalTransport_idx_getMessageLength4Diameter + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_LocalTransport_idx_getMessageLength4Diameter := 1; + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_LocalTransport_idx_getMessageLengthChunkedCoding + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_LocalTransport_idx_getMessageLengthChunkedCoding := 2; + + /////////////////////////////////////////////////////////////////////////////// + // const: Hash map name constants for Local transport + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_LocalTransport_HashMap_groupName2Idx := "EPTF HTTP: Group name to group index HashMap"; + const charstring c_EPTF_HTTP_LocalTransport_HashMap_fnGrp2Idx := "EPTF HTTP: Function group to index HashMap"; + const charstring c_EPTF_HTTP_LocalTransport_HashMap_localHost := "EPTF HTTP: Local Host HashMap"; + const charstring c_EPTF_HTTP_LocalTransport_HashMap_remoteHost := "EPTF HTTP: Remote Host HashMap"; + const charstring c_EPTF_HTTP_LocalTransport_HashMap_connId2PortGrp := "EPTF HTTP: Connection id to Port group index HashMap"; + const charstring c_EPTF_HTTP_LocalTransport_HashMap_connId2Port := "EPTF HTTP: Connection id to Port index within port group HashMap"; + const charstring c_EPTF_HTTP_LocalTransport_HashMap_sessId2Port := "EPTF HTTP: Session id to Port index within port group HashMap"; + const charstring c_EPTF_HTTP_LocalTransport_HashMap_portId2Idx := "EPTF HTTP: Port id to Port index within port group HashMap"; + const charstring c_EPTF_HTTP_LocalTransport_HashMap_isSlotBusy := "EPTF HTTP: Buffer queue HashMap"; + const charstring c_EPTF_HTTP_LocalTransport_HashMap_seqNum2messageIdx := "EPTF HTTP: Sequence number to message queue index HashMap"; +} + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_RemoteTransport +// +// Purpose: +// The definitions of the EPTF HTTP Remote Transport +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_RemoteTransport +{ + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_RemoteTransport_CT + // + // Purpose: + // EPTF HTTP remote transport component + // + // Extends: + // EPTF_Base_CT + // EPTF_HTTP_Transport_Logging_CT (this extends EPTF_Logging_CT) + // + // Ports: + // v_EPTF_HTTP_RemoteTransport_commPort - <EPTF_HTTP_Transport_PT> - + // internal communication port + // + // Timers: + // - + // + // Elements: + // v_EPTF_HTTP_RemoteTransport_selfName - *charstring* - self name of the + // component + // v_EPTF_HTTP_RemoteTransport_result - <EPTF_HTTP_Transport_Result> - + // Remote transport internal communication ASP for incoming events + // v_EPTF_HTTP_RemoteTransport_receive - <EPTF_HTTP_Transport_Receive> - + // Remote transport internal communication ASP for incoming messages + // v_EPTF_HTTP_RemoteTransport_error - <EPTF_HTTP_Transport_Error> - + // Remote transport internal communication ASP for error messages + // v_EPTF_HTTP_RemoteTransport_listenEvent - <EPTF_HTTP_Transport_ListenEvent> - + // Remote transport internal communication ASP for listening socket events + // v_EPTF_HTTP_RemoteTransport_listenError - <EPTF_HTTP_Transport_ListenError> - + // Remote transport internal communication ASP for listening socket errors + // vf_EPTF_HTTP_RemoteTransport_handleReceive - <EPTF_HTTP_messageProcess_FT> - + // receive callback function pointer + // vf_EPTF_HTTP_RemoteTransport_eventReceive - <EPTF_HTTP_eventReceive_FT> - + // receive event callback function pointer + // vf_EPTF_HTTP_RemoteTransport_socketErrorReceive - <EPTF_HTTP_socketErrorReceive_FT> - + // receive socket error callback function pointer + // v_EPTF_HTTP_RemoteTransport_default - *default* - remote transport + // default altstep handler + // v_EPTF_HTTP_RemoteTransport_initialized - *boolean* - remote transport + // component initialization state + // v_EPTF_HTTP_RemoteTransport_transportIdToConnId - *integer* - hash map + // index + // v_EPTF_HTTP_Mapper_halfClose - <EPTF_HTTP_Transport_HalfClose> - HTTP + // half close message ASP + // + /////////////////////////////////////////////////////////////////////////////// + type component EPTF_HTTP_RemoteTransport_CT extends + EPTF_Base_CT, + EPTF_HTTP_Transport_Logging_CT, + EPTF_HashMap_CT + { + var charstring v_EPTF_HTTP_RemoteTransport_selfName := "EPTF_HTTP_RemoteTransport"; + + var EPTF_HTTP_Transport_Result v_EPTF_HTTP_RemoteTransport_result; + var EPTF_HTTP_Transport_Receive v_EPTF_HTTP_RemoteTransport_receive; + var EPTF_HTTP_Transport_Error v_EPTF_HTTP_RemoteTransport_error; + + var EPTF_HTTP_Transport_ListenEvent v_EPTF_HTTP_RemoteTransport_listenEvent; + var EPTF_HTTP_Transport_ListenError v_EPTF_HTTP_RemoteTransport_listenError; + + var EPTF_HTTP_messageProcess_FT vf_EPTF_HTTP_RemoteTransport_handleReceive := null; + var EPTF_HTTP_eventReceive_FT vf_EPTF_HTTP_RemoteTransport_eventReceive := null; + var EPTF_HTTP_socketErrorReceive_FT vf_EPTF_HTTP_RemoteTransport_socketErrorReceive := null; + + var EPTF_HTTP_listenSocketEvent_FT vf_EPTF_HTTP_RemoteTransport_listenSocketEvent := null; + var EPTF_HTTP_listenSocketError_FT vf_EPTF_HTTP_RemoteTransport_listenSocketError := null + + var default v_EPTF_HTTP_RemoteTransport_default; + + var boolean v_EPTF_HTTP_RemoteTransport_initialized := false; + var integer v_EPTF_HTTP_RemoteTransport_transportIdToConnId := -1; + + port EPTF_HTTP_Transport_PT v_EPTF_HTTP_RemoteTransport_commPort; + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_RemoteTransport_CTList + // + // Purpose: + // Remote transport CT list + // + // Elements: + // record of <EPTF_HTTP_RemoteTransport_CT> + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_RemoteTransport_CT EPTF_HTTP_RemoteTransport_CTList; +} + +/////////////////////////////////////////////////////////////////////////////// +// const: Hash map name constants for Remote transport +// +// Purpose: +// - +// +/////////////////////////////////////////////////////////////////////////////// +const charstring c_EPTF_HTTP_RemoteTransport_HashMap_transportId2ConnId := "EPTF HTTP: Transport ID To Connection ID HashMap"; + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Mapper +// +// Purpose: +// The definitions of the EPTF HTTP Mapper +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Mapper +{ + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Mapper_CT + // + // Purpose: + // EPTF HTTP mapper component + // + // Extends: + // EPTF_HTTP_LocalTransport_CT + // + // EPTF_Routing_CT + // + // EPTF_Base_CT + // + // Ports: + // v_EPTF_HTTP_Mapper_commPort - <EPTF_HTTP_Transport_PT> - internal + // communication port + // + // Timers: + // - + // + // Elements: + // v_EPTF_HTTP_Mapper_componentId - *integer* - component id for routing + // v_EPTF_HTTP_Mapper_default - *default* - handle of the Mapper's + // default altstep + // v_EPTF_HTTP_Mapper_componentRef - <EPTF_Base_CT> - store remote load + // generator component reference for routing + // v_EPTF_HTTP_Mapper_hashMapIdx - *integer* - mapper routing hash map + // v_EPTF_HTTP_Mapper_initialized - *boolean* - mapper initialization + // state + // v_EPTF_HTTP_Mapper_newPortGroup - <EPTF_HTTP_Transport_NewPortGroup> - + // HTTP new port group ASP + // v_EPTF_HTTP_Mapper_deletePortGroup - <EPTF_HTTP_Transport_DeletePortGroup> - + // HTTP delete port group ASP + // v_EPTF_HTTP_Mapper_newPort - <EPTF_HTTP_Transport_NewPort> - HTTP + // new port ASP + // v_EPTF_HTTP_Mapper_newServerPort - <EPTF_HTTP_Transport_NewServerPort> - HTTP + // new server port ASP + // v_EPTF_HTTP_Mapper_deletePort - <EPTF_HTTP_Transport_DeletePort> - + // HTTP delete port ASP + // v_EPTF_HTTP_Mapper_addPort - <EPTF_HTTP_Transport_AddPort> - HTTP + // HTTP add port from port group ASP + // v_EPTF_HTTP_Mapper_removePort - <EPTF_HTTP_Transport_RemovePort> - + // HTTP remove port from port group ASP + // v_EPTF_HTTP_Mapper_sendMessage - <EPTF_HTTP_Transport_Send> - HTTP + // HTTP send message ASP + // v_EPTF_HTTP_Mapper_connect - <EPTF_HTTP_Transport_Connect> - HTTP + // connect message ASP + // v_EPTF_HTTP_Mapper_close - <EPTF_HTTP_Transport_Close> - HTTP close + // message ASP + // v_EPTF_HTTP_Mapper_halfClose - <EPTF_HTTP_Transport_HalfClose> - HTTP + // half close message ASP + // v_EPTF_HTTP_Mapper_listen - <EPTF_HTTP_Transport_Listen> - HTTP + // listen message ASP + // v_EPTF_HTTP_Mapper_sendResponse - <EPTF_HTTP_Transport_SendResponse> - HTTP + // send response ASP + // + /////////////////////////////////////////////////////////////////////////////// + type component EPTF_HTTP_Mapper_CT extends + EPTF_HTTP_LocalTransport_CT, + EPTF_Routing_CT, + EPTF_Base_CT + { + port EPTF_HTTP_Transport_PT v_EPTF_HTTP_Mapper_commPort; + + var integer v_EPTF_HTTP_Mapper_sessionId; + var integer v_EPTF_HTTP_Mapper_portId; + + var EPTF_IntegerList v_EPTF_HTTP_Mapper_componentId; + var default v_EPTF_HTTP_Mapper_default; + var EPTF_Base_CT v_EPTF_HTTP_Mapper_componentRef; + var integer v_EPTF_HTTP_Mapper_hashMapIdx := -1; + var boolean v_EPTF_HTTP_Mapper_initialized := false; + + var EPTF_BooleanList v_EPTF_HTTP_Mapper_routingSetDatabase := {}; + var EPTF_HTTP_Mapper_Routing_Database v_EPTF_HTTP_Mapper_inRoutingDatabase := {}; + + var EPTF_HTTP_MapperRoutingUri2LGenDB v_EPTF_HTTP_MapperRoutingUri2LGenDB; + private var EPTF_HTTP_MapperRoutingUri2LGen_GetUri_FT fcb_EPTF_HTTP_MapperRoutingUri2LGen_GetUri := null; + + var EPTF_HTTP_Transport_NewPortGroup v_EPTF_HTTP_Mapper_newPortGroup; + var EPTF_HTTP_Transport_DeletePortGroup v_EPTF_HTTP_Mapper_deletePortGroup; + var EPTF_HTTP_Transport_NewPort v_EPTF_HTTP_Mapper_newPort; + var EPTF_HTTP_Transport_NewServerPort v_EPTF_HTTP_Mapper_newServerPort; + var EPTF_HTTP_Transport_DeletePort v_EPTF_HTTP_Mapper_deletePort; + var EPTF_HTTP_Transport_AddPort v_EPTF_HTTP_Mapper_addPort; + var EPTF_HTTP_Transport_RemovePort v_EPTF_HTTP_Mapper_removePort; + var EPTF_HTTP_Transport_Connect v_EPTF_HTTP_Mapper_connect; + var EPTF_HTTP_Transport_Send v_EPTF_HTTP_Mapper_sendMessage; + var EPTF_HTTP_Transport_ClosePortOfUser v_EPTF_HTTP_Mapper_closePortOfUser; + var EPTF_HTTP_Transport_FreePortOfUser v_EPTF_HTTP_Mapper_freePortOfUser; + var EPTF_HTTP_Transport_Close v_EPTF_HTTP_Mapper_close; + var EPTF_HTTP_Transport_HalfClose v_EPTF_HTTP_Mapper_halfClose; + var EPTF_HTTP_Transport_Listen v_EPTF_HTTP_Mapper_listen; + var EPTF_HTTP_Transport_SendResponse v_EPTF_HTTP_Mapper_sendResponse; + var EPTF_HTTP_Transport_closePort v_EPTF_HTTP_Mapper_closePort; + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Mapper_Routing + // + // Purpose: + // Routing setup element + // + // Elements: + // groupId - *integer* - group index + // compIdList - <EPTF_IntegerList> - component id list casted to integer + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Mapper_Routing { + integer groupId, + EPTF_IntegerList compIdList + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Mapper_Routing + // + // Purpose: + // Routing setup list + // + // Elements: + // record of <EPTF_HTTP_Mapper_Routing> + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_Mapper_Routing EPTF_HTTP_Mapper_RoutingList; + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Mapper_Routing_DBE + // + // Purpose: + // Routing database element + // + // Elements: + // ptr - *integer* - next component id list pointer to send + // size - *integer* - component id list size + // compIdList - <EPTF_IntegerList> - component id list casted to integer + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record EPTF_HTTP_Mapper_Routing_DBE { + integer ptr, + integer size, + EPTF_IntegerList compIdList + } + + /////////////////////////////////////////////////////////////////////////////// + // const: c_EPTF_HTTP_initRoutingDBE + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const EPTF_HTTP_Mapper_Routing_DBE c_EPTF_HTTP_initRoutingDBE := + { + ptr := 0, + size := 0, + compIdList := {} + } + + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Mapper_Routing_Database + // + // Purpose: + // Routing database + // + // Elements: + // record of <EPTF_HTTP_Mapper_Routing_DBE> + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + type record of EPTF_HTTP_Mapper_Routing_DBE EPTF_HTTP_Mapper_Routing_Database; + + const charstring c_EPTF_HTTP_Transport_hashMapName_uri2idxHash := "SIP: uri2Idx"; + type record EPTF_HTTP_MapperRoutingUri2LGenDB { + integer uri2lgenIdxHash + } + + type function EPTF_HTTP_MapperRoutingUri2LGen_GetUri_FT() runs on self return charstring; + + + /////////////////////////////////////////////////////////////////////////////// + // const: Hash map name constants for Mapper + // + // Purpose: + // - + // + /////////////////////////////////////////////////////////////////////////////// + const charstring c_EPTF_HTTP_Mapper_HashMap_routing := "EPTF HTTP: Routing HashMap"; +} + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Transport_Logging +// +// Purpose: +// The definitions of the EPTF HTTP Transport Logging +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Transport_Logging +{ + /////////////////////////////////////////////////////////////////////////////// + // Type: EPTF_HTTP_Transport_Logging_CT + // + // Purpose: + // Common logging component for Local/Remote transport + // + // Extends: + // EPTF_Logging_CT + // + // Ports: + // - + // + // Timers: + // - + // + // Elements: + // v_EPTF_HTTP_Transport_loggingMaskId - *integer* - logging mask id + // + /////////////////////////////////////////////////////////////////////////////// + type component EPTF_HTTP_Transport_Logging_CT extends EPTF_Logging_CT + { + // logging + var integer v_EPTF_HTTP_Transport_loggingMaskId := c_EPTF_Logging_invalidMaskId; + + var integer v_EPTF_HTTP_Transport_bufferLoggingMaskId := c_EPTF_Logging_invalidMaskId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_Transport_loggingEventClasses + // + // Purpose: + // list of logging event class names used on the EPTF HTTP + // Transport component + // + // Detailed Comments: + // <EPTF_Logging_EventClassPrefixList> { "Error", "Warning", "Debug" } + /////////////////////////////////////////////////////////////////////////////// + const EPTF_Logging_EventClassPrefixList + c_EPTF_HTTP_Transport_loggingEventClasses := { "Error", "Warning", "Debug", "BufferWarning", "BufferDebug"}; + + /////////////////////////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_Transport_loggingClassIdx_Error + // + // Purpose: + // logging class index for Error + // + // Detailed Comments: + // *0* + /////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_Transport_loggingClassIdx_Error := 0; + + /////////////////////////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_Transport_loggingClassIdx_Warning + // + // Purpose: + // logging class index for Warning + // + // Detailed Comments: + // *1* + /////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_Transport_loggingClassIdx_Warning := 1; + + /////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_Transport_loggingClassIdx_Debug + // + // Purpose: + // logging class index for Debug + // + // Detailed Comments: + // *2* + /////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_Transport_loggingClassIdx_Debug := 2; + + /////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_Transport_loggingClassIdx_BufferWarning + // + // Purpose: + // logging class index for Buffer debug warning logging. + // + // Detailed Comments: + // *0* + /////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_Transport_loggingClassIdx_BufferWarning := 3; + + /////////////////////////////////////////////////////////// + // Constant: c_EPTF_HTTP_Transport_loggingClassIdx_BufferDebug + // + // Purpose: + // logging class index for Buffer debug logging. + // + // Detailed Comments: + // *1* + /////////////////////////////////////////////////////////////////////////////// + const integer c_EPTF_HTTP_Transport_loggingClassIdx_BufferDebug := 4; +} + +/////////////////////////////////////////////////////////// +// Type: fcb_EPTF_HTTP_messageSentHook +// +// Purpose: Message hook for post-processing HTTP message sent. +// +/////////////////////////////////////////////////////////// +type function fcb_EPTF_HTTP_messageSentHook(in integer pl_eIdx, in octetstring pl_httpMessage) runs on self; + +}//end of module +with { +extension "version <RnXnn>" +} + diff --git a/src/Transport/EPTF_HTTP_Transport_Functions.ttcn b/src/Transport/EPTF_HTTP_Transport_Functions.ttcn new file mode 100644 index 0000000..711465c --- /dev/null +++ b/src/Transport/EPTF_HTTP_Transport_Functions.ttcn @@ -0,0 +1,6482 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_HTTP_Transport_Functions.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2014-03-21 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// Module: EPTF_HTTP_Transport_Functions +// +// Purpose: +// This module contains the HTTP transport layer functions +// +// Module Parameters: +// See <EPTF_HTTP_Transport_Definitions> +// +// Module depends on: +// <EPTF_CLL_TransportRouting_Functions> +// +// <EPTF_CLL_TransportMessageBufferManager_Functions> +// +// <EPTF_CLL_Base_Definitions> +// +// <EPTF_CLL_Base_Functions> +// +// <EPTF_CLL_Variable_Functions> +// +// <EPTF_CLL_Logging_Definitions> +// +// <EPTF_CLL_Logging_Functions> +// +// <EPTF_CLL_TransportCommPortIPL4_Definitions> +// +// <EPTF_CLL_TransportCommPortIPL4_Functions> +// +// <EPTF_CLL_Common_Definitions> +// +// <EPTF_CLL_LGenBase_Functions> +// +// <EPTF_CLL_LGenBase_Definitions> +// +// <EPTF_CLL_HashMapStr2Int_Functions> +// +// <EPTF_CLL_HashMapInt2Int_Functions> +// +// <EPTF_CLL_FBQ_Definitions> +// +// <EPTF_CLL_FBQ_Functions> +// +// <EPTF_HTTP_Definitions> +// +// <EPTF_HTTP_Transport_Definitions> +// +// <IPL4asp_Types> +// +// <TCCMessageHandling_Functions> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-08-10 +// +// Detailed Comments: +// - +// +/////////////////////////////////////////////////////////////////////////////// + +module EPTF_HTTP_Transport_Functions { + +//============================================================================= +// Imports +//============================================================================= + +import from EPTF_CLL_TransportRouting_Functions all; +import from EPTF_CLL_TransportMessageBufferManager_Functions all; +import from EPTF_CLL_Base_Functions all; +import from EPTF_CLL_Logging_Definitions all; +import from EPTF_CLL_Logging_Functions all; +import from EPTF_CLL_TransportCommPortIPL4_Definitions all; +import from EPTF_CLL_TransportCommPortIPL4_Functions all; +import from EPTF_CLL_HashMapStr2Int_Functions all; +import from EPTF_CLL_HashMapInt2Int_Functions all; +import from EPTF_CLL_FBQ_Functions all; +import from EPTF_CLL_HashMap_Functions all; + +import from EPTF_HTTP_Definitions all; // events +import from EPTF_HTTP_Transport_Definitions all; + +import from IPL4asp_Types all; + +import from TCCMessageHandling_Functions all; + +//============================================================================= +// Functions +//============================================================================= + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_LocalTransport +// +// Purpose: +// Functions of the EPTF HTTP Local Transport +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_LocalTransport +{ + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_init_CT + // + // Purpose: + // Function to init The LocalTransprot component + // + // Parameters: + // - pl_selfName - *in* *charstring* - self name of the component + // - pl_receiveFunction - *in* <EPTF_HTTP_messageProcess_FT> - the + // receive callback function to handle received messages + // - pl_eventReceiveFunction - *in* <EPTF_HTTP_eventReceive_FT> - the + // receive event callback function to handle received events + // - pl_socketErrorReceiveFunction - *in* <EPTF_HTTP_socketErrorReceive_FT> - the + // socket error receive callback function to handle received socket error events and messages + // - pl_interfaceInformationList - *in* <EPTF_CommPort_IPL4_InterfaceInformationList> - + // the defined interfaces for IPL4 (can be used only with root rights) + // + // Return Value: + // *integer* - if the component is initialized already the return value + // will be -1 + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_init_CT( + in charstring pl_selfName := "EPTF_HTTP_LocalTransport", + in EPTF_HTTP_messageProcess_FT pl_receiveFunction := null, + in EPTF_HTTP_eventReceive_FT pl_eventReceiveFunction := null, + in EPTF_HTTP_socketErrorReceive_FT pl_socketErrorReceiveFunction := null, + in EPTF_CommPort_IPL4_InterfaceInformationList pl_interfaceInformationList := {}, + in EPTF_HTTP_listenSocketEvent_FT pl_listenSocketEvent := null, + in EPTF_HTTP_listenSocketError_FT pl_listenSocketError := null) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + if (v_EPTF_HTTP_LocalTransport_initialized) + { + log(%definitionId & // intentionally simple log + ": The HTTP LocalTransport component already initialized!"); + + return -1; + } + + v_EPTF_HTTP_LocalTransport_selfName := pl_selfName + + f_EPTF_Logging_init_CT(pl_selfName); + + v_EPTF_HTTP_Transport_loggingMaskId := + f_EPTF_Logging_registerComponentMasks( + tsp_EPTF_HTTP_Transport_loggingComponentMask, + c_EPTF_HTTP_Transport_loggingEventClasses, + EPTF_Logging_CLL); + + if (tsp_EPTF_HTTP_Transport_loggingEnable) + { + f_EPTF_Logging_enableLocalMask( + v_EPTF_HTTP_Transport_loggingMaskId, + c_EPTF_HTTP_Transport_loggingClassIdx_Debug); + } + else + { + f_EPTF_Logging_disableLocalMask( + v_EPTF_HTTP_Transport_loggingMaskId, + c_EPTF_HTTP_Transport_loggingClassIdx_Debug); + } + + if (tsp_EPTF_HTTP_Transport_bufferLogEnable) + { + f_EPTF_Logging_enableLocalMask( + v_EPTF_HTTP_Transport_loggingMaskId, + c_EPTF_HTTP_Transport_loggingClassIdx_BufferDebug); + }else + { + f_EPTF_Logging_disableLocalMask( + v_EPTF_HTTP_Transport_loggingMaskId, + c_EPTF_HTTP_Transport_loggingClassIdx_BufferDebug); + } + + vf_getGroupAndPort := refers(f_EPTF_HTTP_LocalTransport_getGroupAndPort_default); + vf_getGroup := refers(f_EPTF_HTTP_LocalTransport_getGroup_default); + + vf_EPTF_HTTP_LocalTransport_receive := pl_receiveFunction; + vf_EPTF_HTTP_LocalTransport_eventReceive := pl_eventReceiveFunction; + vf_EPTF_HTTP_LocalTransport_socketErrorReceive := pl_socketErrorReceiveFunction; + + vf_EPTF_HTTP_LocalTransport_listenSocketEvent := pl_listenSocketEvent; + vf_EPTF_HTTP_LocalTransport_listenSocketError := pl_listenSocketError; + + f_EPTF_CommPort_IPL4_init(pl_interfaceInformationList,true); + + f_EPTF_CommPort_IPL4_setReceive( + { asp_RecvFrom := ? },refers(f_EPTF_HTTP_LocalTransport_receiveMessage), pl_selfName); + + f_EPTF_CommPort_IPL4_setReceive( + { asp_Event := ? },refers(f_EPTF_HTTP_LocalTransport_receiveEvent), pl_selfName); + + f_EPTF_CommPort_IPL4_activateDefaultBufferingHandler(pl_selfName); + + f_EPTF_CommPort_IPL4_setMsgLen(-1, + refers(f_EPTF_HTTP_LocalTransport_getMessageLength), {}); + + f_EPTF_FBQ_initFreeBusyQueue(v_EPTF_HTTP_Transport_groupQueue); + + f_EPTF_int2int_HashMap_Init(); + f_EPTF_str2int_HashMap_Init(); + + v_EPTF_HTTP_Transport_groupName2Idx_HM := + f_EPTF_str2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_groupName2Idx); + v_EPTF_HTTP_Transport_functions2Idx_HM := + f_EPTF_str2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_fnGrp2Idx); + v_EPTF_HTTP_Transport_localHostHashMap := + f_EPTF_str2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_localHost); + v_EPTF_HTTP_Transport_remoteHostHashMap := + f_EPTF_str2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_remoteHost); + v_EPTF_HTTP_Transport_connId2GroupId_HM := + f_EPTF_int2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_connId2PortGrp); + v_EPTF_HTTP_Transport_connId2PortId_HM := + f_EPTF_int2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_connId2Port); + v_EPTF_HTTP_Transport_sessId2PortId_HM := + f_EPTF_int2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_sessId2Port); + v_EPTF_HTTP_Transport_portId2Idx_HM := + f_EPTF_int2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_portId2Idx); + + f_EPTF_Base_init_CT(pl_selfName); + f_EPTF_Base_registerCleanup(refers(f_EPTF_HTTP_LocalTransport_cleanup_CT)); + + if (tsp_EPTF_HTTP_Transport_messageBufferEnable == true) { + f_EPTF_MessageBufferManager_init_CT(); + } + + v_EPTF_HTTP_LocalTransport_initialized := true; + + f_EPTF_HTTP_Transport_debug(%definitionId & "The initialization of the " & + "HTTP LocalTransport component is ready"); + + return 1; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_cleanup_CT + // + // Purpose: + // Function to clean The LocalTransport component + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_cleanup_CT() + runs on EPTF_HTTP_LocalTransport_CT + { + if (not v_EPTF_HTTP_LocalTransport_initialized) { + return; + } + v_EPTF_HTTP_LocalTransport_initialized:= false; + + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + vf_EPTF_HTTP_LocalTransport_receive := null; + vf_EPTF_HTTP_LocalTransport_eventReceive := null; + vf_EPTF_HTTP_LocalTransport_socketErrorReceive := null + + v_EPTF_HTTP_LocalTransport_loggingEnabled := -1; + + // delate all ports and port groups + var integer vl_group; + while (f_EPTF_FBQ_getBusyHeadIdx(vl_group, v_EPTF_HTTP_Transport_groupQueue)) { + f_EPTF_HTTP_LocalTransport_deletePortGroup(vl_group); + } + + f_EPTF_str2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_groupName2Idx); + f_EPTF_str2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_fnGrp2Idx); + f_EPTF_str2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_localHost); + f_EPTF_str2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_remoteHost); + f_EPTF_int2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_connId2PortGrp); + f_EPTF_int2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_connId2Port); + f_EPTF_int2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_sessId2Port); + f_EPTF_int2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_portId2Idx); + + f_EPTF_FBQ_initFreeBusyQueue(v_EPTF_HTTP_Transport_groupQueue); + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": The cleanup of the LocalTransport component is ready"); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_newPortGroup + // + // Purpose: + // Function to create a new port group + // + // Parameters: + // - pl_group - *in* <EPTF_HTTP_Transport_GroupMode> - group data + // - pl_portmode - *in* *boolean* - port mode / group mode selector + // + // Return Value: + // *integer* - index of the new port group if creation successful, + // otherwise -1 + // + // Errors: + // - + // + // Detailed Comments: + // Function creats a new port group based on the given port group data. + // This includes creation of port database objects within the group + // and optionally open ports (based on port group data) + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_newPortGroup( + in EPTF_HTTP_Transport_GroupMode pl_group, + in boolean pl_portmode := false) + runs on EPTF_HTTP_LocalTransport_CT return integer + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var charstring vl_groupName := ""; + var integer i, vl_dummy, vl_fGIdx, vl_newGrpIdx; + + vl_newGrpIdx := f_EPTF_FBQ_getOrCreateFreeSlot(v_EPTF_HTTP_Transport_groupQueue); + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": New group index: " & int2str(vl_newGrpIdx)); + + // if group name not presented a unique one is generated + if (not ispresent(pl_group.name) or pl_group.name == "") { + vl_groupName := f_EPTF_HTTP_LocalTransport_createUniqueGroupName( + v_EPTF_HTTP_LocalTransport_selfName); + } + // if group name presented, then it must be unique + else { + vl_groupName := pl_group.name; + + if (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_groupName2Idx_HM, + vl_groupName, vl_dummy)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Group name: " & vl_groupName & " is not unique!"); + return -1; + } + } + + f_EPTF_FBQ_moveFromFreeToBusyTail(vl_newGrpIdx, v_EPTF_HTTP_Transport_groupQueue); // only if name unique + + // insert new group index into group name - group index hashmap + f_EPTF_str2int_HashMap_Insert(v_EPTF_HTTP_Transport_groupName2Idx_HM, + vl_groupName, vl_newGrpIdx); + + + // set group database + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx] := c_HTTP_Transport_initPortGroup; + + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].name := vl_groupName; + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].localportStep := pl_group.localportStep; + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].remoteportStep := pl_group.remoteportStep; + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].baseLocalHostInformation := pl_group.localHostInformation; + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].baseRemoteHostInformation := pl_group.remoteHostInformation; + + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].useSSL := pl_group.useSSL; // FIXME + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].instantConnOpen := pl_group.instantConnOpen; + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].instantConnClose := pl_group.instantConnClose; + + // overdefine functionality if user functions are presented + if (ispresent(pl_group.userFunctions)) + { + vl_fGIdx := f_EPTF_HTTP_LocalTransport_registerGroupFunctions( + vl_newGrpIdx, pl_portmode, pl_group.userFunctions); + } else + { + vl_fGIdx := f_EPTF_HTTP_LocalTransport_registerGroupFunctions( + vl_newGrpIdx, pl_portmode, c_EPTF_HTTP_initUserFunctions); + } + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].defaultFIdx := vl_fGIdx; + + // init queues + f_EPTF_FBQ_initFreeBusyQueue(v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].portQueue); + f_EPTF_FBQ_initFreeBusyQueue(v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].portStateQueue); + + // add group (and open ports if necessary) + var boolean vl_success := true; + for (i := 0; i < pl_group.numberOfPorts; i:= i + 1) { + if (not v_EPTF_HTTP_Transport_functionDB[vl_fGIdx].addPort.apply(vl_newGrpIdx)) { + vl_success := false; + i := pl_group.numberOfPorts; + } + } + + // evaluate result + if (vl_success) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Group added successfully: " & + int2str(vl_newGrpIdx) & " - " & v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].name); + + return vl_newGrpIdx; + } + else + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Group addition unsuccessful: " & + int2str(vl_newGrpIdx) & " - " & v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].name); + + f_EPTF_HTTP_LocalTransport_deletePortGroup(vl_newGrpIdx); + + return -1; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_deletePortGroup + // + // Purpose: + // Function to delete an existing port group + // + // Parameters: + // - pl_group - *in* <EPTF_HTTP_Transport_GroupMode> - group index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Function deletes a port group based on the given port group index. + // This includes closure and deletion of ports within the port group. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_deletePortGroup( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + var integer vl_fGrpIdx := v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx; + + // remove prots + while (v_EPTF_HTTP_Transport_functionDB[vl_fGrpIdx].removePort.apply(pl_group)) { }; + + for (var integer i := 0; i < sizeof(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase); i := i + 1) + { + if (omit != v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[i].messageBuffer) + { + f_EPTF_HTTP_MsgBuffer_erase(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[i].messageBuffer, i); + } + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[i].messageBuffer := omit; + } + + // remove name + f_EPTF_str2int_HashMap_Erase(v_EPTF_HTTP_Transport_groupName2Idx_HM, + v_EPTF_HTTP_Transport_portDB[pl_group].name); + + // unset database + v_EPTF_HTTP_Transport_portDB[pl_group] := c_HTTP_Transport_initPortGroup; + + // free group in FBQ + f_EPTF_FBQ_moveFromBusyToFreeTail(pl_group, v_EPTF_HTTP_Transport_groupQueue); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Group deleted successfully: " & + int2str(pl_group)); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_newPort + // + // Purpose: + // Function to create a new port group object + // + // Parameters: + // - pl_portInfo - *in* <EPTF_HTTP_Transport_PortMode> - port data + // + // Return Value: + // *integer* - index of the new port group + // + // Errors: + // - + // + // Detailed Comments: + // Function creats a new port based on the given port data. + // It optionally opens the port (based on port group data) + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_newPort( + in EPTF_HTTP_Transport_PortMode pl_portInfo) + runs on EPTF_HTTP_LocalTransport_CT return integer + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var integer vl_group; + var EPTF_HTTP_Transport_GroupMode vl_groupInfo; + + // convert port to group + vl_groupInfo := { + name := pl_portInfo.name, + localHostInformation := pl_portInfo.localHostInformation, + remoteHostInformation := pl_portInfo.remoteHostInformation, + numberOfPorts := 1, + localportStep := 0, + remoteportStep := 0, + instantConnOpen := pl_portInfo.instantConnOpen, + instantConnClose := pl_portInfo.instantConnClose, + useSSL := pl_portInfo.useSSL, + userFunctions := pl_portInfo.userFunctions + }; + + vl_group := f_EPTF_HTTP_LocalTransport_newPortGroup(vl_groupInfo, true); + + if (vl_group != -1) + { + var EPTF_HTTP_Transport_Function vl_funcs := v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[vl_group].defaultFIdx]; + + vl_funcs.addPort := refers(f_EPTF_HTTP_LocalTransport_addRemovePortToGroup_dummy); + //vl_funcs.addPort := refers(f_EPTF_HTTP_LocalTransport_addRemovePortToGroup_dummy); + + // function database index must be updated!! + var integer vl_index; + + // creates a hash map key from the function group + var charstring vl_key := log2str(vl_funcs) + + // if function group is already existing, then return id + if (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_functions2Idx_HM, + vl_key, vl_index)) + { + v_EPTF_HTTP_Transport_portDB[vl_group].defaultFIdx := vl_index; + } + else { + // if function group was not existing, then add new element + vl_index := sizeof(v_EPTF_HTTP_Transport_functionDB); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": New database index: " & int2str(vl_index) & + " for functions: " & vl_key); + + v_EPTF_HTTP_Transport_portDB[vl_group].defaultFIdx := vl_index; + v_EPTF_HTTP_Transport_functionDB[vl_index] := vl_funcs; + + f_EPTF_str2int_HashMap_Insert(v_EPTF_HTTP_Transport_functions2Idx_HM, + vl_key, vl_index); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Functions are registered to group (" & + int2str(vl_group) & " - " & v_EPTF_HTTP_Transport_portDB[vl_group].name & ": " & vl_key & + " at position " & int2str(vl_index) & " in function database!"); + } + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Port created (" & + int2str(vl_group) & ") - " & v_EPTF_HTTP_Transport_portDB[vl_group].name); + + } + else { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Port not created!"); + } + + return vl_group; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_newServerPort + // + // Purpose: + // Function to create a new server port group + // + // Parameters: + // - pl_portInfo - *in* <EPTF_HTTP_Transport_ServerPortMode> - port mode / group mode selector + // + // Return Value: + // *integer* - index of the new port group if creation successful, + // otherwise -1 + // + // Errors: + // - + // + // Detailed Comments: + // Function creats a new port group based on the given port group data. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_newServerPort( + in EPTF_HTTP_Transport_ServerPortMode pl_portInfo) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var integer vl_newGrpIdx := -1; + + v_boolNoWarning := f_EPTF_HTTP_LocalTransport_createServerPort(pl_portInfo, vl_newGrpIdx) + + return vl_newGrpIdx; + } + + function f_EPTF_HTTP_LocalTransport_createServerPort( + in EPTF_HTTP_Transport_ServerPortMode pl_portInfo, + inout integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT + return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var integer vl_fGIdx, vl_newGrpIdx; + + if (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_groupName2Idx_HM, + pl_portInfo.name, pl_groupId)) + { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Server group already exists."); + return false; + } + + vl_newGrpIdx := f_EPTF_FBQ_getOrCreateFreeSlot(v_EPTF_HTTP_Transport_groupQueue); + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": New group index: " & int2str(vl_newGrpIdx)); + + f_EPTF_FBQ_moveFromFreeToBusyTail(vl_newGrpIdx, v_EPTF_HTTP_Transport_groupQueue); + + // insert new group index into group name - group index hashmap + f_EPTF_str2int_HashMap_Insert(v_EPTF_HTTP_Transport_groupName2Idx_HM, + pl_portInfo.name, vl_newGrpIdx); + + + // set group database + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx] := c_HTTP_Transport_initPortGroup; + f_EPTF_FBQ_initFreeBusyQueue(v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].portQueue); + f_EPTF_FBQ_initFreeBusyQueue(v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].portStateQueue); + + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].name := pl_portInfo.name; + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].baseLocalHostInformation := pl_portInfo.localHostInformation; + + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].instantConnClose := pl_portInfo.instantConnClose; + + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].buffer := pl_portInfo.buffer; + + if(ispresent(pl_portInfo.useSSL) and pl_portInfo.useSSL) { + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].useSSL := true; + } + else { + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].useSSL := false; + } + + // overdefine functionality if user functions are presented + if (ispresent(pl_portInfo.userFunctions)) + { + vl_fGIdx := f_EPTF_HTTP_LocalTransport_registerServerGroupFunctions( + vl_newGrpIdx, pl_portInfo.userFunctions); + } else + { + vl_fGIdx := f_EPTF_HTTP_LocalTransport_registerServerGroupFunctions( + vl_newGrpIdx, c_EPTF_HTTP_initServerUserFunctions); + } + v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].defaultFIdx := vl_fGIdx; + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Group added successfully: " & + int2str(vl_newGrpIdx) & " - " & v_EPTF_HTTP_Transport_portDB[vl_newGrpIdx].name); + + pl_groupId := vl_newGrpIdx; + return true; + } + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_deletePort + // + // Purpose: + // Function to delete an existing port + // + // Parameters: + // - pl_group - *in* <EPTF_HTTP_Transport_GroupMode> - port index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Function deletes a port group based on the given port group index. + // This includes closure and deletion of ports within the port group. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_deletePort( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + f_EPTF_HTTP_LocalTransport_deletePortGroup(pl_group); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Port deleted (" & + int2str(pl_group) & ") - " & v_EPTF_HTTP_Transport_portDB[pl_group].name); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_addPortToGroup_default + // + // Purpose: + // Function to add a single port to an existing port group + // + // Parameters: + // - pl_group - *in* <EPTF_HTTP_Transport_GroupMode> - group index + // + // Return Value: + // *boolean* - result of the operation + // + // Errors: + // - + // + // Detailed Comments: + // The new port added to the port group will be created according to + // port group data. Set local and remote IP addresses won't be changed, + // but local and remote ports will be calculated according to: + // (<number of ports in port group> + 1) * (<local/remote port step>). + // + // Addition of new port optionally opens connection on port group data + // to which the port is added (if instant connection open is enabled, + // then ports won't be opened, otherwise they will be). + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_addPortToGroup_default( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return false; }; + + var EPTF_HTTP_HostInformation vl_lhostInformation, vl_rhostInformation; + var integer vl_lhIdx, vl_rhIdx, vl_fbqIdx; + + f_EPTF_FBQ_createFreeSlots(1, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + vl_fbqIdx := f_EPTF_FBQ_getOrCreateFreeSlot(v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + + //vl_fbqStateIdx := f_EPTF_FBQ_getOrCreateFreeSlot(v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + //f_EPTF_Base_assert(%definitionId & "FBQ index mismatch", vl_fbqIdx == vl_fbqStateIdx); + //f_EPTF_FBQ_setQueueDidx(vl_fbqStateIdx, {vl_fbqIdx}, v_EPTF_HTTP_Transport_portDB[pl_portGrpIdx].portStateQueue); + + // calculate next port data according (local) + vl_lhostInformation := v_EPTF_HTTP_Transport_portDB[pl_group].baseLocalHostInformation; + vl_lhostInformation.hostPort := vl_lhostInformation.hostPort + + v_EPTF_HTTP_Transport_portDB[pl_group].localportStep * v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts; + vl_lhIdx := f_EPTF_HTTP_LocalTransport_addLocalHostInformation(vl_lhostInformation); + + // calculate next port data according (remote) + vl_rhostInformation := v_EPTF_HTTP_Transport_portDB[pl_group].baseRemoteHostInformation; + vl_rhostInformation.hostPort := vl_rhostInformation.hostPort + + v_EPTF_HTTP_Transport_portDB[pl_group].remoteportStep * v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts; + vl_rhIdx := f_EPTF_HTTP_LocalTransport_addRemoteHostInformation(vl_rhostInformation); + + // set port data to port info database + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx] := c_EPTF_HTTP_LocalTransport_initPortInfo; + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].groupIndex := pl_group; // FIXME check + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portIndex := vl_fbqIdx; // FIXME check + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].localhostInfoIdx := vl_lhIdx; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].remotehostInfoIdx := vl_rhIdx; + + f_EPTF_HTTP_Transport_debug(%definitionId & ": New port added to " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_fbqIdx)); + + // InstantConnOpen == true means that a send request on the group will + // automatically trigger a port open -> this case no ports are opened + // initially, otherwise ports are opened previosly + if (not v_EPTF_HTTP_Transport_portDB[pl_group].instantConnOpen) + { + if (not f_EPTF_HTTP_LocalTransport_openPortInGroup(pl_group, vl_fbqIdx)) { + return false; + } + } + + // move to busy (only if everything was previously successful) + f_EPTF_FBQ_moveFromFreeToBusyTail(vl_fbqIdx, + v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + + // administrate new port opening + v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts := v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts + 1; + + return true; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_removePortFromGroup_default + // + // Purpose: + // Function to remove a single port from an existing port group + // + // Parameters: + // - pl_group - *in* <EPTF_HTTP_Transport_GroupMode> - group index + // + // Return Value: + // *boolean* - result of the operation + // + // Errors: + // - + // + // Detailed Comments: + // The port which is choosen to be removed is the first one added to + // the port group from which the port is removed. + // + // If the port has an open connection, then the connection will be closed. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_removePortFromGroup_default( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return false; }; + + var EPTF_HTTP_Transport_ConnectionState vl_state; + var integer vl_connId, vl_busyHeadIdx := -1; + + // the first removed port is the oldest one (busy head) + if (f_EPTF_FBQ_getBusyHeadIdx(vl_busyHeadIdx, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue)) + { + vl_connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_busyHeadIdx].connectionId; + vl_state := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_busyHeadIdx].state; + + // when port removed, it must be closed + // it can be closed if connId != -1 and state is OPENING/OPENED/HALFCLOSED + f_EPTF_Base_assert(%definitionId & ": Invalid state of port in " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_busyHeadIdx), + vl_connId != -1 or vl_state == IDLE); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Removing port at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_busyHeadIdx)); + + if (vl_connId != -1) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Closing connection on port " & + "to be removed!"); + + // close port + f_EPTF_HTTP_Transport_closePortInGroup(pl_group, vl_busyHeadIdx); + } + + // deleted port will be allocated again (if necessary) at last time (free tail) + f_EPTF_FBQ_moveFromBusyToFreeTail(vl_busyHeadIdx, + v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_busyHeadIdx] := c_EPTF_HTTP_LocalTransport_initPortInfo; + + v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts := v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts - 1; + + return true; + } + //else + //{ + // f_EPTF_HTTP_Transport_warning(%definitionId & + // ": No more ports to remove from group: " & + // int2str(pl_group) & " - " & v_EPTF_HTTP_Transport_portDB[pl_group].name); + // + return false; + //} + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_removePortFromGroupServer_default + // + // Purpose: + // Function to remove a single port from an existing server port group + // + // Parameters: + // - pl_group - *in* <EPTF_HTTP_Transport_GroupMode> - group index + // + // Return Value: + // *boolean* - result of the operation + // + // Errors: + // - + // + // Detailed Comments: + // The port which is choosen to be removed is the first one added to + // the port group from which the port is removed. + // + // If the port has an open connection, then the connection will be closed. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_removePortFromGroupServer_default( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT + return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return false; }; + + var integer vl_busyHeadIdx := -1; + + if (f_EPTF_FBQ_getBusyHeadIdx(vl_busyHeadIdx, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue)) + { + f_EPTF_HTTP_LocalTransport_removeServerPort(pl_group, vl_busyHeadIdx); + return true; + } + + return false; + } + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_addRemovePortToGroup_dummy + // + // Purpose: + // Dummy function to disable add/remove port + // + // Parameters: + // - pl_group - *in* <EPTF_HTTP_Transport_GroupMode> - group index + // + // Return Value: + // *boolean* - result of the operation + // + // Errors: + // - + // + // Detailed Comments: + // Application of this function can disable addition or deletion of + // new ports from port group + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_addRemovePortToGroup_dummy( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Cannot add/remove ports to port groups created in Port mode"); + + return true; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_selectPortInGroup_defaultGroup + // + // Purpose: + // Function to select a port in the group on which user intends to perform + // an send operation + // + // Parameters: + // - pl_group - *in* *integer* - group index + // + // Return Value: + // *integer* - index of the selected port within the port group + // + // Errors: + // - + // + // Detailed Comments: + // State of ports within a port group are maintained. If someone sends + // an a port, its state is busy for further send. This function selects + // a port within the port group that is not busy for sending. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_selectPortInGroup_defaultGroup( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return integer + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return -1; }; + + var integer vl_nextFreePortIdx; + + if (f_EPTF_FBQ_getFreeTailIdx(vl_nextFreePortIdx, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Selected port is " & + int2str(vl_nextFreePortIdx) & " for group: " & int2str(pl_group)); + + return vl_nextFreePortIdx; + } + + f_EPTF_HTTP_Transport_warning(%definitionId & ": Port selection unsuccessful" + & " for group: " & int2str(pl_group)); + + return -1; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_selectPortInGroup_defaultPort + // + // Purpose: + // Function to select a port in the group on which user intends to perform + // an send operation. + // + // Parameters: + // - pl_group - *in* *integer* - group index + // + // Return Value: + // *integer* - index of the selected port within the port group + // + // Errors: + // - + // + // Detailed Comments: + // The function is the default function for port operation mode and + // therefore it will always provide port 0 as in port operation mode + // only one port is located within the port group. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_selectPortInGroup_defaultPort( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return integer + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_FBQ_itemIsBusy(pl_group, v_EPTF_HTTP_Transport_groupQueue)) { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Group already deleted: " & + int2str(pl_group) & " - " & v_EPTF_HTTP_Transport_portDB[pl_group].name); + return -1; + } + + if (f_EPTF_FBQ_itemIsBusy(0, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Already sending " & + "group: " & int2str(pl_group) & " - " & v_EPTF_HTTP_Transport_portDB[pl_group].name); + + return -1; + } + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Selected port is 0" & + " for group: " & int2str(pl_group)); + + return 0; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_getGroupAndPort_defaultGroup + // + // Purpose: + // Function to acquire port and group index for a connection id + // + // Parameters: + // - pl_connId - *in* *integer* - connection id + // - pl_group - *in* *integer* - port group index + // - pl_port - *in* *integer* - port index within the group id + // + // Return Value: + // *boolean* - true if group and port index successfully retrieved + // + // Errors: + // - + // + // Detailed Comments: + // Default function for group operation mode + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_getGroupAndPort_default( + in integer pl_connId, + inout integer pl_group, + inout integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_connId2GroupId_HM, + pl_connId, pl_group)) + { + if (f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_connId2PortId_HM, + pl_connId, pl_port)) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Connection id mapped " & + " to port: " & int2str(pl_port) & " and group: " & int2str(pl_group)); + + return true; + } + else { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Connection id was " & + "not found in Connection id to port id hash map. Message dropped!"); + + pl_group := -1; pl_port := -1; + return false; + } + } + else { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Connection id was " & + "not found in Connection id to group id hash map. Message dropped!"); + + pl_group := -1; pl_port := -1; + return false; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_getGroup_default + // + // Purpose: + // Function to acquire group index for a connection id + // + // Parameters: + // - pl_connId - *in* *integer* - connection id + // - pl_groupId - *inout* *integer* - port group index + // + // Return Value: + // *boolean* - true if group index is successfully retrieved + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_getGroup_default( + in integer pl_connId, + inout integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_connId2GroupId_HM, + pl_connId, pl_groupId)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Connection id "& int2str(pl_connId) &" was " & + "not found in Connection id to group id hash map. Message dropped!"); + + pl_groupId := -1 + return false; + } + + return true; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_sendMessage_default_IC + // + // Purpose: + // Function to send message and open connection instantly + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_sessionId - *in* *integer* - unique session id of current send + // - pl_msg - *in* *octetstring* - encoded message to be sent + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // The function selects a port within the port group which it has + // been applied to, then tries to open the port's connection instantly. If + // both of these operations have finished successfully, finally sends + // the message. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_sendMessage_default_IC( + in integer pl_group, + in integer pl_sessionId, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + var integer vl_port := + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx].selectPort.apply(pl_group); + + if (vl_port == -1) + { + if (tsp_EPTF_HTTP_Transport_messageBufferEnable == false) { + f_EPTF_HTTP_Transport_warning(%definitionId & ": No more free ports available!"); + } + else { + f_EPTF_MessageBufferManager_setMessageToBuffer(pl_msg, int2str(pl_sessionId), pl_group); + } + } + + else + { + + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].state != IDLE and v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].state != OPENED) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Connection is not in Idle state, state: " & + log2str(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].state)); + } + else + { + if (f_EPTF_FBQ_itemIsBusy(vl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue)) { + var EPTF_HTTP_HostInformation vl_local, vl_remote; + + vl_local := v_EPTF_HTTP_Transport_localHostInformationList[ + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].localhostInfoIdx]; + vl_remote := v_EPTF_HTTP_Transport_remoteHostInformationList[ + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].remotehostInfoIdx]; + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].sessionId := pl_sessionId; + + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].state == OPENED or f_EPTF_HTTP_LocalTransport_openPortInGroup(pl_group, vl_port)) + //if (v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx].openPort.apply(pl_group)) + { + v_EPTF_HTTP_Transport_OutgoingMessage := { asp_Send := { + connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].connectionId, + proto := {tcp:= {}}, + msg := pl_msg + } }; + + v_resultNoWarning := f_EPTF_CommPort_IPL4_send( + v_EPTF_HTTP_Transport_OutgoingMessage, + null, false, true, v_EPTF_HTTP_LocalTransport_selfName); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Send result is " & + log2str(v_resultNoWarning)); + if ((not ispresent(v_resultNoWarning.errorCode)) or + (v_resultNoWarning.errorCode == ERROR_TEMPORARILY_UNAVAILABLE) or + (v_resultNoWarning.errorCode == ERROR_AVAILABLE) ) + { + if (ispresent(v_resultNoWarning.errorCode) and (v_resultNoWarning.errorCode != ERROR_TEMPORARILY_UNAVAILABLE)) { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": f_EPTF_CommPort_IPL4_send error code: " & + log2str(v_resultNoWarning.errorCode)); + } + // move to busy if sending on port + if (not f_EPTF_FBQ_itemIsBusy(vl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) { + f_EPTF_FBQ_moveFromFreeToBusyTail(vl_port, + v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + } + + f_EPTF_int2int_HashMap_Insert(v_EPTF_HTTP_Transport_sessId2PortId_HM, + pl_sessionId, + vl_port); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Message sent on " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_port) & + ": " & log2str(pl_msg)); + } + else + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Send message unsuccessful!" & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_port)); + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].sessionId := -1; + + // socket error, calling callback + if(vf_EPTF_HTTP_LocalTransport_socketErrorReceive != null) { + vf_EPTF_HTTP_LocalTransport_socketErrorReceive.apply({ + pl_group, + pl_sessionId, + v_resultNoWarning}); + } + + } + } + else { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Instant connection opening unsuccessful for port at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_port)); + } + } + else { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Sending on port which has already been removed!" & + int2str(pl_group) & " / " & int2str(vl_port)); + } + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_sendMessage_default_NIC + // + // Purpose: + // Function to send message and open connection instantly + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_sessionId - *in* *integer* - unique session id of current send + // - pl_msg - *in* *octetstring* - encoded message to be sent + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // The function selects a port within the port group which it has + // been applied to, then tries to send the message. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_sendMessage_default_NIC( + in integer pl_group, + in integer pl_sessionId, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + var integer vl_port := + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx].selectPort.apply(pl_group); + + if (vl_port == -1) + { + if (tsp_EPTF_HTTP_Transport_messageBufferEnable == false) { + f_EPTF_HTTP_Transport_warning(%definitionId & ": No more free ports available"); + } + else { + f_EPTF_MessageBufferManager_setMessageToBuffer(pl_msg, int2str (pl_sessionId), pl_group); + } + } + else { + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].state != OPENED) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Connection is not opened, state: " & + log2str(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].state)); + } + else + { + v_EPTF_HTTP_Transport_OutgoingMessage := { asp_Send := { + connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].connectionId, + proto := {tcp:= {}}, + msg := pl_msg + } }; + + v_resultNoWarning := f_EPTF_CommPort_IPL4_send( + v_EPTF_HTTP_Transport_OutgoingMessage, + null, false, true, v_EPTF_HTTP_LocalTransport_selfName); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Send result is " & + log2str(v_resultNoWarning)); + + if (not ispresent(v_resultNoWarning.errorCode) or ((v_resultNoWarning.errorCode == ERROR_TEMPORARILY_UNAVAILABLE) or (v_resultNoWarning.errorCode == ERROR_AVAILABLE))) + { + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].sessionId := pl_sessionId + + // move to busy if sending on port + if (not f_EPTF_FBQ_itemIsBusy(vl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) { + f_EPTF_FBQ_moveFromFreeToBusyTail(vl_port, + v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + } + + f_EPTF_int2int_HashMap_Insert(v_EPTF_HTTP_Transport_sessId2PortId_HM, + pl_sessionId, + vl_port); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Message sent on " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_port) & + ": " & log2str(pl_msg)); + } + else { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Send message unsuccessful!" & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_port)); + + // socket error, calling callback + if(vf_EPTF_HTTP_LocalTransport_socketErrorReceive != null) { + vf_EPTF_HTTP_LocalTransport_socketErrorReceive.apply({ + pl_group, + pl_sessionId, + v_resultNoWarning}); + } + } + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_sendResponse_default_IC + // + // Purpose: + // Function to send a response and close connection instantly + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_portId - *in* *integer* - unique port id to send the request + // - pl_msg - *in* *octetstring* - encoded message to be sent + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_sendResponse_default_IC( + in integer pl_group, + in integer pl_portId, + in integer pl_seqNum, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var integer vl_port := -1; + if (not f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_portId2Idx_HM, pl_portId, vl_port)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Could not find port identifier!" & + log2str(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase)); + return; + } + + if (f_EPTF_HTTP_Transport_sendResponse(pl_group, vl_port, pl_msg)) + { + var integer vl_fGIdx := v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx; + + v_EPTF_HTTP_Transport_functionDB[vl_fGIdx].removeIncomingConn.apply(pl_group, vl_port); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_sendResponse_default_NIC + // + // Purpose: + // Function to send a response. + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_portId - *in* *integer* - unique port id to send the request + // - pl_seqNum - *in* *integer* - sequence number of the response + // - pl_msg - *in* *octetstring* - encoded message to be sent + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_sendResponse_default_NIC( + in integer pl_group, + in integer pl_portId, + in integer pl_seqNum, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var integer vl_port := -1; + if (not f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_portId2Idx_HM, pl_portId, vl_port)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Could not find port identifier!" & + log2str(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase)); + return; + } + + if (-1 == pl_seqNum) + { + v_boolNoWarning := f_EPTF_HTTP_Transport_sendResponse(pl_group, vl_port, pl_msg); + return; + } + + var integer vl_headIdx := + f_EPTF_HTTP_RingBuffer_getHeadIdx(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNums); + var integer vl_messageIdx := -1; + + f_EPTF_HTTP_RingBuffer_setElementBusy( + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNums, + pl_seqNum + ); + + if (pl_seqNum == vl_headIdx) + { + v_boolNoWarning := f_EPTF_HTTP_Transport_sendResponse(pl_group, vl_port, pl_msg); + + if (not v_boolNoWarning) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Error while sending buffered responses, clearing buffer."); + f_EPTF_HTTP_MsgBuffer_clear(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer); + return; + } + + f_EPTF_HTTP_RingBuffer_freeHead(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNums); + + while(f_EPTF_HTTP_RingBuffer_isHeadBusy(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNums)) + { + //send buffered message + vl_headIdx := + f_EPTF_HTTP_RingBuffer_getHeadIdx(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNums); + + if (f_EPTF_int2int_HashMap_Find( + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNum2messageIdxHM, + vl_headIdx, + vl_messageIdx) and + f_EPTF_FBQ_itemIsBusy( + vl_messageIdx, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.messageQueue)) + { + if (f_EPTF_HTTP_Transport_sendResponse( + pl_group, + vl_port, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.httpMessages[vl_messageIdx])) + { + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.httpMessages[vl_messageIdx] := ''O; + f_EPTF_FBQ_moveFromBusyToFreeHead( + vl_messageIdx, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.messageQueue); + f_EPTF_int2int_HashMap_Erase( + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNum2messageIdxHM, + vl_headIdx); + f_EPTF_HTTP_RingBuffer_freeHead(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNums); + continue; + } + + f_EPTF_HTTP_MsgBuffer_clear(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer); + f_EPTF_HTTP_Transport_warning(%definitionId & ": Error while sending buffered responses, clearing buffer."); + return; + + }else{ + f_EPTF_HTTP_MsgBuffer_clear(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer); + f_EPTF_HTTP_Transport_warning(%definitionId & ": Inconsistency in message buffer!"); + } + } + }else{ + //store message + var integer vl_idx := -1; + + if (f_EPTF_int2int_HashMap_Find( + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNum2messageIdxHM, + pl_seqNum, + vl_idx)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Re-using slot! Replacing old message with new."); + }else + { + vl_idx := f_EPTF_FBQ_getOrCreateFreeSlot(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.messageQueue); + f_EPTF_FBQ_moveFromFreeToBusyTail( + vl_idx, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.messageQueue); + + f_EPTF_int2int_HashMap_Insert( + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.seqNum2messageIdxHM, + pl_seqNum, + vl_idx) + } + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].messageBuffer.httpMessages[vl_idx] := pl_msg; + + } + + f_EPTF_HTTP_printBufferStatus(pl_group, vl_port); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_sendResponse + // + // Purpose: + // Sends the response. + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_port - *in* *integer* - port index + // - pl_msg - *in* *octetstring* - encoded message to be sent + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_sendResponse( + in integer pl_group, + in integer pl_port, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT + return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return false; }; + + var ProtoTuple vl_proto := {tcp:= {}}; + if(v_EPTF_HTTP_Transport_portDB[pl_group].useSSL){ + vl_proto := {ssl:= {}} + } + + v_EPTF_HTTP_Transport_OutgoingMessage := { asp_Send := { + connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId, + proto := vl_proto, + msg := pl_msg + } }; + + v_resultNoWarning := f_EPTF_CommPort_IPL4_send( + v_EPTF_HTTP_Transport_OutgoingMessage, + null, false, true, v_EPTF_HTTP_LocalTransport_selfName); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Send result is " & + log2str(v_resultNoWarning)); + + if (ispresent(v_resultNoWarning.errorCode)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Send message unsuccessful!" & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, pl_port) & " " & + log2str(v_resultNoWarning)); + + // socket error, calling callback + if(vf_EPTF_HTTP_LocalTransport_socketErrorReceive != null) { + vf_EPTF_HTTP_LocalTransport_socketErrorReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].portId, + v_resultNoWarning}); + } + return false; + } + + return true; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_receiveMessage_default_IC + // + // Purpose: + // Function to receive message and close connection instantly + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_port - *in* *integer* - port index + // - pl_msg - *in* *octetstring* - encoded message to be sent + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // The function administrates port state and then calls the real + // message handler + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_receiveMessage_default_IC( + in integer pl_group, + in integer pl_port, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + f_EPTF_int2int_HashMap_Erase(v_EPTF_HTTP_Transport_sessId2PortId_HM, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId); + + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state == IDLE) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Port already closed " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, pl_port)); + + return; + } + else + { + f_EPTF_HTTP_Transport_closePortInGroup(pl_group, pl_port); + + //v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state := IDLE; + //v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId := -1; + + //f_EPTF_int2int_HashMap_Erase(v_EPTF_HTTP_Transport_connId2GroupId_HM, pl_conn); + //f_EPTF_int2int_HashMap_Erase(v_EPTF_HTTP_Transport_connId2PortId_HM, pl_conn); + + // deleted port will be allocated again (if necessary) at last time (free tail) + //f_EPTF_FBQ_moveFromBusyToFreeTail(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + + // administrate as IDLE port + //if (f_EPTF_FBQ_itemIsBusy(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) { + // f_EPTF_FBQ_moveFromBusyToFreeTail(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + //} + } + + var integer vl_temp := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId; + // delete session id only after handle receive message + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId := -1; + if (vf_EPTF_HTTP_LocalTransport_receive != null) { + vf_EPTF_HTTP_LocalTransport_receive.apply({ + pl_group, + vl_temp, + -1, + pl_msg}); + } + if (tsp_EPTF_HTTP_Transport_messageBufferEnable == true) { + var octetstring vl_message; + var charstring vl_sessionId; + if (f_EPTF_MessageBufferManager_getMessageFromBuffer(pl_group, vl_message, vl_sessionId)) { + if (lengthof (vl_message) > 0) { + f_EPTF_HTTP_LocalTransport_sendMessage_default_IC(pl_group, str2int(vl_sessionId), vl_message); + } + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_receiveMessage_default_NIC + // + // Purpose: + // Function to handle message recpetion + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_port - *in* *integer* - port index + // - pl_msg - *in* *octetstring* - the received encoded message + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // The function closes the port connection on which the message has + // arrived and then calls the real message handler + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_receiveMessage_default_NIC( + in integer pl_group, + in integer pl_port, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + f_EPTF_int2int_HashMap_Erase(v_EPTF_HTTP_Transport_sessId2PortId_HM, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId); + + // administrate as IDLE port + if (f_EPTF_FBQ_itemIsBusy(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) { + f_EPTF_FBQ_moveFromBusyToFreeTail(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + } + var integer vl_temp := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId; + + if (vf_EPTF_HTTP_LocalTransport_receive != null) { + vf_EPTF_HTTP_LocalTransport_receive.apply({ + pl_group, + vl_temp, + -1, + pl_msg}); + } + + if (tsp_EPTF_HTTP_Transport_messageBufferEnable == true) { + var octetstring vl_message; + var charstring vl_sessionId; + if (f_EPTF_MessageBufferManager_getMessageFromBuffer(pl_group, vl_message, vl_sessionId)) { + if (lengthof (vl_message) > 0) { + f_EPTF_HTTP_LocalTransport_sendMessage_default_NIC(pl_group, str2int(vl_sessionId), vl_message); + } + } + } + // session id cannot be deleted if connection stayed open + //v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId := -1; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_receiveMessageServer_default + // + // Purpose: + // Function to handle message recpetion + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_port - *in* *integer* - port index + // - pl_msg - *in* *octetstring* - the received encoded message + // + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_receiveMessageServer_default( + in integer pl_group, + in integer pl_port, + in octetstring pl_msg) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var integer vl_seqNum := -1; + + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].buffer) + { + vl_seqNum := f_EPTF_HTTP_RingBuffer_getNext(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].messageBuffer.seqNums); + if (-1 == vl_seqNum) + { + f_EPTF_HTTP_Transport_warning(log2str(%definitionId & + ": Dropping message: ", pl_msg)); + return; + } + + f_EPTF_HTTP_printBufferStatus(pl_group, pl_port); + } + + if (vf_EPTF_HTTP_LocalTransport_receive != null) { + vf_EPTF_HTTP_LocalTransport_receive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].portId, + vl_seqNum, + pl_msg}); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_receiveEvent_default + // + // Purpose: + // Function to handle event reception + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_port - *in* *integer* - port index + // - pl_type - *in* *integer* - event type + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_receiveEvent_default( + in integer pl_group, + in integer pl_port, + in integer pl_type) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + select (pl_type) + { + case (c_EPTF_HTTP_inputIdx_connectionOpened) + { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Connection opened received"); + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state := OPENED; + + if (vf_EPTF_HTTP_LocalTransport_eventReceive != null) { + vf_EPTF_HTTP_LocalTransport_eventReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId, + pl_type}); + } + + return; + } + case (c_EPTF_HTTP_inputIdx_connectionClosed) + { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Connection closed received"); + + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state != IDLE) + { + f_EPTF_int2int_HashMap_Erase(v_EPTF_HTTP_Transport_connId2GroupId_HM, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId); + f_EPTF_int2int_HashMap_Erase(v_EPTF_HTTP_Transport_connId2PortId_HM, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId); + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state := IDLE; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId := -1; + + // deleted port will be allocated again (if necessary) at last time (free tail) + //f_EPTF_FBQ_moveFromBusyToFreeTail(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + + // administrate as IDLE port + if (f_EPTF_FBQ_itemIsBusy(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) { + f_EPTF_FBQ_moveFromBusyToFreeTail(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + } + } + else { // receivemessage_default_IC can result in this state + //f_EPTF_HTTP_Transport_warning(%definitionId & + // ": Connection already closed"); + } + + if (vf_EPTF_HTTP_LocalTransport_eventReceive != null) { + vf_EPTF_HTTP_LocalTransport_eventReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId, + pl_type}); + } + + return; + } + case (c_EPTF_HTTP_inputIdx_OKReceived) { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": OK message received"); + + if (vf_EPTF_HTTP_LocalTransport_eventReceive != null) { + vf_EPTF_HTTP_LocalTransport_eventReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId, + pl_type}); + } + + return; + } + case (c_EPTF_HTTP_inputIdx_errorReceived) { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Error message received"); + + // socket error, calling callback + if(vf_EPTF_HTTP_LocalTransport_socketErrorReceive != null) { + vf_EPTF_HTTP_LocalTransport_socketErrorReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId, + v_EPTF_CommPort_IPL4_aspEvent.result}); + } + return; + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_receiveEventServer_default + // + // Purpose: + // Function to handle event reception in a server group. + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_port - *in* *integer* - port index + // - pl_type - *in* *integer* - event type + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_receiveEventServer_default( + in integer pl_group, + in integer pl_port, + in integer pl_type) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + select (pl_type) + { + case (c_EPTF_HTTP_inputIdx_connectionOpened) + { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Connection opened received"); + + var integer vl_fGIdx := v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx; + var integer vl_port := -1; + + if (v_EPTF_HTTP_Transport_functionDB[vl_fGIdx].createIncomingConn.apply(pl_group, + v_EPTF_CommPort_IPL4_aspEvent.connOpened, + vl_port)) + { + if (vf_EPTF_HTTP_LocalTransport_eventReceive != null) { + vf_EPTF_HTTP_LocalTransport_eventReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].portId, + pl_type}); + } + } + + return; + } + case (c_EPTF_HTTP_inputIdx_connectionClosed) + { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Connection closed received"); + + if (vf_EPTF_HTTP_LocalTransport_eventReceive != null) { + vf_EPTF_HTTP_LocalTransport_eventReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].portId, + pl_type}); + } + + var integer vl_fGIdx := v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx; + var integer vl_connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId; + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state := CLOSED; + f_EPTF_HTTP_Transport_socketClosed(vl_connId); + + v_EPTF_HTTP_Transport_functionDB[vl_fGIdx].removeIncomingConn.apply(pl_group, pl_port); + + return; + } + case (c_EPTF_HTTP_inputIdx_OKReceived) { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": OK message received"); + + if (LISTENING_PORT == v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].portType) + { + if (vf_EPTF_HTTP_LocalTransport_listenSocketEvent != null) { + vf_EPTF_HTTP_LocalTransport_listenSocketEvent.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].baseLocalHostInformation, + pl_type}); + } + + }else + { + if (vf_EPTF_HTTP_LocalTransport_eventReceive != null) { + vf_EPTF_HTTP_LocalTransport_eventReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId, + pl_type}); + } + } + + return; + } + case (c_EPTF_HTTP_inputIdx_errorReceived) { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Error message received"); + + if (LISTENING_PORT == v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].portType) + { + if (vf_EPTF_HTTP_LocalTransport_listenSocketError != null) { + vf_EPTF_HTTP_LocalTransport_listenSocketError.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].baseLocalHostInformation, + v_EPTF_CommPort_IPL4_aspEvent.result}); + } + + }else + { + // socket error, calling callback + if(vf_EPTF_HTTP_LocalTransport_socketErrorReceive != null) { + vf_EPTF_HTTP_LocalTransport_socketErrorReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId, + v_EPTF_CommPort_IPL4_aspEvent.result}); + } + } + return; + } + } + } + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_closePortOfUser_default + // + // Purpose: + // Function to close the port of an HTTP user free + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_sessionId - *in* *integer* - session id + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // An HTTP user is identified internally with a unique session id. + // If the HTTP user sends on a port of a port group, it can close the + // connection of its port group + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_closePortOfUser_default( + in integer pl_group, + in integer pl_sessionId) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + var integer vl_port; + + if (f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_sessId2PortId_HM, pl_sessionId, vl_port)) + { + f_EPTF_HTTP_Transport_closePortInGroup(pl_group, vl_port); + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].sessionId := -1; + } + else { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Port cannot be closed for session id " & + int2str(pl_sessionId) & " in group " & int2str(pl_group)); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_freePortOfUser_default + // + // Purpose: + // Function to make the port of an HTTP user free + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_sessionId - *in* *integer* - session id + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // An HTTP user is identified internally with a unique session id. + // If the HTTP user sends on a port of a port group, it can make the + // state of its port free. This case incoming messages on the port + // will be dropped and the port is free again for any HTTP user to use. + // + // If the port is reused by another HTTP user and the message of the + // last session arrives during this time, then the message will be + // forwaerded to the new HTTP user. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_freePortOfUser_default( + in integer pl_group, + in integer pl_sessionId) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + var integer vl_port; + + if (f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_sessId2PortId_HM, pl_sessionId, vl_port)) + { + // administrate as IDLE port + if (f_EPTF_FBQ_itemIsBusy(vl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) + { + f_EPTF_FBQ_moveFromBusyToFreeTail(vl_port, + v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + + // if port made free again, then messages from last session are disabled + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_port].sessionId := -1; + } + } + else + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Port cannot be made free for session id " & + int2str(pl_sessionId) & " in group " & int2str(pl_group)) + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_openConnection_defaultGroup + // + // Purpose: + // Function to open connections within a port group + // + // Parameters: + // - pl_group - *in* *integer* - group index + // + // Return Value: + // *boolean* - result of connection opening + // + // Errors: + // - + // + // Detailed Comments: + // Connection for all the ports will be opened within the port group. If + // one fails, all will be closed. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_openConnection_defaultGroup( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return false; }; + + var boolean vl_hasMoreElement; + var boolean vl_success := true; + var integer i; //, vl_ports := sizeof(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase); + + vl_hasMoreElement := f_EPTF_FBQ_getBusyHeadIdx(i, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + + while (vl_hasMoreElement) + //for (i := 0; i < vl_ports; i := i + 1) + { + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[i].state == IDLE) + { + f_EPTF_Base_assert(%definitionId & + ": Port is in idle state but connection id is presented at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, i), + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[i].connectionId == -1); + + if (not f_EPTF_HTTP_LocalTransport_openPortInGroup(pl_group, i)) { + vl_success := false; + break; //i := vl_ports; + } + } + + vl_hasMoreElement := f_EPTF_FBQ_getFwdBusyItemIdx(i, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + } + + if (not vl_success) { + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx].closeConnection.apply(pl_group); + } + + return vl_success; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_openPortInGroup + // + // Purpose: + // Auxilary function to open a connection for a given port of a given + // port group + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_port - *in* *integer* - port index + // + // Return Value: + // *boolean* - result of connection opening + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_openPortInGroup( + in integer pl_group, + in integer pl_port + ) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var EPTF_HTTP_HostInformation vl_local, vl_remote; + var Result vl_result; + + vl_local := v_EPTF_HTTP_Transport_localHostInformationList[ + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].localhostInfoIdx]; + vl_remote := v_EPTF_HTTP_Transport_remoteHostInformationList[ + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].remotehostInfoIdx]; + + v_EPTF_HTTP_Transport_OutgoingMessage := { + asp_Connect := { + remName := vl_remote.hostIPAddress, + remPort := vl_remote.hostPort, + locName := vl_local.hostIPAddress, + locPort := vl_local.hostPort, + proto := {tcp := {}} + } + } + + vl_result:={omit,omit,omit,omit}; + vl_result := f_EPTF_CommPort_IPL4_send( + v_EPTF_HTTP_Transport_OutgoingMessage, + null,false,false,v_EPTF_HTTP_LocalTransport_selfName); + + if (ispresent(vl_result.errorCode) and + IPL4_ERROR_TEMPORARILY_UNAVAILABLE != vl_result.errorCode) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Connection opening unsuccessful" & + " for port (" & log2str(vl_result) & ") at " & + + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, pl_port)); + + // socket error, calling callback + if(vf_EPTF_HTTP_LocalTransport_socketErrorReceive != null) { + vf_EPTF_HTTP_LocalTransport_socketErrorReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId, + vl_result}); + } + + return false; + } + else { + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId := vl_result.connId; + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state := OPENED; + + f_EPTF_HTTP_Transport_socketOpened(vl_result.connId, pl_group, pl_port); + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Connection opening successful for port at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, pl_port) & + " with connection id: " & int2str(vl_result.connId)); + } + + return true; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_openConnection_defaultPort + // + // Purpose: + // Function to open connection for a given port + // + // Parameters: + // - pl_group - *in* *integer* - port index + // + // Return Value: + // *boolean* - result of connection opening + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_openConnection_defaultPort( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return false; }; + + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].state != IDLE) + { + f_EPTF_Base_assert("Non-IDLE port must be busy!", + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].state == IDLE or + f_EPTF_FBQ_itemIsBusy(0, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue) ); + + f_EPTF_HTTP_Transport_warning(%definitionId & ": Connection already open!"); + return true; // because connection is open + } + else + { + if (f_EPTF_FBQ_itemIsBusy(0, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue)) + { + var Result vl_result; + + log(v_EPTF_HTTP_Transport_portDB[pl_group]); + + f_EPTF_Base_assert(%definitionId & + ": Port is in idle state but connection id is presented at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, 0), + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].connectionId == -1); + + v_EPTF_HTTP_Transport_OutgoingMessage := { + asp_Connect := { + remName := v_EPTF_HTTP_Transport_portDB[pl_group].baseRemoteHostInformation.hostIPAddress, + remPort := v_EPTF_HTTP_Transport_portDB[pl_group].baseRemoteHostInformation.hostPort, + locName := v_EPTF_HTTP_Transport_portDB[pl_group].baseLocalHostInformation.hostIPAddress, + locPort := v_EPTF_HTTP_Transport_portDB[pl_group].baseLocalHostInformation.hostPort, + proto := {tcp := {}} + } + } + + vl_result:={omit,omit,omit,omit}; + vl_result := f_EPTF_CommPort_IPL4_send( + v_EPTF_HTTP_Transport_OutgoingMessage, + null,false,false,v_EPTF_HTTP_LocalTransport_selfName); + + if (ispresent(vl_result.errorCode) and + IPL4_ERROR_TEMPORARILY_UNAVAILABLE != vl_result.errorCode) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Connection opening unsuccessful" & + " for port (" & log2str(vl_result) & ") at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, 0)); + + // socket error, calling callback + if(vf_EPTF_HTTP_LocalTransport_socketErrorReceive != null) { + vf_EPTF_HTTP_LocalTransport_socketErrorReceive.apply({ + pl_group, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].sessionId, + vl_result}); + } + + return false; + } + else + { + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].connectionId := vl_result.connId; + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].state := OPENED; + + f_EPTF_HTTP_Transport_socketOpened(vl_result.connId, pl_group, 0); + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Connection opening successful for port at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, 0) & + " with connection id: " & int2str(vl_result.connId)); + + return true + } + } + else { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Port 0 already deleted from group: " & int2str(pl_group)); + + return false; + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_listen_default + // + // Purpose: + // Opens a listen port in a server port group. + // + // Parameters: + // - pl_group - *in* *integer* - server port group index + // + // Return Value: + // *boolean* - result + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_listen_default( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return -1; }; + + if (-1 != v_EPTF_HTTP_Transport_portDB[pl_group].listeningPortIdx) + { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Already listening on " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, v_EPTF_HTTP_Transport_portDB[pl_group].listeningPortIdx)); + return v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[v_EPTF_HTTP_Transport_portDB[pl_group].listeningPortIdx].portId; + } + + var charstring vl_localHost := v_EPTF_HTTP_Transport_portDB[pl_group].baseLocalHostInformation.hostIPAddress; + var integer vl_localPort := v_EPTF_HTTP_Transport_portDB[pl_group].baseLocalHostInformation.hostPort; + var ProtoTuple vl_proto := {tcp := {}} + if(v_EPTF_HTTP_Transport_portDB[pl_group].useSSL) { + vl_proto := {ssl := {}}; + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Using SSL."); + } + v_EPTF_HTTP_Transport_OutgoingMessage := { + asp_Listen := { + locName := vl_localHost, + locPort := vl_localPort, + proto := vl_proto + } + } + + v_resultNoWarning := f_EPTF_CommPort_IPL4_send( + v_EPTF_HTTP_Transport_OutgoingMessage, + null,false,false,v_EPTF_HTTP_LocalTransport_selfName); + + if (ispresent(v_resultNoWarning.errorCode)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Listening unsuccessful for port (" & log2str(v_resultNoWarning) & ") at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, 0)); + + return -1; + } + + var integer vl_fbqIdx := -1; + vl_fbqIdx := f_EPTF_FBQ_getOrCreateFreeSlot(v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + var Result vl_result; + + vl_result := f_EPTF_CommPort_IPL4_setUserData(v_resultNoWarning.connId, v_resultNoWarning.connId); + + f_EPTF_HTTP_Transport_socketOpened(v_resultNoWarning.connId, pl_group, vl_fbqIdx); + + f_EPTF_FBQ_moveFromFreeToBusyTail(vl_fbqIdx, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue) + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx] := c_EPTF_HTTP_LocalTransport_initPortInfo; + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].groupIndex := pl_group; // FIXME check + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portIndex := vl_fbqIdx; // FIXME check + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portType := LISTENING_PORT; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].state := OPENED; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portId := f_EPTF_HTTP_Transport_generatePortId(pl_group); + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].connectionId := v_resultNoWarning.connId; + v_EPTF_HTTP_Transport_portDB[pl_group].listeningPortIdx := vl_fbqIdx; + + v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts := v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts + 1; + + f_EPTF_int2int_HashMap_Insert(v_EPTF_HTTP_Transport_portId2Idx_HM, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portId, vl_fbqIdx); + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Listening successful on " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_fbqIdx) & + " with connection id: " & int2str(v_resultNoWarning.connId)); + + return v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_createIncomingConn_default + // + // Purpose: + // Creates an incoming connection in the port group. + // + // Parameters: + // - pl_group - *in* *integer* - port group index + // - pl_connOpened - *in* <ConnectionOpenedEvent> - connection opened event + // - pl_port - *inout* *integer* - the index of the created port + // + // Return Value: + // boolean - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_createIncomingConn_default( + in integer pl_group, + in ConnectionOpenedEvent pl_connOpened, + inout integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT + return boolean + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return false;}; + + var integer vl_fbqIdx := -1, vl_rhIdx := -1; + var EPTF_HTTP_HostInformation vl_rhostInformation := {"", -1}; + + vl_rhostInformation.hostIPAddress := pl_connOpened.remName; + vl_rhostInformation.hostPort := pl_connOpened.remPort; + vl_rhIdx := f_EPTF_HTTP_LocalTransport_addRemoteHostInformation(vl_rhostInformation); + + vl_fbqIdx := f_EPTF_FBQ_getOrCreateFreeSlot(v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + + f_EPTF_FBQ_moveFromFreeToBusyTail(vl_fbqIdx, + v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + + v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts := v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts + 1; + + // set port data to port info database + if (sizeof(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase) <= vl_fbqIdx) + { + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx] := c_EPTF_HTTP_LocalTransport_initPortInfo; + } + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].groupIndex := pl_group; // FIXME check + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portIndex := vl_fbqIdx; // FIXME check + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].connectionId := pl_connOpened.connId; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portId := f_EPTF_HTTP_Transport_generatePortId(pl_group); + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portType := INCOMING_PORT; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].state := OPENED; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].remotehostInfoIdx := vl_rhIdx; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].buffer := v_EPTF_HTTP_Transport_portDB[pl_group].buffer; + if (v_EPTF_HTTP_Transport_portDB[pl_group].buffer and omit == v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].messageBuffer) + { + f_EPTF_HTTP_MsgBuffer_init( + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].messageBuffer, + v_EPTF_HTTP_Transport_bufferSize, + vl_fbqIdx); + } + + f_EPTF_HTTP_Transport_socketOpened(pl_connOpened.connId, pl_group, vl_fbqIdx); + + f_EPTF_int2int_HashMap_Insert(v_EPTF_HTTP_Transport_portId2Idx_HM, + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[vl_fbqIdx].portId, vl_fbqIdx); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": New incoming connection added to " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, vl_fbqIdx)); + + pl_port := vl_fbqIdx; + + return true; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_removeIncomingConn_default + // + // Purpose: + // Removes an incoming connection from the server port group. + // + // Parameters: + // - pl_group - *in* *integer* - port group index + // - pl_port - *in* *integer* - the index of the port to remove + // + // Return Value: + // boolean - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_removeIncomingConn_default( + in integer pl_group, + in integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + f_EPTF_HTTP_LocalTransport_removeServerPort(pl_group, pl_port); + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_closePort_default + // + // Purpose: + // Closes a connection. + // + // Parameters: + // - pl_group - *in* *integer* - port group index + // - pl_portId - *in* *integer* - port identifier + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_closePort_default( + in integer pl_group, + in integer pl_portId) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + var integer vl_port := -1; + + if (not f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_portId2Idx_HM, pl_portId, vl_port)) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Could not find port identifier!" & + log2str(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase)); + return; + } + + f_EPTF_HTTP_LocalTransport_removeServerPort(pl_group, vl_port); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_removeServerPort + // + // Purpose: + // Removes a port from the server group. + // + // Parameters: + // - pl_group - *in* *integer* - port group index + // - pl_port - *in* *integer* - port index + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_removeServerPort( + in integer pl_group, + in integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + if (f_EPTF_FBQ_itemIsBusy(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue)) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Removing port from group: " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, pl_port)); + + if (CLOSED != v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state) + { + var integer vl_connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId; + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Closing connection with id " & int2str(vl_connId)); + + v_EPTF_HTTP_Transport_OutgoingMessage := { + asp_Close := { + id := vl_connId, + proto := {tcp := {}} + } + } + + v_resultNoWarning := f_EPTF_CommPort_IPL4_send( + v_EPTF_HTTP_Transport_OutgoingMessage, + null, false, false, v_EPTF_HTTP_LocalTransport_selfName); + + f_EPTF_HTTP_Transport_socketClosed(vl_connId); + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state := CLOSED; + } + + f_EPTF_int2int_HashMap_Erase(v_EPTF_HTTP_Transport_portId2Idx_HM, v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].portId); + + f_EPTF_FBQ_moveFromBusyToFreeTail(pl_port, + v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + + if (omit == v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].messageBuffer) + { + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port] := c_EPTF_HTTP_LocalTransport_initPortInfo; + }else + { + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].groupIndex := c_EPTF_HTTP_LocalTransport_initPortInfo.groupIndex; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].portIndex := c_EPTF_HTTP_LocalTransport_initPortInfo.portIndex; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId := c_EPTF_HTTP_LocalTransport_initPortInfo.connectionId; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].sessionId := c_EPTF_HTTP_LocalTransport_initPortInfo.sessionId; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].portId := c_EPTF_HTTP_LocalTransport_initPortInfo.portId; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].localhostInfoIdx := c_EPTF_HTTP_LocalTransport_initPortInfo.localhostInfoIdx; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].remotehostInfoIdx := + c_EPTF_HTTP_LocalTransport_initPortInfo.remotehostInfoIdx; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state := c_EPTF_HTTP_LocalTransport_initPortInfo.state; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].portType := c_EPTF_HTTP_LocalTransport_initPortInfo.portType; + + f_EPTF_HTTP_MsgBuffer_clear(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].messageBuffer); + } + v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts := v_EPTF_HTTP_Transport_portDB[pl_group].numberOfPorts - 1; + v_EPTF_HTTP_Transport_portDB[pl_group].listeningPortIdx := -1; + + } + else + { + f_EPTF_HTTP_Transport_warning(log2str(%definitionId & + ": Error removing incoming connection: port(",pl_port,") is not busy : " & + int2str(pl_group) & " - " & + v_EPTF_HTTP_Transport_portDB[pl_group].name & "; ", + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port])); + } + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_closeConnection_defaultGroup + // + // Purpose: + // Function to close connections for a given port group + // + // Parameters: + // - pl_group - *in* *integer* - port index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // All open ports within the port group will be closed + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_closeConnection_defaultGroup( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + var boolean vl_hasMoreElement; + var integer i; + + //vl_ports := sizeof(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase); + vl_hasMoreElement := f_EPTF_FBQ_getBusyHeadIdx(i, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + while (vl_hasMoreElement) + //for (i := 0; i < vl_ports; i := i + 1); + { + f_EPTF_HTTP_Transport_closePortInGroup(pl_group, i); + + vl_hasMoreElement := f_EPTF_FBQ_getFwdBusyItemIdx(i, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_closePortInGroup + // + // Purpose: + // Auxialry funtion to close a given port of a given port group + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_port - *in* *integer* - port index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_closePortInGroup( + in integer pl_group, + in integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state != IDLE) + { + var integer vl_connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId; + + f_EPTF_Base_assert(%definitionId & + ": Port is not in IDLE state but connection id is missing at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, pl_port), + vl_connId != -1); + + v_EPTF_HTTP_Transport_OutgoingMessage := { + asp_Close := { + id := vl_connId, + proto := {tcp := {}} + } + } + + v_resultNoWarning := f_EPTF_CommPort_IPL4_send( + v_EPTF_HTTP_Transport_OutgoingMessage, + null, false, false, v_EPTF_HTTP_LocalTransport_selfName); + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId := -1; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state := IDLE; + + f_EPTF_HTTP_Transport_socketClosed(vl_connId); + + // administrate port as free + //if (f_EPTF_FBQ_itemIsBusy(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue)) { + // f_EPTF_FBQ_moveFromBusyToFreeTail(pl_port, + // v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + //} + + // administrate as IDLE port + if (f_EPTF_FBQ_itemIsBusy(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) { + f_EPTF_FBQ_moveFromBusyToFreeTail(pl_port, + v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + } + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Connection (" & + int2str(vl_connId) & ") closed for port at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, pl_port)); + } + else + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Connection (" & + int2str(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId) & + ") is already closed for port at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, pl_port)); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_closeConnection_defaultPort + // + // Purpose: + // Function to close connection of a port + // + // Parameters: + // - pl_group - *in* *integer* - port index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_closeConnection_defaultPort( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + var integer vl_connId; + + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].state == IDLE) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Connection already closed!"); + return; + } + else + { + vl_connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].connectionId; + + log(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0]); + + f_EPTF_Base_assert(%definitionId & + ": Port is not in IDLE state but connection id is missing at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, 0), + vl_connId != -1); + + v_EPTF_HTTP_Transport_OutgoingMessage := { + asp_Close := { + id := vl_connId, + proto := {tcp := {}} + } + } + + v_resultNoWarning := f_EPTF_CommPort_IPL4_send( + v_EPTF_HTTP_Transport_OutgoingMessage, + null, false, false, v_EPTF_HTTP_LocalTransport_selfName); + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].connectionId := -1; + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].state := IDLE; + + f_EPTF_HTTP_Transport_socketClosed(vl_connId); + + // administrate port as free + //if (f_EPTF_FBQ_itemIsBusy(0, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue)) { + // f_EPTF_FBQ_moveFromBusyToFreeTail(0, + // v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + //} + + // administrate as IDLE port + if (f_EPTF_FBQ_itemIsBusy(0, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue)) { + f_EPTF_FBQ_moveFromBusyToFreeTail(0, + v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + } + } + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Connection (" & + int2str(vl_connId) & ") closed for port at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, 0)); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_halfCloseConnection_defaultGroup + // + // Purpose: + // Function to half close connections for a given port group + // + // Parameters: + // - pl_group - *in* *integer* - port index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // State of all opened ports will be set to half closed + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_halfCloseConnection_defaultGroup( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + var boolean vl_hasMoreElement; + var integer i; //, vl_ports; + + //vl_ports := sizeof(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase); + + vl_hasMoreElement := f_EPTF_FBQ_getBusyHeadIdx(i, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + while (vl_hasMoreElement) + //for (i := 0; i < vl_ports; i := i + 1) + { + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[i].state != IDLE and + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[i].state != HALFCLOSED) + { + f_EPTF_Base_assert(%definitionId & + ": Port is not in IDLE/HALFCLOSED state but connection id is missing at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, i), + -1 != v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[i].connectionId); + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[i].state := HALFCLOSED; + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Port state is set to " & + "half closed at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, i)); + } + + vl_hasMoreElement := f_EPTF_FBQ_getFwdBusyItemIdx(i, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_halfCloseConnection_defaultPort + // + // Purpose: + // Auxialry funtion to close a given port + // + // Parameters: + // - pl_group - *in* *integer* - port index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_halfCloseConnection_defaultPort( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return; }; + + if (v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].state != IDLE and + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].state != HALFCLOSED and + f_EPTF_FBQ_itemIsBusy(0, v_EPTF_HTTP_Transport_portDB[pl_group].portQueue)) + { + f_EPTF_Base_assert(%definitionId & + ": Port is not in IDLE/HALFCLOSED state but connection id is missing at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, 0), + -1 != v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].connectionId); + + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[0].state := HALFCLOSED; + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Port state is set to " & + "half closed at " & + f_EPTF_HTTP_LocalTransport_createGroupPortInfoString(pl_group, 0)); + } + else + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Connection already half closed!"); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_createGroupPortInfoString + // + // Purpose: + // Helper function to create port information string for logging + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_port - *in* *integer* - port index + // + // Return Value: + // *charstring* - the created information string + // + // Errors: + // - + // + // Detailed Comments: + // Information string will be 'group (<group index>) - <group name> at + // port index <port index>: Local: <local host information> / Remote: + // <remote host information>' + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_createGroupPortInfoString( + in integer pl_group, + in integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT return charstring + { + var EPTF_HTTP_HostInformation vl_local := {"", -1}, vl_remote := {"", -1}; + if( sizeof(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase) > pl_port ) { + var integer vl_localIdx := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].localhostInfoIdx; + var integer vl_remoteIdx := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].remotehostInfoIdx; + + if (0 <= vl_localIdx) + { + vl_local := v_EPTF_HTTP_Transport_localHostInformationList[ + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].localhostInfoIdx]; + }else{ + vl_local := v_EPTF_HTTP_Transport_portDB[pl_group].baseLocalHostInformation + } + + if (0 <= vl_remoteIdx) + { + vl_remote := v_EPTF_HTTP_Transport_remoteHostInformationList[ + v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].remotehostInfoIdx]; + } + } else { + f_EPTF_HTTP_Transport_debug(%definitionId & " Not fully initialized portDB: v_EPTF_HTTP_Transport_portDB:" & + log2str(v_EPTF_HTTP_Transport_portDB) & " pl_group: " & log2str(pl_group) & " pl_port: " & log2str(pl_port)); + } + return "group (" & int2str(pl_group) & ") - " & v_EPTF_HTTP_Transport_portDB[pl_group].name & + " at port index " & int2str(pl_port) & + ": Local: " & log2str(vl_local) & " / Remote: " & log2str(vl_remote); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_createUniqueGroupName + // + // Purpose: + // Creates a unique group name for port groups + // + // Parameters: + // - pl_basename - *in* *charstring* - base name for port names + // + // Return Value: + // - charstring - the created group name + // + // Errors: + // - + // + // Detailed Comments: + // The function appends a number to the provided pl_basename and increases + // the attached number till the created name will be unique + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_createUniqueGroupName( + in charstring pl_basename) + runs on EPTF_HTTP_LocalTransport_CT return charstring + { + var integer vl_dummy; + var charstring vl_groupName := pl_basename & "." & int2str(v_nameIdx); + + while (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_groupName2Idx_HM, + vl_groupName, vl_dummy)) + { + v_nameIdx := v_nameIdx + 1; + vl_groupName := pl_basename & "." & int2str(v_nameIdx); + } + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Unique group name created: " & vl_groupName); + + return vl_groupName; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_registerGroupFunctions + // + // Purpose: + // Registers handler functions to a port group + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_portMode - *in* *boolean* - port group creation mode + // (port/group mode) + // - pl_funcs - *in* <EPTF_HTTP_Transport_UserFunctions> - record + // containing function references of handler functions + // + // Return Value: + // *charstring* - the created group name + // + // Errors: + // - + // + // Detailed Comments: + // The function should be applied to an already created port group with + // set instant connection close, instant connection open parameters. + // + // If the port group which the function is applied to has a set + // handler function reference index (defaultFIdx != -1), then the functions + // which are set in pl_funcs will be used to overdefine the default + // handler functions. The ones that are omit in pl_funcs will be left + // unchanged. + // + // If the port group which the function is applied to doesn't have a set + // handler function reference index (defaultFIdx != -1), then all the + // handler functions will be redefined. If a function reference is omit in + // pl_funcs, the handler function will be overdefined with default functions + // based on instant connection close, instant connection open parameters + // of the port group, otherwise the set function reference will be used to + // redefine the handler function. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_registerGroupFunctions( + in integer pl_group, + in boolean pl_portMode, + in EPTF_HTTP_Transport_UserFunctions pl_funcs) + runs on EPTF_HTTP_LocalTransport_CT return integer + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return -1; }; + + var integer vl_index; + var charstring vl_key; + var EPTF_HTTP_Transport_Function vl_funcs := c_HTTP_Transport_initFunction; + + f_EPTF_Base_assert(%definitionId & + ": Group not yet initialized (" & int2str(pl_group) & ")", + pl_group < sizeof(v_EPTF_HTTP_Transport_portDB) and f_EPTF_FBQ_itemIsBusy(pl_group, v_EPTF_HTTP_Transport_groupQueue)); + + // checks if function group has been checked before + var boolean vl_override := v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx == -1; + var boolean vl_iconn := v_EPTF_HTTP_Transport_portDB[pl_group].instantConnOpen; + var boolean vl_iclose := v_EPTF_HTTP_Transport_portDB[pl_group].instantConnClose; + + // creates new candidate function group for the the port group + if (ispresent(pl_funcs.addPort) and pl_funcs.addPort != null) { + vl_funcs.addPort := pl_funcs.addPort; + } else { + if (vl_override) { + vl_funcs.addPort := refers(f_EPTF_HTTP_LocalTransport_addPortToGroup_default); + } + } + + if (ispresent(pl_funcs.removePort) and pl_funcs.removePort != null) { + vl_funcs.removePort := pl_funcs.removePort; + } else { + if (vl_override) { + vl_funcs.removePort := refers(f_EPTF_HTTP_LocalTransport_removePortFromGroup_default); + } + } + + if (ispresent(pl_funcs.selectPort) and pl_funcs.selectPort != null) + { + vl_funcs.selectPort := pl_funcs.selectPort; + } else { + if (vl_override) { + if (pl_portMode) { + vl_funcs.selectPort := refers( + f_EPTF_HTTP_LocalTransport_selectPortInGroup_defaultPort); + } + else { + vl_funcs.selectPort := refers( + f_EPTF_HTTP_LocalTransport_selectPortInGroup_defaultGroup); + } + } + } + + /* MOVED TO COMPONENT VARIABLE vf_getGroupAndPort + if (ispresent(pl_funcs.getGroupAndPort) and pl_funcs.getGroupAndPort != null) + { + vl_funcs.getGroupAndPort := pl_funcs.getGroupAndPort; + } + else { + if (vl_override) { + if (pl_portMode) { + vl_funcs.getGroupAndPort := refers( + f_EPTF_HTTP_LocalTransport_getGroupAndPort_defaultGroup); + } + else { + vl_funcs.getGroupAndPort := refers( + f_EPTF_HTTP_LocalTransport_getGroupAndPort_defaultPort); + } + } + } + */ + + if (ispresent(pl_funcs.sendMessage) and pl_funcs.sendMessage != null) + { + vl_funcs.sendMessage := pl_funcs.sendMessage; + } + else { + if (vl_override) { + if (vl_iconn) { + vl_funcs.sendMessage := refers( + f_EPTF_HTTP_LocalTransport_sendMessage_default_IC); + } + else { + vl_funcs.sendMessage := refers( + f_EPTF_HTTP_LocalTransport_sendMessage_default_NIC); + } + } + } + + if (ispresent(pl_funcs.closePortOfUser) and pl_funcs.closePortOfUser != null) + { + vl_funcs.closePortOfUser := pl_funcs.closePortOfUser; + } + else { + if (vl_override) { + vl_funcs.closePortOfUser := refers(f_EPTF_HTTP_LocalTransport_closePortOfUser_default); + } + } + + if (ispresent(pl_funcs.freePortOfUser) and pl_funcs.freePortOfUser != null) + { + vl_funcs.freePortOfUser := pl_funcs.freePortOfUser; + } + else { + if (vl_override) { + vl_funcs.freePortOfUser := refers(f_EPTF_HTTP_LocalTransport_freePortOfUser_default); + } + } + + if (ispresent(pl_funcs.openPort) and pl_funcs.openPort != null) + { + vl_funcs.openPort := pl_funcs.openPort; + } + else { + if (vl_override) { + if (pl_portMode) { + vl_funcs.openPort := refers( + f_EPTF_HTTP_LocalTransport_openConnection_defaultPort); + } + else { + vl_funcs.openPort := refers( + f_EPTF_HTTP_LocalTransport_openConnection_defaultGroup); + } + } + } + + + if (ispresent(pl_funcs.closeConnection) and pl_funcs.closeConnection != null) + { + vl_funcs.closeConnection := pl_funcs.closeConnection; + } + else { + if (vl_override) { + if (pl_portMode) { + vl_funcs.closeConnection := refers( + f_EPTF_HTTP_LocalTransport_closeConnection_defaultPort); + } + else { + vl_funcs.closeConnection := refers( + f_EPTF_HTTP_LocalTransport_closeConnection_defaultGroup); + } + } + } + + if (ispresent(pl_funcs.halfClosePort) and pl_funcs.halfClosePort != null) + { + vl_funcs.halfClosePort := pl_funcs.halfClosePort; + } + else { + if (vl_override) { + if (pl_portMode) { + vl_funcs.halfClosePort := refers( + f_EPTF_HTTP_LocalTransport_halfCloseConnection_defaultPort); + } + else { + vl_funcs.halfClosePort := refers( + f_EPTF_HTTP_LocalTransport_halfCloseConnection_defaultGroup); + } + } + } + + if (ispresent(pl_funcs.receiveMessage) and pl_funcs.receiveMessage != null) { + vl_funcs.receiveMessage := pl_funcs.receiveMessage; + } + else { + if (vl_override) { + if (vl_iclose) { + vl_funcs.receiveMessage := refers( + f_EPTF_HTTP_LocalTransport_receiveMessage_default_IC); + } + else { + vl_funcs.receiveMessage := refers( + f_EPTF_HTTP_LocalTransport_receiveMessage_default_NIC); + } + } + } + + if (ispresent(pl_funcs.receiveEvent) and pl_funcs.receiveEvent != null) { + vl_funcs.receiveEvent := pl_funcs.receiveEvent; + } + else { + if (vl_override) { + vl_funcs.receiveEvent := refers(f_EPTF_HTTP_LocalTransport_receiveEvent_default); + } + } + + // creates a hash map key from the function group + vl_key := log2str(vl_funcs) + + // if function group is already existing, then return id + if (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_functions2Idx_HM, + vl_key, vl_index)) + { + return vl_index; + } + + // if function group was not existing, then add new element + vl_index := sizeof(v_EPTF_HTTP_Transport_functionDB); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": New database index: " & int2str(vl_index) & + " for functions: " & vl_key); + + v_EPTF_HTTP_Transport_functionDB[vl_index] := vl_funcs; + + f_EPTF_str2int_HashMap_Insert(v_EPTF_HTTP_Transport_functions2Idx_HM, + vl_key, vl_index); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Functions are registered to group (" & + int2str(pl_group) & " - " & v_EPTF_HTTP_Transport_portDB[pl_group].name & ": " & vl_key & + " at position " & int2str(vl_index) & " in function database!"); + + return vl_index; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_registerServerGroupFunctions + // + // Purpose: + // Registers handler functions to a server port group + // + // Parameters: + // - pl_group - *in* *integer* - group index + // - pl_funcs - *in* <EPTF_HTTP_Transport_ServerUserFunctions> - record + // containing function references of handler functions + // + // Return Value: + // *charstring* - the created group name + // + // Errors: + // - + // + // Detailed Comments: + // The function should be applied to an already created port group with + // set instant connection close, instant connection open parameters. + // + // If the port group which the function is applied to has a set + // handler function reference index (defaultFIdx != -1), then the functions + // which are set in pl_funcs will be used to overdefine the default + // handler functions. The ones that are omit in pl_funcs will be left + // unchanged. + // + // If the port group which the function is applied to doesn't have a set + // handler function reference index (defaultFIdx != -1), then all the + // handler functions will be redefined. If a function reference is omit in + // pl_funcs, the handler function will be overdefined with default functions + // based on instant connection close, instant connection open parameters + // of the port group, otherwise the set function reference will be used to + // redefine the handler function. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_registerServerGroupFunctions( + in integer pl_group, + in EPTF_HTTP_Transport_ServerUserFunctions pl_funcs) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_group)) { return -1; }; + + var integer vl_index; + var charstring vl_key; + var EPTF_HTTP_Transport_Function vl_funcs := c_HTTP_Transport_initFunction; + + f_EPTF_Base_assert(%definitionId & + ": Group not yet initialized (" & int2str(pl_group) & ")", + pl_group < sizeof(v_EPTF_HTTP_Transport_portDB) and f_EPTF_FBQ_itemIsBusy(pl_group, v_EPTF_HTTP_Transport_groupQueue)); + + // checks if function group has been checked before + var boolean vl_override := v_EPTF_HTTP_Transport_portDB[pl_group].defaultFIdx == -1; + var boolean vl_iclose := v_EPTF_HTTP_Transport_portDB[pl_group].instantConnClose; + + if (ispresent(pl_funcs.removePort) and pl_funcs.removePort != null) { + vl_funcs.removePort := pl_funcs.removePort; + } else { + if (vl_override) { + vl_funcs.removePort := refers(f_EPTF_HTTP_LocalTransport_removePortFromGroupServer_default); + } + } + + if (ispresent(pl_funcs.listen) and pl_funcs.listen != null){ + vl_funcs.listen := pl_funcs.listen; + }else{ + if (vl_override) { + vl_funcs.listen := refers(f_EPTF_HTTP_LocalTransport_listen_default); + } + } + + if (ispresent(pl_funcs.createIncomingConn) and pl_funcs.createIncomingConn != null){ + vl_funcs.createIncomingConn := pl_funcs.createIncomingConn; + }else{ + if (vl_override) { + vl_funcs.createIncomingConn := refers(f_EPTF_HTTP_LocalTransport_createIncomingConn_default); + } + } + + if (ispresent(pl_funcs.removeIncomingConn) and pl_funcs.removeIncomingConn != null){ + vl_funcs.removeIncomingConn := pl_funcs.removeIncomingConn; + }else{ + if (vl_override) { + vl_funcs.removeIncomingConn := refers(f_EPTF_HTTP_LocalTransport_removeIncomingConn_default); + } + } + + if (ispresent(pl_funcs.receiveEvent) and pl_funcs.receiveEvent != null) { + vl_funcs.receiveEvent := pl_funcs.receiveEvent; + } + else { + if (vl_override) { + vl_funcs.receiveEvent := refers(f_EPTF_HTTP_LocalTransport_receiveEventServer_default); + } + } + + if (ispresent(pl_funcs.receiveMessage) and pl_funcs.receiveMessage != null) { + vl_funcs.receiveMessage := pl_funcs.receiveMessage; + } + else { + if (vl_override) { + vl_funcs.receiveMessage := refers( + f_EPTF_HTTP_LocalTransport_receiveMessageServer_default); + } + } + + if (ispresent(pl_funcs.sendResponse) and pl_funcs.sendResponse != null) + { + vl_funcs.sendResponse := pl_funcs.sendResponse; + } + else { + if (vl_override) { + if (vl_iclose) { + vl_funcs.sendResponse := refers( + f_EPTF_HTTP_LocalTransport_sendResponse_default_IC); + } + else { + vl_funcs.sendResponse := refers( + f_EPTF_HTTP_LocalTransport_sendResponse_default_NIC); + } + } + } + + if (ispresent(pl_funcs.closePort) and pl_funcs.listen != null){ + vl_funcs.closePort := pl_funcs.closePort; + }else{ + if (vl_override) { + vl_funcs.closePort := refers(f_EPTF_HTTP_LocalTransport_closePort_default); + } + } + + // creates a hash map key from the function group + vl_key := log2str(vl_funcs) + + // if function group is already existing, then return id + if (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_functions2Idx_HM, + vl_key, vl_index)) + { + return vl_index; + } + + // if function group was not existing, then add new element + vl_index := sizeof(v_EPTF_HTTP_Transport_functionDB); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": New database index: " & int2str(vl_index) & + " for functions: " & vl_key); + + v_EPTF_HTTP_Transport_functionDB[vl_index] := vl_funcs; + + f_EPTF_str2int_HashMap_Insert(v_EPTF_HTTP_Transport_functions2Idx_HM, + vl_key, vl_index); + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Functions are registered to group (" & + int2str(pl_group) & " - " & v_EPTF_HTTP_Transport_portDB[pl_group].name & ": " & vl_key & + " at position " & int2str(vl_index) & " in function database!"); + + return vl_index; + + } + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_checkGroup + // + // Purpose: + // Check the state of a port group + // + // Parameters: + // - pl_group - *in* *integer* - group index + // + // Return Value: + // *boolean* - true if group is okay, false otherwise + // + // Errors: + // - + // + // Detailed Comments: + // Check group index and group occupation state + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_checkGroup( + in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + if (pl_group == -1) { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Group does not exist!"); + return false; + } + + if (sizeof(v_EPTF_HTTP_Transport_portDB) <= pl_group) { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Invalid group index: " & + int2str(pl_group)); + return false; + } + + if (not f_EPTF_FBQ_itemIsBusy(pl_group, v_EPTF_HTTP_Transport_groupQueue)) { + f_EPTF_HTTP_Transport_warning(%definitionId & ": Group already deleted: " & + int2str(pl_group) & " - " & v_EPTF_HTTP_Transport_portDB[pl_group].name); + return false; + } + + return true; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_addLocalHostInformation + // + // Purpose: + // Function to add new Local Host Information to the LocalHostInformation database + // + // Parameters: + // pl_hostInformation - *in* - <EPTF_HTTP_HostInformation> - The local host information + // + // Return Value: + // *integer* - the index of the database record + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_addLocalHostInformation ( + in EPTF_HTTP_HostInformation pl_hostInformation) + runs on EPTF_HTTP_LocalTransport_CT return integer + { + var integer vl_EPTF_HTTP_index; + + if (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_localHostHashMap, + pl_hostInformation.hostIPAddress&int2str(pl_hostInformation.hostPort), + vl_EPTF_HTTP_index)) + { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Local HostIPAddress already exists: "&int2str(vl_EPTF_HTTP_index)); + } + else + { + vl_EPTF_HTTP_index := sizeof(v_EPTF_HTTP_Transport_localHostInformationList); + + f_EPTF_str2int_HashMap_Insert(v_EPTF_HTTP_Transport_localHostHashMap, + pl_hostInformation.hostIPAddress&int2str(pl_hostInformation.hostPort), + vl_EPTF_HTTP_index); + + v_EPTF_HTTP_Transport_localHostInformationList[vl_EPTF_HTTP_index] := pl_hostInformation; + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Local HostIPAddress does not exist, now added: "&int2str(vl_EPTF_HTTP_index)); + } + + return vl_EPTF_HTTP_index; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_addRemoteHostInformation + // + // Purpose: + // Function to add new Remote Host Information to the LocalHostInformation database + // + // Parameters: + // pl_hostInformation - *in* - <EPTF_HTTP_HostInformation> - The remote host information + // + // Return Value: + // *integer* - the index of the database record + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_addRemoteHostInformation ( + in EPTF_HTTP_HostInformation pl_hostInformation) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + var integer vl_EPTF_HTTP_index; + + if (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_remoteHostHashMap, + pl_hostInformation.hostIPAddress&int2str(pl_hostInformation.hostPort), + vl_EPTF_HTTP_index)) + { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Remote HostIPAddress already exists: "&int2str(vl_EPTF_HTTP_index)); + } + else + { + vl_EPTF_HTTP_index := sizeof(v_EPTF_HTTP_Transport_remoteHostInformationList); + + f_EPTF_str2int_HashMap_Insert(v_EPTF_HTTP_Transport_remoteHostHashMap, + pl_hostInformation.hostIPAddress&int2str(pl_hostInformation.hostPort), + vl_EPTF_HTTP_index); + + v_EPTF_HTTP_Transport_remoteHostInformationList[vl_EPTF_HTTP_index] := pl_hostInformation; + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Remote HostIPAddress not exists, now added: "&int2str(vl_EPTF_HTTP_index)); + } + + return vl_EPTF_HTTP_index; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_addMessageLengthCalculationFunction + // + // Purpose: + // Function to add a new message length calculation function + // + // Parameters: + // pl_functionRef - *in* <f_IPL4_getMsgLen> - function reference of + // messagelength calculation function + // + // Return Value: + // *integer* - message length calcualtion function index + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_addMessageLengthCalculationFunction( + in f_IPL4_getMsgLen pl_functionRef) + runs on EPTF_HTTP_LocalTransport_CT return integer + { + var integer vl_size := + sizeof(v_EPTF_HTTPLocalTransport_lengthCalculationFunctions); + + v_EPTF_HTTPLocalTransport_lengthCalculationFunctions[vl_size] := + pl_functionRef; + + return vl_size; + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_setMessageLengthCalculationFunctionToConnId + // + // Purpose: + // Function to set a message length calculation function to a connection + // id + // + // Parameters: + // pl_connId - *in* *integer* - connection id + // pl_functionIdx - *in* *integer* - message length calculation + // function database index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_setMessageLengthCalculationFunctionToConnId( + in integer pl_connId, + in integer pl_functionIdx) + runs on EPTF_HTTP_LocalTransport_CT + { + + f_EPTF_CommPort_IPL4_setMsgLen(pl_connId, + v_EPTF_HTTPLocalTransport_lengthCalculationFunctions[pl_functionIdx], {}); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_getMessageLength + // + // Purpose: + // Function to get the message length of a stream + // + // Parameters: + // stream - *in* *octetstring* - stream + // args - *inout* - arguments + // + // Return Value: + // *integer* - message length of stream + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_getMessageLength ( + in octetstring stream, + inout ro_integer args) + return integer + { + return f_TCCMessageHandling_getMessageLength(stream) + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_receiveMessage + // + // Purpose: + // Function to receive the incoming messages + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_receiveMessage() + runs on EPTF_HTTP_LocalTransport_CT { + + f_EPTF_HTTP_Transport_debug("### " & %definitionId & + "(): Message received on connection: " & + int2str(v_EPTF_CommPort_IPL4_aspRecvFrom.connId)); + + var integer vl_group, vl_port; + + v_boolNoWarning := vf_getGroupAndPort.apply(v_EPTF_CommPort_IPL4_aspRecvFrom.connId, vl_group, vl_port); + + v_EPTF_HTTP_Transport_lastReceivedGroup := vl_group; + + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[vl_group].defaultFIdx].receiveMessage.apply( + vl_group, vl_port, + v_EPTF_CommPort_IPL4_aspRecvFrom.msg); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_receiveEvent + // + // Purpose: + // Function to receive the incoming events + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_receiveEvent() + runs on EPTF_HTTP_LocalTransport_CT { + + var integer vl_group, vl_port, vl_conn; + + if (ischosen(v_EPTF_CommPort_IPL4_aspEvent.connOpened)) + { + vl_conn := v_EPTF_CommPort_IPL4_aspEvent.connOpened.connId; + var integer vl_userData := -1; + + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "(): " & + "Event received on connection:" & int2str(vl_conn) & ": " & + log2str(v_EPTF_CommPort_IPL4_aspEvent)); + + v_resultNoWarning := f_EPTF_CommPort_IPL4_getUserData(vl_conn, vl_userData); + + v_boolNoWarning := vf_getGroup.apply(vl_userData, vl_group); + + v_EPTF_HTTP_Transport_lastReceivedGroup := vl_group; + + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[vl_group].defaultFIdx].receiveEvent.apply( + vl_group, vl_port, + //vl_conn, + //v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase[vl_port].sessionId, //vl_conn, + c_EPTF_HTTP_inputIdx_connectionOpened); + } + else + if (ischosen(v_EPTF_CommPort_IPL4_aspEvent.connClosed)) + { + vl_conn := v_EPTF_CommPort_IPL4_aspEvent.connClosed.connId; + + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()" & + "Event received on connection:" & int2str(vl_conn) & ": " & + log2str(v_EPTF_CommPort_IPL4_aspEvent)); + + v_boolNoWarning := vf_getGroupAndPort.apply(vl_conn, vl_group, vl_port); + + v_EPTF_HTTP_Transport_lastReceivedGroup := vl_group; + + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[vl_group].defaultFIdx].receiveEvent.apply( + vl_group, vl_port, + //vl_conn, + //v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase[vl_port].sessionId, //vl_conn, + c_EPTF_HTTP_inputIdx_connectionClosed); + } + else + if (ischosen(v_EPTF_CommPort_IPL4_aspEvent.result)) + { + vl_conn := v_EPTF_CommPort_IPL4_aspEvent.result.connId; + + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "(): " & + "Event received on connection: " & int2str(vl_conn) & ": " & + log2str(v_EPTF_CommPort_IPL4_aspEvent)); + + v_boolNoWarning := vf_getGroupAndPort.apply(vl_conn, vl_group, vl_port); + + v_EPTF_HTTP_Transport_lastReceivedGroup := vl_group; + + if (v_EPTF_CommPort_IPL4_aspEvent.result.errorCode == omit) + { + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[vl_group].defaultFIdx].receiveEvent.apply( + vl_group, vl_port, + //vl_conn, + //v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase[vl_port].sessionId, //vl_conn, + c_EPTF_HTTP_inputIdx_OKReceived); + } + else + { + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[vl_group].defaultFIdx].receiveEvent.apply( + vl_group, vl_port, + //vl_conn, + //v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase[vl_port].sessionId, //vl_conn, + c_EPTF_HTTP_inputIdx_errorReceived); + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_closePortOfUser + // + // Purpose: + // Function to close the port of an HTTP user + // + // Parameters: + // pl_connId - *in* *integer* - group id + // pl_sessionId - *in* *integer* - session id of HTTP user + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_closePortOfUser( + in integer pl_groupId, + in integer pl_sessionId) + runs on EPTF_HTTP_LocalTransport_CT + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return; }; + + v_EPTF_HTTP_Transport_functionDB[ + v_EPTF_HTTP_Transport_portDB[pl_groupId].defaultFIdx].closePortOfUser.apply( + pl_groupId, + pl_sessionId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_freePortOfUser + // + // Purpose: + // Function to free the port of an HTTP user + // + // Parameters: + // pl_groupId - *in* *integer* - group id + // pl_sessionId - *in* *integer* - session id of HTTP user + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_freePortOfUser( + in integer pl_groupId, + in integer pl_sessionId) + runs on EPTF_HTTP_LocalTransport_CT + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return; }; + + v_EPTF_HTTP_Transport_functionDB[ + v_EPTF_HTTP_Transport_portDB[pl_groupId].defaultFIdx].freePortOfUser.apply( + pl_groupId, + pl_sessionId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_connectionOpen + // + // Purpose: + // Function to open the connection + // + // Parameters: + // pl_connId - *in* *integer* - group id + // pl_sessionId - *in* *integer* - session id of HTTP user + // + // Return Value: + // <Result> - the result of port open + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_connectionOpen( + in integer pl_connId, + in integer pl_sessionId) + runs on EPTF_HTTP_LocalTransport_CT return boolean + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_connId)) { return false; }; + + + var integer vl_port := + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_connId].defaultFIdx].selectPort.apply(pl_connId); + + if (vl_port == -1) + { + f_EPTF_HTTP_Transport_warning(%definitionId & ": No more free ports available!"); + } + else + { + v_EPTF_HTTP_Transport_portDB[pl_connId].portDatabase[vl_port].sessionId := pl_sessionId; + } + + return v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_connId].defaultFIdx].openPort.apply(pl_connId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_connectionClose + // + // Purpose: + // Function to close the connection + // + // Parameters: + // pl_connId - *in* - <Result> - the connection ID + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_connectionClose( + in integer pl_connId) + runs on EPTF_HTTP_LocalTransport_CT + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_connId)) { return; }; + + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_connId].defaultFIdx].closeConnection.apply(pl_connId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_connectionClose + // + // Purpose: + // Function to close the connection + // + // Parameters: + // pl_connId - *in* - <Result> - the connection ID + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_connectionHalfClose( + in integer pl_connId) + runs on EPTF_HTTP_LocalTransport_CT + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_connId)) { return; }; + + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_connId].defaultFIdx].halfClosePort.apply(pl_connId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_sendMessage + // + // Purpose: + // Function to send the outgoing message + // + // Parameters: + // pl_connId - *in* *integer* - connection id + // pl_sessionId - *in* *integer* - session id + // pl_message - *in* *octetstring* - encoded message + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_sendMessage( + in integer pl_connId, + in integer pl_sessionId, + in octetstring pl_message) + runs on EPTF_HTTP_LocalTransport_CT + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_connId)) { return; }; + + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_connId].defaultFIdx].sendMessage.apply( + pl_connId, + pl_sessionId, + pl_message); + + if (vf_EPTF_HTTP_messageSentHook != null) { + vf_EPTF_HTTP_messageSentHook.apply(pl_sessionId, pl_message); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_sendResponse + // + // Purpose: + // Function to send the response + // + // Parameters: + // pl_groupId - *in* *integer* - connection id + // pl_portId - *in* *integer* - unique port id + // pl_seqNum - *in* *integer* - sequnence number of the response + // pl_message - *in* *octetstring* - encoded message + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_sendResponse( + in integer pl_groupId, + in integer pl_portId, + in integer pl_seqNum, + in octetstring pl_message) + runs on EPTF_HTTP_LocalTransport_CT + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return; }; + + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_groupId].defaultFIdx].sendResponse.apply( + pl_groupId, + pl_portId, + pl_seqNum, + pl_message); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_listen + // + // Purpose: + // Function to create a listening socket in a server port group. + // + // Parameters: + // pl_groupId - *in* *integer* - the group ID + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_listen( + in integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return -1; }; + + return v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_groupId].defaultFIdx].listen.apply(pl_groupId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_LocalTransport_closePort + // + // Purpose: + // Closes a socket in a server port. + // + // Parameters: + // pl_groupId - *in* *integer* - the group ID + // pl_portId - *in* *integer* - the port ID + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_LocalTransport_closePort( + in integer pl_groupId, + in integer pl_portId) + runs on EPTF_HTTP_LocalTransport_CT + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return; }; + + v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[pl_groupId].defaultFIdx].closePort.apply(pl_groupId, pl_portId); + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_generatePortId + // + // Purpose: + // Generates a port identifier unique in the port group. + // + // Parameters: + // pl_group - *in* *integer* - connection id + // + // Return Value: + // integer - identifier + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_generatePortId(in integer pl_group) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + var integer vl_maxNoPortIds:=100000; + var integer vl_dummyIdx:=-1; + var integer vl_nextPortId:=v_EPTF_HTTP_Transport_portDB[pl_group].currentPortId; + var boolean vl_foundFreePortId:=false; + + //TR: HK96316 + for(var integer i:=0;i< vl_maxNoPortIds and not vl_foundFreePortId;i:=i+1) { + vl_nextPortId:=(vl_nextPortId+1) mod vl_maxNoPortIds; + if( not f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_portId2Idx_HM,vl_nextPortId,vl_dummyIdx) ){ + vl_foundFreePortId:=true; + } + } + + if(not vl_foundFreePortId) { + f_EPTF_HTTP_Transport_warning(log2str(%definitionId & + " : Error in generating the next free portId. There is no free portId and it will fail" )); + } + v_EPTF_HTTP_Transport_portDB[pl_group].currentPortId:=vl_nextPortId; + return vl_nextPortId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_socketOpened + // + // Purpose: + // Creates the database entries needed in case of opening a new socket. + // + // Parameters: + // - pl_connId - *in* *integer* - connection Id + // - pl_groupId - *in* *integer* - the index of the group + // - pl_port - *inout* *integer* - the index of the port + // + // Return Value: + // boolean - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_socketOpened(in integer pl_connId, in integer pl_groupId, in integer pl_portId) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_int2int_HashMap_Insert(v_EPTF_HTTP_Transport_connId2GroupId_HM, + pl_connId, pl_groupId); + f_EPTF_int2int_HashMap_Insert(v_EPTF_HTTP_Transport_connId2PortId_HM, + pl_connId, pl_portId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_socketClosed + // + // Purpose: + // Removes the database entries needed in case of closing a socket. + // + // Parameters: + // - pl_connId - *in* *integer* - connection Id + // + // Return Value: + // boolean - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_socketClosed(in integer pl_connId) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_int2int_HashMap_Erase(v_EPTF_HTTP_Transport_connId2GroupId_HM, pl_connId); + f_EPTF_int2int_HashMap_Erase(v_EPTF_HTTP_Transport_connId2PortId_HM, pl_connId); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setFunc_getGroupAndPort + // + // Purpose: + // Registers the group and port search function + // + // Parameters: + // pl_func - *in* <EPTF_HTTP_Transport_GetGroupAndPort_FT> - function reference + // + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setFunc_getGroupAndPort(in EPTF_HTTP_Transport_GetGroupAndPort_FT pl_func) + runs on EPTF_HTTP_LocalTransport_CT + { + vf_getGroupAndPort := pl_func; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setFunc_getGroup + // + // Purpose: + // Registers the group search function + // + // Parameters: + // pl_func - *in* <EPTF_HTTP_Transport_GetGroup_FT> - function reference + // + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setFunc_getGroup(in EPTF_HTTP_Transport_GetGroup_FT pl_func) + runs on EPTF_HTTP_LocalTransport_CT + { + vf_getGroup := pl_func; + } + +} // group LocalTransport + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_RemoteTransport +// +// Purpose: +// Functions of the EPTF HTTP Remote Transport +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_RemoteTransport { + + /////////////////////////////////////////////////////////////////////////////// + // Altstep: as_EPTF_HTTP_RemoteTransport_handler + // + // Purpose: + // Altstep to handle the incoming messages from the mapper component + // + /////////////////////////////////////////////////////////////////////////////// + altstep as_EPTF_HTTP_RemoteTransport_handler() + runs on EPTF_HTTP_RemoteTransport_CT + { + [] v_EPTF_HTTP_RemoteTransport_commPort.receive(EPTF_HTTP_Transport_Receive:?) -> value v_EPTF_HTTP_RemoteTransport_receive + { + vf_EPTF_HTTP_RemoteTransport_handleReceive.apply({ + v_EPTF_HTTP_RemoteTransport_receive.groupId, + v_EPTF_HTTP_RemoteTransport_receive.sessionId, + v_EPTF_HTTP_RemoteTransport_receive.seqNum, + v_EPTF_HTTP_RemoteTransport_receive.reveivedMessage}); + + repeat; + } + [] v_EPTF_HTTP_RemoteTransport_commPort.receive(EPTF_HTTP_Transport_Result:?) -> value v_EPTF_HTTP_RemoteTransport_result + { + vf_EPTF_HTTP_RemoteTransport_eventReceive.apply({ + v_EPTF_HTTP_RemoteTransport_result.groupId, + v_EPTF_HTTP_RemoteTransport_result.sessionId, + v_EPTF_HTTP_RemoteTransport_result.resultType}); + + repeat; + } + [] v_EPTF_HTTP_RemoteTransport_commPort.receive(EPTF_HTTP_Transport_Error:?) -> value v_EPTF_HTTP_RemoteTransport_error + { + vf_EPTF_HTTP_RemoteTransport_socketErrorReceive.apply({ + v_EPTF_HTTP_RemoteTransport_error.groupId, + v_EPTF_HTTP_RemoteTransport_error.sessionId, + v_EPTF_HTTP_RemoteTransport_error.result}); + + repeat; + } + [] v_EPTF_HTTP_RemoteTransport_commPort.receive(EPTF_HTTP_Transport_ListenEvent:?) -> value v_EPTF_HTTP_RemoteTransport_listenEvent + { + vf_EPTF_HTTP_RemoteTransport_listenSocketEvent.apply({ + v_EPTF_HTTP_RemoteTransport_listenEvent.groupId, + v_EPTF_HTTP_RemoteTransport_listenEvent.hostInfo, + v_EPTF_HTTP_RemoteTransport_listenEvent.eventType}); + + repeat; + } + [] v_EPTF_HTTP_RemoteTransport_commPort.receive(EPTF_HTTP_Transport_ListenError:?) -> value v_EPTF_HTTP_RemoteTransport_listenError + { + vf_EPTF_HTTP_RemoteTransport_listenSocketError.apply({ + v_EPTF_HTTP_RemoteTransport_listenError.groupId, + v_EPTF_HTTP_RemoteTransport_listenError.hostInfo, + v_EPTF_HTTP_RemoteTransport_listenError.transportError}); + + repeat; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_init_CT + // + // Purpose: + // Function to init the RemoteTransport component + // + // Parameters: + // pl_selfName - *in* *charstring* - self name of the component + // pl_handleReceive - *in* - <EPTF_HTTP_messageProcess_FT> - receive + // function + // pl_eventReceiveFunction - *in* - <EPTF_HTTP_eventReceive_FT> - + // event receive function + // + // Return Value: + // *integer* - if the component initialize already the return value + // will be -1 + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_init_CT( + in charstring pl_selfName := "EPTF_HTTP_RemoteTransport", + in EPTF_HTTP_messageProcess_FT pl_handleReceive, + in EPTF_HTTP_eventReceive_FT pl_eventReceiveFunction, + in EPTF_HTTP_socketErrorReceive_FT pl_socketErrorReceiveFunction, + in EPTF_HTTP_listenSocketEvent_FT pl_listenSocketEvent := null, + in EPTF_HTTP_listenSocketError_FT pl_listenSocketError := null) + runs on EPTF_HTTP_RemoteTransport_CT + return integer + { + if (v_EPTF_HTTP_RemoteTransport_initialized) + { + log(%definitionId & ": " & // intentionally simple log + "The HTTP RemoteTransport component already initialized!"); + return -1; + } + + v_EPTF_HTTP_RemoteTransport_selfName := pl_selfName + + f_EPTF_Logging_init_CT(pl_selfName); + + v_EPTF_HTTP_Transport_loggingMaskId := + f_EPTF_Logging_registerComponentMasks( + tsp_EPTF_HTTP_Transport_loggingComponentMask, + c_EPTF_HTTP_Transport_loggingEventClasses, + EPTF_Logging_CLL); + + if (tsp_EPTF_HTTP_Transport_loggingEnable) + { + f_EPTF_Logging_enableLocalMask( + v_EPTF_HTTP_Transport_loggingMaskId, + c_EPTF_HTTP_Transport_loggingClassIdx_Debug); + } + else + { + f_EPTF_Logging_disableLocalMask( + v_EPTF_HTTP_Transport_loggingMaskId, + c_EPTF_HTTP_Transport_loggingClassIdx_Debug); + } + + + if (tsp_EPTF_HTTP_Transport_bufferLogEnable) + { + f_EPTF_Logging_enableLocalMask( + v_EPTF_HTTP_Transport_loggingMaskId, + c_EPTF_HTTP_Transport_loggingClassIdx_BufferDebug); + }else + { + f_EPTF_Logging_disableLocalMask( + v_EPTF_HTTP_Transport_loggingMaskId, + c_EPTF_HTTP_Transport_loggingClassIdx_BufferDebug); + } + + vf_EPTF_HTTP_RemoteTransport_handleReceive := pl_handleReceive; + vf_EPTF_HTTP_RemoteTransport_eventReceive := pl_eventReceiveFunction; + vf_EPTF_HTTP_RemoteTransport_socketErrorReceive := pl_socketErrorReceiveFunction; + + vf_EPTF_HTTP_RemoteTransport_listenSocketEvent := pl_listenSocketEvent; + vf_EPTF_HTTP_RemoteTransport_listenSocketError := pl_listenSocketError; + + f_EPTF_Base_init_CT(pl_selfName); + f_EPTF_Base_registerCleanup(refers(f_EPTF_HTTP_RemoteTransport_cleanup_CT)); + f_EPTF_HashMap_init_CT(pl_selfName); + + v_EPTF_HTTP_RemoteTransport_transportIdToConnId := + f_EPTF_int2int_HashMap_New(c_EPTF_HTTP_RemoteTransport_HashMap_transportId2ConnId); + + v_EPTF_HTTP_RemoteTransport_default := activate(as_EPTF_HTTP_RemoteTransport_handler()); + + //map(self:IPL4_PCO, system:IPL4_PCO); + + v_EPTF_HTTP_RemoteTransport_initialized := true; + + f_EPTF_HTTP_Transport_debug(%definitionId & ": The initialization of the " & + "HTTP RemoteTransport component is ready"); + + return 1; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTranport_cleanup_CT + // + // Purpose: + // Function to clean the RemoteTransport component + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_cleanup_CT () + runs on EPTF_HTTP_RemoteTransport_CT + { + if (not v_EPTF_HTTP_RemoteTransport_initialized) { + return; + } + v_EPTF_HTTP_RemoteTransport_initialized := false; + + deactivate(v_EPTF_HTTP_RemoteTransport_default); + v_EPTF_HTTP_RemoteTransport_default := null; + + f_EPTF_int2int_HashMap_Delete(c_EPTF_HTTP_RemoteTransport_HashMap_transportId2ConnId); + v_EPTF_HTTP_RemoteTransport_transportIdToConnId := -1; + + vf_EPTF_HTTP_RemoteTransport_handleReceive := null; + //f_EPTF_Logging_debug(true,"The cleanup of the RemoteTransport component is ready"); + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_newPortGroup + // + // Purpose: + // Function to create port group on the mapper component remotely + // + // Parameters: + // pl_result - *out* - <Result> - the result of sending + // + // Return Value: + // *integer* - index of newly created port group, -1 if creation is + // unsuccessful + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_newPortGroup( + in EPTF_HTTP_Transport_GroupMode pl_group) + runs on EPTF_HTTP_RemoteTransport_CT return integer + { + var integer vl_groupId; + var EPTF_HTTP_Transport_NewPortGroup vl_createPortGroup := { + groupInfo := pl_group + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_createPortGroup); + + alt { + [] v_EPTF_HTTP_RemoteTransport_commPort.receive (integer:?) -> value vl_groupId {} + } + + return vl_groupId; + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_deletePortGroup + // + // Purpose: + // Function to delete port group on the mapper component remotely + // + // Parameters: + // pl_group - *in* - *integer* - port group index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_deletePortGroup( + in integer pl_group) + runs on EPTF_HTTP_RemoteTransport_CT + { + var EPTF_HTTP_Transport_DeletePortGroup vl_deletePortGroup := { + groupId := pl_group + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_deletePortGroup); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_newPort + // + // Purpose: + // Function to create a port on the mapper component remotely + // + // Parameters: + // pl_portInfo - *in* - <EPTF_HTTP_Transport_PortMode> - port data + // + // Return Value: + // *integer* - index of newly created port, -1 if creation is + // unsuccessful + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_newPort( + in EPTF_HTTP_Transport_PortMode pl_portInfo) + runs on EPTF_HTTP_RemoteTransport_CT return integer + { + var integer vl_groupId; + var EPTF_HTTP_Transport_NewPort vl_createPort := { + portInfo := pl_portInfo + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_createPort); + + alt { + [] v_EPTF_HTTP_RemoteTransport_commPort.receive (integer:?) -> value vl_groupId {} + } + + return vl_groupId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_newServerPort + // + // Purpose: + // Creates a server port on the mapper component remotely + // + // Parameters: + // pl_portInfo - *in* - <EPTF_HTTP_Transport_ServerPortMode> - server port data + // + // Return Value: + // *integer* - index of newly created port, -1 if creation is + // unsuccessful + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_newServerPort( + in EPTF_HTTP_Transport_ServerPortMode pl_portInfo) + runs on EPTF_HTTP_RemoteTransport_CT return integer + { + var integer vl_groupId; + var EPTF_HTTP_Transport_NewServerPort vl_createServerPort := { + portInfo := pl_portInfo + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_createServerPort); + + alt { + [] v_EPTF_HTTP_RemoteTransport_commPort.receive (integer:?) -> value vl_groupId {} + } + + return vl_groupId; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_deletePort + // + // Purpose: + // Function to delete a port on the mapper component remotely + // + // Parameters: + // pl_group - *in* - *integer* - port group index + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_deletePort( + in integer pl_group) + runs on EPTF_HTTP_RemoteTransport_CT + { + var EPTF_HTTP_Transport_DeletePort vl_deletePort := { + portId := pl_group + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_deletePort); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_addPortToGroup + // + // Purpose: + // Function to add a new port to a port group on the mapper component + // remotely + // + // Parameters: + // pl_group - *in* - <EPTF_HTTP_Transport_GroupMode> - port group data + // pl_result - *out* - <Result> - the result of sending + // + // Return Value: + // *boolean* - success result of new port addition to port group + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_addPortToGroup( + in integer pl_group) + runs on EPTF_HTTP_RemoteTransport_CT return boolean + { + var integer vl_groupId; + var EPTF_HTTP_Transport_AddPort vl_addPort := { + groupId := pl_group + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_addPort); + + alt { + [] v_EPTF_HTTP_RemoteTransport_commPort.receive (integer:?) -> value vl_groupId {} + } + + if (vl_groupId == -1) { return false; } else { return true; }; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_removePortFromGroup + // + // Purpose: + // Function to remove a port from a port group on the mapper remotely + // + // Parameters: + // pl_group - *in* - *integer* - port group data + // + // Return Value: + // *boolean* - result of port removal + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_removePortFromGroup( + in integer pl_group) + runs on EPTF_HTTP_RemoteTransport_CT + { + var EPTF_HTTP_Transport_RemovePort vl_removePort := { + groupId := pl_group + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_removePort); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_sendMessage + // + // Purpose: + // Function to send the messages to the mapper component + // + // Parameters: + // pl_connId - *in* - *integer* - connection id + // pl_sessionId - *in* - *integer* - session id + // pl_message - *in* *octetstring* - encoded message + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_sendMessage( + in integer pl_connId, + in integer pl_sessionId, + in octetstring pl_message) + runs on EPTF_HTTP_RemoteTransport_CT + { + var EPTF_HTTP_Transport_Send vl_send := { + groupId := pl_connId, + sessionId := pl_sessionId, + outgoingMessage := pl_message + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_send); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_sendMessage + // + // Purpose: + // Function to close the port of an HTTP user + // + // Parameters: + // pl_groupId - *in* - *integer* - group id + // pl_sessionId - *in* - *integer* - session id + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_closePortOfUser( + in integer pl_groupId, + in integer pl_sessionId) + runs on EPTF_HTTP_RemoteTransport_CT + { + var EPTF_HTTP_Transport_ClosePortOfUser vl_send := { + groupId := pl_groupId, + sessionId := pl_sessionId + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_send); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_freePortOfUser + // + // Purpose: + // Function to free the port of an HTTP user + // + // Parameters: + // pl_groupId - *in* - *integer* - group id + // pl_sessionId - *in* - *integer* - session id + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // If port is freed then it can be reused by any HTTP user. Incoming + // messages from last session will be dropped. + // + // If message arrives on the port from the last session after reuse, + // then the message will be forwarded to the new entity + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_freePortOfUser( + in integer pl_groupId, + in integer pl_sessionId) + runs on EPTF_HTTP_RemoteTransport_CT + { + var EPTF_HTTP_Transport_FreePortOfUser vl_send := { + groupId := pl_groupId, + sessionId := pl_sessionId + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_send); + } + + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_connectionOpen + // + // Purpose: + // Function to open the connection + // + // Parameters: + // pl_connId - *in* - *integer* - port group index + // pl_sessionId - *in* - *integer* - session id + // + // Return Value: + // *boolean* - result of connection opening + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_connectionOpen( + in integer pl_connId, + in integer pl_sessionId) + runs on EPTF_HTTP_RemoteTransport_CT return boolean + { + var integer vl_connId; + var EPTF_HTTP_Transport_Connect vl_connect := { + groupId := pl_connId, + sessionId := pl_sessionId + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_connect); + + alt { + [] v_EPTF_HTTP_RemoteTransport_commPort.receive (integer:?) -> value vl_connId {} + } + + if (vl_connId == -1) { return false; } else { return true; }; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_connectionClose + // + // Purpose: + // Function to close the connection + // + // Parameters: + // pl_connId - *in* - *integer* - the connection ID + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_connectionClose( + in integer pl_connId) + runs on EPTF_HTTP_RemoteTransport_CT { + + var EPTF_HTTP_Transport_Close vl_close := { + groupId := pl_connId + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_close); + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_connectionHalfClose + // + // Purpose: + // Function to close the connection + // + // Parameters: + // pl_connId - *in* - *integer* - the connection ID + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_connectionHalfClose( + in integer pl_connId) + runs on EPTF_HTTP_RemoteTransport_CT { + + var EPTF_HTTP_Transport_HalfClose vl_halfclose := { + groupId := pl_connId + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_halfclose); + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_listen + // + // Purpose: + // Function to open a listening socket + // + // Parameters: + // pl_group - *in* - *integer* - the server port identifier + // + // Return Value: + // boolean - listen result + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_listen( + in integer pl_groupId) + runs on EPTF_HTTP_RemoteTransport_CT + return integer{ + + var integer vl_result; + var EPTF_HTTP_Transport_Listen vl_listen := { + groupId := pl_groupId + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_listen); + + alt { + [] v_EPTF_HTTP_RemoteTransport_commPort.receive (integer:?) -> value vl_result {} + } + + return vl_result; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_closePort + // + // Purpose: + // Closes a socket in the server port. + // + // Parameters: + // pl_group - *in* - *integer* - the server port identifier + // pl_portId - *in* - *integer* - the port identifier + // + // Return Value: + // boolean - listen result + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_closePort( + in integer pl_groupId, + in integer pl_portId) + runs on EPTF_HTTP_RemoteTransport_CT + { + var EPTF_HTTP_Transport_closePort vl_close :={ + groupId := pl_groupId, + portId := pl_portId + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_close); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RemoteTransport_sendResponse + // + // Purpose: + // Function to send the responses to the mapper component + // + // Parameters: + // pl_group - *in* - *integer* - server group identifier + // pl_portId - *in* - *integer* - unique port identifier of the request + // pl_message - *in* *octetstring* - encoded message + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RemoteTransport_sendResponse( + in integer pl_groupId, + in integer pl_portId, + in integer pl_seqNum, + in octetstring pl_message + ) + runs on EPTF_HTTP_RemoteTransport_CT{ + + var EPTF_HTTP_Transport_SendResponse vl_response :={ + groupId := pl_groupId, + portId := pl_portId, + seqNum := pl_seqNum, + msg := pl_message + } + + v_EPTF_HTTP_RemoteTransport_commPort.send(vl_response); + } +} // group remoteTransport + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Mapper +// +// Purpose: +// The functions of the EPTF HTTP Mapper +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Mapper { + + /////////////////////////////////////////////////////////////////////////////// + // Altstep: as_EPTF_HTTP_Mapper_Handler + // + // Purpose: + // Altstep to handle the incoming messages from the RemoteTransport component + // + /////////////////////////////////////////////////////////////////////////////// + altstep as_EPTF_HTTP_Mapper_Handler() + runs on EPTF_HTTP_Mapper_CT + { + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_NewPortGroup:?) -> value v_EPTF_HTTP_Mapper_newPortGroup sender v_EPTF_HTTP_Mapper_componentRef + { + var integer vl_newGroupId := + f_EPTF_HTTP_LocalTransport_newPortGroup(v_EPTF_HTTP_Mapper_newPortGroup.groupInfo); + + if (vl_newGroupId == -1) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Creation of port group failed for group: " & + log2str(v_EPTF_HTTP_Mapper_newPortGroup.groupInfo)); + + v_EPTF_HTTP_Mapper_commPort.send(-1) to v_EPTF_HTTP_Mapper_componentRef; + } + else + { + f_EPTF_HTTP_Transport_debug(%definitionId & + "New group id acquired (" & int2str(vl_newGroupId) & " for group: " & + log2str(v_EPTF_HTTP_Mapper_newPortGroup.groupInfo)); + + v_EPTF_HTTP_Mapper_commPort.send(vl_newGroupId) to v_EPTF_HTTP_Mapper_componentRef; + } + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_DeletePortGroup:?) -> value v_EPTF_HTTP_Mapper_deletePortGroup sender v_EPTF_HTTP_Mapper_componentRef + { + f_EPTF_HTTP_LocalTransport_deletePortGroup(v_EPTF_HTTP_Mapper_deletePortGroup.groupId); + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_NewPort:?) -> value v_EPTF_HTTP_Mapper_newPort sender v_EPTF_HTTP_Mapper_componentRef + { + var integer vl_newGroupId := + f_EPTF_HTTP_LocalTransport_newPort(v_EPTF_HTTP_Mapper_newPort.portInfo); + + if (vl_newGroupId == -1) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Creation of port failed for port: " & + log2str(v_EPTF_HTTP_Mapper_newPort.portInfo)); + + v_EPTF_HTTP_Mapper_commPort.send(-1) to v_EPTF_HTTP_Mapper_componentRef; + } + else + { + f_EPTF_HTTP_Transport_debug(%definitionId & + "New port id acquired (" & int2str(vl_newGroupId) & " for port: " & + log2str(v_EPTF_HTTP_Mapper_newPort.portInfo)); + + v_EPTF_HTTP_Mapper_commPort.send(vl_newGroupId) to v_EPTF_HTTP_Mapper_componentRef; + } + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_NewServerPort:?) -> value v_EPTF_HTTP_Mapper_newServerPort sender v_EPTF_HTTP_Mapper_componentRef + { + var integer vl_newGroupId := -1 + var boolean vl_new := + f_EPTF_HTTP_LocalTransport_createServerPort(v_EPTF_HTTP_Mapper_newServerPort.portInfo, vl_newGroupId); + + if (vl_newGroupId == -1) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Creation of port failed for port: " & + log2str(v_EPTF_HTTP_Mapper_newServerPort.portInfo)); + + v_EPTF_HTTP_Mapper_commPort.send(-1) to v_EPTF_HTTP_Mapper_componentRef; + + } + else + { + if (vl_new) + { + v_EPTF_HTTP_Mapper_inRoutingDatabase[vl_newGroupId] := c_EPTF_HTTP_initRoutingDBE; + } + var integer vl_size := v_EPTF_HTTP_Mapper_inRoutingDatabase[vl_newGroupId].size; + + v_EPTF_HTTP_Mapper_inRoutingDatabase[vl_newGroupId].size := vl_size + 1; + v_EPTF_HTTP_Mapper_inRoutingDatabase[vl_newGroupId].compIdList[vl_size] := f_EPTF_Base_upcast(v_EPTF_HTTP_Mapper_componentRef); + + f_EPTF_HTTP_Transport_debug(log2str(%definitionId, + ": Routing database: ", v_EPTF_HTTP_Mapper_inRoutingDatabase[vl_newGroupId])); + + v_EPTF_HTTP_Mapper_commPort.send(vl_newGroupId) to v_EPTF_HTTP_Mapper_componentRef; + } + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_DeletePort:?) -> value v_EPTF_HTTP_Mapper_deletePort sender v_EPTF_HTTP_Mapper_componentRef + { + f_EPTF_HTTP_LocalTransport_deletePort(v_EPTF_HTTP_Mapper_deletePort.portId); + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_AddPort:?) -> value v_EPTF_HTTP_Mapper_addPort sender v_EPTF_HTTP_Mapper_componentRef + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(v_EPTF_HTTP_Mapper_addPort.groupId)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Wrong port group index: " & int2str(v_EPTF_HTTP_Mapper_addPort.groupId)); + + v_EPTF_HTTP_Mapper_commPort.send(-1) to v_EPTF_HTTP_Mapper_componentRef; + + repeat; + }; + + if (v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[v_EPTF_HTTP_Mapper_addPort.groupId].defaultFIdx].addPort.apply( + v_EPTF_HTTP_Mapper_addPort.groupId)) + { + v_EPTF_HTTP_Mapper_commPort.send(1) to v_EPTF_HTTP_Mapper_componentRef; + } + else + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Port addition to group failed: " & int2str(v_EPTF_HTTP_Mapper_addPort.groupId)); + + v_EPTF_HTTP_Mapper_commPort.send(-1) to v_EPTF_HTTP_Mapper_componentRef; + } + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_RemovePort:?) -> value v_EPTF_HTTP_Mapper_removePort sender v_EPTF_HTTP_Mapper_componentRef + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(v_EPTF_HTTP_Mapper_removePort.groupId)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Wrong port group index: " & int2str(v_EPTF_HTTP_Mapper_removePort.groupId)); + + repeat; + }; + + v_boolNoWarning := v_EPTF_HTTP_Transport_functionDB[v_EPTF_HTTP_Transport_portDB[v_EPTF_HTTP_Mapper_removePort.groupId].defaultFIdx + ].removePort.apply(v_EPTF_HTTP_Mapper_removePort.groupId); + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_Connect:?) -> value v_EPTF_HTTP_Mapper_connect sender v_EPTF_HTTP_Mapper_componentRef + { + if (f_EPTF_HTTP_LocalTransport_connectionOpen(v_EPTF_HTTP_Mapper_connect.groupId, v_EPTF_HTTP_Mapper_connect.sessionId)) + { + //v_EPTF_HTTP_Transport_lastReceivedGroup := v_EPTF_HTTP_Mapper_connect.groupId; + //v_EPTF_HTTP_Mapper_portId := f_EPTF_HTTP_LocalTransport_selectPortInGroup_defaultGroup( + // v_EPTF_HTTP_Mapper_groupId); // port on which we will send + + //f_EPTF_Routing_processOutgoingMessage(); + + v_EPTF_HTTP_Mapper_commPort.send( v_EPTF_HTTP_Mapper_connect.groupId ) to v_EPTF_HTTP_Mapper_componentRef; + } + else + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Open connection unsuccessful for port group: " & + int2str(v_EPTF_HTTP_Mapper_connect.groupId)); + + v_EPTF_HTTP_Mapper_commPort.send(-1) to v_EPTF_HTTP_Mapper_componentRef; + } + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_Send:?) -> value v_EPTF_HTTP_Mapper_sendMessage sender v_EPTF_HTTP_Mapper_componentRef + { + v_EPTF_HTTP_Mapper_sessionId := v_EPTF_HTTP_Mapper_sendMessage.sessionId; + f_EPTF_Routing_processOutgoingMessage(); + + if (v_EPTF_HTTP_Mapper_sessionId != -1) + { + f_EPTF_HTTP_LocalTransport_sendMessage( + v_EPTF_HTTP_Mapper_sendMessage.groupId, + v_EPTF_HTTP_Mapper_sendMessage.sessionId, + v_EPTF_HTTP_Mapper_sendMessage.outgoingMessage); + } + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_SendResponse:?) -> value v_EPTF_HTTP_Mapper_sendResponse sender v_EPTF_HTTP_Mapper_componentRef + { + v_EPTF_HTTP_Mapper_portId := v_EPTF_HTTP_Mapper_sendResponse.portId; + + f_EPTF_HTTP_LocalTransport_sendResponse( + v_EPTF_HTTP_Mapper_sendResponse.groupId, + v_EPTF_HTTP_Mapper_sendResponse.portId, + v_EPTF_HTTP_Mapper_sendResponse.seqNum, + v_EPTF_HTTP_Mapper_sendResponse.msg); + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_ClosePortOfUser:?) -> value v_EPTF_HTTP_Mapper_closePortOfUser sender v_EPTF_HTTP_Mapper_componentRef + { + f_EPTF_HTTP_LocalTransport_closePortOfUser( + v_EPTF_HTTP_Mapper_closePortOfUser.groupId, + v_EPTF_HTTP_Mapper_closePortOfUser.sessionId); + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_FreePortOfUser:?) -> value v_EPTF_HTTP_Mapper_freePortOfUser sender v_EPTF_HTTP_Mapper_componentRef + { + f_EPTF_HTTP_LocalTransport_freePortOfUser( + v_EPTF_HTTP_Mapper_freePortOfUser.groupId, + v_EPTF_HTTP_Mapper_freePortOfUser.sessionId); + + repeat; + } + + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_Close:?) -> value v_EPTF_HTTP_Mapper_close sender v_EPTF_HTTP_Mapper_componentRef + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(v_EPTF_HTTP_Mapper_close.groupId)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Wrong port group index: " & int2str(v_EPTF_HTTP_Mapper_close.groupId)); + + repeat; + }; + + //for (var integer i := 0; i < sizeof(v_EPTF_HTTP_Transport_portDB[v_EPTF_HTTP_Transport_lastReceivedGroup].portDatabase); i := i + 1) + //{ + // v_EPTF_HTTP_Mapper_portId := i; + + // f_EPTF_Routing_processOutgoingMessage(); + //} + + f_EPTF_HTTP_LocalTransport_connectionClose(v_EPTF_HTTP_Mapper_close.groupId); + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_HalfClose:?) -> value v_EPTF_HTTP_Mapper_halfClose sender v_EPTF_HTTP_Mapper_componentRef + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(v_EPTF_HTTP_Mapper_halfClose.groupId)) { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Wrong port group index: " & int2str(v_EPTF_HTTP_Mapper_halfClose.groupId)); + + repeat; + }; + + //for (var integer i := 0; i < sizeof(v_EPTF_HTTP_Transport_portDB[v_EPTF_HTTP_Transport_lastReceivedGroup].portDatabase); i := i + 1) + //{ + // v_EPTF_HTTP_Mapper_portId := i; + + // f_EPTF_Routing_processOutgoingMessage(); + //} + + f_EPTF_HTTP_LocalTransport_connectionHalfClose( + v_EPTF_HTTP_Mapper_halfClose.groupId); + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_Listen:?) -> value v_EPTF_HTTP_Mapper_listen sender v_EPTF_HTTP_Mapper_componentRef + { + var integer vl_id := f_EPTF_HTTP_LocalTransport_listen(v_EPTF_HTTP_Mapper_listen.groupId); + v_EPTF_HTTP_Mapper_commPort.send(vl_id) to v_EPTF_HTTP_Mapper_componentRef; + + repeat; + } + [] v_EPTF_HTTP_Mapper_commPort.receive (EPTF_HTTP_Transport_closePort:?) -> value v_EPTF_HTTP_Mapper_closePort sender v_EPTF_HTTP_Mapper_componentRef + { + f_EPTF_HTTP_LocalTransport_closePort(v_EPTF_HTTP_Mapper_closePort.groupId, v_EPTF_HTTP_Mapper_closePort.portId); + repeat; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_init_CT + // + // Purpose: + // Function to init the Mapper component + // + // Parameters: + // - pl_selfName - *in charstring* - the name of the component + // - pl_interfaceInformationList - <EPTF_CommPort_IPL4_InterfaceInformationList> - The defined interfaces + // + // Return Value: + // *integer* - if the component initialize already the return value will be -1 + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_init_CT( + in charstring pl_selfName := "", + in EPTF_CommPort_IPL4_InterfaceInformationList pl_interfaceInformationList := {}, + in integer pl_mode := 0) //0: client mode, 1:server mode + runs on EPTF_HTTP_Mapper_CT + return integer + { + if (v_EPTF_HTTP_Mapper_initialized) { + log(%definitionId & // intentionally simple log! + "The Mapper component is initialized already"); + return -1; + } + + v_EPTF_HTTP_Mapper_componentId := {}; + f_EPTF_HashMap_init_CT(pl_selfName); + v_EPTF_HTTP_Mapper_hashMapIdx := f_EPTF_int2int_HashMap_New( + c_EPTF_HTTP_Mapper_HashMap_routing); + v_intNoWarning := f_EPTF_HTTP_LocalTransport_init_CT(pl_selfName, + refers(f_EPTF_HTTP_Mapper_receiveMsg), + refers(f_EPTF_HTTP_Mapper_receiveEvent), + refers(f_EPTF_HTTP_Mapper_receiveSocketError), + pl_interfaceInformationList, + refers(f_EPTF_HTTP_Mapper_listenSocketEvent), + refers(f_EPTF_HTTP_Mapper_listenSocketError)); + + if (0 == pl_mode)//client mode + { + f_EPTF_Routing_init_CT( + refers(f_EPTF_HTTP_Mapper_processOutgoingMessage), + refers(f_EPTF_HTTP_Mapper_processIncomingMessage)); + }else if (1 == pl_mode)//server mode + { + f_EPTF_Routing_init_CT( + -, + refers(f_EPTF_HTTP_Mapper_processIncomingMessageServer)); + } + + v_EPTF_HTTP_MapperRoutingUri2LGenDB.uri2lgenIdxHash := + f_EPTF_str2int_HashMap_New(c_EPTF_HTTP_Transport_hashMapName_uri2idxHash); + + f_EPTF_Base_init_CT(pl_selfName); + f_EPTF_Base_registerCleanup(refers(f_EPTF_HTTP_Mapper_cleanup_CT)); + + v_EPTF_HTTP_Mapper_initialized := true; + + v_EPTF_HTTP_Mapper_default := activate(as_EPTF_HTTP_Mapper_Handler()); + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": The initialization of the Mapper component is ready"); + + return 1; + } + + function f_EPTF_HTTP_Mapper_CommPort_IPL4_setMsgLen( + in ConnectionId pl_connId, + in f_IPL4_getMsgLen pl_function, + in ro_integer pl_msgLenArgs) + runs on EPTF_HTTP_Mapper_CT + { + f_EPTF_CommPort_IPL4_setMsgLen(pl_connId, pl_function, pl_msgLenArgs); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_cleanup_CT + // + // Purpose: + // Function to clean the Mapper component + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_cleanup_CT() + runs on EPTF_HTTP_Mapper_CT + { + if (not v_EPTF_HTTP_Mapper_initialized) { + return; + } + v_EPTF_HTTP_Mapper_initialized := false; + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + v_EPTF_HTTP_Mapper_componentId := {}; + v_EPTF_HTTP_Mapper_hashMapIdx := -1; + + f_EPTF_int2int_HashMap_Delete(c_EPTF_HTTP_Mapper_HashMap_routing); + + v_EPTF_HTTP_Mapper_default := null; + + f_EPTF_HTTP_Transport_debug(%definitionId & + ": The cleanup of the Mapper component is ready"); + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_setRouting + // + // Purpose: + // Function to set routing information for Mapper database + // + // Parameters: + // pl_route - *in* <EPTF_HTTP_Mapper_RoutingList> - routing data + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_setRouting( + in EPTF_HTTP_Mapper_RoutingList pl_route) + runs on EPTF_HTTP_Mapper_CT + { + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var integer i, vl_maxGroupIdx := -1; + + for (i := 0; i < sizeof(pl_route); i := i + 1) + { + if (vl_maxGroupIdx < pl_route[i].groupId) { + vl_maxGroupIdx := pl_route[i].groupId; + }; + } + + for (i := 0; i < vl_maxGroupIdx; i := i + 1) + { + v_EPTF_HTTP_Mapper_routingSetDatabase[i] := false; + } + + for (i := 0; i < sizeof(pl_route); i := i + 1) + { + v_EPTF_HTTP_Mapper_inRoutingDatabase[pl_route[i].groupId] := { + ptr := 0, + size := sizeof(pl_route[i].compIdList), + compIdList := pl_route[i].compIdList + } + + v_EPTF_HTTP_Mapper_routingSetDatabase[i] := true; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_setRoutingUri2LGen_GetUriCallback + // + // Purpose: + // Function to set the fcb_EPTF_HTTP_MapperRoutingUri2LGen_GetUri. + // If fcb_EPTF_HTTP_MapperRoutingUri2LGen_GetUri is set, then the Mapper will use its return value + // to look up the subscribed LGen for the returned URI + // + // Parameters: + // pl_callback - *in* <EPTF_HTTP_MapperRoutingUri2LGen_GetUri_FT> - user function to return the URI + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_setRoutingUri2LGen_GetUriCallback(in EPTF_HTTP_MapperRoutingUri2LGen_GetUri_FT pl_callback) runs on EPTF_HTTP_Mapper_CT { + fcb_EPTF_HTTP_MapperRoutingUri2LGen_GetUri := pl_callback + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_getUri2LGenRoutingData + // + // Purpose: + // Looks up the subscribed LGen for <pl_uri>, and returns it in the <pl_lgenIdx> + // + // Parameters: + // pl_uri - *in* <charstring> - URI to look up + // pl_lgenIdx - *inout* <integer> - LGen index handling the URI + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + private function f_EPTF_HTTP_getUri2LGenRoutingData(in charstring pl_uri, inout integer pl_lgenIdx) runs on EPTF_HTTP_Mapper_CT return boolean { + + if (f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_MapperRoutingUri2LGenDB.uri2lgenIdxHash, pl_uri, pl_lgenIdx)) { + return true; + } + + return false; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_addUri2LGenRoutingData + // + // Purpose: + // Adds (subscribes) LGen <pl_lgenIdx> for URI <pl_uri>, and stores it in the database + // + // Parameters: + // pl_uri - *in* <charstring> - URI to look up + // pl_lgenIdx - *in* <integer> - LGen index handling the URI + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_addUri2LGenRoutingData(in charstring pl_uri, in integer pl_lgenIdx) runs on EPTF_HTTP_Mapper_CT { + f_EPTF_str2int_HashMap_Insert(v_EPTF_HTTP_MapperRoutingUri2LGenDB.uri2lgenIdxHash, pl_uri, pl_lgenIdx); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_removeUri2LGenRoutingData + // + // Purpose: + // Removes (unsubscribes) URI <pl_uri> from the URI <-> LGen database + // + // Parameters: + // pl_uri - *in* <charstring> - URI to look up + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_removeUri2LGenRoutingData(in charstring pl_uri) runs on EPTF_HTTP_Mapper_CT { + f_EPTF_str2int_HashMap_Erase(v_EPTF_HTTP_MapperRoutingUri2LGenDB.uri2lgenIdxHash, pl_uri); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_processOutgoingMessage + // + // Purpose: + // Function to process the outgoing messages + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Functions stores in a hash map the integer casted component id value + // of the component from which the message has been received with the + // key of the connection id value within the message + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_processOutgoingMessage() + runs on EPTF_HTTP_Mapper_CT + { + var integer vl_dummy; + if (f_EPTF_int2int_HashMap_Find( + v_EPTF_HTTP_Mapper_hashMapIdx, + v_EPTF_HTTP_Mapper_sessionId, + vl_dummy)) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": A component reference for session id (" + & int2str(v_EPTF_HTTP_Mapper_sessionId) & + ") is already stored! Message not sent!"); + + v_EPTF_HTTP_Mapper_sessionId := -1; + } + else + { + f_EPTF_int2int_HashMap_Insert( + v_EPTF_HTTP_Mapper_hashMapIdx, + v_EPTF_HTTP_Mapper_sessionId, + f_EPTF_Base_upcast(v_EPTF_HTTP_Mapper_componentRef)); + + f_EPTF_HTTP_Transport_debug(%definitionId & + " Source component index (" & + int2str(f_EPTF_Base_upcast(v_EPTF_HTTP_Mapper_componentRef)) & + ") stored in hash map for session id (" & + int2str(v_EPTF_HTTP_Mapper_sessionId) & ")!"); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_processIncomingMessage + // + // Purpose: + // Function to process the incoming messages + // + // Parameters: + // - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Function retrieves the integer casted component id to which the + // received message should be sent and then places this component id + // into the component variable v_EPTF_HTTP_Mapper_componentId + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_processIncomingMessage() + runs on EPTF_HTTP_Mapper_CT + { + f_EPTF_HTTP_Transport_debug(log2str(%definitionId, + ": Incoming message received for session id: ", + v_EPTF_HTTP_Mapper_sessionId)); + + /* + if (v_EPTF_HTTP_Transport_lastReceivedGroup >= sizeof(v_EPTF_HTTP_Mapper_routingSetDatabase) or + not v_EPTF_HTTP_Mapper_routingSetDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup]) + { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Group id (" & int2str(v_EPTF_HTTP_Transport_lastReceivedGroup) & + ") not found in routing database!"); + + v_EPTF_HTTP_Mapper_componentId := -1; + } + else + { + var integer vl_ptr := v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].ptr; + var integer vl_size := v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].size; + + //log(v_EPTF_HTTP_Mapper_inRoutingDatabase); + //log(vl_ptr); + //log(v_EPTF_HTTP_Mapper_groupId); + v_EPTF_HTTP_Mapper_componentId := + v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].compIdList[vl_ptr]; + + f_EPTF_HTTP_Transport_debug(%definitionId & + " Destination component acquired (" & + int2str(v_EPTF_HTTP_Mapper_componentId) & ") for group id (" & + int2str(v_EPTF_HTTP_Transport_lastReceivedGroup) & ")!"); + + vl_ptr := vl_ptr + 1; + if (vl_ptr >= vl_size) { vl_ptr := 1; }; + } + */ + + var integer vl_compId := -1; + + if (f_EPTF_int2int_HashMap_Find( + v_EPTF_HTTP_Mapper_hashMapIdx, + v_EPTF_HTTP_Mapper_sessionId, + vl_compId)) + { + f_EPTF_HTTP_Transport_debug(log2str(%definitionId, + " Destination component acquired (", + v_EPTF_HTTP_Mapper_componentId, ") for session id (", + int2str(v_EPTF_HTTP_Transport_lastReceivedGroup),")!")); + + f_EPTF_int2int_HashMap_Erase( + v_EPTF_HTTP_Mapper_hashMapIdx, + v_EPTF_HTTP_Mapper_sessionId); + + v_EPTF_HTTP_Mapper_componentId := {vl_compId}; + } + else { + f_EPTF_HTTP_Transport_warning(%definitionId & + ": Session id (" & int2str(v_EPTF_HTTP_Mapper_sessionId) & + ") not found in hash map! Possibly connection closed remotely on Free port!"); + + v_EPTF_HTTP_Mapper_componentId := {}; + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_processIncomingMessageServer + // + // Purpose: + // Processes the incoming messages. + // + // Detailed Comments: + // The current LGen to send the request to is chosen round robin. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_processIncomingMessageServer() + runs on EPTF_HTTP_Mapper_CT + { + f_EPTF_HTTP_Transport_debug(%definitionId & + ": Incoming message received for group id: " & + int2str(v_EPTF_HTTP_Transport_lastReceivedGroup)) + + if(fcb_EPTF_HTTP_MapperRoutingUri2LGen_GetUri == null or (not isbound(v_EPTF_CommPort_IPL4_aspRecvFrom.msg))) { + var integer vl_current := + v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].ptr; + + v_EPTF_HTTP_Mapper_componentId := {v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].compIdList[vl_current]}; + + v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].ptr := + (vl_current + 1) mod v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].size; + } else { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Incoming message received, calling fcb_EPTF_HTTP_MapperRoutingUri2LGen_GetUri.."); + var charstring vl_uri := fcb_EPTF_HTTP_MapperRoutingUri2LGen_GetUri.apply(); + var integer vl_comp; + if(f_EPTF_HTTP_getUri2LGenRoutingData(vl_uri, vl_comp)) { + //log("LGen #", vl_comp, " is subscribed to the URI: ", vl_uri, "."); + v_EPTF_HTTP_Mapper_componentId := { vl_comp }; + } else { + //log("No LGen is subscribed to the URI: ", vl_uri, ". Message discarded!"); + v_EPTF_HTTP_Mapper_componentId := {}; + } + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_receiveMsg + // + // Purpose: + // Function to receive the incoming messages + // + // Parameters: + // pl_message - *in* <EPTF_HTTP_IncomingMessage> - incoming message from the transport layer + // + // Detailed Comments: + // Function performs routing of incoming messages. It determins to which + // load generator component the message should be sent based on + // the provided connection id and sends it to this component. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_receiveMsg( + in EPTF_HTTP_IncomingMessage pl_message) + runs on EPTF_HTTP_Mapper_CT + { + v_EPTF_HTTP_Mapper_sessionId := pl_message.sessionId; + + f_EPTF_Routing_processIncomingMessage(); + + var EPTF_HTTP_Transport_Receive vl_receive := { + groupId := pl_message.groupId, + sessionId := pl_message.sessionId, + seqNum := pl_message.seqNum, + reveivedMessage := pl_message.httpMessage + } + + for (var integer i := 0; i < sizeof(v_EPTF_HTTP_Mapper_componentId); i := i + 1) + { + v_EPTF_HTTP_Mapper_commPort.send(vl_receive) to f_EPTF_Base_downcast(v_EPTF_HTTP_Mapper_componentId[i]); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_receiveEvent + // + // Purpose: + // Function to receive the incoming events + // + // Parameters: + // pl_event - *in* <EPTF_HTTP_Event> - incoming event from the transport layer + // + // Detailed Comments: + // Function performs routing of incoming messages. It determins to which + // load generator component the message should be sent based on + // the provided connection id and sends it to this component. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_receiveEvent( + in EPTF_HTTP_Event pl_event) + runs on EPTF_HTTP_Mapper_CT + { + v_EPTF_HTTP_Mapper_sessionId := pl_event.sessionId; + + f_EPTF_Routing_processIncomingMessage(); + + var EPTF_HTTP_Transport_Result vl_result := { + groupId := pl_event.groupId, + sessionId := pl_event.sessionId, //pl_sessionId, + resultType := pl_event.eventType + } + + for (var integer i := 0; i < sizeof(v_EPTF_HTTP_Mapper_componentId); i := i + 1) + { + v_EPTF_HTTP_Mapper_commPort.send(vl_result) to f_EPTF_Base_downcast(v_EPTF_HTTP_Mapper_componentId[i]); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_receiveSocketError + // + // Purpose: + // Function to receive the incoming socket errors + // + // Parameters: + // pl_error - <EPTF_HTTP_Error> - the error message + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Function performs routing of incoming messages. It determins to which + // load generator component the message should be sent based on + // the provided connection id and sends it to this component. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_receiveSocketError( + in EPTF_HTTP_EventError pl_error) + runs on EPTF_HTTP_Mapper_CT + { + v_EPTF_HTTP_Mapper_sessionId := pl_error.sessionId; + f_EPTF_Routing_processIncomingMessage(); + + var EPTF_HTTP_Transport_Error vl_result := { + groupId := pl_error.groupId, + sessionId := pl_error.sessionId, //pl_sessionId, + result := pl_error.transportError + } + + for (var integer i := 0; i < sizeof(v_EPTF_HTTP_Mapper_componentId); i := i + 1) + { + v_EPTF_HTTP_Mapper_commPort.send(vl_result) to f_EPTF_Base_downcast(v_EPTF_HTTP_Mapper_componentId[i]); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_listenSocketEvent + // + // Purpose: + // Function to receive the incoming listening socket events + // + // Parameters: + // pl_event - <EPTF_HTTP_listenSocketEvent> - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Events are routed to all of the LGens belonging to the server port. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_listenSocketEvent( + in EPTF_HTTP_listenSocketEvent pl_event) + runs on EPTF_HTTP_Mapper_CT + { + var EPTF_HTTP_Transport_ListenEvent vl_result := { + groupId := pl_event.groupId, + hostInfo := pl_event.hostInfo, + eventType := pl_event.eventType + } + + for (var integer i := 0; i < v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].size; i := i + 1) + { + v_EPTF_HTTP_Mapper_commPort.send(vl_result) to + f_EPTF_Base_downcast(v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].compIdList[i]); + } + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Mapper_listenSocketError + // + // Purpose: + // Function to receive the incoming listening socket events + // + // Parameters: + // pl_error - <EPTF_HTTP_listenSocketError> - + // + // Return Value: + // - + // + // Errors: + // - + // + // Detailed Comments: + // Events are routed to all of the LGens belonging to the server port. + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Mapper_listenSocketError( + in EPTF_HTTP_listenSocketError pl_error) + runs on EPTF_HTTP_Mapper_CT + { + var EPTF_HTTP_Transport_ListenError vl_result := { + groupId := pl_error.groupId, + hostInfo := pl_error.hostInfo, + transportError := pl_error.transportError + } + + for (var integer i := 0; i < v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].size; i := i + 1) + { + v_EPTF_HTTP_Mapper_commPort.send(vl_result) to + f_EPTF_Base_downcast(v_EPTF_HTTP_Mapper_inRoutingDatabase[v_EPTF_HTTP_Transport_lastReceivedGroup].compIdList[i]); + } + } + +} // end of Group: Mapper + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Transport_Logging +// +// Purpose: +// The functions of the EPTF HTTP Transport Logging +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Transport_Logging { + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_error + // + // Purpose: + // Function to log an error from EPTF HTTP Transport + // + // Parameters: + // - pl_message - *in* *charstring* - the message to log + // + // Return Value: + // - + // + // Errors & assertions: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_error( + in @lazy charstring pl_message) + runs on EPTF_HTTP_Transport_Logging_CT + { + f_EPTF_Logging_errorV2(pl_message, + v_EPTF_HTTP_Transport_loggingMaskId, + {c_EPTF_HTTP_Transport_loggingClassIdx_Error}); + f_EPTF_Base_stopAll(); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_warning + // + // Purpose: + // Function to log a warning from EPTF HTTP Transport + // + // Parameters: + // - pl_message - *in* *charstring* - the message to log + // + // Return Value: + // - + // + // Errors & assertions: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_warning( + in @lazy charstring pl_message) + runs on EPTF_HTTP_Transport_Logging_CT + { + f_EPTF_Logging_warningV2(pl_message, + v_EPTF_HTTP_Transport_loggingMaskId, + {c_EPTF_HTTP_Transport_loggingClassIdx_Warning}); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_debug + // + // Purpose: + // Function to log a debug message from EPTF HTTP Transport + // + // Parameters: + // - pl_message - *in* *charstring* - the message to log + // + // Return Value: + // - + // + // Errors & assertions: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_debug( + in @lazy charstring pl_message) + runs on EPTF_HTTP_Transport_Logging_CT + { + f_EPTF_Logging_debugV2(pl_message, + v_EPTF_HTTP_Transport_loggingMaskId, + {c_EPTF_HTTP_Transport_loggingClassIdx_Debug}); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_bufferWarning + // + // Purpose: + // Function to log a buffer warning message from EPTF HTTP Transport + // + // Parameters: + // - pl_message - *in* *charstring* - the message to log + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_bufferWarning( + in @lazy charstring pl_message) + runs on EPTF_HTTP_Transport_Logging_CT + { + f_EPTF_Logging_warningV2(pl_message, + v_EPTF_HTTP_Transport_loggingMaskId, + {c_EPTF_HTTP_Transport_loggingClassIdx_BufferWarning}); + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_bufferDebug + // + // Purpose: + // Function to log a buffer debug message from EPTF HTTP Transport + // + // Parameters: + // - pl_message - *in* *charstring* - the message to log + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_bufferDebug( + in @lazy charstring pl_message) + runs on EPTF_HTTP_Transport_Logging_CT + { + f_EPTF_Logging_debugV2(pl_message, + v_EPTF_HTTP_Transport_loggingMaskId, + {c_EPTF_HTTP_Transport_loggingClassIdx_BufferDebug}); + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_debugEnabled + // + // Purpose: + // Function to check if debug is enabled for EPTF HTTP Transport + // + // Parameters: + // - + // + // Return Value: + // *boolean* - true if debug enalbed + // + // Errors & assertions: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_debugEnabled() + runs on EPTF_HTTP_Transport_Logging_CT + return boolean + { + return f_EPTF_Logging_isEnabled( + v_EPTF_HTTP_Transport_loggingMaskId, + c_EPTF_HTTP_Transport_loggingClassIdx_Debug); + } +} // group Logging + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Transport_DB +// +// Purpose: +// Contains the database handling functions. +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Transport_DB{ + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_Transport_debugEnabled + // + // Purpose: + // Function to check if debug is enabled for EPTF HTTP Transport + // + // Parameters: + // - + // + // Return Value: + // *boolean* - true if debug enalbed + // + // Errors & assertions: + // - + // + // Detailed Comments: + // - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_Transport_Group_getName(in integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT + return charstring + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return ""; }; + + return v_EPTF_HTTP_Transport_portDB[pl_groupId].name; + } + + function f_EPTF_HTTP_Transport_Group_getLocHostInfo(in integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT + return EPTF_HTTP_HostInformation + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return {"", -1}; }; + + return v_EPTF_HTTP_Transport_portDB[pl_groupId].baseLocalHostInformation; + } + + function f_EPTF_HTTP_Transport_Group_getRemoteHostInfo(in integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT + return EPTF_HTTP_HostInformation + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return {"", -1}; }; + + return v_EPTF_HTTP_Transport_portDB[pl_groupId].baseRemoteHostInformation; + } + + function f_EPTF_HTTP_Transport_Group_getNumberOfPorts(in integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return -1; }; + + return v_EPTF_HTTP_Transport_portDB[pl_groupId].numberOfPorts; + } + + function f_EPTF_HTTP_Transport_Group_getLocalportStep(in integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return -1; }; + + return v_EPTF_HTTP_Transport_portDB[pl_groupId].localportStep; + } + + function f_EPTF_HTTP_Transport_Group_getRemoteportStep(in integer pl_groupId) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return -1; }; + + return v_EPTF_HTTP_Transport_portDB[pl_groupId].remoteportStep; + } + + function f_EPTF_HTTP_Transport_Group_getUseSSL(in integer pl_groupId, inout boolean pl_useSSL) + runs on EPTF_HTTP_LocalTransport_CT + return boolean + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return false; }; + + pl_useSSL := v_EPTF_HTTP_Transport_portDB[pl_groupId].useSSL; + return true; + } + + function f_EPTF_HTTP_Transport_Group_getInstantConnClose(in integer pl_groupId, inout boolean pl_instantConnClose) + runs on EPTF_HTTP_LocalTransport_CT + return boolean + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return false; }; + + pl_instantConnClose := v_EPTF_HTTP_Transport_portDB[pl_groupId].instantConnClose; + return true; + } + + function f_EPTF_HTTP_Transport_Group_getInstantConnOpen(in integer pl_groupId, inout boolean pl_instantConnOpen) + runs on EPTF_HTTP_LocalTransport_CT + return boolean + { + if (not f_EPTF_HTTP_LocalTransport_checkGroup(pl_groupId)) { return false; }; + + pl_instantConnOpen := v_EPTF_HTTP_Transport_portDB[pl_groupId].instantConnOpen; + return true; + } + +}//EPTF_HTTP_Transport_DB + +/////////////////////////////////////////////////////////////////////////////// +// Group: EPTF_HTTP_Buffer +// +// Purpose: +// Contains the buffer handling functions. +// +/////////////////////////////////////////////////////////////////////////////// +group EPTF_HTTP_Buffer{ + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_MsgBuffer_init + // + // Purpose: + // Initializes the message buffer. + // + // Parameters: + // pl_buffer - *inout* <EPTF_HTTP_MessageBuffer> - + // pl_size - *in* *integer* - maximum size of the buffer + // pl_id - *in* *integer* - unique identifier of the buffer + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_MsgBuffer_init(inout EPTF_HTTP_MessageBuffer pl_buffer, in integer pl_size, in integer pl_id) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_RingBuffer_init(pl_buffer.seqNums, pl_size, pl_id); + pl_buffer.seqNum2messageIdxHM := + f_EPTF_int2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_seqNum2messageIdx & int2str(pl_id)); + f_EPTF_FBQ_initFreeBusyQueue(pl_buffer.messageQueue); + pl_buffer.httpMessages := {} + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RingBuffer_init + // + // Purpose: + // Initializes the sequence numbers. + // + // Parameters: + // pl_buffer - *inout* <EPTF_HTTP_SeqNumMgmt> - + // pl_size - *in* *integer* - maximum sequence number + // pl_id - *in* *integer* - unique identifier + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RingBuffer_init(inout EPTF_HTTP_RingBuffer pl_buffer, in integer pl_size, in integer pl_id) + runs on EPTF_HTTP_LocalTransport_CT + { + pl_buffer.nextSeqNum := 0; + pl_buffer.waitForSeqNum := 0; + pl_buffer.usedSlots := 0; + pl_buffer.maxSize := pl_size; + + pl_buffer.isSlotBusyHM := + f_EPTF_int2int_HashMap_New(c_EPTF_HTTP_LocalTransport_HashMap_isSlotBusy & int2str(pl_id)); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RingBuffer_clear + // + // Purpose: + // Clears the sequence numbers. + // + // Parameters: + // pl_buffer - *inout* <EPTF_HTTP_RingBuffer> - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RingBuffer_clear(inout EPTF_HTTP_RingBuffer pl_buffer) + runs on EPTF_HTTP_LocalTransport_CT + { + pl_buffer.nextSeqNum := 0; + pl_buffer.waitForSeqNum := 0; + pl_buffer.usedSlots := 0; + + f_EPTF_int2int_HashMap_Clear(pl_buffer.isSlotBusyHM); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RingBuffer_erase + // + // Purpose: + // Clears the sequence numbers. + // + // Parameters: + // pl_buffer - *inout* <EPTF_HTTP_RingBuffer> - + // pl_id - *in* *integer* - unique identifier + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RingBuffer_erase(inout EPTF_HTTP_RingBuffer pl_buffer, in integer pl_id) + runs on EPTF_HTTP_LocalTransport_CT + { + pl_buffer.nextSeqNum := 0; + pl_buffer.waitForSeqNum := 0; + pl_buffer.usedSlots := 0; + + f_EPTF_int2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_isSlotBusy & int2str(pl_id)); + + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_MsgBuffer_clear + // + // Purpose: + // Clears the message buffer. + // + // Parameters: + // pl_buffer - *inout* <EPTF_HTTP_Buffer> - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_MsgBuffer_clear(inout EPTF_HTTP_MessageBuffer pl_buffer) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_RingBuffer_clear(pl_buffer.seqNums); + f_EPTF_int2int_HashMap_Clear(pl_buffer.seqNum2messageIdxHM) + f_EPTF_FBQ_initFreeBusyQueue(pl_buffer.messageQueue); + pl_buffer.httpMessages := {} + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_MsgBuffer_erase + // + // Purpose: + // Erases the message buffer. + // + // Parameters: + // pl_buffer - *inout* <EPTF_HTTP_Buffer> - + // pl_id - *in* *integer* - unique identifier + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_MsgBuffer_erase(inout EPTF_HTTP_MessageBuffer pl_buffer, in integer pl_id) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_bufferDebug("### " & %definitionId & "()"); + + f_EPTF_HTTP_RingBuffer_erase(pl_buffer.seqNums, pl_id); + f_EPTF_int2int_HashMap_Delete(c_EPTF_HTTP_LocalTransport_HashMap_seqNum2messageIdx & int2str(pl_id)) + pl_buffer.seqNum2messageIdxHM := -1; + f_EPTF_FBQ_initFreeBusyQueue(pl_buffer.messageQueue); + pl_buffer.httpMessages := {} + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RingBuffer_getNext + // + // Purpose: + // Gets the next sequence number. + // + // Parameters: + // pl_buffer - *inout* <EPTF_HTTP_RingBuffer> - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RingBuffer_getNext(inout EPTF_HTTP_RingBuffer pl_buffer) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + if (pl_buffer.usedSlots == pl_buffer.maxSize) + { + f_EPTF_HTTP_Transport_bufferWarning(log2str(%definitionId & + ": Buffer is full!")); + return -1; + } + + var integer vl_next := pl_buffer.nextSeqNum; + + pl_buffer.nextSeqNum := (vl_next + 1) mod pl_buffer.maxSize; + + pl_buffer.usedSlots := pl_buffer.usedSlots + 1 + + return vl_next; + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RingBuffer_setElementBusy + // + // Purpose: + // Sets the element status to busy. + // + // Parameters: + // pl_buffer - *inout* <EPTF_HTTP_RingBuffer> - + // pl_elemIdx -*integer* *integer*- element index + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RingBuffer_setElementBusy(inout EPTF_HTTP_RingBuffer pl_buffer, in integer pl_elemIdx) + runs on EPTF_HTTP_LocalTransport_CT + { + if (pl_elemIdx >= pl_buffer.nextSeqNum and pl_elemIdx < pl_buffer.waitForSeqNum) + { + f_EPTF_HTTP_Transport_bufferWarning(log2str(%definitionId & + ": Setting invalid index (",pl_elemIdx,"). ", "head: ", pl_buffer.waitForSeqNum, " tail: ", pl_buffer.nextSeqNum)); + return; + } + + f_EPTF_int2int_HashMap_Insert(pl_buffer.isSlotBusyHM, pl_elemIdx, 1); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RingBuffer_isHeadBusy + // + // Purpose: + // Retreive head slot status. + // + // Parameters: + // pl_buffer - *in* <EPTF_HTTP_RingBuffer> - + // + // Return Value: + // boolean - true if the head is busy + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RingBuffer_isHeadBusy(in EPTF_HTTP_RingBuffer pl_buffer) + runs on EPTF_HTTP_LocalTransport_CT + return boolean + { + var integer vl_tmp; + return f_EPTF_int2int_HashMap_Find(pl_buffer.isSlotBusyHM, pl_buffer.waitForSeqNum, vl_tmp); + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RingBuffer_freeHead + // + // Purpose: + // Sets the status of the head to free. + // + // Parameters: + // pl_buffer - *inout* <EPTF_HTTP_RingBuffer> - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RingBuffer_freeHead(inout EPTF_HTTP_RingBuffer pl_buffer) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_int2int_HashMap_Erase(pl_buffer.isSlotBusyHM, pl_buffer.waitForSeqNum); + pl_buffer.usedSlots := pl_buffer.usedSlots - 1; + + pl_buffer.waitForSeqNum := (pl_buffer.waitForSeqNum + 1) mod pl_buffer.maxSize + } + + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_RingBuffer_getHeadIdx + // + // Purpose: + // Gets the index of the head. + // + // Parameters: + // pl_buffer - *in* <EPTF_HTTP_RingBuffer> - + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_RingBuffer_getHeadIdx(in EPTF_HTTP_RingBuffer pl_buffer) + runs on EPTF_HTTP_LocalTransport_CT + return integer + { + return pl_buffer.waitForSeqNum; + } + /////////////////////////////////////////////////////////////////////////////// + // Function: f_EPTF_HTTP_printBufferStatus + // + // Purpose: + // Prints message buffer status. + // + // Parameters: + // pl_group - *in* *integer* - group id + // pl_port - *in* *integer* - port id + // + /////////////////////////////////////////////////////////////////////////////// + function f_EPTF_HTTP_printBufferStatus(in integer pl_group, in integer pl_port) + runs on EPTF_HTTP_LocalTransport_CT + { + f_EPTF_HTTP_Transport_bufferDebug(log2str(%definitionId, ": Buffer status (group: ",pl_group," port: ",pl_port,"):", + " next sequence number: "& int2str(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].messageBuffer.seqNums.nextSeqNum), + " waiting for: ", int2str(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].messageBuffer.seqNums.waitForSeqNum), + " used slots: ", int2str(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].messageBuffer.seqNums.usedSlots), + " size of message buffer: ", + f_EPTF_FBQ_getLengthOfFreeChain(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].messageBuffer.messageQueue))); + + } + +}//EPTF_HTTP_Buffer + +}//end of module +with { +extension "version <RnXnn>" +} + diff --git a/test/EPTF_AppLib_HTTP_Test_Makepatch.sh b/test/EPTF_AppLib_HTTP_Test_Makepatch.sh new file mode 100755 index 0000000..191a7d2 --- /dev/null +++ b/test/EPTF_AppLib_HTTP_Test_Makepatch.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +sed -e ' + +s/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = -D$(PLATFORM) -I$(OPENSSL_DIR)\/include -I$(TTCN3_DIR)\/include -DNO_IPV6/g + +s/OPENSSL_DIR = $(TTCN3_DIR)/#OPENSSL_DIR = $(TTCN3_DIR)/g + +#s/CXX = g++/CXX = \/usr\/sfw\/bin\/g++/g +#s/CPP = cpp/CPP = \/usr\/sfw\/bin\/cpp/g + +#s/-L$(OPENSSL_DIR)\/lib -lcrypto $($(PLATFORM)_LIBS)/-L$(OPENSSL_DIR)\/lib -lcrypto $($(PLATFORM)_LIBS)/g + +s/SOLARIS_LIBS = -lsocket -lnsl/SOLARIS_LIBS = -lsocket -lnsl -lresolv -lxnet/g + +s/SOLARIS8_LIBS = -lsocket -lnsl/SOLARIS8_LIBS = -lsocket -lnsl -lresolv -lxnet/g + +s/CXXFLAGS = -Wall/CXXFLAGS = -Wall /g + +#s/LDFLAGS =/LDFLAGS = -g/g + +' <$1 >$2 diff --git a/test/EPTF_Applib_HTTP_CNL113618_TD.doc b/test/EPTF_Applib_HTTP_CNL113618_TD.doc Binary files differnew file mode 100644 index 0000000..5c7b796 --- /dev/null +++ b/test/EPTF_Applib_HTTP_CNL113618_TD.doc diff --git a/test/EPTF_Applib_HTTP_CNL113618_TR.doc b/test/EPTF_Applib_HTTP_CNL113618_TR.doc Binary files differnew file mode 100644 index 0000000..3522e40 --- /dev/null +++ b/test/EPTF_Applib_HTTP_CNL113618_TR.doc diff --git a/test/EPTF_Applib_HTTP_NaturalDocs_Generator/Languages.txt b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/Languages.txt new file mode 100755 index 0000000..2fbc5d1 --- /dev/null +++ b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/Languages.txt @@ -0,0 +1,138 @@ +Format: 1.35 + +# This is the Natural Docs languages file for this project. If you change +# anything here, it will apply to THIS PROJECT ONLY. If you'd like to change +# something for all your projects, edit the Languages.txt in Natural Docs' +# Config directory instead. + + +Ignore Extensions: c cpp hh o sh csh txt pl pm + + +#------------------------------------------------------------------------------- +# SYNTAX: +# +# Unlike other Natural Docs configuration files, in this file all comments +# MUST be alone on a line. Some languages deal with the # character, so you +# cannot put comments on the same line as content. +# +# Also, all lists are separated with spaces, not commas, again because some +# languages may need to use them. +# +# Language: [name] +# Alter Language: [name] +# Defines a new language or alters an existing one. Its name can use any +# characters. If any of the properties below have an add/replace form, you +# must use that when using Alter Language. +# +# The language Shebang Script is special. It's entry is only used for +# extensions, and files with those extensions have their shebang (#!) lines +# read to determine the real language of the file. Extensionless files are +# always treated this way. +# +# The language Text File is also special. It's treated as one big comment +# so you can put Natural Docs content in them without special symbols. Also, +# if you don't specify a package separator, ignored prefixes, or enum value +# behavior, it will copy those settings from the language that is used most +# in the source tree. +# +# Extensions: [extension] [extension] ... +# [Add/Replace] Extensions: [extension] [extension] ... +# Defines the file extensions of the language's source files. You can +# redefine extensions found in the main languages file. You can use * to +# mean any undefined extension. +# +# Shebang Strings: [string] [string] ... +# [Add/Replace] Shebang Strings: [string] [string] ... +# Defines a list of strings that can appear in the shebang (#!) line to +# designate that it's part of the language. You can redefine strings found +# in the main languages file. +# +# Ignore Prefixes in Index: [prefix] [prefix] ... +# [Add/Replace] Ignored Prefixes in Index: [prefix] [prefix] ... +# +# Ignore [Topic Type] Prefixes in Index: [prefix] [prefix] ... +# [Add/Replace] Ignored [Topic Type] Prefixes in Index: [prefix] [prefix] ... +# Specifies prefixes that should be ignored when sorting symbols in an +# index. Can be specified in general or for a specific topic type. +# +#------------------------------------------------------------------------------ +# For basic language support only: +# +# Line Comments: [symbol] [symbol] ... +# Defines a space-separated list of symbols that are used for line comments, +# if any. +# +# Block Comments: [opening sym] [closing sym] [opening sym] [closing sym] ... +# Defines a space-separated list of symbol pairs that are used for block +# comments, if any. +# +# Package Separator: [symbol] +# Defines the default package separator symbol. The default is a dot. +# +# [Topic Type] Prototype Enders: [symbol] [symbol] ... +# When defined, Natural Docs will attempt to get a prototype from the code +# immediately following the topic type. It stops when it reaches one of +# these symbols. Use \n for line breaks. +# +# Line Extender: [symbol] +# Defines the symbol that allows a prototype to span multiple lines if +# normally a line break would end it. +# +# Enum Values: [global|under type|under parent] +# Defines how enum values are referenced. The default is global. +# global - Values are always global, referenced as 'value'. +# under type - Values are under the enum type, referenced as +# 'package.enum.value'. +# under parent - Values are under the enum's parent, referenced as +# 'package.value'. +# +# Perl Package: [perl package] +# Specifies the Perl package used to fine-tune the language behavior in ways +# too complex to do in this file. +# +#------------------------------------------------------------------------------ +# For full language support only: +# +# Full Language Support: [perl package] +# Specifies the Perl package that has the parsing routines necessary for full +# language support. +# +#------------------------------------------------------------------------------- + +# The following languages are defined in the main file, if you'd like to alter +# them: +# +# Text File, Shebang Script, C/C++, C#, Java, JavaScript, Perl, Python, +# PHP, SQL, Visual Basic, Pascal, Assembly, Ada, Tcl, Ruby, Makefile, +# ActionScript, ColdFusion, R, Fortran + +# If you add a language that you think would be useful to other developers +# and should be included in Natural Docs by default, please e-mail it to +# languages [at] naturaldocs [dot] org. + + +Language: TTCN3 + + Extension: ttcn ttcnin ttcnpp + Line Comment: // + Block Comment: /* */ + Function Prototype Enders: ; { + Variable Prototype Enders: ; = + RequirementProcedure Prototype Ender: { + Procedure Prototype Ender: { + RequirementFunction Prototype Ender: { + + +Language: ASN1 + + Extension: asn + Line Comment: -- + + +Language: C++ + + Extension: cc hh h + Line Comment: // + Block Comment: /* */ + diff --git a/test/EPTF_Applib_HTTP_NaturalDocs_Generator/Menu.txt b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/Menu.txt new file mode 100755 index 0000000..d75a170 --- /dev/null +++ b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/Menu.txt @@ -0,0 +1,47 @@ +Format: 1.35 + + +Title: HTTP Application Library +SubTitle: CNL 113 618 Rev.R2A01 + +Footer: Copyright (c) 2000-2018 Ericsson Telecom AB + + +# -------------------------------------------------------------------------- +# +# Cut and paste the lines below to change the order in which your files +# appear on the menu. Don't worry about adding or removing files, Natural +# Docs will take care of that. +# +# You can further organize the menu by grouping the entries. Add a +# "Group: [name] {" line to start a group, and add a "}" to end it. +# +# You can add text and web links to the menu by adding "Text: [text]" and +# "Link: [name] ([URL])" lines, respectively. +# +# The formatting and comments are auto-generated, so don't worry about +# neatness when editing the file. Natural Docs will clean it up the next +# time it is run. When working with groups, just deal with the braces and +# forget about the indentation and comments. +# +# -------------------------------------------------------------------------- + + +File: EPTF_HTTP_Definitions.ttcn (LoadGen/EPTF_HTTP_Definitions.ttcn) +File: EPTF_HTTP_Functions.ttcn (LoadGen/EPTF_HTTP_Functions.ttcn) +File: EPTF_HTTP_Logger_Definitions.ttcn (Logger/EPTF_HTTP_Logger_Definitions.ttcn) +File: EPTF_HTTP_Logger_Functions.ttcn (Logger/EPTF_HTTP_Logger_Functions.ttcn) +File: EPTF_HTTP_Transport_Definitions.ttcn (Transport/EPTF_HTTP_Transport_Definitions.ttcn) +File: EPTF_HTTP_Transport_Functions.ttcn (Transport/EPTF_HTTP_Transport_Functions.ttcn) + +Group: Index { + + Altstep Index: Altsteps + Constant Index: Constants + Index: Everything + File Index: Files + Function Index: Functions + Template Index: Templates + Type Index: Types + } # Group: Index + diff --git a/test/EPTF_Applib_HTTP_NaturalDocs_Generator/Topics.txt b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/Topics.txt new file mode 100755 index 0000000..bf2a03b --- /dev/null +++ b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/Topics.txt @@ -0,0 +1,182 @@ +Format: 1.35 + +# This is the Natural Docs topics file for this project. If you change anything +# here, it will apply to THIS PROJECT ONLY. If you'd like to change something +# for all your projects, edit the Topics.txt in Natural Docs' Config directory +# instead. + + +Ignore Keywords: + note, notes + + +#------------------------------------------------------------------------------- +# SYNTAX: +# +# Topic Type: [name] +# Alter Topic Type: [name] +# Creates a new topic type or alters one from the main file. Each type gets +# its own index and behavior settings. Its name can have letters, numbers, +# spaces, and these charaters: - / . ' +# +# Plural: [name] +# Sets the plural name of the topic type, if different. +# +# Keywords: +# [keyword] +# [keyword], [plural keyword] +# ... +# Defines or adds to the list of keywords for the topic type. They may only +# contain letters, numbers, and spaces and are not case sensitive. Plural +# keywords are used for list topics. You can redefine keywords found in the +# main topics file. +# +# Index: [yes|no] +# Whether the topics get their own index. Defaults to yes. Everything is +# included in the general index regardless of this setting. +# +# Scope: [normal|start|end|always global] +# How the topics affects scope. Defaults to normal. +# normal - Topics stay within the current scope. +# start - Topics start a new scope for all the topics beneath it, +# like class topics. +# end - Topics reset the scope back to global for all the topics +# beneath it. +# always global - Topics are defined as global, but do not change the scope +# for any other topics. +# +# Class Hierarchy: [yes|no] +# Whether the topics are part of the class hierarchy. Defaults to no. +# +# Variable Type: [yes|no] +# Whether the topics can be a variable type. Defaults to no. +# +# Page Title If First: [yes|no] +# Whether the topic's title becomes the page title if it's the first one in +# a file. Defaults to no. +# +# Break Lists: [yes|no] +# Whether list topics should be broken into individual topics in the output. +# Defaults to no. +# +# Can Group With: [type], [type], ... +# Defines a list of topic types that this one can possibly be grouped with. +# Defaults to none. +#------------------------------------------------------------------------------- + +# The following topics are defined in the main file, if you'd like to alter +# their behavior or add keywords: +# +# Generic, Class, Interface, Section, File, Group, Function, Variable, +# Property, Type, Constant, Enumeration, Event, Delegate, Macro, +# Database, Database Table, Database View, Database Index, Database +# Cursor, Database Trigger, Cookie, Build Target + +# If you add something that you think would be useful to other developers +# and should be included in Natural Docs by default, please e-mail it to +# topics [at] naturaldocs [dot] org. + + +Topic Type: Testcase + + Plural: Testcases + Keywords: + testcase, testcases + testcasefunction, testcasefunctions + + +Topic Type: RequirementTestcase + + Plural: RequirementTestcases + Keywords: + requirementtestcase, requirementtestcases + + +Topic Type: RequirementFunction + + Plural: RequirementFunctions + Keywords: + requirementfunction, requirementfunctions + + +Topic Type: Procedure + + Plural: Procedures + Keywords: + procedure, procedures + + +Topic Type: RequirementProcedure + + Plural: RequirementProcedures + Keywords: + requirementprocedure, requirementprocedures + + +Topic Type: Primitive + + Plural: Primitives + Keywords: + primitive, primitives + + +Topic Type: Altstep + + Plural: Altsteps + Keywords: + altstep, altsteps + + +Topic Type: RequirementAltstep + + Plural: RequirementAltsteps + Keywords: + requirementaltstep, requirementaltsteps + + +Topic Type: Template + + Plural: Templates + Keywords: + template, templates + + +Topic Type: RequirementType + + Plural: RequirementTypes + Keywords: + requirementtype, requirementtypes + + +Alter Topic Type: Group + + Plural: Groups + Index: No + + Add Keywords: + group + + +Alter Topic Type: Generic + + + +Alter Topic Type: File + + Add Keywords: + module + asnmodule + + +Topic Type: AsnType + + Plural: AsnTypes + Keywords: + asntype, asntypes + + +Topic Type: Component + + Plural: Components + Keywords: + component, components diff --git a/test/EPTF_Applib_HTTP_NaturalDocs_Generator/generate.sh b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/generate.sh new file mode 100755 index 0000000..9101fb0 --- /dev/null +++ b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/generate.sh @@ -0,0 +1,85 @@ +#!/usr/bin/sh + +ct=/usr/atria/bin/cleartool +natdoc=/mnt/TTCN/Tools/naturaldocs/NaturalDocs +ttcn3=/view/${USER}_tcc/vobs/ttcn/TCC_Common/Libraries/EPTF_Applib_HTTP_CNL113618/src +natdocvobdir=$ttcn3/../test/EPTF_Applib_HTTP_NaturalDocs_Generator #to be excluded + +natdocproj=$natdocvobdir/generated +html_dir=$natdocproj/html + +# Prepare Files +prepare_file() +{ + f=$1 + if [ -w $f ] + then + $ct lscheckout -cview $f | grep unreserved + if [ $? ] + then + $ct unco -rm $f + else + echo "Warning - $f is checked out reserved!" + fi + fi + if [ ! -w $f ] + then + $ct co -c "Checked out by generate.sh" -unreserved $f + fi + if [ ! -w $f ] + then + echo "Error - unable to check out $f - check your config spec" + $ct ls $f + exit + fi +} + +if [ ! -x $natdoc ] +then + echo "Error - Can't execute $natdoc" + exit +fi + +# Check out those files that need to be modified, unreserved +#prepare_file "$natdocproj/Topics.txt" +#prepare_file "$natdocproj/Languages.txt" +cp $natdocvobdir/Topics.txt $natdocproj/Topics.txt +cp $natdocvobdir/Languages.txt $natdocproj/Languages.txt +cp $natdocvobdir/load.css $natdocproj/load.css +cp $natdocvobdir/Menu.txt $natdocproj/Menu.txt +chmod 664 $natdocproj/Topics.txt $natdocproj/Languages.txt $natdocproj/load.css #$natdocproj/Menu.txt + +# Run from the top level directory +# NaturalDocs doesn't seem to update the menu properly without the hacking below +echo "Deleting cached info..." +#/usr/bin/rm -f $natdocproj/Menu.txt +/usr/bin/rm -f $natdocproj/Data/* +echo "Rebuilding everything..." +$natdoc --input $ttcn3 --output framedhtml $html_dir --project $natdocproj -s Default load -r --exclude-input $natdocvobdir + +# Ensure that any new files created are writable by all, but ignore +# the errors that will probably come +chmod 775 `find $html_dir -type d` > /dev/null 2>&1 +chmod 664 `find $html_dir -type f` > /dev/null 2>&1 +chmod 664 `find $natdocproj/Data -type f` > /dev/null 2>&1 +chmod 664 $natdocproj/Menu.txt > /dev/null 2>&1 + +/usr/bin/rm -f $natdocproj/Topics.txt +/usr/bin/rm -f $natdocproj/load.css +/usr/bin/rm -f $natdocproj/Languages.txt + +# copy externally modified html files +#cp $natdocvobdir/TITANSim.html $html_dir/files/TITANSim.html +#cp $natdocvobdir/index.html $html_dir/index.html + +# close group items for default +#/bin/sh closegroups.sh $html_dir/menu.html $html_dir/menu2.html +#/usr/bin/rm -f $html_dir/menu.html +#/usr/bin/mv $html_dir/menu2.html $html_dir/menu.html + +# repairs unnatural html files generated by NaturalDocs +/usr/local/bin/perl /$natdocvobdir/repairunnaturalhtml.pl $html_dir + + + + diff --git a/test/EPTF_Applib_HTTP_NaturalDocs_Generator/load.css b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/load.css new file mode 100755 index 0000000..bd55024 --- /dev/null +++ b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/load.css @@ -0,0 +1,45 @@ +/* + IMPORTANT: If you're editing this file in the output directory of one of + your projects, your changes will be overwritten the next time you run + Natural Docs. Instead, copy this file to your project directory, make your + changes, and you can use it with -s. Even better would be to make a CSS + file in your project directory with only your changes, which you can then + use with -s [original style] [your changes]. + + On the other hand, if you're editing this file in the Natural Docs styles + directory, the changes will automatically be applied to all your projects + that use this style the next time Natural Docs is run on them. + + This file is part of Natural Docs, which is Copyright © 2003-2004 Greg Valure + Natural Docs is licensed under the GPL +*/ + +/* NO longer necessary!! + .Prototype td { + font-size: 8pt; + } +*/ + +.CRequirementTestcase .Prototype { background-color: #F4F4F4; border-color: #D0D0D0 } +.CRequirementFunction .Prototype { background-color: #F4F4F4; border-color: #D0D0D0 } +.CRequirementProcedure .Prototype { background-color: #F4F4F4; border-color: #D0D0D0 } +.CRequirementType .Prototype { background-color: #F4F4F4; border-color: #D0D0D0 } + +.MGroupContent { + font-variant: normal; + font-weight: normal; + display: none; +} + +/* NO longer necessary!! +@media print { + + blockquote { + overflow: visible; + } + + .IE blockquote { + width: auto; + } +} +*/ diff --git a/test/EPTF_Applib_HTTP_NaturalDocs_Generator/repairunnaturalhtml.pl b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/repairunnaturalhtml.pl new file mode 100755 index 0000000..85478af --- /dev/null +++ b/test/EPTF_Applib_HTTP_NaturalDocs_Generator/repairunnaturalhtml.pl @@ -0,0 +1,99 @@ +#!/usr/bin/perl -w + +use strict; + +# in: file path +# out: extension +sub getFileExtension +{ + my $path = shift; + my @lst = split( /\./ , $path ); + return( (@lst<2) ? '' : $lst[@lst-1] ); +} + +#in : reference to string containing source code line, extension +#out: number of inserted line breaks +sub insertLineBreaks +{ + my $r_line = shift; + my $extension = shift; # currently not used + my $subst_cnt = $$r_line =~ s/>\s*<([^\/])/>\n<$1/g; + return $subst_cnt; +} + +sub isHtmldocFile +{ + my $fname = shift; + my $htmldocexts = "html|htm"; + return ($fname =~/\.($htmldocexts)$/); +} + +# recursive scan of the given path: insert line breaks for all html files +# input : path +# output: number of changed html files +sub repairHtmlDoc +{ + my $source_path = shift; + my %my_cnt = ( 'html' => 0, 'changed' => 0 ); + + opendir(DIRH, $source_path) or die("Could not open the directory: $source_path\n"); + my @dirContent = readdir DIRH; + closedir(DIRH); + + my $file; + foreach $file (@dirContent) + { + if (($file ne '.') and ($file ne '..')) + { + my $path = $source_path.'/'.$file; + if (-l $path) + { + # nothing to do + } + elsif (-d $path) + { + # recursive call + my %cnt = repairHtmlDoc($path); + $my_cnt{'html'} += $cnt{'html'}; + $my_cnt{'changed'} += $cnt{'changed'}; + } + else # file + { + if (isHtmldocFile($path)) + { + my $inserted = 0; + my $extension = getFileExtension($path); + # read content + open(HTML_FILE, $path) or die("Could not open file '$path' for reading.\n"); + my @html_content = <HTML_FILE>; + close HTML_FILE; + # overwrite file with inserted line breaks + open(HTML_FILE, "+>$path") or die("Could not open file '$path' for overwriting.\n"); + my $line; + foreach $line (@html_content) + { + $inserted += insertLineBreaks(\$line, $extension); + print HTML_FILE $line; + } + close HTML_FILE; + $my_cnt{'html'}++; + $my_cnt{'changed'}++ if ($inserted); + print "Inserted $inserted line breaks into '$path' file.\n"; + } + } + } + } + return %my_cnt; +} + +#START: +# get directory name +die "Usage: $0 <path_to_naturaldocs_documentation_directory>\n" if (@ARGV!=1); +my $dirname = $ARGV[0]; +# remove eventual ending '/' from directory names +$dirname =~ s/\/$//; +die "Directory '$dirname' does not exist.\n" unless (-e $dirname); +# insert line breaks in place +my %cnt = repairHtmlDoc($dirname); +# print statistics +print "*** Processed ".$cnt{'html'}." html files.\n"; diff --git a/test/EPTF_Applib_HTTP_Test.cfg b/test/EPTF_Applib_HTTP_Test.cfg new file mode 100644 index 0000000..8b6cb72 --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test.cfg @@ -0,0 +1,41 @@ +[EXECUTE] +EPTF_Applib_HTTP_Test_Testcases.control + +[LOGGING] +FileMask := TTCN_ERROR | TTCN_WARNING | TTCN_USER | TTCN_VERDICTOP | +TTCN_TESTCASE |TTCN_STATISTICS |TTCN_PARALLEL | TTCN_MATCHING | TTCN_PORTEVENT | TTCN_DEBUG +ConsoleMask := TTCN_ERROR | TTCN_WARNING | TTCN_VERDICTOP | TTCN_TESTCASE |TTCN_STATISTICS +LogEventTypes := Yes +SourceInfoFormat := Stack #Single +LogEntityName := Yes +#MatchingHints := Detailed + +[MODULE_PARAMETERS] +tsp_EPTF_Var_debug := true; +tsp_EPTF_HTTP_Transport_loggingEnable := true; +tsp_EPTF_HTTP_loggingEnable := true; +tsp_EPTF_HTTP_maxNumberOfEntities := 100; + +tsp_EPTF_HTTP_dispatchLevel := Detailed; + +tsp_EPTF_LGenBaseDebug := false; +tsp_EPTF_LGenBaseDebugTraffic := false; + +tsp_EPTF_HTTP_Test_Responder_host := "159.107.193.33"; +tsp_EPTF_HTTP_Test_Responder_port := 3100; +tsp_EPTF_HTTP_Test_Application1_host := "159.107.193.33"; +tsp_EPTF_HTTP_Test_Application1_port := 6000; + +#tsp_runningTime := 4; +#tsp_QPS := 500; +#tsp_rangeHi := 3000; + + +[TESTPORT_PARAMETERS] +#*.IPL4_PCO.debug := "YES" +#*.v_IPL4_PCO.debug := "YES" + +[MAIN_CONTROLLER] +#TCPPort := 1025 +#NumHCs := 1 +#KillTimer := 11 diff --git a/test/EPTF_Applib_HTTP_Test.prj b/test/EPTF_Applib_HTTP_Test.prj new file mode 100644 index 0000000..55dbb10 --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test.prj @@ -0,0 +1,127 @@ +<!DOCTYPE TITAN_GUI_project_file> +<Project TITAN_version="1.8.pl2" > + <General> + <Project_Name>HTTP</Project_Name> + <Executable_Path>../bin/HTTP</Executable_Path> + <Working_Dir>../bin</Working_Dir> + <Build_Host>alpha</Build_Host> + <Execution_Mode>Parallel</Execution_Mode> + <Code_Splitting_Mode>None</Code_Splitting_Mode> + <ScriptFile_AfterMake>EPTF_AppLib_HTTP_Test_Makepatch.sh</ScriptFile_AfterMake> + <Log_Format>yes</Log_Format> + <Update_Symlinks>yes</Update_Symlinks> + <Create_Absolute_Symlinks>no</Create_Absolute_Symlinks> + <Update_Makefile>yes</Update_Makefile> + <Localhost_Execute>yes</Localhost_Execute> + <Execute_Command>rsh %host "cd %project_working_dir ; "%executable" %localhost %mctr_port"</Execute_Command> + <Execute_Hosts>alfa, beta, gamma</Execute_Hosts> + <UnUsed_List>../../EPTF_Core_Library_CNL113512/src/Common/EPTF_CLL_Common_RndDefinitions.ttcn,../../EPTF_Core_Library_CNL113512/src/Common/EPTF_CLL_Common_RndFunctions.ttcn,../../EPTF_Core_Library_CNL113512/src/LGenBase/EPTF_CLL_LGenBaseStatsUI_Definitions.ttcn,../../EPTF_Core_Library_CNL113512/src/LGenBase/EPTF_CLL_LGenBaseStatsUI_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCAssertion.cc,../../TCCUsefulFunctions_CNL113472/src/TCCAssertion_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCEncoding.cc,../../TCCUsefulFunctions_CNL113472/src/TCCEncoding_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCEnv.cc,../../TCCUsefulFunctions_CNL113472/src/TCCEnv_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCIPsec.cc,../../TCCUsefulFunctions_CNL113472/src/TCCIPsec_Definitions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCIPsec_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCTitanMetadata.cc,../../TCCUsefulFunctions_CNL113472/src/TCCTitanMetadata_Functions.ttcn,../../TCCUsefulFunctions_CNL113472/src/TCCXPathSupport.cc,../../TCCUsefulFunctions_CNL113472/src/TCCXPathSupport_Functions.ttcn,../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_User_CtrlFunct.ttcn,../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_User_CtrlFunctDef.cc</UnUsed_List> + </General> + <Configs> + <Config>EPTF_Applib_HTTP_Test.cfg</Config> + </Configs> + <Test_Cases> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.control</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test1</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test2</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test3</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test4</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test5</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test6</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test7</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test8</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test9</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test10</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test11</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test12</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test13</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test14</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test15</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test16</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test17</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test18</Test_Case> + <Test_Case>EPTF_Applib_HTTP_Test_Testcases.tc_EPTF_HTTP_Test_test19</Test_Case> + </Test_Cases> + <Others> + <Other>EPTF_AppLib_HTTP_Test_Makepatch.sh</Other> + <Other>EPTF_Applib_HTTP_Test.prj</Other> + </Others> + <File_Group name="MainFileGroup" > + <File_Groups> + <File_Group name="CoreLibrary" > + <File_Groups> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Base/EPTF_CLL_Base.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Common/EPTF_CLL_Common.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/FreeBusyQueue/EPTF_CLL_FreeBusyQueue.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/HashMap/EPTF_CLL_HashMap.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/LGenBase/EPTF_CLL_LGenBase_All.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Logging/EPTF_CLL_Logging.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Logging/EPTF_CLL_LoggingUI.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/RedBlackTree/EPTF_CLL_RBtree.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Scheduler/EPTF_CLL_Scheduler.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Semaphore/EPTF_CLL_Semaphore.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/StatHandler/EPTF_CLL_StatHandler.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/StatHandler/EPTF_CLL_StatHandlerUI.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportCommPortIPL4.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportMessageBufferManager.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Transport/EPTF_CLL_TransportRouting.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/UIHandler/EPTF_CLL_UIHandler.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/Variable/EPTF_CLL_Variable.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/StatMeasure/EPTF_CLL_StatMeasure.grp" /> + <File_Group path="../../EPTF_Core_Library_CNL113512/src/RandomNArray/EPTF_CLL_RNA.grp" /> + </File_Groups> + </File_Group> + <File_Group path="../../TCCUsefulFunctions_CNL113472/src/TCCUsefulFunctions_Library.grp" /> + <File_Group name="Test" > + <File path="EPTF_Applib_HTTP_Test_Application1_Definitions.ttcn" /> + <File path="EPTF_Applib_HTTP_Test_Application1_Functions.ttcn" /> + <File path="EPTF_Applib_HTTP_Test_Responder.ttcn" /> + <File path="EPTF_Applib_HTTP_Test_Testcases.ttcn" /> + <File path="EPTF_Applib_HTTP_Test_Definitions.ttcn" /> + <File path="EPTF_Applib_HTTP_Test_Functions.ttcn" /> + <File path="EPTF_Applib_HTTP_Test_Templates.ttcn" /> + </File_Group> + <File_Group name="HTTP" > + <File_Groups> + <File_Group name="LGen" > + <File path="../src/LoadGen/EPTF_HTTP_Definitions.ttcn" /> + <File path="../src/LoadGen/EPTF_HTTP_Functions.ttcn" /> + </File_Group> + <File_Group name="Transport" > + <File path="../src/Transport/EPTF_HTTP_Transport_Definitions.ttcn" /> + <File path="../src/Transport/EPTF_HTTP_Transport_Functions.ttcn" /> + </File_Group> + <File_Group name="Logger" > + <File path="../src/Logger/EPTF_HTTP_Logger_Definitions.ttcn" /> + <File path="../src/Logger/EPTF_HTTP_Logger_Functions.ttcn" /> + </File_Group> + </File_Groups> + </File_Group> + <File_Group name="TestPorts" > + <File_Groups> + <File_Group path="../../../TestPorts/IPL4asp_CNL113531/src/IPL4.grp" /> + <File_Group name="IPL4 User Ctrl Functions" > + <File path="../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_User_CtrlFunct.ttcn" /> + <File path="../../../TestPorts/IPL4asp_CNL113531/src/IPL4asp_User_CtrlFunctDef.cc" /> + </File_Group> + <File_Group name="HTTP_TP" > + <File path="../../../TestPorts/HTTPmsg_CNL113312/src/HTTPmsg_PT.cc" /> + <File path="../../../TestPorts/HTTPmsg_CNL113312/src/HTTPmsg_PT.hh" /> + <File path="../../../TestPorts/HTTPmsg_CNL113312/src/HTTPmsg_PortType.ttcn" /> + <File path="../../../TestPorts/HTTPmsg_CNL113312/src/HTTPmsg_Types.ttcn" /> + </File_Group> + <File_Group path="../../../TestPorts/XTDPasp_CNL113494/src/XTDPasp.grp" /> + <File_Group name="AS" > + <File path="../../../TestPorts/Common_Components/Abstract_Socket_CNL113384/src/Abstract_Socket.cc" /> + <File path="../../../TestPorts/Common_Components/Abstract_Socket_CNL113384/src/Abstract_Socket.hh" /> + </File_Group> + <File_Group name="Telnet" > + <File path="../../../TestPorts/TELNETasp_CNL113320/src/TELNETasp_PT.cc" /> + <File path="../../../TestPorts/TELNETasp_CNL113320/src/TELNETasp_PT.hh" /> + <File path="../../../TestPorts/TELNETasp_CNL113320/src/TELNETasp_PortType.ttcn" /> + </File_Group> + </File_Groups> + </File_Group> + </File_Groups> + </File_Group> +</Project> diff --git a/test/EPTF_Applib_HTTP_Test.tpd b/test/EPTF_Applib_HTTP_Test.tpd new file mode 100644 index 0000000..9d29972 --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test.tpd @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<TITAN_Project_File_Information version="1.0"> + <ProjectName>EPTF_Applib_HTTP_Test</ProjectName> + <ReferencedProjects> + <ReferencedProject name="EPTF_Applib_HTTP_CNL113618" projectLocationURI="../EPTF_Applib_HTTP_CNL113618.tpd"/> + + </ReferencedProjects> + <Files> + <FileResource projectRelativePath="EPTF_Applib_HTTP_Test.cfg" relativeURI="EPTF_Applib_HTTP_Test.cfg"/> + <FileResource projectRelativePath="EPTF_Applib_HTTP_Test_Application1_Definitions.ttcn" relativeURI="EPTF_Applib_HTTP_Test_Application1_Definitions.ttcn"/> + <FileResource projectRelativePath="EPTF_Applib_HTTP_Test_Application1_Functions.ttcn" relativeURI="EPTF_Applib_HTTP_Test_Application1_Functions.ttcn"/> + <FileResource projectRelativePath="EPTF_Applib_HTTP_Test_Responder.ttcn" relativeURI="EPTF_Applib_HTTP_Test_Responder.ttcn"/> + <FileResource projectRelativePath="EPTF_Applib_HTTP_Test_Testcases.ttcn" relativeURI="EPTF_Applib_HTTP_Test_Testcases.ttcn"/> + <FileResource projectRelativePath="EPTF_Applib_HTTP_Test_Definitions.ttcn" relativeURI="EPTF_Applib_HTTP_Test_Definitions.ttcn"/> + <FileResource projectRelativePath="EPTF_Applib_HTTP_Test_Functions.ttcn" relativeURI="EPTF_Applib_HTTP_Test_Functions.ttcn"/> + <FileResource projectRelativePath="EPTF_Applib_HTTP_Test_Templates.ttcn" relativeURI="EPTF_Applib_HTTP_Test_Templates.ttcn"/> + </Files> + <ActiveConfiguration>Default</ActiveConfiguration> + <Configurations> + <Configuration name="Default"> + <ProjectProperties> + <MakefileSettings> + <generateInternalMakefile>true</generateInternalMakefile> + <GNUMake>true</GNUMake> + <incrementalDependencyRefresh>true</incrementalDependencyRefresh> + <targetExecutable>bin/EPTF_Applib_HTTP_Test</targetExecutable> + <suppressWarnings>true</suppressWarnings> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>bin</workingDirectory> + </LocalBuildSettings> + </ProjectProperties> + </Configuration> + </Configurations> +</TITAN_Project_File_Information> diff --git a/test/EPTF_Applib_HTTP_Test_Application1_Definitions.ttcn b/test/EPTF_Applib_HTTP_Test_Application1_Definitions.ttcn new file mode 100644 index 0000000..bbe45a5 --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test_Application1_Definitions.ttcn @@ -0,0 +1,178 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_Applib_HTTP_Test_Application1_Definitions.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-01-08 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// Module: EPTF_Applib_HTTP_Test_Application1_Definitions +// +// Purpose: +// This module contains the definitions to test HTTP application. +// +// Module Parameters: +// - +// +// Module depends on: +// <EPTF_CLL_Common_Definitions> +// +// <EPTF_CLL_LGenBase_ConfigDefinitions> +// +// <EPTF_HTTP_Transport_Definitions> +// +// <EPTF_HTTP_Definitions> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-01-09 +// +// Detailed Comments: +// +// Application1 is based on HTTP transport. +// HTTP transport related components are extended here. Both +// local and remote operation mode is supported. Current +// operation mode is determined via configuration. +// +/////////////////////////////////////////////////////////////////////////////// + +module EPTF_Applib_HTTP_Test_Application1_Definitions { + +//========================================================================= +// Import Part +//========================================================================= +import from EPTF_CLL_Common_Definitions all; +import from EPTF_CLL_LGenBase_ConfigDefinitions all; +import from EPTF_HTTP_Transport_Definitions all; +import from EPTF_HTTP_Definitions all; + +//========================================================================= +// Types +//========================================================================= + +type record EPTF_HTTP_Test_Valid +{ + integer step, + integer groupId +} + +type enumerated EPTF_HTTP_Test_Status +{ + READY +} + +type port EPTF_HTTP_Test_Validation_PT message +{ + inout EPTF_HTTP_Test_Valid; + inout EPTF_HTTP_Test_Status; +}with {extension "internal"} + +// HTTP_CT to extend functionality of AppLib +// Extension functions and AppLib API can run on this CT +type component EPTF_HTTP_Test_Application1_CT + extends EPTF_HTTP_LGen_CT +{ + // extensions component variables e.g. new stats + var EPTF_CharstringList v_HTTP1_strList := {}; + + var integer v_numEntities; + var boolean v_portMode; + var boolean v_globalMode; + var integer v_numOfPorts; + var boolean v_iConnOpen; + var boolean v_iConnClose; + + var integer v_sizeofAnswers_idx := -1; + + var EPTF_BooleanArray2D v_portStates; + + var integer v_tcIdx; + + var boolean v_stateCheckEnabled := true; +} + +// HTTP Local transport CT +// Extends HTTP_CT so that extension function and AppLib API +// work on it and transport specific API can be added +type component EPTF_HTTP_Test_Application1_LocalCT extends + EPTF_HTTP_Test_Application1_CT, EPTF_HTTP_LocalTransport_CT +{ +} + +type record of EPTF_HTTP_Test_Application1_LocalCT EPTF_HTTP_Test_Application1_LocalCTList; + +type record of EPTF_BooleanList EPTF_BooleanArray2D; + +// HTTP Remote transport CT +// Extends HTTP_CT so that extension function and AppLib API +// work on it and transport specific API can be added +type component EPTF_HTTP_Test_Application1_RemoteCT extends + EPTF_HTTP_Test_Application1_CT, EPTF_HTTP_RemoteTransport_CT +{ +} + +type record of EPTF_HTTP_Test_Application1_RemoteCT EPTF_HTTP_Test_Application1_RemoteCTList; + +type record of EPTF_HTTP_Transport_ConnectionState EPTF_HTTP_Transport_ConnectionStateList; + +// HTTP Mapper CT +type component EPTF_HTTP_Test_Application1_MapperCT + extends EPTF_HTTP_Mapper_CT, EPTF_HTTP_Test_Application1_LocalCT +{ + port EPTF_HTTP_Test_Validation_PT v_validation_PCO; +} + +template EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 t_HTTP_defaultTC( + in charstring pl_name, + in charstring pl_fsmName, + in charstring pl_eType +) := +{ + name := pl_name, + fsmName := pl_fsmName, + entityType := pl_eType, + customEntitySucc := "" +} + +template EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 t_HTTP_defaultSC( + in charstring pl_name, + in EPTF_LGenBase_TcMgmt_TcOfScenario2List pl_tclist) := +{ + name := pl_name, + tcList := pl_tclist +} + + +template EPTF_LGenBase_TcMgmt_TcOfScenario2 t_HTTP_defaultTCofSC( + in charstring pl_name, + in float pl_delay, + in float pl_cps) := +{ + tcName := pl_name, + startDelay := pl_delay, + cpsToReach := pl_cps, + enableEntities := true, + enable := true, + ranges := {}, + params := {}, + //finishConditions + groupFinishConditions := c_EPTF_LGenBase_TcMgmt_emptyGroupFinishConditions2, + entityFinishConditions := c_EPTF_LGenBase_TcMgmt_emptyEntityFinishConditions, + //actionLists + entityFinishActions := {}, + tcFinishActions := {} +} + +} diff --git a/test/EPTF_Applib_HTTP_Test_Application1_Functions.ttcn b/test/EPTF_Applib_HTTP_Test_Application1_Functions.ttcn new file mode 100644 index 0000000..6fb98fc --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test_Application1_Functions.ttcn @@ -0,0 +1,1675 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_Applib_HTTP_Test_Application1_Functions.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2012-02-23 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +// Module: EPTF_Applib_HTTP_Test_Application1_Functions +// +// Purpose: +// This module contains the functions to demo HTTP application +// +// Module Parameters: +// tsp_EPTF_HTTP_Test_Application1_numberOfLoadGens - *integer* - number of load generators +// tsp_EPTF_HTTP_Test_Responder_host - *charstring* - server simulator local IP address +// tsp_EPTF_HTTP_Test_Responder_port - *integer* - server simulator local port +// tsp_EPTF_HTTP_Test_Application1_host - *charstring* - HTTP application local IP address +// tsp_EPTF_HTTP_Test_Application1_port - *integer* - HTTP application local port +// +// Module depends on: +// <EPTF_CLL_Common_Definitions> +// +// <EPTF_CLL_Base_Functions> +// +// <EPTF_CLL_LGenBase_Definitions> +// +// <EPTF_CLL_LGenBase_ConfigDefinitions> +// +// <EPTF_CLL_LGenBase_ConfigFunctions> +// +// <EPTF_CLL_LGenBase_TrafficFunctions> +// +// <EPTF_CLL_HashMapInt2Int_Functions> +// +// <EPTF_CLL_Variable_Functions> +// +// <EPTF_CLL_FBQ_Functions> +// +// <EPTF_Applib_HTTP_Test_Application1_Definitions> +// +// <EPTF_HTTP_Transport_Definitions> +// +// <EPTF_HTTP_Transport_Functions> +// +// <EPTF_HTTP_Definitions> +// +// <EPTF_HTTP_Functions> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-03-11 +// +// Detailed Comments: +// +/////////////////////////////////////////////////////////// + +module EPTF_Applib_HTTP_Test_Application1_Functions { + +//========================================================================= +// Import Part +//========================================================================= +import from EPTF_CLL_Common_Definitions all; +import from EPTF_CLL_Base_Functions all; +import from EPTF_CLL_LGenBase_Definitions all; +import from EPTF_CLL_LGenBase_ConfigDefinitions all; +import from EPTF_CLL_LGenBase_ConfigFunctions all; +import from EPTF_CLL_LGenBase_TrafficFunctions all; +import from EPTF_CLL_HashMapInt2Int_Functions all; +import from EPTF_CLL_Variable_Functions all; +import from EPTF_CLL_FBQ_Functions all; + +import from EPTF_Applib_HTTP_Test_Application1_Definitions all; + +import from EPTF_HTTP_Transport_Definitions all; +import from EPTF_HTTP_Transport_Functions all; +import from EPTF_HTTP_Definitions all; +import from EPTF_HTTP_Functions all; + +//========================================================================= +// Module parameters +//========================================================================= +modulepar integer tsp_EPTF_HTTP_Test_Application1_numberOfLoadGens := 1; +modulepar charstring tsp_EPTF_HTTP_Test_Responder_host := "159.107.193.33"; +modulepar integer tsp_EPTF_HTTP_Test_Responder_port := 4000; +modulepar charstring tsp_EPTF_HTTP_Test_Application1_host := "159.107.193.33"; +modulepar integer tsp_EPTF_HTTP_Test_Application1_port := 5000; + +//========================================================================= +// Functions +//========================================================================= +// checks state of a port in a group (pl_group, pl_port) +// pl_state - port state +// pl_connId - connection id +// pl_c2g - should be in connection id 2 group id HashMap +// pl_c2p - should be in connection id 2 port id HashMap +// pl_busyState - should be busy in portStateQueue (meaning free/busy for sending) +function f_EPTF_HTTP_Test_Application1_checkPortState( + in integer pl_group, + in integer pl_port, + in EPTF_HTTP_Transport_ConnectionState pl_state, + in integer pl_connId, + in boolean pl_c2g, + in boolean pl_c2p, + in boolean pl_busyState) +runs on EPTF_HTTP_Test_Application1_LocalCT return boolean +{ + log("Checking port state for :", pl_group, " / ", pl_port); + + var boolean vl_found; + var integer vl_result, vl_connId; + var EPTF_HTTP_Transport_ConnectionState vl_state; + + if (pl_group == -1 or pl_group >= sizeof(v_EPTF_HTTP_Transport_portDB)) { + log("Port database (GROUP) is wrong!"); + setverdict(fail); + return false; + } + + if (pl_port == -1 or pl_port >= sizeof(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase)) { + log("Port database (PORT) is wrong!"); + setverdict(fail); + return false; + } + + log(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port]); + + vl_state := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state; + if (vl_state != pl_state) + { + log("Inconsistent port state: ", vl_state, " instead of: ", pl_state); + setverdict(fail); + return false; + } + + vl_connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId; + if (pl_connId == -1 and vl_connId != pl_connId) + { + log("Inconsistent connnection id: ", vl_connId, " instead of: ", pl_connId); + setverdict(fail); + return false; + } + + if (pl_connId != -1 and vl_connId <= 0) + { + log("Inconsistent connnection id: ", vl_connId, " instead of a positive value!"); + setverdict(fail); + return false; + } + + vl_found := f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_connId2GroupId_HM, + vl_connId, vl_result); + + if (vl_found != pl_c2g) { + if (pl_c2g) { + log("Group id not found in Conn2Grp HM for connection (", + vl_connId, "), but it should be there!"); + } else { + log("Group id found in Conn2Grp HM for connection (", + vl_connId, "), but it shouldn't be there!"); + } + setverdict(fail); + return false; + } + + vl_found := f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_connId2PortId_HM, + vl_connId, vl_result); + + if (vl_found != pl_c2p) { + if (pl_c2p) { + log("Port id not found in Conn2Grp HM for connection (", + vl_connId, "), but it should be there!"); + } else { + log("Port id found in Conn2Grp HM for connection (", + vl_connId, "), but it shouldn't be there!"); + } + setverdict(fail); + return false; + } + + vl_found := f_EPTF_FBQ_itemIsBusy(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + if (pl_busyState != vl_found) { + if (vl_found) { + log("Port is busy for sending!"); + } + else { + log("Port is free for sending!"); + } + setverdict(fail); + return false; + } + + return true; +} + +function f_EPTF_HTTP_Test_Application1_checkResponses( + in integer pl_selfId, + in integer pl_succ) +runs on EPTF_HTTP_Test_Application1_CT +{ + var EPTF_CharstringList vl_strList := {}; + + log("Self ID: ", pl_selfId, " and request number: ", pl_succ); + + for (var integer i := 0; i < pl_succ; i := i + 1) { + vl_strList[i] := "<A" & int2str(v_EPTF_HTTP_selfId) & + "." & int2str(i) & ">"; + } + + if (not match(v_HTTP1_strList, vl_strList)) { + log("Responses are inconsistenct!"); + log(match(v_HTTP1_strList, vl_strList)); + setverdict(fail); + } +} + +function f_EPTF_HTTP_Test_Application1_step_recordAnswer( + in EPTF_LGenBase_TestStepArgs pl_ptr) +runs on EPTF_HTTP_Test_Application1_CT +{ + if (ischosen(v_EPTF_HTTP_incomingMessage.response)) { + log(v_EPTF_HTTP_incomingMessage); + v_HTTP1_strList[sizeof(v_HTTP1_strList)] := + v_EPTF_HTTP_incomingMessage.response.body; + log(v_HTTP1_strList); + + f_EPTF_Var_adjustContent( v_sizeofAnswers_idx, + { intVal := f_EPTF_Var_getIntValue(v_sizeofAnswers_idx) + 1 }); + f_EPTF_Var_refreshContent(v_sizeofAnswers_idx); + } + else { + f_EPTF_HTTP_error(%definitionId & ": Invalid resonse message received: " & + log2str(v_EPTF_HTTP_incomingMessage)); + } +} + +function f_EPTF_HTTP_Test_Application1_step_wrongState( + in EPTF_LGenBase_TestStepArgs pl_ptr) +runs on EPTF_HTTP_Test_Application1_CT +{ + var integer eIdx := pl_ptr.eIdx; + var integer fIdx := pl_ptr.refContext.fCtxIdx; + + select (pl_ptr.refContext.fRefArgs[0]) + { + case (0) { + f_EPTF_HTTP_error("TrafficCaseStarted event received in Wait state for entity/fsm: " & + int2str(eIdx) & " / " & int2str(fIdx)); + } + case (1) { + f_EPTF_HTTP_error("StartTC event received in Wait state for entity/fsm: " & + int2str(eIdx) & " / " & int2str(fIdx)); + } + case (2) { + f_EPTF_HTTP_error("Message received event received in Idle state for entity/fsm: " & + int2str(eIdx) & " / " & int2str(fIdx)); + } + case (3) { + f_EPTF_HTTP_error("TIMEOUT timer timed out in Idle state for entity/fsm: " & + int2str(eIdx) & " / " & int2str(fIdx)); + } + } +} + +function f_EPTF_HTTP_Test_Application1_step_rightState( + in EPTF_LGenBase_TestStepArgs pl_ptr) +runs on EPTF_HTTP_Test_Application1_CT +{ + var integer eIdx := pl_ptr.eIdx; + var integer fIdx := pl_ptr.refContext.fCtxIdx; + + select (pl_ptr.refContext.fRefArgs[0]) + { + case (0) { + f_EPTF_HTTP_debug("TrafficCaseStarted event received in Idle state for entity/fsm: " & + int2str(eIdx) & " / " & int2str(fIdx)); + } + case (1) { + f_EPTF_HTTP_debug("StartTC event received in Idle state for entity/fsm: " & + int2str(eIdx) & " / " & int2str(fIdx)); + } + case (2) { + f_EPTF_HTTP_debug("Message received event received in Wait state for entity/fsm: " & + int2str(eIdx) & " / " & int2str(fIdx)); + } + case (3) { + f_EPTF_HTTP_debug("TIMEOUT timer timed out in Wait state for entity/fsm: " & + int2str(eIdx) & " / " & int2str(fIdx)); + } + } +} + +function f_EPTF_HTTP_Test_Application1_step_enableStateCheck( + in EPTF_LGenBase_TestStepArgs pl_ptr) +runs on EPTF_HTTP_Test_Application1_CT +{ + v_stateCheckEnabled := true; +} + +function f_EPTF_HTTP_Test_Application1_step_disableStateCheck( + in EPTF_LGenBase_TestStepArgs pl_ptr) +runs on EPTF_HTTP_Test_Application1_CT +{ + v_stateCheckEnabled := false; +} + +function f_EPTF_HTTP_Test_Application1_step_checkPortState( + in EPTF_LGenBase_TestStepArgs pl_ptr) +runs on EPTF_HTTP_Test_Application1_LocalCT +{ + if (not v_stateCheckEnabled) { + f_EPTF_HTTP_warning(%definitionId & ": State check disabled!"); + return; + }; + + var integer vl_grpIdx; + + select (pl_ptr.refContext.fRefArgs[0]) + { + case (0) + { + if (v_globalMode) { vl_grpIdx := 0; } else { vl_grpIdx := pl_ptr.eIdx; }; + + if (v_portMode) + { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(vl_grpIdx, 0, OPENED, vl_grpIdx+1, true, true, false)) { f_EPTF_Base_stopAll(); } + } + else { + var integer vl_connId; + for (var integer i := 0; i < v_numOfPorts; i := i + 1) + { + vl_connId := (vl_grpIdx * v_numOfPorts) + i + 1; + if (not f_EPTF_HTTP_Test_Application1_checkPortState(vl_grpIdx, i, OPENED, vl_connId, true, true, false)) { f_EPTF_Base_stopAll(); } + } + } + } + case (1) + { + //log(v_EPTF_HTTP_ConnId2EIdx); + //log(v_EPTF_HTTP_ConnId2FIdx); + + if (v_globalMode) { vl_grpIdx := 0; } else { vl_grpIdx := pl_ptr.eIdx; }; + + if (v_portMode) + { + v_portStates[vl_grpIdx][0] := true; + + if (not f_EPTF_HTTP_Test_Application1_checkPortState(vl_grpIdx, 0, OPENED, vl_grpIdx+1, true, true, true)) { f_EPTF_Base_stopAll(); } + } + else { + var integer vl_port; + f_EPTF_FBQ_getBusyTailIdx(vl_port,v_EPTF_HTTP_Transport_portDB[vl_grpIdx].portStateQueue); // must be called after send message + log("Busy tail: ", vl_port); + + v_portStates[vl_grpIdx][vl_port] := true; + + var integer vl_connId; + for (var integer i := 0; i < v_numOfPorts; i := i + 1) + { + vl_connId := (vl_grpIdx * v_numOfPorts) + i + 1; + + + if (v_portStates[vl_grpIdx][i]) { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(vl_grpIdx, i, OPENED, vl_connId, true, true, v_portStates[vl_grpIdx][i])) + { + f_EPTF_Base_stopAll(); + } + } + else { + if (v_iConnClose) { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(vl_grpIdx, i, IDLE, -1, false, false, v_portStates[vl_grpIdx][i])) + { + f_EPTF_Base_stopAll(); + } + } + } + + } + } + } + case (2) + { + if (v_globalMode) { vl_grpIdx := 0; } else { vl_grpIdx := pl_ptr.eIdx; }; + + if (v_portMode) + { + v_portStates[vl_grpIdx][0] := false; + + if (v_iConnClose) { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(vl_grpIdx, 0, IDLE, -1, false, false, false)) { f_EPTF_Base_stopAll(); } + } + else { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(vl_grpIdx, 0, OPENED, vl_grpIdx+1, true, true, false)) { f_EPTF_Base_stopAll(); } + } + } + else + { + var integer vl_connId, vl_port; + f_EPTF_FBQ_getFreeTailIdx(vl_port,v_EPTF_HTTP_Transport_portDB[vl_grpIdx].portStateQueue); + log("Free tail: ", vl_port); + + v_portStates[vl_grpIdx][vl_port] := false; + + for (var integer i := 0; i < v_numOfPorts; i := i + 1) + { + if (v_iConnClose) + { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(vl_grpIdx, i, IDLE, -1, false, false, v_portStates[vl_grpIdx][i])) { f_EPTF_Base_stopAll(); } + } + else + { + vl_connId := (vl_grpIdx * v_numOfPorts) + i + 1; + if (not f_EPTF_HTTP_Test_Application1_checkPortState(vl_grpIdx, i, OPENED, vl_connId, true, true, v_portStates[vl_grpIdx][i])) { f_EPTF_Base_stopAll(); } + } + } + } + } + case (3) + { + f_EPTF_HTTP_debug("Do nothing!"); + } + } +} + +function f_EPTF_HTTP_Test_Application1_createPort( + in integer pl_idx, + in boolean pl_iCO, + in boolean pl_iCC) +runs on EPTF_HTTP_Test_Application1_LocalCT return EPTF_HTTP_Transport_PortMode +{ + var EPTF_HTTP_Transport_PortMode vl_connObj := + { + name := "MyPort." & int2str(pl_idx), + localHostInformation := {tsp_EPTF_HTTP_Test_Application1_host, tsp_EPTF_HTTP_Test_Application1_port + pl_idx + 100 * v_tcIdx}, + remoteHostInformation := {tsp_EPTF_HTTP_Test_Responder_host, tsp_EPTF_HTTP_Test_Responder_port + v_tcIdx}, + instantConnOpen := pl_iCO, + instantConnClose := pl_iCC, + useSSL := false, + userFunctions := omit + }; + + return vl_connObj; +} + +function f_EPTF_HTTP_Test_Application1_createGroup( + in integer pl_idx, + in integer pl_nOPs, + in boolean pl_iCO, + in boolean pl_iCC) +runs on EPTF_HTTP_Test_Application1_LocalCT return EPTF_HTTP_Transport_GroupMode +{ + var EPTF_HTTP_Transport_GroupMode vl_connObj := { + name := "MyGroup." & int2str(pl_idx), + + localHostInformation := {tsp_EPTF_HTTP_Test_Application1_host, tsp_EPTF_HTTP_Test_Application1_port + pl_nOPs * pl_idx + 100 * v_tcIdx}, + remoteHostInformation := {tsp_EPTF_HTTP_Test_Responder_host, tsp_EPTF_HTTP_Test_Responder_port + v_tcIdx}, + + numberOfPorts := pl_nOPs, + localportStep := 1, + remoteportStep := 0, + + instantConnOpen := pl_iCO, + instantConnClose := pl_iCC, + useSSL := false, + userFunctions := omit + } + + return vl_connObj; +} + +function f_EPTF_HTTP_Test_Application1_createScenarios( + in integer pl_selfid, + in integer pl_numEntities, + out integer pl_egIdx, + out integer pl_scIdx, + out integer pl_tcIdx, + in boolean pl_globalMode, + in boolean pl_remote) +runs on EPTF_HTTP_Test_Application1_CT +{ + f_EPTF_HTTP_debug("### " & %definitionId & "()"); + + var integer vl_noIntWarning; + var EPTF_IntegerList v_noIntListWarning; + var charstring vl_prefix := "HTTP1_"; + var charstring vl_name := vl_prefix & "APPL." & int2str(pl_selfid); + var charstring vl_tcname := vl_prefix & "SendReceive"; + var float vl_startDelay := int2float(pl_selfid); + log("Start delay: ", vl_startDelay); + + f_EPTF_HTTP_debug("Configuring traffic properties ..."); + + // Creating trafic manually (no execution control) + vl_noIntWarning := f_EPTF_LGenBase_declareEntityType( + vl_name & "ET", { c_EPTF_HTTP_myBName }); + vl_noIntWarning := f_EPTF_LGenBase_createEntityGroup( + {vl_name & "EG", vl_name & "ET", pl_numEntities}); + + vl_noIntWarning := f_EPTF_LGenBase_declareTcType2(valueof( + t_HTTP_defaultTC(vl_tcname & "TC", vl_tcname & "FSM", vl_name & "ET"))); + vl_noIntWarning := f_EPTF_LGenBase_declareScenarioType2(valueof( + t_HTTP_defaultSC(vl_tcname & "SC", { valueof(t_HTTP_defaultTCofSC(vl_tcname & "TC", vl_startDelay, 1.0)) } ))); + f_EPTF_LGenBase_createScenario2EntityGroup({vl_name & "EG", vl_tcname & "SC"}); + + var integer vl_groupIdx:=f_EPTF_LGenBase_entityGrpNameIndex(vl_name & "EG"); + var integer vl_groupBaseOffsetIdx:= f_EPTF_LGenBase_getEGrpBaseOffset(vl_groupIdx); + + var charstring vl_body := ""; + if (pl_globalMode) + { + for (var integer i := vl_groupBaseOffsetIdx; i < vl_groupBaseOffsetIdx + pl_numEntities; i := i + 1) + { + vl_body := "<A" & int2str(v_EPTF_HTTP_selfId) & "." & int2str(i) & ">"; + + f_EPTF_HTTP_setEntityContext (i, + "POST", + "http://responder.com", + 1, + 1, + f_EPTF_HTTP_createContextLengthHeaderLine(vl_body), + 0, + -, + { charVal := vl_body }); + } + }else{ + if (pl_remote) + { + for (var integer i := vl_groupBaseOffsetIdx; i < vl_groupBaseOffsetIdx + pl_numEntities; i := i + 1) + { + vl_body := "<A" & int2str(v_EPTF_HTTP_selfId) & "." & int2str(i) & ">"; + + f_EPTF_HTTP_setEntityContext (i, + "POST", + "http://responder.com", + 1, + 1, + f_EPTF_HTTP_createContextLengthHeaderLine(vl_body), + 5*v_EPTF_HTTP_selfId + i, + -, + { charVal := vl_body }); + } + } + for (var integer i := vl_groupBaseOffsetIdx; i < vl_groupBaseOffsetIdx + pl_numEntities; i := i + 1) + { + vl_body := "<A" & int2str(v_EPTF_HTTP_selfId) & "." & int2str(i) & ">"; + + f_EPTF_HTTP_setEntityContext (i, + "POST", + "http://responder.com", + 1, + 1, + f_EPTF_HTTP_createContextLengthHeaderLine(vl_body), + i, + -, + { charVal := vl_body }); + } + } + + pl_egIdx := f_EPTF_LGenBase_entityGrpNameIndex(vl_name & "EG"); + pl_scIdx := f_EPTF_LGenBase_scenarioNameIndex(vl_tcname & "SC"); + pl_tcIdx := f_EPTF_LGenBase_trafficCaseId(vl_name & "EG", vl_tcname & "SC", vl_tcname & "TC"); +} + +function f_EPTF_HTTP_Test_Application1_HTTP1_createConnectionObjects() +runs on EPTF_HTTP_Test_Application1_LocalCT +{ + var integer vl_connObjIdx, i, j; + + f_EPTF_HTTP_Transport_debug(%definitionId & ": Starting ..."); + + if (v_portMode) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Port mode"); + + if (v_globalMode) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": One port for all entities"); + + vl_connObjIdx := f_EPTF_HTTP_LocalTransport_newPort(f_EPTF_HTTP_Test_Application1_createPort(0, v_iConnOpen, v_iConnClose)); + + if (v_iConnOpen) { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(0, 0, IDLE, -1, false, false, false)) { f_EPTF_Base_stopAll(); } + v_portStates[0][0] := false; + } + else { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(0, 0, OPENED, 1, true, true, false)) { f_EPTF_Base_stopAll(); } + v_portStates[0][0] := false; + }; + } + else + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Different ports for entities"); + + for (i := 0; i < v_numEntities; i := i + 1) + { + vl_connObjIdx := f_EPTF_HTTP_LocalTransport_newPort(f_EPTF_HTTP_Test_Application1_createPort(i, v_iConnOpen, v_iConnClose)); + + if (v_iConnOpen) { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(i, 0, IDLE, -1, false, false, false)) { f_EPTF_Base_stopAll(); } + v_portStates[i][0] := false; + } + else { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(i, 0, OPENED, i+1, true, true, false)) { f_EPTF_Base_stopAll(); } + v_portStates[i][0] := false; + }; + } + } + } + else + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Group mode"); + + if (v_globalMode) + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": One port for all entities"); + + vl_connObjIdx := f_EPTF_HTTP_LocalTransport_newPortGroup(f_EPTF_HTTP_Test_Application1_createGroup(0, v_numOfPorts, v_iConnOpen, v_iConnClose)); + + if (v_iConnOpen) { + for (i := 0; i < v_numOfPorts; i := i + 1) { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(0, i, IDLE, -1, false, false, false)) { f_EPTF_Base_stopAll(); } + v_portStates[0][i] := false; + } + } + else { + for (i := 0; i < v_numOfPorts; i := i + 1) { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(0, i, OPENED, i+1, true, true, false)) { f_EPTF_Base_stopAll(); } + v_portStates[0][i] := false; + } + }; + } + else + { + f_EPTF_HTTP_Transport_debug(%definitionId & ": Different ports for entities"); + + for (i := 0; i < v_numEntities; i := i + 1) { + vl_connObjIdx := f_EPTF_HTTP_LocalTransport_newPortGroup(f_EPTF_HTTP_Test_Application1_createGroup(i, v_numOfPorts, v_iConnOpen, v_iConnClose)); + + if (v_iConnOpen) { + for (j := 0; j < v_numOfPorts; j := j + 1) { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(i, j, IDLE, -1, false, false, false)) { f_EPTF_Base_stopAll(); } + v_portStates[i][j] := false; + } + } + else { + for (j := 0; j < v_numOfPorts; j := j + 1) { + if (not f_EPTF_HTTP_Test_Application1_checkPortState(i, j, OPENED, (i*v_numOfPorts)+j+1, true, true, false)) { f_EPTF_Base_stopAll(); } + v_portStates[i][j] := false; + } + }; + } + } + } +} + +function f_EPTF_HTTP_Test_Application1_LocalBehavior( + in integer pl_tcIdx, + in integer pl_selfid, + in integer pl_numEntities, + in boolean pl_portMode, + in boolean pl_globalMode, + in integer pl_numOfPorts, + in boolean pl_iConnOpen, + in boolean pl_iConnClose, + in float pl_runningTime, + in float pl_responderRunningTime) +runs on EPTF_HTTP_Test_Application1_LocalCT +{ + f_EPTF_HTTP_debug("### " & %definitionId & "()"); + + var integer vl_noIntWarning, vl_egIdx, vl_scIdx, vl_TCIdx; + var EPTF_IntegerList vl_noIntListWarning; + var charstring vl_prefix := "HTTP1_"; + var charstring vl_name := vl_prefix & "APPL." & int2str(pl_selfid); + var charstring vl_tcname := vl_prefix & "SendReceive"; + + v_tcIdx := pl_tcIdx; + + v_numEntities := pl_numEntities; + v_portMode := pl_portMode; + v_globalMode := pl_globalMode; + v_numOfPorts := pl_numOfPorts; + v_iConnOpen := pl_iConnOpen; + v_iConnClose := pl_iConnClose; + + // Initialize applib + f_EPTF_HTTP_init(vl_name, pl_selfid, vl_prefix); + + // Application steps + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("RecordAnswer", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_recordAnswer)}); + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("WrongState", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_wrongState)}); + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("RightState", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_rightState)}); + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("CheckState", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_checkPortState)}); + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("DisableState", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_disableStateCheck)}); + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("EnableState", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_enableStateCheck)}); + + // Initialize transport + vl_noIntWarning := f_EPTF_HTTP_LocalTransport_init_CT(vl_name, + refers(f_EPTF_HTTP_messageReceived), + refers(f_EPTF_HTTP_eventReceived), + refers(f_EPTF_HTTP_socketErrorReceived)); + + f_EPTF_HTTP_setSendRequestFunction(refers(f_EPTF_HTTP_LocalTransport_sendMessage)); + f_EPTF_HTTP_setConnectionCloseFunction(refers(f_EPTF_HTTP_LocalTransport_connectionClose)); + f_EPTF_HTTP_setConnectionOpenFunction(refers(f_EPTF_HTTP_LocalTransport_connectionOpen)); + f_EPTF_HTTP_setConnectionHalfCloseFunction(refers(f_EPTF_HTTP_LocalTransport_connectionHalfClose)); + f_EPTF_HTTP_setClosePortOfUserFunction(refers(f_EPTF_HTTP_LocalTransport_closePortOfUser)); + f_EPTF_HTTP_setFreePortOfUserFunction(refers(f_EPTF_HTTP_LocalTransport_freePortOfUser)); + + f_EPTF_Var_newInt("NumberOfReceivedAnswers", 0, v_sizeofAnswers_idx); + + if (pl_tcIdx == 16) { // TC 16 is the index of the reconnect test traffic case (no state check performed) + vl_noIntListWarning := f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables( + f_EPTF_HTTP_Test_Application1_HTTP1_CreateBasicFSM_Local_RECONNECTTEST(vl_tcname & "FSM")); + } else { + vl_noIntListWarning := f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables( + f_EPTF_HTTP_Test_Application1_HTTP1_CreateBasicFSM_Local(vl_tcname & "FSM")); + } + + + f_EPTF_HTTP_Test_Application1_createScenarios(pl_selfid, pl_numEntities, vl_egIdx, vl_scIdx, vl_TCIdx, pl_globalMode, false); + + f_EPTF_HTTP_debug("numEntities: "&log2str(pl_numEntities)&"eGrpIdx: "&log2str(vl_egIdx)&" scIdx: "&log2str(vl_scIdx)); + + f_EPTF_HTTP_debug("getEGrpBaseOffset: "&log2str(f_EPTF_LGenBase_getEGrpBaseOffset(vl_egIdx))); + + f_EPTF_HTTP_Test_Application1_HTTP1_createConnectionObjects(); + + f_EPTF_LGenBase_enableScenarioOnEntityGroup(vl_egIdx, vl_scIdx, true); + + f_EPTF_HTTP_debug("Entering main altstep ..."); + + timer t_guard := pl_runningTime; + t_guard.start; + + alt { + [] t_guard.timeout { f_EPTF_HTTP_debug("Timer timed out!"); } + } + + f_EPTF_LGenBase_stopScenarioByIdx(vl_egIdx, vl_scIdx); + + f_EPTF_HTTP_debug("Responses: " & log2str(v_HTTP1_strList)); + + if (pl_tcIdx != 16) { // TC 16 is the index of the reconnect test traffic case (no state check performed) + var integer vl_nofStarts := f_EPTF_LGenBase_getTcStarts(vl_TCIdx); + var integer vl_nofSucc := f_EPTF_LGenBase_getTcSuccesses(vl_TCIdx); + var integer vl_nofFails := f_EPTF_LGenBase_getTcFails(vl_TCIdx); + + f_EPTF_HTTP_debug("Number of starts: " & int2str(vl_nofStarts)); + f_EPTF_HTTP_debug("Number of successful: " & int2str(vl_nofSucc)); + f_EPTF_HTTP_debug("Number of fails: " & int2str(vl_nofFails)); + + if (vl_nofStarts != vl_nofSucc + vl_nofFails) + { + //wait for pending + timer t_wait := 2.0; + t_wait.start; + t_wait.timeout; + } + + f_EPTF_HTTP_Test_Application1_checkResponses(pl_selfid, vl_nofSucc); + } + + f_EPTF_HTTP_debug("Quitting load generator ..."); + + setverdict(pass); + + f_EPTF_Base_cleanup_CT(); +} + +function f_EPTF_HTTP_Test_Application1_RemoteBehavior( + in integer pl_selfid, + in integer pl_numEntities, + in boolean pl_globalMode, + in float pl_runningTime, + in float pl_responderRunningTime) +runs on EPTF_HTTP_Test_Application1_RemoteCT +{ + f_EPTF_HTTP_debug("### " & %definitionId & "()"); + + var integer vl_noIntWarning, vl_egIdx, vl_scIdx, vl_tcIdx; + var charstring vl_prefix := "HTTP1_"; + var charstring vl_name := vl_prefix & "APPL." & int2str(pl_selfid); + var charstring vl_tcname := vl_prefix & "SendReceive"; + + log("Applib init ..."); + + // Initialize applib + f_EPTF_HTTP_init(vl_name, pl_selfid, vl_prefix); + + log("Steps ..."); + + // Application steps + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("RecordAnswer", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_recordAnswer)}); + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("WrongState", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_wrongState)}); + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("RightState", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_rightState)}); + //f_EPTF_LGenBase_declareFunction("CheckState", + // {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_checkPortState)}); + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("DisableState", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_disableStateCheck)}); + vl_noIntWarning := f_EPTF_LGenBase_declareFunction("EnableState", + {testStepFunction := refers(f_EPTF_HTTP_Test_Application1_step_enableStateCheck)}); + + log("Remote init ..."); + + // Initialize transport + vl_noIntWarning := f_EPTF_HTTP_RemoteTransport_init_CT(vl_name, + refers(f_EPTF_HTTP_messageReceived), + refers(f_EPTF_HTTP_eventReceived), + refers(f_EPTF_HTTP_socketErrorReceived)); + + log("Reset funcs ..."); + + f_EPTF_HTTP_setSendRequestFunction(refers(f_EPTF_HTTP_RemoteTransport_sendMessage)); + f_EPTF_HTTP_setConnectionCloseFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionClose)); + f_EPTF_HTTP_setConnectionOpenFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionOpen)); + f_EPTF_HTTP_setConnectionHalfCloseFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionHalfClose)); + f_EPTF_HTTP_setClosePortOfUserFunction(refers(f_EPTF_HTTP_RemoteTransport_closePortOfUser)); + f_EPTF_HTTP_setFreePortOfUserFunction(refers(f_EPTF_HTTP_RemoteTransport_freePortOfUser)); + + f_EPTF_Var_newInt("NumberOfReceivedAnswers", 0, v_sizeofAnswers_idx); + + //f_EPTF_HTTP_Test_Application1_HTTP1_createConnectionObjects(); + + log("FSM ..."); + + var EPTF_IntegerList vl_noIntListWarning := f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables( + f_EPTF_HTTP_Test_Application1_HTTP1_CreateBasicFSM_Remote(vl_tcname & "FSM")); + + log("Scaneraios ..."); + + f_EPTF_HTTP_Test_Application1_createScenarios(pl_selfid, pl_numEntities, vl_egIdx, vl_scIdx, vl_tcIdx, pl_globalMode, true); + + log("Enable scenarios ..."); + + f_EPTF_LGenBase_enableScenarioOnEntityGroup(vl_egIdx, vl_scIdx, true); + + f_EPTF_HTTP_debug("Entity context database: " & log2str(v_EPTF_HTTP_contexts)); + + f_EPTF_HTTP_debug("Entering main altstep ..."); + + timer t_guard := pl_runningTime; + t_guard.start; + + alt { + [] t_guard.timeout { f_EPTF_HTTP_debug("Timer timed out!"); } + } + + f_EPTF_LGenBase_stopScenarioByIdx(vl_egIdx, vl_scIdx); + + //f_EPTF_HTTP_RemoteTransport_cleanup_CT(); + + f_EPTF_HTTP_debug("Responses: " & log2str(v_HTTP1_strList)); + + var integer vl_nofStarts := f_EPTF_LGenBase_getTcStarts(vl_tcIdx); + var integer vl_nofSucc := f_EPTF_LGenBase_getTcSuccesses(vl_tcIdx); + var integer vl_nofFails := f_EPTF_LGenBase_getTcFails(vl_tcIdx); + + f_EPTF_HTTP_debug("Number of starts: " & int2str(vl_nofStarts)); + f_EPTF_HTTP_debug("Number of successful: " & int2str(vl_nofSucc)); + f_EPTF_HTTP_debug("Number of fails: " & int2str(vl_nofFails)); + + f_EPTF_HTTP_Test_Application1_checkResponses(pl_selfid, vl_nofSucc); + + f_EPTF_HTTP_debug("Quitting load generator ..."); + + f_EPTF_Base_cleanup_CT(); + + setverdict(pass); +} + +function f_EPTF_HTTP_Test_Application1_Mapper_Behavior( + in EPTF_HTTP_Test_Application1_RemoteCTList pl_comps, + in integer pl_tcIdx, + in integer pl_numEntities, + in boolean pl_portMode, + in boolean pl_globalMode, + in integer pl_numOfPorts, + in boolean pl_iConnOpen, + in boolean pl_iConnClose, + in float pl_runningTime) +runs on EPTF_HTTP_Test_Application1_MapperCT +{ + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + v_tcIdx := pl_tcIdx; + + v_numEntities := 2*pl_numEntities; // wired in for two lgens only + v_portMode := pl_portMode; + v_globalMode := pl_globalMode; + v_numOfPorts := pl_numOfPorts; + v_iConnOpen := pl_iConnOpen; + v_iConnClose := pl_iConnClose; + + var integer i, j, vl_initResult := + f_EPTF_HTTP_Mapper_init_CT("HTTP1_MAPPER"); + + var EPTF_HTTP_Mapper_RoutingList vl_rInfo; + + f_EPTF_HTTP_Test_Application1_HTTP1_createConnectionObjects(); + + // set routing + if (pl_globalMode) + { + var EPTF_IntegerList vl_comps := {}; + for (i := 0; i < sizeof(pl_comps); i := i + 1) { + vl_comps[i] := f_EPTF_Base_upcast(pl_comps[i]); + } + + vl_rInfo := {{0, vl_comps}}; + f_EPTF_HTTP_Transport_debug("Routing info: " & log2str(vl_rInfo)); + } + else { + + var integer vl_size := sizeof(v_EPTF_HTTP_Transport_portDB); // better with FBQ but ok for test + var integer vl_psize := float2int(int2float(vl_size) / int2float(sizeof(pl_comps))); + + log(vl_size); + log(vl_psize); + + if (vl_size == 0) { vl_size := 1; }; + + for (j:= 0; j < sizeof(pl_comps); j := j + 1) + { + for (i := j*vl_psize; i < (j+1)*vl_psize; i := i + 1) + { + vl_rInfo[i].groupId := i; + vl_rInfo[i].compIdList := { f_EPTF_Base_upcast(pl_comps[j]) }; + } + } + f_EPTF_HTTP_Transport_debug("Routing info: " & log2str(vl_rInfo)); + } + + f_EPTF_HTTP_Mapper_setRouting(vl_rInfo); + + f_EPTF_HTTP_Transport_debug("Entering main altstep ..."); + + timer t_guard := pl_runningTime; + t_guard.start; + + alt { + [] t_guard.timeout { f_EPTF_HTTP_Transport_debug("Timer timed out!"); } + } + + setverdict(pass); + + f_EPTF_HTTP_Transport_debug("Quitting mapper ..."); + + //f_EPTF_Base_stopRemote(mtc); + f_EPTF_Base_cleanup_CT(); +} + +template EPTF_HTTP_Transport_PortGroup t_expectedPortGroup1 := { + name := "MyGroup", + + baseLocalHostInformation := { "127.0.0.1", 4000 }, + baseRemoteHostInformation := { "127.0.0.1", 5000 }, + + currentPortId := ?, + + numberOfPorts := 2, + localportStep := 1, + remoteportStep := 0, + + portDatabase := { + { + groupIndex := 0, + portIndex := 0, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 1, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 1, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } + }, + + listeningPortIdx := -1, + + defaultFIdx := 0, + + portQueue := ?, + portStateQueue := ?, + + useSSL := false, + instantConnOpen := true, + instantConnClose := true, + buffer := false +}; + +template EPTF_HTTP_Transport_PortGroup t_expectedPortGroup4 modifies t_expectedPortGroup1 := { + name := "MyPort", + + numberOfPorts := 1, + localportStep := 0, + remoteportStep := 0, + + portDatabase := { + { + groupIndex := 1, + portIndex := 0, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } + }, + + defaultFIdx := 2 +} + +template EPTF_HTTP_Transport_PortGroup t_expectedPortGroup5 modifies t_expectedPortGroup1 := { + name := "MyPort2", + + numberOfPorts := 1, + localportStep := 0, + remoteportStep := 0, + + portDatabase := { + { + groupIndex := 2, + portIndex := 0, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } + }, + + defaultFIdx := 2 +} + +template EPTF_HTTP_Transport_PortGroup t_expectedPortGroup2 modifies t_expectedPortGroup1 := { + numberOfPorts := 3, + portDatabase := { + { + groupIndex := 0, + portIndex := 0, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 1, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 1, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 2, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 2, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } + } +}; + +template EPTF_HTTP_Transport_PortGroup t_expectedPortGroup3 modifies t_expectedPortGroup1 := { + portDatabase := { + { + groupIndex := -1, + portIndex := -1, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := -1, + remotehostInfoIdx := -1, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 1, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 1, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 2, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 2, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } + } +}; + +template EPTF_HTTP_Transport_PortGroupList t_expectedPortDB1( + template EPTF_HTTP_Transport_PortGroupList pl_groups) := pl_groups; + + +function f_EPTF_HTTP_Test_Application1_Mapper_Behavior_CheckRandomAPI( + in float pl_runningTime) +runs on EPTF_HTTP_Test_Application1_MapperCT +{ + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var boolean vl_pass := true; + var integer i, j, vl_initResult := + f_EPTF_HTTP_Mapper_init_CT("HTTP1_MAPPER"); + + f_EPTF_HTTP_Transport_debug("Entering main altstep ..."); + + timer t_guard := pl_runningTime; + t_guard.start; + + alt { + [] t_guard.timeout { f_EPTF_HTTP_Transport_debug("Timer timed out!"); } + } + + f_EPTF_HTTP_Mapper_cleanup_CT(); + + f_EPTF_HTTP_Transport_debug("Quitting mapper ..."); + + if (vl_pass) { setverdict(pass); }; +} + +function f_EPTF_HTTP_Test_Application1_Mapper_Behavior_CheckAPI( + in float pl_runningTime) +runs on EPTF_HTTP_Test_Application1_MapperCT +{ + f_EPTF_HTTP_Transport_debug("### " & %definitionId & "()"); + + var boolean vl_pass := true; + var integer i, j, vl_initResult := + f_EPTF_HTTP_Mapper_init_CT("HTTP1_MAPPER"); + + var EPTF_HTTP_Test_Valid vl_validation; + timer t_guard := pl_runningTime; + t_guard.start; + + alt { + [] v_validation_PCO.receive(EPTF_HTTP_Test_Valid:?) -> value vl_validation + { + select (vl_validation.step) { + case (0) + { + log(v_EPTF_HTTP_Transport_portDB); + + if (not match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1({ t_expectedPortGroup1 }))) { + log("Database inconsistency after addition to v_EPTF_HTTP_Transport_portDB!"); + log(match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1({ t_expectedPortGroup1 }))); + vl_pass := false; + setverdict(fail); + } + + v_validation_PCO.send(EPTF_HTTP_Test_Status:READY); + } + case (1) + { + log(v_EPTF_HTTP_Transport_portDB); + + if (not match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1({ t_expectedPortGroup2 }))) { + log("Database inconsistency after addition to v_EPTF_HTTP_Transport_portDB!"); + log(match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1({ t_expectedPortGroup2 }))); + vl_pass := false; + setverdict(fail); + } + } + case (2) + { + log(v_EPTF_HTTP_Transport_portDB); + + if (not match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1({ t_expectedPortGroup3 }))) { + log("Database inconsistency after delete to v_EPTF_HTTP_Transport_portDB!"); + log(match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1({ t_expectedPortGroup3 }))); + vl_pass := false; + setverdict(fail); + } + } + case (3) + { + log(v_EPTF_HTTP_Transport_portDB); + + if (not match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1({ t_expectedPortGroup3, t_expectedPortGroup4, t_expectedPortGroup5 }))) { + log("Database inconsistency after addition to v_EPTF_HTTP_Transport_portDB!"); + log(match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1({ t_expectedPortGroup3, t_expectedPortGroup4, t_expectedPortGroup5 }))); + vl_pass := false; + setverdict(fail); + } + } + } + + v_validation_PCO.send(EPTF_HTTP_Test_Status:READY) + repeat; + } + [] v_validation_PCO.receive{repeat;} + [] t_guard.timeout { f_EPTF_HTTP_Transport_debug("Timer timed out!"); } + } + + f_EPTF_HTTP_Mapper_cleanup_CT(); + + f_EPTF_HTTP_Transport_debug("Quitting mapper ..."); + + if (vl_pass) { setverdict(pass); }; +} + +function f_EPTF_HTTP_Test_Application1_HTTP1_CreateBasicFSM_Local( + in charstring pl_name) +runs on EPTF_HTTP_Test_Application1_LocalCT +return EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList +{ + return { + { name := pl_name, + stateList := { "idle", "wait" }, + timerList := { { name := "TIMEOUT", startValue := 1.0 } }, + table := { +/* + // TC tarted event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_trafficCaseStarted, fsm }, + cellRow := { + // state == idle + { { + { "RightState", { stepContextArgs := { 0 } } }, + { c_EPTf_EPTF_HTTP_Test_Application1_stepName_openConnection, { stepContextArgs := {} } }, + { "CheckState", { stepContextArgs := { 0 } } } + }, omit, omit }, + // state == wait + { { + { "WrongState", { stepContextArgs := { 0 } } } + }, omit, "idle" } + } + }, + */ + // start TC event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_startTC, fsm }, + cellRow := { + // state == idle + { { + { "RightState", { stepContextArgs := { 1 } } }, + { c_EPTF_HTTP_stepName_sendRequest, { stepContextArgs := {} } }, + { "CheckState", { stepContextArgs := { 1 } } } + }, omit, "wait" }, + // state == wait + { { + { "WrongState", { stepContextArgs := { 1 } } } + }, omit, "idle" } + } + }, + + // answer OK event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_responseCharReceived, fsm }, + cellRow := { + // state == idle + { { + { "WrongState", { stepContextArgs := { 2 } } } + }, omit, omit }, + // state == wait + { { + { "RightState", { stepContextArgs := { 2 } } }, + { "RecordAnswer", { stepContextArgs := {} } }, + { "CheckState", { stepContextArgs := { 2 } } }, + { c_EPTF_LGenBase_StepFunction_trafficSuccess, { stepContextArgs := {} } } + }, omit, "idle" } + } + }, + + // timeout event + { + eventToListen := { c_EPTF_LGenBase_specialBName_timerTimeout, "TIMEOUT", fsm }, + cellRow := { + // state == idle + { { + { "WrongState", { stepContextArgs := { 3 } } } + }, omit, "idle" }, + // state == wait + { { + { "RightState", { stepContextArgs := { 3 } } }, + { c_EPTF_HTTP_stepName_handleTimeout, { stepContextArgs := {} } }, + { c_EPTF_HTTP_stepName_cleanUpContext, { stepContextArgs := {} } }, + { c_EPTF_LGenBase_StepFunction_trafficFailed, { stepContextArgs := {} } } + }, omit, "idle" } + } + }, + + // connection closed event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_connectionClosed, fsm }, + cellRow := { + // state == idle + { { + { "DisableState", { stepContextArgs := { } } } + }, omit, omit }, + // state == wait + { { + { "DisableState", { stepContextArgs := { } } } + }, omit, omit } + } + }, + + // connection opened event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_connectionOpened, fsm }, + cellRow := { + // state == idle + { { + { "EnableState", { stepContextArgs := { } } } + }, omit, omit }, + // state == wait + { { + { "EnableState", { stepContextArgs := { } } } + }, omit, omit } + } + }, + + // stop TC event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_stopTC, fsm }, + cellRow := { + // state == idle + { { + { c_EPTF_HTTP_stepName_cleanUpContext, { stepContextArgs := {} } } , + { c_EPTF_LGenBase_StepFunction_entityStopped, { stepContextArgs := { } } } + }, omit, "idle" }, + // state == wait + { { + { c_EPTF_HTTP_stepName_cleanUpContext, { stepContextArgs := {} } } , + { c_EPTF_LGenBase_StepFunction_entityStopped, { stepContextArgs := { } } } + }, omit, "idle" } + } + } + } + } + } +} + +function f_EPTF_HTTP_Test_Application1_HTTP1_CreateBasicFSM_Local_RECONNECTTEST( + in charstring pl_name) +runs on EPTF_HTTP_Test_Application1_LocalCT +return EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList +{ + return { + { name := pl_name, + stateList := { "idle", "wait" }, + timerList := { { name := "TIMEOUT", startValue := 1.0 } }, + table := { +/* + // TC tarted event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_trafficCaseStarted, fsm }, + cellRow := { + // state == idle + { { + { "RightState", { stepContextArgs := { 0 } } }, + { c_EPTf_EPTF_HTTP_Test_Application1_stepName_openConnection, { stepContextArgs := {} } }, + { "CheckState", { stepContextArgs := { 0 } } } + }, omit, omit }, + // state == wait + { { + { "WrongState", { stepContextArgs := { 0 } } } + }, omit, "idle" } + } + }, + */ + // start TC event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_startTC, fsm }, + cellRow := { + // state == idle + { { + { "RightState", { stepContextArgs := { 1 } } }, + { c_EPTF_HTTP_stepName_sendRequest, { stepContextArgs := {} } }//, + //{ "CheckState", { stepContextArgs := { 1 } } } + }, omit, "wait" }, + // state == wait + { { + { "WrongState", { stepContextArgs := { 1 } } } + }, omit, "idle" } + } + }, + + // answer OK event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_responseCharReceived, fsm }, + cellRow := { + // state == idle + { { + { "WrongState", { stepContextArgs := { 2 } } } + }, omit, omit }, + // state == wait + { { + { "RightState", { stepContextArgs := { 2 } } }, + { "RecordAnswer", { stepContextArgs := {} } }, + //{ "CheckState", { stepContextArgs := { 2 } } }, + { c_EPTF_LGenBase_StepFunction_trafficSuccess, { stepContextArgs := {} } } + }, omit, "idle" } + } + }, + + // timeout event + { + eventToListen := { c_EPTF_LGenBase_specialBName_timerTimeout, "TIMEOUT", fsm }, + cellRow := { + // state == idle + { { + { "WrongState", { stepContextArgs := { 3 } } } + }, omit, "idle" }, + // state == wait + { { + { "RightState", { stepContextArgs := { 3 } } }, + { c_EPTF_HTTP_stepName_cleanUpContext, { stepContextArgs := {} } } , + { c_EPTF_HTTP_stepName_handleTimeout, { stepContextArgs := {} } }, + { c_EPTF_LGenBase_StepFunction_trafficFailed, { stepContextArgs := {} } } + }, omit, "idle" } + } + }, + + // connection closed event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_connectionClosed, fsm }, + cellRow := { + // state == idle + { { + { "DisableState", { stepContextArgs := { } } } + }, omit, omit }, + // state == wait + { { + { "DisableState", { stepContextArgs := { } } } + }, omit, omit } + } + }, + + // connection opened event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_connectionOpened, fsm }, + cellRow := { + // state == idle + { { + { "EnableState", { stepContextArgs := { } } } + }, omit, omit }, + // state == wait + { { + { "EnableState", { stepContextArgs := { } } } + }, omit, omit } + } + }, + + // stop TC event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_stopTC, fsm }, + cellRow := { + // state == idle + { { + { c_EPTF_HTTP_stepName_cleanUpContext, { stepContextArgs := {} } } , + { c_EPTF_LGenBase_StepFunction_entityStopped, { stepContextArgs := { } } } + }, omit, "idle" }, + // state == wait + { { + { c_EPTF_HTTP_stepName_cleanUpContext, { stepContextArgs := {} } } , + { c_EPTF_LGenBase_StepFunction_entityStopped, { stepContextArgs := { } } } + }, omit, "idle" } + } + } + } + } + } +} + +function f_EPTF_HTTP_Test_Application1_HTTP1_CreateBasicFSM_Remote( + in charstring pl_name) +runs on EPTF_HTTP_Test_Application1_RemoteCT +return EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList +{ + return { + { name := pl_name, + stateList := { "idle", "wait" }, + timerList := { { name := "TIMEOUT", startValue := 1.0 } }, + table := { +/* + // TC tarted event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_trafficCaseStarted, fsm }, + cellRow := { + // state == idle + { { + { "RightState", { stepContextArgs := { 0 } } }, + { c_EPTf_EPTF_HTTP_Test_Application1_stepName_openConnection, { stepContextArgs := {} } }, + { "CheckState", { stepContextArgs := { 0 } } } + }, omit, omit }, + // state == wait + { { + { "WrongState", { stepContextArgs := { 0 } } } + }, omit, "idle" } + } + }, + */ + // start TC event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_startTC, fsm }, + cellRow := { + // state == idle + { { + { "RightState", { stepContextArgs := { 1 } } }, + { c_EPTF_HTTP_stepName_sendRequest, { stepContextArgs := {} } }//, + //{ "CheckState", { stepContextArgs := { 1 } } } + }, omit, "wait" }, + // state == wait + { { + { "WrongState", { stepContextArgs := { 1 } } } + }, omit, "idle" } + } + }, + + // answer OK event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_responseCharReceived, fsm }, + cellRow := { + // state == idle + { { + { "WrongState", { stepContextArgs := { 2 } } } + }, omit, omit }, + // state == wait + { { + { "RightState", { stepContextArgs := { 2 } } }, + { "RecordAnswer", { stepContextArgs := {} } }, + //{ "CheckState", { stepContextArgs := { 2 } } }, + { c_EPTF_LGenBase_StepFunction_trafficSuccess, { stepContextArgs := {} } } + }, omit, "idle" } + } + }, + + // timeout event + { + eventToListen := { c_EPTF_LGenBase_specialBName_timerTimeout, "TIMEOUT", fsm }, + cellRow := { + // state == idle + { { + { "WrongState", { stepContextArgs := { 3 } } } + }, omit, "idle" }, + // state == wait + { { + { "RightState", { stepContextArgs := { 3 } } }, + { c_EPTF_HTTP_stepName_handleTimeout, { stepContextArgs := {} } }, + { c_EPTF_HTTP_stepName_cleanUpContext, { stepContextArgs := {} } } , + { c_EPTF_LGenBase_StepFunction_trafficFailed, { stepContextArgs := {} } } + }, omit, "idle" } + } + }, + + // connection closed event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_connectionClosed, fsm }, + cellRow := { + // state == idle + { { + { "DisableState", { stepContextArgs := { } } } + }, omit, omit }, + // state == wait + { { + { "DisableState", { stepContextArgs := { } } } + }, omit, omit } + } + }, + + // connection opened event + { + eventToListen := { c_EPTF_HTTP_myBName, c_EPTF_HTTP_inputName_connectionOpened, fsm }, + cellRow := { + // state == idle + { { + { "EnableState", { stepContextArgs := { } } } + }, omit, omit }, + // state == wait + { { + { "EnableState", { stepContextArgs := { } } } + }, omit, omit } + } + }, + + // stop TC event + { + eventToListen := { c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_stopTC, fsm }, + cellRow := { + // state == idle + { { + { c_EPTF_HTTP_stepName_cleanUpContext, { stepContextArgs := {} } } , + { c_EPTF_LGenBase_StepFunction_entityStopped, { stepContextArgs := { } } } + }, omit, "idle" }, + // state == wait + { { + { c_EPTF_HTTP_stepName_cleanUpContext, { stepContextArgs := {} } } , + { c_EPTF_LGenBase_StepFunction_entityStopped, { stepContextArgs := { } } } + }, omit, "idle" } + } + } + } + } + } +} + +} diff --git a/test/EPTF_Applib_HTTP_Test_Definitions.ttcn b/test/EPTF_Applib_HTTP_Test_Definitions.ttcn new file mode 100644 index 0000000..bfde76e --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test_Definitions.ttcn @@ -0,0 +1,105 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_Applib_HTTP_Test_Definitions.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-01-08 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +// Module: EPTF_Applib_HTTP_Test_Definitions +// +// Purpose: +// Definitions of EPTF HTTP Application Library test cases +// +// Module Parameters: +// - +// +// Module depends on: +// <EPTF_CLL_Base_Definitions> +// +// <HTTPmsg_Types> +// +// <IPL4asp_Types> +// +// <EPTF_Applib_HTTP_Responder> +// +// <EPTF_Applib_HTTP_Test_Application1_Definitions> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-01-09 +// +// Detailed Comments: +// - +// +/////////////////////////////////////////////////////////// +module EPTF_Applib_HTTP_Test_Definitions { + +//========================================================================= +// Import Part +//========================================================================= +import from EPTF_CLL_Base_Definitions all; +import from EPTF_CLL_Variable_Definitions all; + +import from HTTPmsg_Types all; +import from IPL4asp_Types all; + +import from EPTF_Applib_HTTP_Test_Responder all; +import from EPTF_Applib_HTTP_Test_Application1_Definitions all; + +//========================================================================= +// Types +//========================================================================= + +type component EPTF_HTTP_Test_CT extends EPTF_Base_CT, EPTF_Var_CT +{ + var EPTF_HTTP_Test_Responder_CT v_HTTP_Responder_comp; + var EPTF_HTTP_Test_Application1_MapperCT v_HTTP_Mapper1_comp; + var EPTF_HTTP_Test_Application1_LocalCTList v_HTTP_Local1_comps; + var EPTF_HTTP_Test_Application1_RemoteCTList v_HTTP_Remote1_comps; + var EPTF_HTTP_Test_Application1_MapperCT v_HTTP_Mapper2_comp; + + var boolean v_isRemote_appl1, v_isRemote_appl2; + var integer v_numberOfLGens1, v_numberOfLGens2; + + var integer v_nofAnswers := -1; + + var octetstring v_HTTP_oct; + var HTTPMessage v_HTTP_msg; + + var float v_randState; + + port EPTF_HTTP_Test_CM_PT v_CM_PCO; +} + +type component EPTF_HTTP_Test_LocalAPI_CT + extends EPTF_HTTP_Test_Application1_LocalCT, EPTF_HTTP_Test_CT +{ + var ASP_RecvFrom v_ASP_RecvFrom; + var ASP_Event v_ASP_Event; + var integer v_noIntWarning; +} + +type component EPTF_HTTP_Test_RemoteAPI_CT + extends EPTF_HTTP_Test_Application1_RemoteCT, EPTF_HTTP_Test_CT +{ + var ASP_RecvFrom v_ASP_RecvFrom; + var ASP_Event v_ASP_Event; + var integer v_noIntWarning; + var boolean v_noBoolWarning; + + port EPTF_HTTP_Test_Validation_PT v_validation_PCO; +} +} diff --git a/test/EPTF_Applib_HTTP_Test_Functions.ttcn b/test/EPTF_Applib_HTTP_Test_Functions.ttcn new file mode 100644 index 0000000..2ef6d1a --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test_Functions.ttcn @@ -0,0 +1,422 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_Applib_HTTP_Test_Functions.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-01-08 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +// Module: EPTF_Applib_HTTP_Test_Functions +// +// Purpose: +// Functions of EPTF HTTP Application Library test cases +// +// Module Parameters: +// - +// +// Module depends on: +// <EPTF_CLL_HashMapInt2Int_Functions> +// +// <EPTF_CLL_FBQ_Functions> +// +// <IPL4asp_Types> +// +// <HTTPmsg_Types> +// +// <EPTF_CLL_Base_Functions> +// +// <EPTF_HTTP_Transport_Definitions> +// +// <EPTF_HTTP_Transport_Functionss> +// +// <EPTF_Applib_HTTP_Test_Responder> +// +// <EPTF_Applib_HTTP_Test_Application1_Definitions> +// +// <EPTF_Applib_HTTP_Test_Application1_Functions> +// +// <TCCMaths_GenericTypes> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-01-09 +// +// Detailed Comments: +// - +// +/////////////////////////////////////////////////////////// +module EPTF_Applib_HTTP_Test_Functions { + +//========================================================================= +// Import Part +//========================================================================= +import from EPTF_CLL_HashMapInt2Int_Functions all; +import from EPTF_CLL_FBQ_Functions all; +import from HTTPmsg_Types all; +import from EPTF_CLL_Base_Functions all; + +import from EPTF_HTTP_Transport_Definitions all; +import from EPTF_HTTP_Transport_Functions all; + +import from EPTF_Applib_HTTP_Test_Definitions all; +import from EPTF_Applib_HTTP_Test_Responder all; +import from EPTF_Applib_HTTP_Test_Application1_Definitions all; +import from EPTF_Applib_HTTP_Test_Application1_Functions all; + +import from TCCMaths_GenericTypes all; + +//========================================================================= +// Functions +//========================================================================= +/* +function f_myRandom() runs on EPTF_HTTP_Test_CT return float +{ + var float vl_randVal := 1.0 / int2float(tsp_rangeHi) + 0.5 * rnd() / int2float(tsp_rangeHi); + v_randState := v_randState + vl_randVal; + + if (v_randState >= 1.0) { v_randState := v_randState - 1.0; }; + + return v_randState; +} +*/ + +function f_EPTF_HTTP_Test_checkConfig() +runs on EPTF_HTTP_Test_CT return boolean +{ + if (not isvalue(v_numberOfLGens1)) { + log("Parameter v_numberOfLGens1 not value!"); + return false; + } + + if (not isvalue(v_numberOfLGens2)) { + log("Parameter v_numberOfLGens2 not value!"); + return false; + } + + if (v_numberOfLGens1 < 0) { + log("Parameter tsp_numberOfLGens1 must be at least zero (now: ", v_numberOfLGens1, ")"); + return false; + } + + if (v_numberOfLGens2 < 0) { + log("Parameter tsp_numberOfLGens2 must be at least zero (now: ", v_numberOfLGens2, ")"); + return false; + } + + return true; +} + +function f_EPTF_HTTP_Test_createResponder( + in integer pl_tcId, + in float pl_runningTime) +runs on EPTF_HTTP_Test_CT +{ + log("--- Creating responder ... "); + + v_HTTP_Responder_comp := EPTF_HTTP_Test_Responder_CT.create("HTTP_Responder"); + connect(v_HTTP_Responder_comp:v_CM_PCO, self:v_CM_PCO); + v_HTTP_Responder_comp.start(f_EPTF_HTTP_Test_Responder_behavior(pl_tcId, pl_runningTime)); + + timer tl_guard; + tl_guard.start(5.0); + alt { + [] v_CM_PCO.receive {tl_guard.stop} + [] tl_guard.timeout {f_EPTF_Base_stopAll()} + } +} + +function f_EPTF_HTTP_Test_createApplConfig1( + in integer pl_tcIdx, + in integer pl_numEntities, + in float pl_runningTime, + in float pl_responderRunningTime, + in boolean pl_portMode, + in boolean pl_globalMode, + in integer pl_numOfPorts, + in boolean pl_iConnOpen, + in boolean pl_iConnClose) +runs on EPTF_HTTP_Test_CT +{ + log("--- Creating Application 1 configuration ... "); + + if (v_numberOfLGens1 == 0) { + log("WARNING! Application 1 disabled!"); + return; + } + + var integer i; + var charstring vl_name; + + v_isRemote_appl1 := v_numberOfLGens1 > 1; + log(" Remote transport: ", v_isRemote_appl1); + + if (v_isRemote_appl1) + { + vl_name := "APPL1_MAPPER"; + log(" Creating mapper: ", vl_name); + + v_HTTP_Mapper1_comp := EPTF_HTTP_Test_Application1_MapperCT.create(vl_name); + } + + for (i := 0; i < v_numberOfLGens1; i := i + 1) + { + vl_name := "APPL1_LGEN_" & int2str(i); + + if (v_isRemote_appl1) + { + + log(" Creating REMOTE lgen: ", vl_name); + v_HTTP_Remote1_comps[i] := EPTF_HTTP_Test_Application1_RemoteCT.create(vl_name); + + connect(v_HTTP_Remote1_comps[i]:v_EPTF_HTTP_RemoteTransport_commPort, + v_HTTP_Mapper1_comp:v_EPTF_HTTP_Mapper_commPort); + + v_HTTP_Remote1_comps[i].start(f_EPTF_HTTP_Test_Application1_RemoteBehavior( + i, pl_numEntities, + pl_globalMode, pl_runningTime, pl_responderRunningTime)); + } + else + { + log(" Creating LOCAL lgen: ", vl_name); + v_HTTP_Local1_comps[i] := EPTF_HTTP_Test_Application1_LocalCT.create(vl_name); + v_HTTP_Local1_comps[i].start(f_EPTF_HTTP_Test_Application1_LocalBehavior(pl_tcIdx, + i, pl_numEntities, + pl_portMode, pl_globalMode, pl_numOfPorts, pl_iConnOpen, pl_iConnClose, + pl_runningTime, pl_responderRunningTime)); + } + } + + if (v_isRemote_appl1) + { + v_HTTP_Mapper1_comp.start(f_EPTF_HTTP_Test_Application1_Mapper_Behavior( + v_HTTP_Remote1_comps, pl_tcIdx, pl_numEntities, pl_portMode, + pl_globalMode, pl_numOfPorts, pl_iConnOpen, pl_iConnClose, + 2.0*pl_runningTime)); + } +} + +// checks state of a port in a group (pl_group, pl_port) +// pl_state - port state +// pl_connId - connection id +// pl_c2g - should be in connection id 2 group id HashMap +// pl_c2p - should be in connection id 2 port id HashMap +// pl_busyState - should be busy in portStateQueue (meaning free/busy for sending) +// return true if state is valid, false otherwise +function f_EPTF_HTTP_Test_checkPortState( + in integer pl_group, + in integer pl_port, + in EPTF_HTTP_Transport_ConnectionState pl_state, + in integer pl_connId, + in boolean pl_c2g, + in boolean pl_c2p, + in boolean pl_busyState) +runs on EPTF_HTTP_Test_LocalAPI_CT return boolean +{ + var boolean vl_found; + var integer vl_result, vl_connId; + var EPTF_HTTP_Transport_ConnectionState vl_state; + + if (pl_group == -1 or pl_group >= sizeof(v_EPTF_HTTP_Transport_portDB)) { + log("Port database (GROUP) is wrong!"); + setverdict(fail); + return false; + } + + if (pl_port == -1 or pl_port >= sizeof(v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase)) { + log("Port database (PORT) is wrong!"); + setverdict(fail); + return false; + } + + vl_state := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].state; + if (vl_state != pl_state) + { + log("Inconsistent port state: ", vl_state, " instead of: ", pl_state); + setverdict(fail); + return false; + } + + vl_connId := v_EPTF_HTTP_Transport_portDB[pl_group].portDatabase[pl_port].connectionId; + if (vl_connId != pl_connId) + { + log("Inconsistent connnection id: ", vl_connId, "instead of: ", pl_connId); + setverdict(fail); + return false; + } + + vl_found := f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_connId2GroupId_HM, + vl_connId, vl_result); + + if (vl_found != pl_c2g) { + if (pl_c2g) { + log("Group id not found in Conn2Grp HM for connection (", + vl_connId, "), but it should be there!"); + } else { + log("Group id found in Conn2Grp HM for connection (", + vl_connId, "), but it shouldn't be there!"); + } + + setverdict(fail); + return false; + } + + vl_found := f_EPTF_int2int_HashMap_Find(v_EPTF_HTTP_Transport_connId2PortId_HM, + vl_connId, vl_result); + + if (vl_found != pl_c2p) { + if (pl_c2p) { + log("Port id not found in Conn2Grp HM for connection (", + vl_connId, "), but it should be there!"); + } else { + log("Port id found in Conn2Grp HM for connection (", + vl_connId, "), but it shouldn't be there!"); + } + + setverdict(fail); + return false; + } + + vl_found := f_EPTF_FBQ_itemIsBusy(pl_port, v_EPTF_HTTP_Transport_portDB[pl_group].portStateQueue); + if (pl_busyState != vl_found) { + if (vl_found) { + log("Port is busy for sending!"); + } + else { + log("Port is free for sending!"); + } + + return false; + } + + return true; +} + +function f_EPTF_HTTP_Test_DummyHTTPRequest( + in charstring pl_body) +return octetstring +{ + var HTTPMessage vl_outgoingMessage := { + request := { + client_id:= omit, + method:= "GET", + uri:= "http://responder.com", + version_major := 1, + version_minor := 1, + header:= {{"Content-Length", int2str(lengthof(pl_body)) }}, + body:= pl_body + } + } + + log("HTTP message: ", vl_outgoingMessage); + + return enc_HTTPMessage(vl_outgoingMessage); +} + +function f_EPTF_HTTP_Test_bufferTest(in integer pl_size, in integer pl_offset) +runs on EPTF_HTTP_Test_LocalAPI_CT +{ + var EPTF_HTTP_RingBuffer vl_buffer; + var integer vl_int := 0; + var boolean vl_busy := false; + var IntegerList vl_list := {}; + var IntegerList vl_listExpected := {}; + var integer vl_headIdx := -1; + + f_EPTF_HTTP_RingBuffer_init(vl_buffer, pl_size, 0); + + vl_buffer.nextSeqNum := pl_offset; + vl_buffer.waitForSeqNum := pl_offset; + + + for(var integer i := 0; i < pl_size; i := i + 1) + { + vl_listExpected[sizeof(vl_listExpected)] := (i + pl_offset) mod pl_size; + } + + vl_listExpected[sizeof(vl_listExpected)] := -1; + + for(var integer i := 0; i < pl_size + 1; i := i + 1) + { + vl_list[sizeof(vl_list)] := f_EPTF_HTTP_RingBuffer_getNext(vl_buffer) + } + + if (vl_list != vl_listExpected) + { + setverdict(fail); + log("Error: getting sequence number. Expected: ", vl_listExpected, " got: ", vl_list); + log(vl_buffer); + } + + for(var integer i := pl_size - 1; i > 0; i := i - 1) + { + f_EPTF_HTTP_RingBuffer_setElementBusy(vl_buffer, (i + pl_offset) mod pl_size); + vl_busy := f_EPTF_HTTP_RingBuffer_isHeadBusy(vl_buffer) or vl_busy; + } + + if (vl_busy) + { + log("Error: header should be free"); + log(vl_buffer); + setverdict(fail); + } + + f_EPTF_HTTP_RingBuffer_setElementBusy(vl_buffer, pl_offset); + + while (f_EPTF_HTTP_RingBuffer_isHeadBusy(vl_buffer)) + { + vl_list[sizeof(vl_list)] := f_EPTF_HTTP_RingBuffer_getHeadIdx(vl_buffer); + f_EPTF_HTTP_RingBuffer_freeHead(vl_buffer); + } + + for (var integer i := 0; i < pl_size; i := i + 1) + { + vl_listExpected[sizeof(vl_listExpected)] := (i + pl_offset) mod pl_size; + } + + if (vl_list != vl_listExpected) + { + setverdict(fail); + log("Error: reading out buffer. Expected: ", vl_listExpected, " got: ", vl_list); + log(vl_buffer); + } + + vl_headIdx := f_EPTF_HTTP_RingBuffer_getHeadIdx(vl_buffer); + + if (vl_headIdx != pl_offset) + { + log("Error: head index: ", vl_headIdx, " expected: ", pl_offset); + log(vl_buffer); + setverdict(fail); + } + + vl_int := f_EPTF_HTTP_RingBuffer_getNext(vl_buffer); + + if (pl_offset != vl_int) + { + log("Error: next sequence number: ", vl_int, " expected: ", pl_offset); + log(vl_buffer); + setverdict(fail); + } + + if (f_EPTF_int2int_HashMap_Size(vl_buffer.isSlotBusyHM) != 0) + { + log("Error: size of busy slot hash map should be 0."); + f_EPTF_int2int_HashMap_DumpByID(vl_buffer.isSlotBusyHM); + setverdict(fail); + } + + f_EPTF_HTTP_RingBuffer_erase(vl_buffer, 0) +} +} diff --git a/test/EPTF_Applib_HTTP_Test_Responder.ttcn b/test/EPTF_Applib_HTTP_Test_Responder.ttcn new file mode 100644 index 0000000..6ba8aca --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test_Responder.ttcn @@ -0,0 +1,230 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_Applib_HTTP_Test_Responder.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-01-08 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +// Module: EPTF_Applib_HTTP_Test_Responder +// +// Purpose: +// This module contains the functions to simulate a HTTP +// responder node for tests +// +// Module Parameters: +// - +// +// Module depends on: +// <HTTPmsg_Types> +// +// <IPL4asp_Types> +// +// <IPL4asp_PortType> +// +// <EPTF_CLL_Common_Definitions> +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-01-09 +// +// Detailed Comments: +// - +// +/////////////////////////////////////////////////////////// + +module EPTF_Applib_HTTP_Test_Responder { + +//========================================================================= +// Import Part +//========================================================================= +import from HTTPmsg_Types all; +import from IPL4asp_Types all; +import from IPL4asp_PortType all; +import from EPTF_CLL_Common_Definitions all; + +//========================================================================= +// Module parameters +//========================================================================= +modulepar charstring tsp_EPTF_HTTP_Test_Responder_host := "159.107.193.33"; +modulepar integer tsp_EPTF_HTTP_Test_Responder_port := 4000; + +//========================================================================= +// Component types +//========================================================================= +type component EPTF_HTTP_Test_Responder_CT { + port IPL4asp_PT v_IPL4_PCO; + port EPTF_HTTP_Test_CM_PT v_CM_PCO; + + var EPTF_HTTP_Test_Responder_HostInformationList v_hostDatabase := {}; + var EPTF_IntegerList v_connIds := {}; + + var ASP_RecvFrom v_ASP_RecvFrom; + var ASP_Event v_ASP_Event; + + var HTTPMessage v_HTTP_msg; + + var integer v_intNoWarn; +} + +//========================================================================= +// Types +//========================================================================= + +type port EPTF_HTTP_Test_CM_PT message { + inout charstring +} with {extension "internal"} + +type record EPTF_HTTP_Test_Responder_HostInformation { + charstring hostIPAddress , + integer hostPort +} + +type record of EPTF_HTTP_Test_Responder_HostInformation EPTF_HTTP_Test_Responder_HostInformationList; + +//========================================================================= +// Functions +//========================================================================= +function f_EPTF_HTTP_Test_Responder_init( + in EPTF_HTTP_Test_Responder_HostInformationList pl_hosts) +runs on EPTF_HTTP_Test_Responder_CT return boolean +{ + var Result vl_result; + var integer i; + + map(self:v_IPL4_PCO, system:v_IPL4_PCO); + + v_hostDatabase := pl_hosts; + + for (i := 0; i < sizeof(v_hostDatabase); i := i + 1) + { + vl_result := f_IPL4_listen(v_IPL4_PCO, + v_hostDatabase[i].hostIPAddress, v_hostDatabase[i].hostPort, { tcp := {} }); + + if (vl_result.errorCode == omit) { + log("Listening successful on: ", v_hostDatabase[i], " (", vl_result.connId, ")"); + v_connIds[i] := vl_result.connId; + } else { + log("Listening failed on: ", v_hostDatabase[i], " (", vl_result, ")"); + return false; + } + } + + return true; +} + +function f_EPTF_HTTP_Test_Responder_uninit() +runs on EPTF_HTTP_Test_Responder_CT +{ + var Result vl_result; + var integer i; + + for (i := 0; i < sizeof(v_connIds); i := i + 1) + { + vl_result := f_IPL4_close(v_IPL4_PCO, v_connIds[i], { tcp := {} }); + } + + v_hostDatabase := {}; + v_connIds := {}; + + unmap(self:v_IPL4_PCO, system:v_IPL4_PCO); +} + +function f_EPTF_HTTP_Test_dummyHTTPResponse( + in charstring pl_body) +return octetstring +{ + var HTTPMessage vl_outgoingMessage := { + response := { + client_id := omit, + version_major := 1, + version_minor := 1, + statuscode := 200, + statustext := "OK", + header:= {{"Content-Length", int2str(lengthof(pl_body)) }}, + body:= pl_body + } + } + + log("HTTP message: ", vl_outgoingMessage); + + return enc_HTTPMessage(vl_outgoingMessage); +} + +function f_EPTF_HTTP_Test_Responder_behavior( + in integer pl_tcId, + in float pl_runningTime) +runs on EPTF_HTTP_Test_Responder_CT +{ + log("<< Starting HTTP responder! >>"); + + timer t_guard := pl_runningTime; + + var EPTF_HTTP_Test_Responder_HostInformationList vl_hList; + var ASP_Send vl_send; + + // provide initial data according to TC + vl_hList := { { tsp_EPTF_HTTP_Test_Responder_host, tsp_EPTF_HTTP_Test_Responder_port + pl_tcId } }; + + // initialize component + if (not f_EPTF_HTTP_Test_Responder_init(vl_hList)) { + log("HTTP responder failed during initialization!"); + + f_EPTF_HTTP_Test_Responder_uninit(); + setverdict(fail); + return + } + + v_CM_PCO.send("Hello, I'm ready! :-)"); + + t_guard.start; + alt { + [] v_IPL4_PCO.receive(ASP_RecvFrom:?) -> value v_ASP_RecvFrom { + log("ASP receive from: ", v_ASP_RecvFrom); + + v_intNoWarn := dec_HTTPMessage(v_ASP_RecvFrom.msg, v_HTTP_msg, false); + log("HTTP payload: ", v_HTTP_msg); + + vl_send := { + v_ASP_RecvFrom.connId, {tcp := {}}, + f_EPTF_HTTP_Test_dummyHTTPResponse(v_HTTP_msg.request.body) + }; + + v_IPL4_PCO.send(vl_send); + + repeat; + } + [] v_IPL4_PCO.receive(ASP_Event:?) -> value v_ASP_Event { + log("ASP event: ", v_ASP_Event); + log(v_IPL4_PCO); + repeat; + } + [] v_IPL4_PCO.receive { + log("Invalid message received!"); + repeat; + } + [] t_guard.timeout { + log("Timer timed out!"); + } + } + + f_EPTF_HTTP_Test_Responder_uninit(); + + log("<< Stopping HTTP responder! >>"); + + setverdict(pass); +} + +} diff --git a/test/EPTF_Applib_HTTP_Test_Templates.ttcn b/test/EPTF_Applib_HTTP_Test_Templates.ttcn new file mode 100644 index 0000000..ed9ad83 --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test_Templates.ttcn @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_Applib_HTTP_Test_Templates.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-01-08 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +// Module: EPTF_Applib_HTTP_Test_Templates +// +// Purpose: +// Templates of the EPTF HTTP application library test cases +// +// Module Parameters: +// - +// +// Module depends on: +// - +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-01-09 +// +// Detailed Comments: +// - +// +/////////////////////////////////////////////////////////// +module EPTF_Applib_HTTP_Test_Templates { + +} diff --git a/test/EPTF_Applib_HTTP_Test_Testcases.ttcn b/test/EPTF_Applib_HTTP_Test_Testcases.ttcn new file mode 100644 index 0000000..0d483d0 --- /dev/null +++ b/test/EPTF_Applib_HTTP_Test_Testcases.ttcn @@ -0,0 +1,2233 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2000-2018 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_Applib_HTTP_Test_Testcases.ttcn +// Rev: <RnXnn> +// Prodnr: CNL 113 618 +// Updated: 2009-01-08 +// Contact: http://ttcn.ericsson.se +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////// +// Module: EPTF_Applib_HTTP_Test_Testcases +// +// Purpose: +// HTTP application library testcases +// +// Module Parameters: +// tsp_EPTF_HTTP_Test_Responder_host - *charstring* - host IP address of responder component +// tsp_EPTF_HTTP_Test_Application1_host - *charstring* - host IP address of application1 component +// tsp_Application2_host - *charstring* - host IP address of application2 component +// tsp_EPTF_HTTP_Test_Responder_port - *charstring* - host port of responder component +// tsp_EPTF_HTTP_Test_NonExistent_host - *charstring* - a non existent host IP address +// +// Module depends on: +// <EPTF_CLL_HashMapInt2Int_Functions> +// +// <EPTF_CLL_HashMapStr2Int_Functions> +// +// <EPTF_CLL_FBQ_Functions> +// +// <EPTF_CLL_Base_Functions> +// +// <EPTF_CLL_Logging_Definitions> +// +// <EPTF_CLL_Logging_Functions> +// +// <IPL4asp_Types> +// +// <EPTF_HTTP_Definitions> +// +// <EPTF_HTTP_Functions> +// +// <EPTF_HTTP_Transport_Definitions> +// +// <EPTF_HTTP_Transport_Functions> +// +// <EPTF_Applib_HTTP_Test_Application1_Definitions> +// +// <EPTF_Applib_HTTP_Test_Application1_Functions> +// +// <EPTF_Applib_HTTP_Test_Definitions> +// +// <EPTF_Applib_HTTP_Test_Functions> +// +// <EPTF_Applib_HTTP_Test_Templates> +// +// +// Current Owner: +// EAKOPER +// +// Last Review Date: +// 2009-01-09 +// +// Detailed Comments: +// - +// +/////////////////////////////////////////////////////////// +module EPTF_Applib_HTTP_Test_Testcases { + +//========================================================================= +// Import Part +//========================================================================= +import from EPTF_CLL_HashMapInt2Int_Functions all; +import from EPTF_CLL_HashMapStr2Int_Functions all; +import from EPTF_CLL_FBQ_Functions all; +import from EPTF_CLL_Base_Functions all; +import from EPTF_CLL_Variable_Functions all; +import from EPTF_CLL_Logging_Definitions all; +import from EPTF_CLL_Logging_Functions all; +import from IPL4asp_Types all; + +import from EPTF_HTTP_Definitions all; +import from EPTF_HTTP_Functions all; +import from EPTF_HTTP_Transport_Definitions all; +import from EPTF_HTTP_Transport_Functions all; + +import from EPTF_Applib_HTTP_Test_Application1_Definitions all; +import from EPTF_Applib_HTTP_Test_Application1_Functions all; +import from EPTF_Applib_HTTP_Test_Definitions all; +import from EPTF_Applib_HTTP_Test_Functions all; +import from EPTF_Applib_HTTP_Test_Templates all; + +//========================================================================= +// Module paramers +//========================================================================= +modulepar charstring tsp_EPTF_HTTP_Test_Responder_host := "159.107.193.33"; +modulepar integer tsp_EPTF_HTTP_Test_Responder_port := 4000; +modulepar charstring tsp_EPTF_HTTP_Test_Application1_host := "159.107.193.33"; +modulepar integer tsp_EPTF_HTTP_Test_Application1_port := 5000; +modulepar charstring tsp_EPTF_HTTP_Test_NonExistent_host := "159.1.1.1"; + +//modulepar integer tsp_runningTime := 60; +//modulepar integer tsp_QPS := 500; +//modulepar integer tsp_rangeHi := 3000; + +//========================================================================= +// Testcases +//========================================================================= + +////========================================================================= +// test of new port connection object +// test of creation, deletion, database consistency and open/close +testcase tc_EPTF_HTTP_Test_test1() +runs on EPTF_HTTP_Test_LocalAPI_CT +{ + log("=============================="); + log("<< Starting test case 1 ... >>"); + log("=============================="); + log(""); + + var EPTF_HTTP_HostInformation vl_local, vl_remote; + var integer vl_group, vl_dummy; + var boolean vl_pass := true; + + // init base component + vl_dummy := f_EPTF_HTTP_LocalTransport_init_CT("EPTF_HTTP_Transport"); + + if ("LALA.0" != f_EPTF_HTTP_LocalTransport_createUniqueGroupName("LALA")) { + log("Creation of unique name failed"); + vl_pass := false; + setverdict(fail); + } + + // init testcase + vl_local := { "127.0.0.1", 5000 }; + vl_remote := { "127.0.0.1", 4000 }; + + vl_group := f_EPTF_HTTP_LocalTransport_newPort( + {"MyLittlePorty", vl_local, vl_remote, true, false, false, omit}); + + if (vl_pass and vl_group != 0) { + log("Wrong group id acquired! (", vl_group, ")"); + vl_pass := false; + setverdict(fail); + } + + // check local host information in database + if (vl_pass and not f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_localHostHashMap, + vl_local.hostIPAddress&int2str(vl_local.hostPort), + vl_dummy)) + { + log("Adding local host information to database has failed! (", vl_local, ")"); + vl_pass := false; + setverdict(fail); + } + + // check remote host information in database + if (vl_pass and not f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_remoteHostHashMap, + vl_local.hostIPAddress&int2str(vl_remote.hostPort), + vl_dummy)) + { + log("Adding remote host information to database has failed! (", vl_remote, ")"); + vl_pass := false; + setverdict(fail); + } + + // Check created database + if (vl_pass) + { + template EPTF_HTTP_Transport_PortGroupList t_expectedPortDB1 := { { + name := "MyLittlePorty", + baseLocalHostInformation := vl_local, + baseRemoteHostInformation := vl_remote, + + currentPortId := ?, + + numberOfPorts := 1, + localportStep := 0, + remoteportStep := 0, + + portDatabase := { + { + groupIndex := 0, + portIndex := 0, + connectionId := -1, + sessionId := ?, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } + }, + + listeningPortIdx := -1, + + defaultFIdx := 1, + + portQueue := ?, + portStateQueue := ?, + + useSSL := false, + instantConnOpen := true, + instantConnClose := false, + buffer := false + } }; + + if (not match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1)) { + log("Database inconsistency after addition to v_EPTF_HTTP_Transport_portDB!"); + log(match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1)); + vl_pass := false; + setverdict(fail); + } + } + + if (vl_pass) + { + template EPTF_HTTP_Transport_PortGroupList t_expectedPortDB2 := { { + name := "", + baseLocalHostInformation := { "", -1 }, + baseRemoteHostInformation := { "", -1 }, + + currentPortId := ?, + numberOfPorts := 0, + localportStep := -1, + remoteportStep := -1, + + portDatabase := { }, + + listeningPortIdx := -1, + + defaultFIdx := -1, + + portQueue := ?, + portStateQueue := ?, + + useSSL := false, + instantConnOpen := false, + instantConnClose := false, + buffer := false + } }; + + f_EPTF_HTTP_LocalTransport_deletePort(vl_group); + + if (not match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB2)) { + log("Database inconsistency after deletion from v_EPTF_HTTP_Transport_portDB!"); + log(match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB2)); + vl_pass := false; + setverdict(fail); + } + + // check local host information in database (must not be deleted after removal of port) + if (vl_pass and not f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_localHostHashMap, + vl_local.hostIPAddress&int2str(vl_local.hostPort), + vl_dummy)) + { + log("Local host information has been removed from database! (", vl_local, ")"); + vl_pass := false; + setverdict(fail); + } + + // check remote host information in database (must not be deleted after removal of port) + if (vl_pass and not f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_remoteHostHashMap, + vl_local.hostIPAddress&int2str(vl_remote.hostPort), + vl_dummy)) + { + log("Remote host information has been removed from database! (", vl_remote, ")"); + vl_pass := false; + setverdict(fail); + } + } + var integer vl_sessionId := 1; + if (vl_pass and f_EPTF_HTTP_LocalTransport_connectionOpen(vl_group, vl_sessionId)) { + log("Connection open successful after deletion of connection object!"); + vl_pass := false; + setverdict(fail); + } + + if (vl_pass) { + f_EPTF_HTTP_LocalTransport_connectionClose(vl_group); // no ret value, check no dynamic error + f_EPTF_HTTP_LocalTransport_deletePort(vl_group); + } + + if (f_EPTF_FBQ_itemIsBusy(vl_group, v_EPTF_HTTP_Transport_groupQueue)) { + log("Group not deleted properly!"); + vl_pass := false; + setverdict(fail); + } + +f_EPTF_Base_cleanup_CT(); + + if (vl_pass) { setverdict(pass); }; + +} + +////========================================================================= +// test of new group connection object +// test of creation, deletion, database consistency and open/close +testcase tc_EPTF_HTTP_Test_test2() +runs on EPTF_HTTP_Test_LocalAPI_CT +{ + log("=============================="); + log("<< Starting test case 2 ... >>"); + log("=============================="); + log(""); + + var EPTF_HTTP_HostInformation vl_local, vl_remote; + var integer vl_group, vl_dummy; + var boolean vl_pass := true; + + // init base component + v_noIntWarning := f_EPTF_HTTP_LocalTransport_init_CT("EPTF_HTTP_Transport"); + + // init testcase + vl_local := { "127.0.0.1", 5000 }; + vl_remote := { "127.0.0.1", 4000 }; + + vl_group := f_EPTF_HTTP_LocalTransport_newPortGroup( + {"MyLittleGroupy", vl_local, vl_remote, 3, 2, 0, true, false, false, omit}); + + if (vl_pass and vl_group != 0) { + log("Wrong group id acquired! (", vl_group, ")"); + vl_pass := false; + setverdict(fail); + } + + // check local host information in database + if (vl_pass and not f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_localHostHashMap, + vl_local.hostIPAddress&int2str(vl_local.hostPort), + vl_dummy)) + { + log("Adding local host information to database has failed! (", vl_local, ")"); + vl_pass := false; + setverdict(fail); + } + + // check remote host information in database + if (vl_pass and not f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_remoteHostHashMap, + vl_local.hostIPAddress&int2str(vl_remote.hostPort), + vl_dummy)) + { + log("Adding remote host information to database has failed! (", vl_remote, ")"); + vl_pass := false; + setverdict(fail); + } + + // Check created database + if (vl_pass) + { + template EPTF_HTTP_Transport_PortGroupList t_expectedPortDB1 := { { + name := "MyLittleGroupy", + baseLocalHostInformation := vl_local, + baseRemoteHostInformation := vl_remote, + + currentPortId := ?, + + numberOfPorts := 3, + localportStep := 2, + remoteportStep := 0, + + portDatabase := { + { + groupIndex := 0, + portIndex := 0, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 1, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 1, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 2, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 2, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } + }, + + listeningPortIdx := -1, + + defaultFIdx := 0, + + portQueue := ?, + portStateQueue := ?, + + useSSL := false, + instantConnOpen := true, + instantConnClose := false, + buffer := false + } }; + + if (not match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1)) { + log("Database inconsistency after addition to v_EPTF_HTTP_Transport_portDB!"); + log(match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB1)); + vl_pass := false; + setverdict(fail); + } + } + + if (vl_pass) + { + template EPTF_HTTP_Transport_PortGroupList t_expectedPortDB2 := { { + name := "", + baseLocalHostInformation := { "", -1 }, + baseRemoteHostInformation := { "", -1 }, + + currentPortId := ?, + + numberOfPorts := 0, + localportStep := -1, + remoteportStep := -1, + + portDatabase := { }, + + listeningPortIdx := -1, + + defaultFIdx := -1, + + portQueue := ?, + portStateQueue := ?, + + useSSL := false, + instantConnOpen := false, + instantConnClose := false, + buffer := false + } }; + + f_EPTF_HTTP_LocalTransport_deletePort(vl_group); + + if (not match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB2)) { + log("Database inconsistency after deletion from v_EPTF_HTTP_Transport_portDB!"); + log(match(v_EPTF_HTTP_Transport_portDB, t_expectedPortDB2)); + vl_pass := false; + setverdict(fail); + } + + // check local host information in database (must not be deleted after removal of port) + if (vl_pass and not f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_localHostHashMap, + vl_local.hostIPAddress&int2str(vl_local.hostPort), + vl_dummy)) + { + log("Local host information has been removed from database! (", vl_local, ")"); + vl_pass := false; + setverdict(fail); + } + + // check remote host information in database (must not be deleted after removal of port) + if (vl_pass and not f_EPTF_str2int_HashMap_Find(v_EPTF_HTTP_Transport_remoteHostHashMap, + vl_local.hostIPAddress&int2str(vl_remote.hostPort), + vl_dummy)) + { + log("Remote host information has been removed from database! (", vl_remote, ")"); + vl_pass := false; + setverdict(fail); + } + } + var integer vl_sessionId := 1; + if (vl_pass and f_EPTF_HTTP_LocalTransport_connectionOpen(vl_group, vl_sessionId)) { + log("Connection open successful after deletion of connection object!"); + vl_pass := false; + setverdict(fail); + } + + if (vl_pass) { + f_EPTF_HTTP_LocalTransport_connectionClose(vl_group); // no ret value, check no dznamic errorohh + f_EPTF_HTTP_LocalTransport_deletePortGroup(vl_group); + } + + if (f_EPTF_FBQ_itemIsBusy(vl_group, v_EPTF_HTTP_Transport_groupQueue)) { + log("Group not deleted properly!"); + vl_pass := false; + setverdict(fail); + } + + f_EPTF_Base_cleanup_CT(); + + if (vl_pass) { setverdict(pass); }; +} +testcase tc_EPTF_HTTP_Test_test3() +runs on EPTF_HTTP_Test_RemoteAPI_CT +{ + log("=============================="); + log("<< Starting test case 3 ... >>"); + log("=============================="); + log(""); + + timer t_guard := 2.0; + timer t_wait := 1.0; + + f_EPTF_HTTP_init( + "APPL1_LGEN", + 1, + "HTTP1_", + 0); //, pl_bind, pl_reset, pl_unbind); + + // Initialize transport + v_noIntWarning := f_EPTF_HTTP_RemoteTransport_init_CT("RemoteVagyokRagyogok", + refers(f_EPTF_HTTP_messageReceived), + refers(f_EPTF_HTTP_eventReceived), + refers(f_EPTF_HTTP_socketErrorReceived)); + + f_EPTF_HTTP_setSendRequestFunction(refers(f_EPTF_HTTP_RemoteTransport_sendMessage)); + f_EPTF_HTTP_setConnectionCloseFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionClose)); + f_EPTF_HTTP_setConnectionOpenFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionOpen)); + f_EPTF_HTTP_setConnectionHalfCloseFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionHalfClose)); + + var EPTF_HTTP_Test_Application1_MapperCT vl_mapper_comp; + + vl_mapper_comp := EPTF_HTTP_Test_Application1_MapperCT.create("MapperVagyokRagyogok"); + + connect(self:v_EPTF_HTTP_RemoteTransport_commPort, + vl_mapper_comp:v_EPTF_HTTP_Mapper_commPort); + connect(self:v_validation_PCO, + vl_mapper_comp:v_validation_PCO); + + vl_mapper_comp.start( + f_EPTF_HTTP_Test_Application1_Mapper_Behavior_CheckAPI(10.0)); + + var EPTF_HTTP_Transport_GroupMode vl_group := { + name := "MyGroup", + + localHostInformation := { "127.0.0.1", 4000 }, + remoteHostInformation := { "127.0.0.1", 5000 }, + + numberOfPorts := 2, + localportStep := 1, + remoteportStep := 0, + + instantConnOpen := true, + instantConnClose := true, + useSSL := false, + userFunctions := omit + }; + + var EPTF_HTTP_Transport_PortMode vl_port := + { + name := "MyPort", + localHostInformation := { "127.0.0.1", 4000 }, + remoteHostInformation := { "127.0.0.1", 5000 }, + instantConnOpen := true, + instantConnClose := true, + useSSL := false, + userFunctions := omit + }; + + var integer vl_groupId; + var boolean vl_pass := true; + vl_groupId := f_EPTF_HTTP_RemoteTransport_newPortGroup(vl_group) + + if (vl_pass and vl_groupId != 0) { + log("Group creation unsuccessful! Acquired id: ", vl_groupId); + setverdict(fail); + vl_pass := false; + } + + if (vl_pass) { + f_EPTF_HTTP_RemoteTransport_deletePortGroup(vl_groupId); + vl_groupId := f_EPTF_HTTP_RemoteTransport_newPortGroup(vl_group); + + if (vl_groupId != 0) { + log("Group creation unsuccessful! Acquired id: ", vl_groupId) + setverdict(fail); + vl_pass := false; + } + } + + v_validation_PCO.send(EPTF_HTTP_Test_Valid:{0, vl_groupId}) + t_guard.start; + alt{ + [] v_validation_PCO.receive(EPTF_HTTP_Test_Status:READY){t_guard.stop;} + [] t_guard.timeout{ + log("Validation timer timeout! "); + setverdict(fail); + } + } + // Mapper side validation 1 comes here + + if (vl_pass) { + if (not f_EPTF_HTTP_RemoteTransport_addPortToGroup(vl_groupId)) { + log("Port addition unsuccessful to group: ", vl_groupId); + setverdict(fail); + vl_pass := false; + } + } + + v_validation_PCO.send(EPTF_HTTP_Test_Valid:{1, vl_groupId}) + t_guard.start; + alt{ + [] v_validation_PCO.receive(EPTF_HTTP_Test_Status:READY){t_guard.stop;} + [] t_guard.timeout{ + log("Validation timer timeout! "); + setverdict(fail); + } + } + + // Mapper side validation 2 comes here + + if (vl_pass) { + f_EPTF_HTTP_RemoteTransport_removePortFromGroup(vl_groupId); + } + + t_wait.start; + t_wait.timeout; + + v_validation_PCO.send(EPTF_HTTP_Test_Valid:{2, vl_groupId}) + t_guard.start; + alt{ + [] v_validation_PCO.receive(EPTF_HTTP_Test_Status:READY){t_guard.stop;} + [] t_guard.timeout{ + log("Validation timer timeout! "); + setverdict(fail); + } + } + + // Mapper side validation 3 comes here + + if (vl_pass) { + vl_groupId := f_EPTF_HTTP_RemoteTransport_newPort(vl_port) + + if (vl_groupId != 1) { + log("Port creation unsuccessful! Acquired id: ", vl_groupId); + setverdict(fail); + vl_pass := false; + } + } + + if (vl_pass) { + f_EPTF_HTTP_RemoteTransport_deletePort(vl_groupId); + vl_groupId := f_EPTF_HTTP_RemoteTransport_newPort(vl_port); + + if (vl_groupId != 1) { + log("Port recreation unsuccessful!"); + setverdict(fail); + vl_pass := false; + } + } + + if (vl_pass) { + vl_port.name := "MyPort2"; + vl_groupId := f_EPTF_HTTP_RemoteTransport_newPort(vl_port); + + if (vl_groupId != 2) { + log("Port creation unsuccessful!"); + setverdict(fail); + vl_pass := false; + } + } + + v_validation_PCO.send(EPTF_HTTP_Test_Valid:{3, vl_groupId}) + t_guard.start; + alt{ + [] v_validation_PCO.receive(EPTF_HTTP_Test_Status:READY){t_guard.stop;} + [] t_guard.timeout{ + log("Validation timer timeout! "); + setverdict(fail); + } + } + + f_EPTF_Base_cleanup_CT(); + + setverdict(pass); + +} + +// test random remote API usage +// no validation, testcase passes if it stops without errors +testcase tc_EPTF_HTTP_Test_test4() +runs on EPTF_HTTP_Test_RemoteAPI_CT +{ + log("=============================="); + log("<< Starting test case 4 ... >>"); + log("=============================="); + log(""); + + f_EPTF_HTTP_init( + "APPL1_LGEN", + 1, + "HTTP1_", + 0); //, pl_bind, pl_reset, pl_unbind); + + // Initialize transport + + v_noIntWarning := f_EPTF_HTTP_RemoteTransport_init_CT("RemoteVagyokRagyogok", + refers(f_EPTF_HTTP_messageReceived), + refers(f_EPTF_HTTP_eventReceived), + refers(f_EPTF_HTTP_socketErrorReceived)); + + f_EPTF_HTTP_setSendRequestFunction(refers(f_EPTF_HTTP_RemoteTransport_sendMessage)); + f_EPTF_HTTP_setConnectionCloseFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionClose)); + f_EPTF_HTTP_setConnectionOpenFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionOpen)); + f_EPTF_HTTP_setConnectionHalfCloseFunction(refers(f_EPTF_HTTP_RemoteTransport_connectionHalfClose)); + + var EPTF_HTTP_Test_Application1_MapperCT vl_mapper_comp; + + vl_mapper_comp := EPTF_HTTP_Test_Application1_MapperCT.create("MapperVagyokRagyogok"); + + connect(self:v_EPTF_HTTP_RemoteTransport_commPort, + vl_mapper_comp:v_EPTF_HTTP_Mapper_commPort); + + vl_mapper_comp.start( + f_EPTF_HTTP_Test_Application1_Mapper_Behavior_CheckRandomAPI(10.0)); + + var EPTF_HTTP_Transport_GroupMode vl_group := { + name := omit, + + localHostInformation := { "127.0.0.1", 4000 }, + remoteHostInformation := { "127.0.0.1", 5000 }, + + numberOfPorts := 2, + localportStep := 1, + remoteportStep := 0, + + instantConnOpen := true, + instantConnClose := true, + useSSL := false, + userFunctions := omit + }; + + var EPTF_HTTP_Transport_PortMode vl_port := + { + name := omit, + localHostInformation := { "127.0.0.1", 4000 }, + remoteHostInformation := { "127.0.0.1", 5000 }, + instantConnOpen := true, + instantConnClose := true, + useSSL := false, + userFunctions := omit + }; + + var integer i, op; + var integer vl_grpId, vl_hPort := 0; + + for (i := 0; i < 1000; i := i + 1) + { + op := float2int(12.999 * rnd()); + + select(op) + { + case (0) { // new group + vl_group.numberOfPorts := float2int(5.0 * rnd()) + 1; + vl_group.localportStep := float2int(2.0 * rnd()) + 1; + + if (f_EPTF_HTTP_RemoteTransport_newPortGroup(vl_group) != -1) { + vl_hPort := vl_hPort + 1; + } + } + case (1) { // new port + if (f_EPTF_HTTP_RemoteTransport_newPort(vl_port) != -1) { + vl_hPort := vl_hPort + 1; + } + } + case (2) { // delete group + if (vl_hPort > 0) { vl_hPort := vl_hPort - 1; }; + + vl_grpId := float2int(1.2 * rnd() * int2float(vl_hPort)); // 1.2 for chance to have bad IDs + f_EPTF_HTTP_RemoteTransport_deletePortGroup(vl_grpId); + } + case (3) { // delete port + if (vl_hPort > 0) { vl_hPort := vl_hPort - 1; }; + + vl_grpId := float2int(1.2 * rnd() * int2float(vl_hPort)); // 1.2 for chance to have bad IDs + f_EPTF_HTTP_RemoteTransport_deletePort(vl_grpId); + } + case (4) { // add port to group + vl_grpId := float2int(rnd() * int2float(vl_hPort)); + v_noBoolWarning := + f_EPTF_HTTP_RemoteTransport_addPortToGroup(vl_grpId); + } + case (5) { // remove port from port + vl_grpId := float2int(rnd() * int2float(vl_hPort)); + f_EPTF_HTTP_RemoteTransport_removePortFromGroup(vl_grpId); + } + case (6) { // remove port from port again + vl_grpId := float2int(rnd() * int2float(vl_hPort)); + f_EPTF_HTTP_RemoteTransport_removePortFromGroup(vl_grpId); + } + case (7) { // remove port from port again + vl_grpId := float2int(rnd() * int2float(vl_hPort)); + var integer vl_sessionId := 1; + v_noBoolWarning := + f_EPTF_HTTP_RemoteTransport_connectionOpen(vl_grpId,vl_sessionId); + } + case (8) { // remove port from port again + vl_grpId := float2int(rnd() * int2float(vl_hPort)); + f_EPTF_HTTP_RemoteTransport_connectionClose(vl_grpId); + } + case (9) { // remove port from port again + vl_grpId := float2int(rnd() * int2float(vl_hPort)); + f_EPTF_HTTP_RemoteTransport_connectionHalfClose(vl_grpId); + } + case (10) { // remove port from port again + vl_grpId := float2int(rnd() * int2float(vl_hPort)); + f_EPTF_HTTP_RemoteTransport_sendMessage(vl_grpId, 0, char2oct("ABCD")); + } + case (11) { // close port of user + vl_grpId := float2int(rnd() * int2float(vl_hPort)); + f_EPTF_HTTP_RemoteTransport_closePortOfUser(vl_grpId, 0); + } + case (12) { // free port of user + vl_grpId := float2int(rnd() * int2float(vl_hPort)); + f_EPTF_HTTP_RemoteTransport_freePortOfUser(vl_grpId, 0); + } + case else { + log("Wrong operation!"); + } + } + } + + f_EPTF_Base_cleanup_CT(); + + setverdict(pass); +} + +////========================================================================= +// real connection test for port object +// instant open / close / open for single port +testcase tc_EPTF_HTTP_Test_test5() +runs on EPTF_HTTP_Test_LocalAPI_CT +{ + log("=============================="); + log("<< Starting test case 5 ... >>"); + log("=============================="); + log(""); + + var EPTF_HTTP_HostInformation vl_local, vl_remote; + var integer vl_group, vl_dummy, vl_tcIdx := 5; + var boolean vl_bNoW, vl_pass := true; + + // create components + f_EPTF_HTTP_Test_createResponder(vl_tcIdx, 12.0); + + // init base component + v_noIntWarning := f_EPTF_HTTP_LocalTransport_init_CT("EPTF_HTTP_Transport"); + + // init testcase + vl_local := { tsp_EPTF_HTTP_Test_Application1_host, tsp_EPTF_HTTP_Test_Application1_port }; + vl_remote := { tsp_EPTF_HTTP_Test_Responder_host, tsp_EPTF_HTTP_Test_Responder_port + vl_tcIdx }; + + vl_group := f_EPTF_HTTP_LocalTransport_newPort( // connection set to open instantly + {"MyLittlePorty", vl_local, vl_remote, false, false, false, omit}); + + if (vl_pass and vl_group != 0) { + log("Wrong group id acquired! (", vl_group, ")"); + vl_pass := false; + setverdict(fail); + } + + if (vl_pass and not f_EPTF_HTTP_Test_checkPortState(vl_group, 0, OPENED, 1, true, true, false)) { + vl_pass := false; + setverdict(fail); + } + + + if (vl_pass) { + log("Starting altstep!"); + + var integer vl_actionCnt := 0; + timer t_action := 1.0; + timer t_guard := 12.0; + t_action.start; + t_guard.start; + alt { +/* [] IPL4_PCO.receive(ASP_RecvFrom:?) -> value v_ASP_RecvFrom { + log("ASP receive from: ", v_ASP_RecvFrom); + repeat; + } + [] IPL4_PCO.receive(ASP_Event:?) -> value v_ASP_Event { + log("ASP event: ", v_ASP_Event); + repeat; + } + [] IPL4_PCO.receive { + log("Invalid message received!"); + repeat; + }*/ + [] t_action.timeout { + if (vl_actionCnt == 0) { // reopen connection + var integer vl_sessionId := 1; + vl_bNoW := f_EPTF_HTTP_LocalTransport_connectionOpen(vl_group, vl_sessionId); + + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, 0, OPENED, 1, true, true, false)) { + vl_pass := false; + setverdict(fail); + } else { + t_action.start; + } + } + else + if (vl_actionCnt == 1) { // send message + + v_HTTP_oct := f_EPTF_HTTP_Test_DummyHTTPRequest("AABBCC"); + f_EPTF_HTTP_LocalTransport_sendMessage(vl_group, 0, v_HTTP_oct); + //var integer vl_dec := dec_HTTPMessage(v_HTTP_oct, v_HTTP_msg); + //log("Sending (", vl_dec, "): ", v_HTTP_msg); + + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, 0, OPENED, 1, true, true, true)) { + vl_pass := false; + setverdict(fail); + } else { + t_action.start; + } + } + else + if (vl_actionCnt == 2) { // send message + + v_HTTP_oct := f_EPTF_HTTP_Test_DummyHTTPRequest("CCBBAA"); + f_EPTF_HTTP_LocalTransport_sendMessage(vl_group, 1, v_HTTP_oct); + //var integer vl_dec := dec_HTTPMessage(v_HTTP_oct, v_HTTP_msg); + //log("Sending (", vl_dec, "): ", v_HTTP_msg); + + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, 0, OPENED, 1, true, true, true)) { + vl_pass := false; + setverdict(fail); + } else { + t_action.start; + } + } + else + if (vl_actionCnt == 3) { // half close connection + f_EPTF_HTTP_LocalTransport_connectionHalfClose(vl_group); + + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, 0, HALFCLOSED, 1, true, true, true)) { + vl_pass := false; + setverdict(fail); + } else { + t_action.start; + } + } + else + if (vl_actionCnt == 4) { // rehalf close connection + f_EPTF_HTTP_LocalTransport_connectionHalfClose(vl_group); + + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, 0, HALFCLOSED, 1, true, true, true)) { + vl_pass := false; + setverdict(fail); + } else { + t_action.start; + } + } + else + if (vl_actionCnt == 5) { // close connection + f_EPTF_HTTP_LocalTransport_connectionClose(vl_group); + + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, 0, IDLE, -1, false, false, false)) { + vl_pass := false; + setverdict(fail); + } else { + t_action.start; + } + } + else + if (vl_actionCnt == 6) { // reclose connection + f_EPTF_HTTP_LocalTransport_connectionClose(vl_group); + + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, 0, IDLE, -1, false, false, false)) { + vl_pass := false; + setverdict(fail); + } + + //t_action.start; + } + + vl_actionCnt := vl_actionCnt + 1; + + repeat; + } + [] t_guard.timeout { + log("Timer timed out!"); + } + } + + } + + if (vl_pass) { + f_EPTF_HTTP_LocalTransport_closeConnection_defaultGroup(vl_group); + f_EPTF_HTTP_LocalTransport_deletePort(vl_group); + + if (f_EPTF_FBQ_itemIsBusy(vl_group, v_EPTF_HTTP_Transport_groupQueue)) { + log("Group not deleted properly!"); + vl_pass := false; + setverdict(fail); + } + } + + f_EPTF_Base_cleanup_CT(); + + if (vl_pass) { setverdict(pass); }; +} + +////========================================================================= +// real connection test for port object +// instant open / close / open for single port +testcase tc_EPTF_HTTP_Test_test6() +runs on EPTF_HTTP_Test_LocalAPI_CT +{ + log("=============================="); + log("<< Starting test case 6 ... >>"); + log("=============================="); + log(""); + + var EPTF_HTTP_HostInformation vl_local, vl_remote; + var integer i, vl_group, vl_dummy, vl_tcIdx := 6; + var boolean vl_bNoW, vl_pass := true; + + // create components + f_EPTF_HTTP_Test_createResponder(vl_tcIdx, 12.0); + + // init base component + v_noIntWarning := f_EPTF_HTTP_LocalTransport_init_CT("EPTF_HTTP_Transport"); + + // init testcase + vl_local := { tsp_EPTF_HTTP_Test_Application1_host, tsp_EPTF_HTTP_Test_Application1_port + 1 }; + vl_remote := { tsp_EPTF_HTTP_Test_Responder_host, tsp_EPTF_HTTP_Test_Responder_port + vl_tcIdx }; + + vl_group := f_EPTF_HTTP_LocalTransport_newPortGroup( // connection set to open instantly + {"MyLittleGroupy", vl_local, vl_remote, 3, 1, 0, false, false, false, omit}); + + if (vl_pass and vl_group != 0) { + log("Wrong group id acquired! (", vl_group, ")"); + vl_pass := false; + setverdict(fail); + } + + for (i := 0; i < 3; i := i + 1) { + if (vl_pass and not f_EPTF_HTTP_Test_checkPortState(vl_group, i, OPENED, i + 1, true, true, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + + if (vl_pass) { + log("Starting altstep!"); + + var integer vl_actionCnt := 0; + timer t_action := 1.0; + timer t_guard := 12.0; + t_action.start; + t_guard.start; + alt { +/* [] IPL4_PCO.receive(ASP_RecvFrom:?) -> value v_ASP_RecvFrom { + log("ASP receive from: ", v_ASP_RecvFrom); + repeat; + } + [] IPL4_PCO.receive(ASP_Event:?) -> value v_ASP_Event { + log("ASP event: ", v_ASP_Event); + repeat; + } + [] IPL4_PCO.receive { + log("Invalid message received!"); + repeat; + }*/ + [] t_action.timeout { + if (vl_actionCnt == 0) { // reopen connection + log("Action: ", vl_actionCnt+1); + var integer vl_sessionId := 1; + vl_bNoW := f_EPTF_HTTP_LocalTransport_connectionOpen(vl_group, vl_sessionId); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, OPENED, i + 1, true, true, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 1) { // reopen connection + log("Action: ", vl_actionCnt+1); + for (i := 0; i < 4; i := i + 1) { + v_HTTP_oct := f_EPTF_HTTP_Test_DummyHTTPRequest("AABBCC" & int2str(i)); + f_EPTF_HTTP_LocalTransport_sendMessage(vl_group, vl_actionCnt, v_HTTP_oct); + //var integer vl_dec := dec_HTTPMessage(v_HTTP_oct, v_HTTP_msg); + //log("Sending (", vl_dec, "): ", v_HTTP_msg); + + } + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, OPENED, i + 1, true, true, true)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 2) { // half close connection + log("Action: ", vl_actionCnt+1); + f_EPTF_HTTP_LocalTransport_connectionHalfClose(vl_group); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, HALFCLOSED, i + 1, true, true, true)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 3) { // re half close connection + log("Action: ", vl_actionCnt+1); + f_EPTF_HTTP_LocalTransport_connectionHalfClose(vl_group); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, HALFCLOSED, i + 1, true, true, true)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 4) { // close connection + log("Action: ", vl_actionCnt+1); + f_EPTF_HTTP_LocalTransport_closeConnection_defaultGroup(vl_group); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, IDLE, -1, false, false, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 5) { // reclose connection + log("Action: ", vl_actionCnt+1); + f_EPTF_HTTP_LocalTransport_connectionClose(vl_group); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, IDLE, -1, false, false, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + + //t_action.start; + } + + vl_actionCnt := vl_actionCnt + 1; + + repeat; + } + [] t_guard.timeout { + log("Timer timed out!"); + } + } + + } + + if (vl_pass) { + f_EPTF_HTTP_LocalTransport_connectionClose(vl_group); + f_EPTF_HTTP_LocalTransport_deletePortGroup(vl_group); + + if (f_EPTF_FBQ_itemIsBusy(vl_group, v_EPTF_HTTP_Transport_groupQueue)) { + log("Group not deleted properly!"); + vl_pass := false; + setverdict(fail); + } + } + + f_EPTF_Base_cleanup_CT(); + + if (vl_pass) { setverdict(pass); }; +} + +// Creates 20 entity and a single global port to send against HTTP responder +// Test case passes if sent messages bodies are received from HTTP responder +// and if state transitions are performed properly +// Instant connection open and close disabled +// LocalTransport mode +// Responder runs for 10.0 seconds -> will stop during test +// LoadGen(s) run for 13.0 secodns -> receive conn close events after 10.0 seconds +// mtc runs for 15.0 seconds +testcase tc_EPTF_HTTP_Test_test7() +runs on EPTF_HTTP_Test_CT +{ + log("=============================="); + log("<< Starting test case 7 ... >>"); + log("=============================="); + log(""); + + // set config + v_numberOfLGens1 := 1; + v_numberOfLGens2 := 0; + + f_EPTF_Base_init_CT("MTC Base"); + + // check config + if (not f_EPTF_HTTP_Test_checkConfig()) { log("Wrong config!"); setverdict(fail); } + else + { + // create components + var float vl_rRunTime := 14.0; + f_EPTF_HTTP_Test_createResponder(7, vl_rRunTime); + f_EPTF_HTTP_Test_createApplConfig1(7, 20, 13.0, vl_rRunTime, true, true, -1, false, false); + //f_createApplConfig2(); + } + + timer t_guard := 20.0; + t_guard.start; + t_guard.timeout; + + f_EPTF_Base_cleanup_CT(); +} + +// Creates 20 entity with single ports to send against HTTP responder +// Test case passes if sent messages bodies are received from HTTP responder +// and if state transitions are performed properly +// Instant connection open and close disabled +// LocalTransport mode +// Responder runs for 10.0 seconds -> will stop during test +// LoadGen(s) run for 13.0 secodns -> receive conn close events after 10.0 seconds +// mtc runs for 15.0 seconds +testcase tc_EPTF_HTTP_Test_test8() +runs on EPTF_HTTP_Test_CT +{ + log("=============================="); + log("<< Starting test case 8 ... >>"); + log("=============================="); + log(""); + + // set config + v_numberOfLGens1 := 1; + v_numberOfLGens2 := 0; + + f_EPTF_Base_init_CT("MTC Base"); + + // check config + if (not f_EPTF_HTTP_Test_checkConfig()) { log("Wrong config!"); setverdict(fail); } + else + { + // create components + var float vl_rRunTime := 14.0; + f_EPTF_HTTP_Test_createResponder(8, vl_rRunTime); + f_EPTF_HTTP_Test_createApplConfig1(8, 20, 13.0, vl_rRunTime, true, false, -1, false, false); + //f_createApplConfig2(); + } + + timer t_guard := 15.0; + t_guard.start; + t_guard.timeout; + + f_EPTF_Base_cleanup_CT(); +} + +// Creates 20 entity and a single global port group containing to ports +// to send against HTTP responder +// Test case passes if sent messages bodies are received from HTTP responder +// and if state transitions are performed properly +// Instant connection open and close disabled +// LocalTransport mode +// Responder runs for 10.0 seconds -> will stop during test +// LoadGen(s) run for 13.0 secodns -> receive conn close events after 10.0 seconds +// mtc runs for 15.0 seconds +testcase tc_EPTF_HTTP_Test_test9() +runs on EPTF_HTTP_Test_CT +{ + log("=============================="); + log("<< Starting test case 9 ... >>"); + log("=============================="); + log(""); + + // set config + v_numberOfLGens1 := 1; + v_numberOfLGens2 := 0; + + f_EPTF_Base_init_CT("MTC Base"); + + // check config + if (not f_EPTF_HTTP_Test_checkConfig()) { log("Wrong config!"); setverdict(fail); } + else + { + // create components + var float vl_rRunTime := 14.0; + f_EPTF_HTTP_Test_createResponder(9, vl_rRunTime); + f_EPTF_HTTP_Test_createApplConfig1(9, 20, 13.0, vl_rRunTime, false, true, 2, false, false); + //f_createApplConfig2(); + } + + timer t_guard := 15.0; + t_guard.start; + t_guard.timeout; + + f_EPTF_Base_cleanup_CT(); +} + +// Creates 20 entity with global port groups containing two port +// to send against HTTP responder +// Test case passes if sent messages bodies are received from HTTP responder +// and if state transitions are performed properly +// Instant connection open and close disabled +// LocalTransport mode +// Responder runs for 10.0 seconds -> will stop during test +// LoadGen(s) run for 13.0 secodns -> receive conn close events after 10.0 seconds +// mtc runs for 15.0 seconds +testcase tc_EPTF_HTTP_Test_test10() +runs on EPTF_HTTP_Test_CT +{ + log("==============================="); + log("<< Starting test case 10 ... >>"); + log("==============================="); + log(""); + + // set config + v_numberOfLGens1 := 1; + v_numberOfLGens2 := 0; + + f_EPTF_Base_init_CT("MTC Base"); + + // check config + if (not f_EPTF_HTTP_Test_checkConfig()) { log("Wrong config!"); setverdict(fail); } + else + { + // create components + var float vl_rRunTime := 14.0; + f_EPTF_HTTP_Test_createResponder(10, vl_rRunTime); + f_EPTF_HTTP_Test_createApplConfig1(10, 20, 13.0, vl_rRunTime, false, false, 2, false, false); + //f_createApplConfig2(); + } + + timer t_guard := 15.0; + t_guard.start; + t_guard.timeout; + + f_EPTF_Base_cleanup_CT(); +} + +// Creates 20 entity with single ports to send against HTTP responder +// Test case passes if sent messages bodies are received from HTTP responder +// and if state transitions are performed properly +// Instant connection open and close enabled +// LocalTransport mode +// Responder runs for 10.0 seconds -> will stop during test +// LoadGen(s) run for 13.0 secodns -> receive conn close events after 10.0 seconds +// mtc runs for 15.0 seconds +testcase tc_EPTF_HTTP_Test_test11() +runs on EPTF_HTTP_Test_CT +{ + log("==============================="); + log("<< Starting test case 11 ... >>"); + log("==============================="); + log(""); + + // set config + v_numberOfLGens1 := 1; + v_numberOfLGens2 := 0; + + f_EPTF_Base_init_CT("MTC Base"); + + // check config + if (not f_EPTF_HTTP_Test_checkConfig()) { log("Wrong config!"); setverdict(fail); } + else + { + // create components + var float vl_rRunTime := 11.0; + f_EPTF_HTTP_Test_createResponder(11, vl_rRunTime); + f_EPTF_HTTP_Test_createApplConfig1(11, 20, 10.0, vl_rRunTime, true, false, -1, true, true); + //f_createApplConfig2(); + } + + timer t_guard := 15.0; + t_guard.start; + t_guard.timeout; + + f_EPTF_Base_cleanup_CT(); +} + +// Creates 20 entity and a single global port group containing to ports +// to send against HTTP responder +// Test case passes if sent messages bodies are received from HTTP responder +// and if state transitions are performed properly +// Instant connection open and close enabled +// LocalTransport mode +// Responder runs for 11.0 seconds -> will not stop during test +// LoadGen(s) run for 10.0 secodns -> doesn't receive conn close events after 10.0 seconds +// mtc runs for 15.0 seconds +testcase tc_EPTF_HTTP_Test_test12() +runs on EPTF_HTTP_Test_CT +{ + log("==============================="); + log("<< Starting test case 12 ... >>"); + log("==============================="); + log(""); + + // set config + v_numberOfLGens1 := 1; + v_numberOfLGens2 := 0; + + f_EPTF_Base_init_CT("MTC Base"); + + // check config + if (not f_EPTF_HTTP_Test_checkConfig()) { log("Wrong config!"); setverdict(fail); } + else + { + // create components + var float vl_rRunTime := 11.0; + f_EPTF_HTTP_Test_createResponder(12, vl_rRunTime); + f_EPTF_HTTP_Test_createApplConfig1(12, 20, 10.0, vl_rRunTime, false, true, 20, true, true); + //f_createApplConfig2(); + } + + timer t_guard := 15.0; + t_guard.start; + t_guard.timeout; + + f_EPTF_Base_cleanup_CT(); +} + +// Creates 20 entity with global port groups containing two port +// to send against HTTP responder +// Test case passes if sent messages bodies are received from HTTP responder +// and if state transitions are performed properly +// Instant connection open and close disabled +// LocalTransport mode +// Responder runs for 11.0 seconds -> will not stop during test +// LoadGen(s) run for 10.0 secodns -> doesn't receive conn close events after 10.0 seconds +// mtc runs for 15.0 seconds +testcase tc_EPTF_HTTP_Test_test13() +runs on EPTF_HTTP_Test_CT +{ + log("==============================="); + log("<< Starting test case 13 ... >>"); + log("==============================="); + log(""); + + // set config + v_numberOfLGens1 := 1; + v_numberOfLGens2 := 0; + + f_EPTF_Base_init_CT("MTC Base"); + + // check config + if (not f_EPTF_HTTP_Test_checkConfig()) { log("Wrong config!"); setverdict(fail); } + else + { + // create components + var float vl_rRunTime := 11.0; + f_EPTF_HTTP_Test_createResponder(13, vl_rRunTime); + f_EPTF_HTTP_Test_createApplConfig1(13, 20, 10.0, vl_rRunTime, false, false, 2, true, true); + //f_createApplConfig2(); + } + + timer t_guard := 15.0; + t_guard.start; + t_guard.timeout; + + f_EPTF_Base_cleanup_CT(); +} + +// Creates 20 entity with global port groups containing two port +// to send against HTTP responder +// Test case passes if sent messages bodies are received from HTTP responder +// and if state transitions are performed properly +// Instant connection open and close disabled +// RemoteTransport mode +// Responder runs for 10.0 seconds -> will stop during test +// LoadGen(s) run for 13.0 secodns -> receive conn close events after 10.0 seconds +// mtc runs for 15.0 seconds +testcase tc_EPTF_HTTP_Test_test14() +runs on EPTF_HTTP_Test_CT +{ + log("=============================="); + log("<< Starting test case 14 ... >>"); + log("=============================="); + log(""); + + // set config + v_numberOfLGens1 := 2; + v_numberOfLGens2 := 0; + + f_EPTF_Base_init_CT("MTC Base"); + + // check config + if (not f_EPTF_HTTP_Test_checkConfig()) { log("Wrong config!"); setverdict(fail); } + else + { + // create components + var float vl_rRunTime := 5.0; + f_EPTF_HTTP_Test_createResponder(14, vl_rRunTime + 0.5); + f_EPTF_HTTP_Test_createApplConfig1(14, 5, vl_rRunTime, vl_rRunTime + 0.5, false, false, 2, false, false); + } + + timer t_guard := 15.0; + t_guard.start; + t_guard.timeout; + f_EPTF_Base_cleanup_CT(); +} + +template EPTF_HTTP_Transport_PortInfoList t_expectedPorts1 := { + { + groupIndex := 0, + portIndex := 0, + connectionId := 1, + sessionId := 100, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := OPENED, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 1, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 1, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 2, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 2, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } +} + +template EPTF_HTTP_Transport_PortInfoList t_expectedPorts2 := { + { + groupIndex := 0, + portIndex := 0, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 1, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 1, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 2, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 2, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } +} + +template EPTF_HTTP_Transport_PortInfoList t_expectedPorts3 := { + { + groupIndex := 0, + portIndex := 0, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 1, + connectionId := 2, + sessionId := 200, + portId := -1, + localhostInfoIdx := 1, + remotehostInfoIdx := 0, + state := OPENED, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 2, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 2, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } +} + +template EPTF_HTTP_Transport_PortInfoList t_expectedPorts4 := { + { + groupIndex := 0, + portIndex := 0, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 0, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 1, + connectionId := 2, + sessionId := -1, + portId := -1, + localhostInfoIdx := 1, + remotehostInfoIdx := 0, + state := OPENED, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + }, + { + groupIndex := 0, + portIndex := 2, + connectionId := -1, + sessionId := -1, + portId := -1, + localhostInfoIdx := 2, + remotehostInfoIdx := 0, + state := IDLE, + portType := OUTGOING_PORT, + buffer := false, + messageBuffer := omit + } +} + +////========================================================================= +// test new close and free port of user API +// local API +testcase tc_EPTF_HTTP_Test_test15() +runs on EPTF_HTTP_Test_LocalAPI_CT +{ + log("=============================="); + log("<< Starting test case 15 ... >>"); + log("=============================="); + log(""); + + var EPTF_HTTP_HostInformation vl_local, vl_remote; + var integer i, vl_group, vl_dummy, vl_tcIdx := 15; + var boolean vl_pass := true; + + // create components + f_EPTF_HTTP_Test_createResponder(vl_tcIdx, 12.0); + + // init base component + v_noIntWarning := f_EPTF_HTTP_LocalTransport_init_CT("EPTF_HTTP_Transport"); + + // init testcase + vl_local := { tsp_EPTF_HTTP_Test_Application1_host, tsp_EPTF_HTTP_Test_Application1_port + 3*10 + 100 * vl_tcIdx }; + vl_remote := { tsp_EPTF_HTTP_Test_Responder_host, tsp_EPTF_HTTP_Test_Responder_port + vl_tcIdx }; + + vl_group := f_EPTF_HTTP_LocalTransport_newPortGroup( // connection set to open instantly + {"MyLittleGroupy", vl_local, vl_remote, 3, 1, 0, true, false, false, omit}); + + v_HTTP_oct := f_EPTF_HTTP_Test_DummyHTTPRequest("AABBCC"); + f_EPTF_HTTP_LocalTransport_sendMessage(vl_group, 100, v_HTTP_oct); + log("Port DB #1", v_EPTF_HTTP_Transport_portDB); + + if (not match(v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase, t_expectedPorts1)) { + log("Database inconsistency after sending on port group!"); + log(match(v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase, t_expectedPorts1)); + vl_pass := false; + setverdict(fail); + } + + if (vl_pass) + { + f_EPTF_HTTP_LocalTransport_closePortOfUser(vl_group, 100); + log("Port DB #2", v_EPTF_HTTP_Transport_portDB); + + if (not match(v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase, t_expectedPorts2)) { + log("Database inconsistency after closing port of user!"); + log(match(v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase, t_expectedPorts2)); + vl_pass := false; + setverdict(fail); + } + } + + if (vl_pass) + { + v_HTTP_oct := f_EPTF_HTTP_Test_DummyHTTPRequest("CCBBAA"); + f_EPTF_HTTP_LocalTransport_sendMessage(vl_group, 200, v_HTTP_oct); + log("Port DB #3", v_EPTF_HTTP_Transport_portDB); + + if (not match(v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase, t_expectedPorts3)) { + log("Database inconsistency after sending on port group!"); + log(match(v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase, t_expectedPorts3)); + vl_pass := false; + setverdict(fail); + } + } + + if (vl_pass) + { + f_EPTF_HTTP_LocalTransport_freePortOfUser(vl_group, 200); + log("Port DB #4", v_EPTF_HTTP_Transport_portDB); + + if (not match(v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase, t_expectedPorts4)) { + log("Database inconsistency after freeing port of user!"); + log(match(v_EPTF_HTTP_Transport_portDB[vl_group].portDatabase, t_expectedPorts4)); + vl_pass := false; + setverdict(fail); + } + } + + f_EPTF_HTTP_LocalTransport_deletePort(vl_group); + + f_EPTF_Base_cleanup_CT(); + + if (vl_pass) { setverdict(pass); }; +} + +// Creates 20 entity and a single global port group containing to ports +// to send against HTTP responder +// Test case passes if reconnection to the Responder is successful +// after the Responder is explicitly shut and restarted +// Instant connection open enabled and instant connection close enabled +// LocalTransport mode +testcase tc_EPTF_HTTP_Test_test16() +runs on EPTF_HTTP_Test_CT +{ + log("=============================="); + log("<< Starting test case 16 ... >>"); + log("=============================="); + log(""); + + var boolean vl_pass := true; + + // set config + v_numberOfLGens1 := 1; + v_numberOfLGens2 := 0; + + f_EPTF_Base_init_CT("MTC Base"); + f_EPTF_Var_init_CT("MTC Var"); + + var float vl_rRunTime := 5.5; + var float vl_serverDownTime := 2.1; + + // check config + if (not f_EPTF_HTTP_Test_checkConfig()) { log("Wrong config!"); setverdict(fail); } + else + { + // create components + f_EPTF_HTTP_Test_createResponder(16, vl_rRunTime); + f_EPTF_HTTP_Test_createApplConfig1(16, 20, + 2.0 * vl_rRunTime + vl_serverDownTime - 0.5, // application running time - 0.5 to surely die before responder dies for the 2nd time + 2.0 * vl_rRunTime + 1.0, + false, true, 20, true, true); + + // 20 is the number of ports in the created group, on Rhea it must be greater then the number of sends as in instant connection + // opend and close mode, the ports are reused but they cannot be reopened again within a given (OS defined) time limit + } + + timer t_guard := vl_rRunTime + 0.5; + t_guard.start; + t_guard.timeout; + + // responder should die now + log("*** Responder must be dead now! ***"); + + f_EPTF_Var_subscribeRemote( // subscribe to the number of received answers EPTF variable + v_HTTP_Local1_comps[0], "NumberOfReceivedAnswers", + realtime, + v_nofAnswers, "MYNumberOfReceivedAnswers"); + + var integer vl_nofAnswers_current := f_EPTF_Var_getIntValue(v_nofAnswers); + log("Number of messages arrived to local lgen from responder (after first deth of responder): ", vl_nofAnswers_current); + + if (vl_pass) + { + if (vl_nofAnswers_current != float2int(vl_rRunTime) + 1) { // first message at zero time + float2int(vl_rRunTime) messages (at 1 CPS) + log("Number of incoming messages from HTTP responder (", vl_nofAnswers_current, + ") are inconsistent with test case settings (Before Responder restart)!"); + vl_pass := false; + setverdict(fail); + } + else + if (v_HTTP_Responder_comp.running) { + log("Responder is still alive! Test case error"); + vl_pass := false; + setverdict(fail); + } + } + + if (vl_pass) + { + t_guard.start(vl_serverDownTime); // wait X sec before restarting responder + t_guard.timeout; + + // recreate responder + log("*** Responder is being restarted now! ***"); + + f_EPTF_HTTP_Test_createResponder(16, vl_rRunTime); + + t_guard.start(vl_rRunTime + 1.0); + t_guard.timeout; + + // responder should be dead now + log("*** Responder must be dead now again! ***"); + + vl_nofAnswers_current := f_EPTF_Var_getIntValue(v_nofAnswers); + log("Number of messages arrived to local lgen from responder (Second responder die)!: ", vl_nofAnswers_current); + + if (vl_pass) + { + if (vl_nofAnswers_current != 2 * (float2int(vl_rRunTime) + 1) - 2) { // second part misses first and last message according to time configurations + log("Number of incoming messages from HTTP responder (", vl_nofAnswers_current, + ") are inconsistent with test case settings (After Responder restart)!"); + vl_pass := false; + setverdict(fail); + } + } + } + f_EPTF_Base_cleanup_CT(); +} + +////========================================================================= +// errornous connection test for port object +// instant open / close / open for single port +// connection is bad tsp_EPTF_HTTP_Test_NonExistent_host should be a non existent host +// testcase will pass if connection is failed +testcase tc_EPTF_HTTP_Test_test17() +runs on EPTF_HTTP_Test_LocalAPI_CT +{ + log("=============================="); + log("<< Starting test case 17 ... >>"); + log("=============================="); + log(""); + + var EPTF_HTTP_HostInformation vl_local, vl_remote; + var integer i, vl_group, vl_dummy, vl_tcIdx := 6; + var boolean vl_bNoW, vl_pass := true; + + // create components + f_EPTF_HTTP_Test_createResponder(vl_tcIdx, 12.0); + + // init base component + f_EPTF_HTTP_init( + "APPL1_LGEN", + 1, + "HTTP1_", + 0); //, pl_bind, pl_reset, pl_unbind); + + v_noIntWarning := f_EPTF_HTTP_LocalTransport_init_CT( + "EPTF_HTTP_Transport", + refers(f_EPTF_HTTP_messageReceived), + refers(f_EPTF_HTTP_eventReceived), + refers(f_EPTF_HTTP_socketErrorReceived)); + + // init testcase + vl_local := { tsp_EPTF_HTTP_Test_NonExistent_host, tsp_EPTF_HTTP_Test_Application1_port + 1 }; + vl_remote := { tsp_EPTF_HTTP_Test_NonExistent_host, tsp_EPTF_HTTP_Test_Responder_port + vl_tcIdx }; + + vl_group := f_EPTF_HTTP_LocalTransport_newPortGroup( // connection set to open instantly + {"MyLittleGroupy", vl_local, vl_remote, 3, 1, 0, true, true, false, omit}); + + if (vl_pass and vl_group != 0) { + log("Wrong group id acquired! (", vl_group, ")"); + vl_pass := false; + setverdict(fail); + } + + for (i := 0; i < 3; i := i + 1) { + if (vl_pass and not f_EPTF_HTTP_Test_checkPortState(vl_group, i, IDLE, -1, false, false, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + + if (vl_pass) { + log("Starting altstep!"); + + var integer vl_actionCnt := 0; + timer t_action := 1.0; + timer t_guard := 12.0; + t_action.start; + t_guard.start; + alt { +/* [] IPL4_PCO.receive(ASP_RecvFrom:?) -> value v_ASP_RecvFrom { + log("ASP receive from: ", v_ASP_RecvFrom); + repeat; + } + [] IPL4_PCO.receive(ASP_Event:?) -> value v_ASP_Event { + log("ASP event: ", v_ASP_Event); + repeat; + } + [] IPL4_PCO.receive { + log("Invalid message received!"); + repeat; + }*/ + [] t_action.timeout { + if (vl_actionCnt == 0) { // reopen connection + log("Action: ", vl_actionCnt+1); + var integer vl_sessionId := 1; + vl_bNoW := f_EPTF_HTTP_LocalTransport_connectionOpen(vl_group,vl_sessionId); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, IDLE, -1, false, false, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 1) { // reopen connection + log("Action: ", vl_actionCnt+1); + for (i := 0; i < 4; i := i + 1) { + v_HTTP_oct := f_EPTF_HTTP_Test_DummyHTTPRequest("AABBCC" & int2str(i)); + f_EPTF_HTTP_LocalTransport_sendMessage(vl_group, vl_actionCnt, v_HTTP_oct); + //var integer vl_dec := dec_HTTPMessage(v_HTTP_oct, v_HTTP_msg); + //log("Sending (", vl_dec, "): ", v_HTTP_msg); + + } + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, IDLE, -1, false, false, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 2) { // half close connection + log("Action: ", vl_actionCnt+1); + f_EPTF_HTTP_LocalTransport_connectionHalfClose(vl_group); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, IDLE, -1, false, false, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 3) { // re half close connection + log("Action: ", vl_actionCnt+1); + f_EPTF_HTTP_LocalTransport_connectionHalfClose(vl_group); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, IDLE, -1, false, false, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 4) { // close connection + log("Action: ", vl_actionCnt+1); + f_EPTF_HTTP_LocalTransport_closeConnection_defaultGroup(vl_group); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, IDLE, -1, false, false, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + if (vl_pass) { t_action.start; } + } + else + if (vl_actionCnt == 5) { // reclose connection + log("Action: ", vl_actionCnt+1); + f_EPTF_HTTP_LocalTransport_connectionClose(vl_group); + + for (i := 0; i < 3; i := i + 1) { + if (not f_EPTF_HTTP_Test_checkPortState(vl_group, i, IDLE, -1, false, false, false)) { + vl_pass := false; i := 3; + setverdict(fail); + } + } + + //t_action.start; + } + + vl_actionCnt := vl_actionCnt + 1; + + repeat; + } + [] t_guard.timeout { + log("Timer timed out!"); + } + } + + } + + if (vl_pass) { + f_EPTF_HTTP_LocalTransport_connectionClose(vl_group); + f_EPTF_HTTP_LocalTransport_deletePortGroup(vl_group); + + if (f_EPTF_FBQ_itemIsBusy(vl_group, v_EPTF_HTTP_Transport_groupQueue)) { + log("Group not deleted properly!"); + vl_pass := false; + setverdict(fail); + } + } + + f_EPTF_Base_cleanup_CT(); + + if (vl_pass) { setverdict(pass); }; +} + +testcase tc_EPTF_HTTP_Test_test18() +runs on EPTF_HTTP_Test_LocalAPI_CT +{ + log("=============================="); + log("<< Starting test case 18 ... >>"); + log("=============================="); + log(""); + + f_EPTF_int2int_HashMap_Init(); + f_EPTF_Logging_init_CT("TEST_"); + v_EPTF_HTTP_Transport_loggingMaskId := + f_EPTF_Logging_registerComponentMasks( + tsp_EPTF_HTTP_Transport_loggingComponentMask, + c_EPTF_HTTP_Transport_loggingEventClasses, + EPTF_Logging_CLL); + + setverdict(pass); + f_EPTF_HTTP_Test_bufferTest(5, 0); + f_EPTF_HTTP_Test_bufferTest(5, 3); + f_EPTF_HTTP_Test_bufferTest(5, 4); +} + +testcase tc_EPTF_HTTP_Test_test19() +runs on EPTF_HTTP_Test_LocalAPI_CT +{ + log("=============================="); + log("<< Starting test case 19 ... >>"); + log("=============================="); + log(""); + + var EPTF_HTTP_setAuthData vl_EPTF_HTTP_setAuthData:={ + method:="", + algorithm:="", + realm:="", + domain:=omit, + qopOptions:="", + password:="password" + }; + + f_EPTF_HTTP_setAuthData(vl_EPTF_HTTP_setAuthData); + + setverdict(pass); + + var charstring vl_authData := "Digest algorithm=MD5, cnonce=\"0a4f113b\", nc=00000001, nonce=\"NGExMTY0MDiDrxJA7/5a8Ya0lZvlaNXuEw==\", opaque=\"\", qop=auth-int, realm=\"access.telekom.de\", response=\"ef57ea40d83403357c16306cd6b811a2\", uri=\"/\", username=\"TASP-SOAP1\""; + + var EPTF_HTTP_AuthDetails vl_authDetails := c_EPTF_HTTP_initAuthDetails; + + var EPTF_HTTP_AuthDetails vl_authDetailsExpected := { + realm := "access.telekom.de", + qop := "auth-int", + nonce := "NGExMTY0MDiDrxJA7/5a8Ya0lZvlaNXuEw==", + cnonce := "0a4f113b", + opaque := c_EPTF_HTTP_initAuthDetails.opaque, + nonceCount := "00000001", + algorithm := "MD5", + response := "ef57ea40d83403357c16306cd6b811a2", + uri := "/", + username := "TASP-SOAP1", + password := c_EPTF_HTTP_initAuthDetails.password + } + + + f_EPTF_HTTP_getAuthParams(vl_authData, vl_authDetails); + + if (vl_authDetails != vl_authDetailsExpected) + { + log("Error: retrieved: ", vl_authDetails, " expected: ", vl_authDetailsExpected); + setverdict(fail); + } + +/* var charstring vl_body := "<?xml version='1.0' ?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.w3.org/2003/05/soap-envelope soap-envelope.xml http://dummydomain.telekom.de/LISA/VoIPNotruf_1_00 VoIPNotruf_1_00.xsd\" >\n<env:Header><lisa:emergencyInformationRequest xmlns:lisa=\"http://dummydomain.telekom.de/LISA/VoIPNotruf_1_00\" env:role=\"next\" env:mustUnderstand=\"true\">\n<lisa:interfaceVersion>1</lisa:interfaceVersion>\n</lisa:emergencyInformationRequest>\n</env:Header>\n<env:Body><lisa:emergencyInformationRequestData xmlns:lisa=\"http://dummydomain.telekom.de/LISA/VoIPNotruf_1_00\">\n<lisa:emergencyNumber>110</lisa:emergencyNumber>\n<lisa:clientIPAddress>217.89.24.10</lisa:clientIPAddress>\n</lisa:emergencyInformationRequestData>\n</env:Body>\n</env:Envelope>" + + if (not f_EPTF_HTTP_checkAuthData("POST", vl_authData, vl_body)) + { + log("Error: auth data checking."); + setverdict(fail); + }*/ +} + +/* +testcase tc_random() runs on EPTF_HTTP_Test_CT +{ + var EPTF_IntegerList vl_intList := {}; + var EPTF_FloatList vl_floatList := {}; + var integer vl_randval, i, j, vl_maxOccurance, vl_different, vl_curMax, vl_curOccurance; + var integer vl_allvalues := tsp_runningTime*tsp_QPS; + var float vl_maxNumber, vl_prev; + var integer vl_time; + + v_randState := 0.0; + + vl_time := f_time(); + + // generate random value + for (i := 0; i < vl_allvalues; i := i + 1) + { + vl_randval := float2int((int2float(tsp_rangeHi) - 0.001) * f_myRandom()); + //log("Random value: ", vl_randval); + + vl_intList[sizeof(vl_intList)] := vl_randval; + } + + log("Generated list: ", vl_intList); + + + // convert to float because of bubble sort + for (i := 0; i < sizeof(vl_intList); i := i + 1) { vl_floatList[i] := int2float(vl_intList[i]); }; + f_EPTF_StatMeasure_bubblesort(vl_floatList); + + log("Generated list (BUBBLE): ", vl_floatList); + + // sarch max occurance and its number and value of different numbers + vl_prev := vl_floatList[0]; + vl_maxNumber := -1.0; + vl_maxOccurance := 0; + vl_different := 0; + vl_curMax := -1; + vl_curOccurance := 0; + for (j := 1; j < sizeof(vl_floatList); j := j + 1) + { + vl_curOccurance := vl_curOccurance + 1; + + if (vl_floatList[j] != vl_prev) { + vl_different := vl_different + 1; + + if (vl_curOccurance > vl_maxOccurance) { + vl_maxOccurance := vl_curOccurance; + vl_maxNumber := vl_prev; + } + + vl_curOccurance := 0; + } + + vl_prev := vl_floatList[j]; + } + + vl_time := f_time() - vl_time; + + log("Running time: ", vl_time); + log("Max number and max occurance: ", float2int(vl_maxNumber), " / ", vl_maxOccurance, + " (ALL: " , vl_allvalues, " / DIFFERENT: ", vl_different, ")"); +} +*/ + +control { + execute(tc_EPTF_HTTP_Test_test1()); + execute(tc_EPTF_HTTP_Test_test2()); + execute(tc_EPTF_HTTP_Test_test3()); + execute(tc_EPTF_HTTP_Test_test4()); + execute(tc_EPTF_HTTP_Test_test5()); + execute(tc_EPTF_HTTP_Test_test6()); + execute(tc_EPTF_HTTP_Test_test7()); + execute(tc_EPTF_HTTP_Test_test8()); + execute(tc_EPTF_HTTP_Test_test9()); + execute(tc_EPTF_HTTP_Test_test10()); + execute(tc_EPTF_HTTP_Test_test11()); + execute(tc_EPTF_HTTP_Test_test12()); + execute(tc_EPTF_HTTP_Test_test13()); + execute(tc_EPTF_HTTP_Test_test14()); + execute(tc_EPTF_HTTP_Test_test15()); + execute(tc_EPTF_HTTP_Test_test16()); + execute(tc_EPTF_HTTP_Test_test17()); + execute(tc_EPTF_HTTP_Test_test18()); + execute(tc_EPTF_HTTP_Test_test19()); +} + +} |