Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » IPL4 port TCP connection problem
IPL4 port TCP connection problem [message #1749800] Mon, 12 December 2016 14:02 Go to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello everyone,

I have already used the IPL4 port to run CoAP tests on UDP and everything works ok.

Today I wanted to make the same thing, but with MQTT or HTTP (TCP), so I downloaded the corresponding Protocol Modules and the conversion works fine (at least from what I have seen), but on connection the TCP port reports an error:

MTC@egm-VirtualBox: entering f__IPL4__PROVIDER__connect: localhost:0 -> localhost:35000 / TCP
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: enter
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: create new socket: localhost:0 -> localhost:35000
MTC@egm-VirtualBox: IPL4: SetLocalSockAddr: locName: localhost loc_port 0 def_loc_host localhost, add_family AF_INET
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::setOptions: enter, number of options: 1
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::setOptions: sock: 7
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::setOptions: Socket option REUSEADDR on socket 7 is set to: 1
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::setOptions: TCP option TCP_KEEPCNT on socket 7 is set to: 20
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::setOptions: TCP option TCP_KEEPIDLE on socket 7 is set to: 180
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::setOptions: TCP option TCP_KEEPINTVL on socket 7 is set to: 60
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::setOptions: socket option SO_KEEPALIVE on socket 7 is set to: 1
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::setOptions: leave
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: sock: 7
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: error: Operation now in progress
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER: ConnAdd enter: type: 2, ssl_tls_type: 0, sock: 7, parentIx: -1
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::ConnAdd: new sockListSize: 16
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::ConnAdd: connId: 1
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::ConnAdd: connId: set ssl options for connId : 1
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::set_ssl_supp_option: set SSL options
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::ConnAdd: getpeername failed: Transport endpoint is not connected
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::ConnAdd: leave: sockListCnt: 1
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: EAGAIN: waiting in poll: fd 7   connId: 1
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: EAGAIN: poll returned: 1
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: EAGAIN: revents: 0x001D
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: EAGAIN: writable
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: Probing connection: getsockopt returned: 0, connection result code: 111
MTC@egm-VirtualBox: IPL4: f__IPL4__PROVIDER__connect: connect error: Connection refused
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::ConnDel: enter: connId: 1
MTC@egm-VirtualBox: IPL4: IPL4asp__PT_PROVIDER::ConnDel: fd: 7
MTC@egm-VirtualBox: { errorCode := ERROR_SOCKET (4), connId := omit, os_error_code := 111, os_error_text := "Connection refused" }
MTC@egm-VirtualBox: Dynamic test case error: Using the value of an optional field containing omit. (Transport endpoint is not connected)


The function that makes this connection looks like this:

function f_cf01Up() runs on ARMOURComponent{
   		var Socket_API_Definitions.Result vl_result;
   		map(mtc:IPL4, system:IPL4);
   		vl_result := IPL4asp_PortType.f_IPL4_connect(IPL4,
     		    finalConnectionParams.remHost,
     		    finalConnectionParams.remPort,
     		    finalConnectionParams.locHost,
     		    finalConnectionParams.locPort,
     		    connectionId, //pl_connectionParams.connId,
     		    {tcp := {}},    
  		);
  		log(vl_result)
  		connectionId := vl_result.connId;
	}


Am I missing something?

Thanks in advance.

Best regards,
Naum
Re: IPL4 port TCP connection problem [message #1749802 is a reply to message #1749800] Mon, 12 December 2016 14:30 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

first , please check if you have compiled the test port with the SSL option, see paragraph

2.11.1 Compilation
The usage of SSL and even the compilation of the SSL related code parts are optional. This is because SSL related code parts cannot be compiled without the OpenSSL installed.
The compilation of SSL related code parts can be disabled by not defining the IPL4_USE_SSL macro in the Makefile during the compilation. If the macro is defined in the Makefile, the SSL code parts are compiled to the executable test code. If it is not defined all SSL related request will cause an error result message about the not supported transport.


of the Description.


Pls let me know of the result.

Also , pls read the rest of the description as separating messages will be an issue we have to deal with ;
TCP will send us a stream of bytes and we have to delimit messages with an appropriate function.


Best regards
Elemer





Re: IPL4 port TCP connection problem [message #1749807 is a reply to message #1749802] Mon, 12 December 2016 15:36 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hi Elemer,

I didn't compile with that option because I don't need SSL right now (preliminary protocol test), but in the near future I will need it.

I put the macro in the Preprocessors defined symbols, with the -lssl library for Linux in Platform specific libraries, but nothing changes.


If I try to launch it from the command line, I get this:

ttcn3_start: Starting the test suite
spawn /home/egm/titan/bin/mctr_cli ../resources/ARMOURConfig.cfg

*************************************************************************
* TTCN-3 Test Executor - Main Controller 2                              *
* Version: CRL 113 200/6 R1A                                            *
* Copyright (c) 2000-2016 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                             *
*************************************************************************

Using configuration file: ../resources/ARMOURConfig.cfg
MC@egm-VirtualBox: Unix server socket created successfully.
MC@egm-VirtualBox: Listening on TCP port 17283.
MC2> egm-VirtualBox is the default
spawn ./ExportedTTCNARMOUR egm-VirtualBox 17283
TTCN-3 Host Controller (parallel mode), version CRL 113 200/5 R5B01
 ./ExportedTTCNARMOUR: Segmentation fault occurred
./ExportedTTCNARMOUR[0x6aa113]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f77b4788390]
/lib/x86_64-linux-gnu/libcrypto.so.1.0.0(BN_free+0x9)[0x7f77b4e0ad89]
./ExportedTTCNARMOUR[0x412902]
/lib/x86_64-linux-gnu/libc.so.6(+0x39ff8)[0x7f77b3b46ff8]
/lib/x86_64-linux-gnu/libc.so.6(+0x3a045)[0x7f77b3b47045]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf7)[0x7f77b3b2d837]
./ExportedTTCNARMOUR[0x40d089]
ttcn3_start: error: Host Controller with id exp7 stopped unexpectedly
exit
MC@egm-VirtualBox: Shutting down session.
MC@egm-VirtualBox: Shutdown complete.
: spawn id exp7 not open
    while executing
"expect -i $hc_id eof"
    (procedure "error_cleanup" line 6)
    invoked from within
"error_cleanup "Host Controller with id $hc_id stopped unexpectedly" 10"
    invoked from within
"expect {
    -i $hc_id -re "Dynamic test case error" {
	error_cleanup "program $ETS could not connect to the MC" 7
    } -i $hc_id -re ".*\r" {
	exp_c..."
    (file "/home/egm/titan/bin/ttcn3_start" line 243)


Best regards.
Re: IPL4 port TCP connection problem [message #1749809 is a reply to message #1749807] Mon, 12 December 2016 16:03 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

OK, now please set DEBUG in port (if not already set ), run again and attach all logs complete.

BR
Elemer
Re: IPL4 port TCP connection problem [message #1749812 is a reply to message #1749809] Mon, 12 December 2016 16:16 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Here are the logs from the run.

Don't be confused if you see three configs for MQTT, HTTP and CoAP, these are three different files that share the same adapter so it's easy for me to test the different codecs under the same project (normally, with different tests for each). Or maybe it is better to separate them in different projects?
  • Attachment: log.zip
    (Size: 7.34KB, Downloaded 67 times)
Re: IPL4 port TCP connection problem [message #1749847 is a reply to message #1749812] Tue, 13 December 2016 08:34 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum.

the two logs are not the same;

the first one shows that the connection was refused for some reason:

MTC@egm-VirtualBox: { errorCode := ERROR_SOCKET (4), connId := omit, os_error_code := 111, os_error_text := "Connection refused" }



in the second case, connection was established , a connId is returned, and the error happened somewhere in the TTCN-3 code:

17:08:58.879219 - { errorCode := omit, connId := 1, os_error_code := omit, os_error_text := omit }
17:08:58.879345 - Dynamic test case error: Using an unbound optional field. (Operation now in progress) 



In your code snippet the initial value of connectionId is unclear; I suggest the following mod:

function f_cf01Up() runs on ARMOURComponent{
   		var Socket_API_Definitions.Result vl_result;
                var ConnectionId  connectionId :=-1;
   		map(mtc:IPL4, system:IPL4);
   		vl_result := IPL4asp_PortType.f_IPL4_connect(IPL4,
     		    finalConnectionParams.remHost,
     		    finalConnectionParams.remPort,
     		    finalConnectionParams.locHost,
     		    finalConnectionParams.locPort,
     		    connectionId, //pl_connectionParams.connId,
     		    {tcp := {}},    
  		);
  		log(vl_result)
  		connectionId := vl_result.connId;
	}



Please let me know if this changes anything.

BR

Elemer
Re: IPL4 port TCP connection problem [message #1749875 is a reply to message #1749847] Tue, 13 December 2016 13:30 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

Sorry for the late response.

I rerun the tests and I am sending you the new logs. They show the same error.
I made a basic mistake to get the first error "Transport endpoint is not connected", because I put a wrong (inactive) port as remotePort.

The value of connectionId is taken from a variable defined in the component initialised with -1, so it should be ok, but thanks for pointing out.

I also checked if I have omitted something that must be in the port connection (connect or listen). To verify this, I added an Option reuseAddress in the optionList:

function f_cf01Up()	runs on ARMOURComponent{
   		var Socket_API_Definitions.Result vl_result;
   		map(mtc:IPL4, system:IPL4);
   		vl_result := IPL4asp_PortType.f_IPL4_connect(IPL4,
     		    finalConnectionParams.remHost,
     		    finalConnectionParams.remPort,
     		    finalConnectionParams.locHost,
     		    finalConnectionParams.locPort,
     		    connectionId,
     		    {tcp := {}},
     		    {{reuseAddress := {true}}}    
  		);
  		log(vl_result)
  		connectionId := vl_result.connId;
	}


but the result is the same (as in the logs).

Best regards,
Naum.
  • Attachment: log2.zip
    (Size: 7.10KB, Downloaded 67 times)
Re: IPL4 port TCP connection problem [message #1749887 is a reply to message #1749875] Tue, 13 December 2016 14:21 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,


OK, again it appears that the TCP connection is made, connId =1 is returned, and the error is -probably- in the TTCN-3 code after returning from

f__IPL4__PROVIDER__connect:

14:05:57.878379 - IPL4: f__IPL4__PROVIDER__connect: Probing connection: getsockopt returned: 0, connection result code: 0
14:05:57.878397 - IPL4: f__IPL4__PROVIDER__connect: leave
14:05:57.878421 - { errorCode := omit, connId := 1, os_error_code := omit, os_error_text := omit }
14:05:57.878517 - Dynamic test case error: Using an unbound optional field. (Operation now in progress) 



Can you please send me teh TTCN-3 code?

Just do a "make archive" and send me the zip file ceated.

BR

Elemer

Re: IPL4 port TCP connection problem [message #1749891 is a reply to message #1749887] Tue, 13 December 2016 14:31 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

I made the archive containing the IPL4 port and the HTTP codec, because of redundancy.

Thanks in advance and best regards,
Naum.

[Updated on: Tue, 13 December 2016 14:33]

Report message to a moderator

Re: IPL4 port TCP connection problem [message #1749901 is a reply to message #1749891] Tue, 13 December 2016 15:52 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,.

if there is a termination for TCP, then the error is generated at this line :


 v_sendMessageBytes := ef_HTTP_Encode(valueof(t_message));


in function
sendRequest()

because t_message is not completely initialized:

{ msg := { start_line := { request_line := { method := GET (0), request_target := "/~/in-cse", version_major := 1, version_minor := 1 } }, headers := <uninitialized template>, body := <uninitialized template> } }


So the TCP connection has been initialized.


I'll come back to you tomorrow as I have suggestions regarding structure and Makefile.

BR

Elemer
Re: IPL4 port TCP connection problem [message #1749941 is a reply to message #1749901] Wed, 14 December 2016 08:14 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

I don't know how well the compressed project you have sent reflects the structure of your project;

however, my recommendation is that you keep different products (test ports, protocol modules etc.) in their separate directories ,

for instance
~/src/Abstract_Socket
~/src/IPL4_testport
~/src/TCCUsefulFunctions

etc.

and these directories should contain all source files (TTCN-3, C++ etc.) that belong to the product.

The main reason for this , besides the structure in itself, is that when you change the version of a product , say you want to install a new IPL4 version,
it's straightforward and simple, and there are less chances of missing a file.
The TTCN-3 files and C++ files of a test port belong together, usually when one changes, this might trigger a change in the other so files belonging to different revisions should not be mixed.

And one more thing: in you Makefile the generated sources and headers reappear as user sources and headers , e.g.::

GENERATED_SOURCES = ARMOUR_Adapter_HTTP.cc General_Types.cc HTTP_MessageLen.cc HTTP_Types.cc IPL4asp_Functions.cc IPL4asp_PortType.cc IPL4asp_Types.cc Socket_API_Definitions.cc TCCAssertion_Functions.cc TCCDateTime_Functions.cc TCCEncoding_Functions.cc TCCEnv_Functions.cc TCCFileIO_Functions.cc TCCFileSystem_Functions.cc TCCIPsec_Definitions.cc TCCIPsec_Functions.cc TCCInterface_Functions.cc TCCMaths_Functions.cc TCCMaths_GenericTypes.cc TCCMessageHandling_Functions.cc TCCPermutatedParameters_Definitions.cc TCCPermutatedParameters_Functions.cc TCCSystem_Functions.cc TCCTemplate_Functions.cc TCCTitanMetadata_Functions.cc TestPurposeSuiteHTTP.cc
:
:

USER_SOURCES = ../ARMOUR_Adapter_HTTP.cc  ../Abstract_Socket.cc  ../General_Types.cc  ../HTTP_EncDec.cc ../HTTP_MessageLen.cc  ../HTTP_MessageLen_Function.cc ../HTTP_Types.cc   ../HTTP_parse_.tab.c  ../IPL4asp_Functions.cc  ../IPL4asp_PT.cc  ../IPL4asp_PortType.cc  ../IPL4asp_Types.cc  ../IPL4asp_discovery.cc  ../Socket_API_Definitions.cc  ../TCCAssertion.cc ../TCCAssertion_Functions.cc  ../TCCDateTime.cc ../TCCDateTime_Functions.cc  ../TCCEncoding.cc ../TCCEncoding_Functions.cc  ../TCCEnv.cc ../TCCEnv_Functions.cc  ../TCCFileIO.cc ../TCCFileIO_Functions.cc  ../TCCFileSystem.cc ../TCCFileSystem_Functions.cc  ../TCCIPsec.cc ../TCCIPsec_Definitions.cc  ../TCCIPsec_Functions.cc  ../TCCInterface.cc ../TCCInterface_Functions.cc   ../TCCMaths.cc ../TCCMaths_Functions.cc  ../TCCMaths_GenericTypes.cc  ../TCCMessageHandling.cc ../TCCMessageHandling_Functions.cc  ../TCCPermutatedParameters_Definitions.cc  ../TCCPermutatedParameters_Functions.cc  ../TCCSystem.cc ../TCCSystem_Functions.cc  ../TCCTemplate_Functions.cc  ../TCCTitanMetadata.cc ../TCCTitanMetadata_Functions.cc  ../TestPurposeSuiteHTTP.cc  ../lex.HTTP_parse_.c



This at a first glance is not a dramatic issue, the only possible adverse effect I can see is that it probably slows down compilation (as object files are generated twice) but it suggests that there's something wrong with the way you are generating Makefiles;
besides there might be hidden pitfalls I don't see right now.

User sources and headers should look like this:

USER_SOURCES = Abstract_Socket.cc HTTP_EncDec.cc HTTP_MessageLen_Function.cc HTTP_parse_.tab.c IPL4asp_PT.cc IPL4asp_discovery.cc TCCAssertion.cc TCCDateTime.cc TCCEncoding.cc TCCEnv.cc TCCFileIO.cc TCCFileSystem.cc TCCIPsec.cc TCCInterface.cc TCCMaths.cc TCCMessageHandling.cc TCCSystem.cc TCCTitanMetadata.cc lex.HTTP_parse_.c
USER_HEADERS = Abstract_Socket.hh HTTP_parse_.tab.h IPL4asp_PT.hh HTTP_parse.h IPL4asp_protocol_L234.hh TCCInterface_ip.h


please try to re-generate the Makefile with : makefilegen ...ttcn3_modules...user_sources....user_headers...

and check what it generates.

Best regards
Elemer

Re: IPL4 port TCP connection problem [message #1749972 is a reply to message #1749941] Wed, 14 December 2016 14:55 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

It seems that I am doing something wrong, because I am going from one error to another.

I separated the files in different folders, as you suggested. In fact, I re-downloaded all modules and added them as folders. I made one little change in the TCCUsefulFunctions module, deleted the TCCRegexp_Functions.ttcn, TCCXPathSupport_Functions.ttcn and their .cc files, because I had to resolve lots of dependencies with tinyxml and tinyxpath. I could compile the code normally with this change (no errors in compilation). The archive is in the attachment.

Now I have another type of error on execution, "The executable is not actually executable. Please set an executable generated for parallel mode execution as the executable". If I run it on the command line, I get a segmentation error.

Also, I uploaded the generated makefile as you suggested so you can compare. Just to note that with this new makefile, one file seems to not be reachable, so it doesn't compile.

Best regards,
Naum
Re: IPL4 port TCP connection problem [message #1750028 is a reply to message #1749972] Thu, 15 December 2016 09:53 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

OK, I did the following:

I have created a script that will create symlinks to all files:
see install.script
(This will also simplify the Makefile)

I have generated the Makefile as below:
makefilegen -f -e TITAN_Adapter ARMOUR_Adapter_HTTP.ttcn General_Types.ttcn HTTP_MessageLen.ttcn HTTP_Types.ttcn IPL4asp_Functions.ttcn IPL4asp_PortType.ttcn IPL4asp_Types.ttcn Socket_API_Definitions.ttcn TCCAssertion_Functions.ttcn TCCConversion_Functions.ttcn TCCDateTime_Functions.ttcn TCCEncoding_Functions.ttcn TCCEnv_Functions.ttcn TCCFileIO_Functions.ttcn TCCFileSystem_Functions.ttcn TCCIPsec_Definitions.ttcn TCCIPsec_Functions.ttcn TCCInterface_Functions.ttcn TCCMaths_Functions.ttcn TCCMaths_GenericTypes.ttcn TCCMessageHandling_Functions.ttcn TCCPermutatedParameters_Definitions.ttcn TCCPermutatedParameters_Functions.ttcn TCCSystem_Functions.ttcn TCCTemplate_Functions.ttcn TCCTitanMetadata_Functions.ttcn TestPurposeSuiteHTTP.ttcn UsefulTtcn3Types.ttcn XSD.ttcn general_typedefs.ttcn http_www_w3_org_XML_1998_namespace.ttcn Abstract_Socket.cc IPL4asp_discovery.cc IPL4asp_PT.cc HTTP_EncDec.cc HTTP_MessageLen_Function.cc HTTP_parse_.tab.c lex.HTTP_parse_.c TCCAssertion.cc TCCConversion.cc TCCDateTime.cc TCCEncoding.cc TCCEnv.cc TCCFileIO.cc TCCFileSystem.cc TCCInterface.cc TCCInterface_ip.h TCCIPsec.cc TCCMaths.cc TCCMessageHandling.cc TCCSystem.cc TCCTitanMetadata.cc Abstract_Socket.hh IPL4asp_PT.hh HTTP_parse_.tab.h HTTP_parse.h IPL4asp_protocol_L234.hh


I have created a directory bin that will contain all artifacts produced during compilation (it's good to keep these temporary files separate from the source)

then

cd bin
../install.script 


creates symlinks

make 


will do the build


ttcn3_start ./TITAN_Adapter ../config/ARMOURConfig.cfg


will execute


see TCP.tgz attached



The Makefile in the package still contains

the generated sources in the USER_SOURCES declaration :

USER_SOURCES = ../ARMOUR_Adapter_HTTP.cc  ../src/port/AbstractSocket/Abstract_Socket.cc  ../General_Types.cc  ../src/codec/http/HTTP_EncDec.cc ../HTTP_MessageLen.cc  ../src/codec/http/HTTP_MessageLen_Function.cc ../HTTP_Types.cc   ../src/codec/http/HTTP_parse_.tab.c  ../IPL4asp_Functions.cc  ../IPL4asp_PT.cc ../src/port/ipl4/IPL4asp_PT.cc   ../IPL4asp_PortType.cc  ../IPL4asp_Types.cc  ../src/port/ipl4/IPL4asp_discovery.cc  ../Socket_API_Definitions.cc  ../src/codec/ttcUsefulFunctions/TCCAssertion.cc ../TCCAssertion_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCConversion.cc ../TCCConversion_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCDateTime.cc ../TCCDateTime_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCEncoding.cc ../TCCEncoding_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCEnv.cc ../TCCEnv_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCFileIO.cc ../TCCFileIO_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCFileSystem.cc ../TCCFileSystem_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCIPsec.cc ../TCCIPsec_Definitions.cc  ../TCCIPsec_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCInterface.cc ../TCCInterface_Functions.cc   ../src/codec/ttcUsefulFunctions/TCCMaths.cc ../TCCMaths_Functions.cc  ../TCCMaths_GenericTypes.cc  ../src/codec/ttcUsefulFunctions/TCCMessageHandling.cc ../TCCMessageHandling_Functions.cc  ../TCCPermutatedParameters_Definitions.cc  ../TCCPermutatedParameters_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCSystem.cc ../TCCSystem_Functions.cc  ../TCCTemplate_Functions.cc  ../src/codec/ttcUsefulFunctions/TCCTitanMetadata.cc ../TCCTitanMetadata_Functions.cc  ../TestPurposeSuiteHTTP.cc  ../UsefulTtcn3Types.cc  ../XSD.cc  ../general_typedefs.cc  ../http_www_w3_org_XML_1998_namespace.cc  ../src/codec/http/lex.HTTP_parse_.c 


Can you please describe how you generate your Makefile?
The executable was not running as something was missing in the Makefile.


Best regards
Elemer


  • Attachment: TCP.tgz
    (Size: 260.33KB, Downloaded 58 times)
Re: IPL4 port TCP connection problem [message #1750054 is a reply to message #1750028] Thu, 15 December 2016 14:17 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hi Elemer,

I tried to compile the zip with your makefile, and everything goes well, even if I take the Makefile to the other project (I came to the error from before "Dynamic test case error: Using an unbound optional field. (Operation now in progress)".

Regarding the generation of the makefile, I tried with this command:
makefilegen -f -e TITAN_Adapter ../src/ARMOUR_Adapter_HTTP.ttcn ../src/codec/common/General_Types.ttcn ../src/codec/http/HTTP_MessageLen.ttcn ../src/codec/http/HTTP_Types.ttcn ../src/port/ipl4/IPL4asp_Functions.ttcn ../src/port/ipl4/IPL4asp_PortType.ttcn ../src/port/ipl4/IPL4asp_Types.ttcn ../src/port/SocketAPI/Socket_API_Definitions.ttcn ../src/codec/ttcUsefulFunctions/TCCAssertion_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCConversion_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCDateTime_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCEncoding_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCEnv_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCFileIO_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCFileSystem_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCIPsec_Definitions.ttcn ../src/codec/ttcUsefulFunctions/TCCIPsec_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCInterface_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCMaths_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCMaths_GenericTypes.ttcn ../src/codec/ttcUsefulFunctions/TCCMessageHandling_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCPermutatedParameters_Definitions.ttcn ../src/codec/ttcUsefulFunctions/TCCPermutatedParameters_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCSystem_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCTemplate_Functions.ttcn ../src/codec/ttcUsefulFunctions/TCCTitanMetadata_Functions.ttcn ../src/TestPurposeSuiteHTTP.ttcn ../src/codec/common/UsefulTtcn3Types.ttcn ../src/codec/common/XSD.ttcn ../src/codec/common/general_typedefs.ttcn ../src/codec/common/http_www_w3_org_XML_1998_namespace.ttcn ../src/port/AbstractSocket/Abstract_Socket.cc ../src/port/ipl4/IPL4asp_discovery.cc ../src/port/ipl4/IPL4asp_PT.cc ../src/codec/http/HTTP_EncDec.cc ../src/codec/http/HTTP_MessageLen_Function.cc ../src/codec/http/HTTP_parse_.tab.c ../src/codec/http/lex.HTTP_parse_.c ../src/codec/ttcUsefulFunctions/TCCAssertion.cc ../src/codec/ttcUsefulFunctions/TCCConversion.cc ../src/codec/ttcUsefulFunctions/TCCDateTime.cc ../src/codec/ttcUsefulFunctions/TCCEncoding.cc ../src/codec/ttcUsefulFunctions/TCCEnv.cc ../src/codec/ttcUsefulFunctions/TCCFileIO.cc ../src/codec/ttcUsefulFunctions/TCCFileSystem.cc ../src/codec/ttcUsefulFunctions/TCCInterface.cc ../src/codec/ttcUsefulFunctions/TCCInterface_ip.h ../src/codec/ttcUsefulFunctions/TCCIPsec.cc ../src/codec/ttcUsefulFunctions/TCCMaths.cc ../src/codec/ttcUsefulFunctions/TCCMessageHandling.cc ../src/codec/ttcUsefulFunctions/TCCSystem.cc ../src/codec/ttcUsefulFunctions/TCCTitanMetadata.cc ../src/port/AbstractSocket/Abstract_Socket.hh ../src/port/ipl4/IPL4asp_PT.hh ../src/codec/http/HTTP_parse_.tab.h ../src/codec/http/HTTP_parse.h ../src/port/ipl4/IPL4asp_protocol_L234.hh

But the error about missing files stays. The Titan build is from yesterday commit.

Best regards,
Naum
Re: IPL4 port TCP connection problem [message #1750057 is a reply to message #1750054] Thu, 15 December 2016 14:21 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
HI Naum,

OK , but what is the error exactly? Which file is missing?


BR

Elemer
Re: IPL4 port TCP connection problem [message #1750058 is a reply to message #1750054] Thu, 15 December 2016 14:21 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
HI Naum,

OK , but what is the error exactly? Which file is missing?


BR

Elemer
Re: IPL4 port TCP connection problem [message #1750060 is a reply to message #1750058] Thu, 15 December 2016 14:36 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Here is the log:

egm@egm-VirtualBox:~/workspace/TITAN_Test_Adapter/bin4$ make
g++  -c -DLINUX -I/home/egm/titan/include -Wall   -o ../src/port/AbstractSocket/Abstract_Socket.o ../src/port/AbstractSocket/Abstract_Socket.cc
g++  -c -DLINUX -I/home/egm/titan/include -Wall   -o ../src/port/ipl4/IPL4asp_discovery.o ../src/port/ipl4/IPL4asp_discovery.cc
../src/port/ipl4/IPL4asp_discovery.cc:22:32: fatal error: IPL4asp_Functions.hh: No such file or directory
compilation terminated.
Makefile:141: recipe for target '../src/port/ipl4/IPL4asp_discovery.o' failed
make: *** [../src/port/ipl4/IPL4asp_discovery.o] Error 1


The file is there, I don't understand why it can't find it.

Best regards,
Naum
Re: IPL4 port TCP connection problem [message #1750117 is a reply to message #1750060] Fri, 16 December 2016 09:31 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

I have done the following this time:


-from the bin directory, I have generated the Makefile as you have indicated above
-when running make, I received errors complaining about missing header files similar to the above
-now I kept adding include paths to the CPPFLAGS line until the errors disappeared

eventually this line looks like:

# Flags for the C++ preprocessor (and makedepend as well):
CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include -I.  -I../src/port/ipl4/ -I../src/codec/http/ -I../src -I../src/port/SocketAPI/



with this the binary is generated and is executable
I have attached the Makefile



I hope this helps


Best regards
Elemer
  • Attachment: Makefile
    (Size: 10.71KB, Downloaded 60 times)
Re: IPL4 port TCP connection problem [message #1750168 is a reply to message #1750117] Fri, 16 December 2016 16:22 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

Thank you for helping me debug those codecs and ports! You are right, the problem was in the codecs, MQTT and HTTP, respectively.

For MQTT, (initially) there was a compiling bug (two pairs of parentheses more than needed) and after that, one field that is not optional in the codec was treated as it is optional (to check if there is a value). I have corrected that and will make a commit soon.

In the HTTP codec the problem was that I didn't understand that I have to declare all headers with, at least, omit value.

I will make more tests with different servers next week, and I will try to use (D)TLS and report the results.

Regarding the makefile, it works when the include parameters are added, but isn't this supposed to be generated automatically with the tool?

Best regards,
Naum.

[Updated on: Fri, 16 December 2016 16:25]

Report message to a moderator

Re: IPL4 port TCP connection problem [message #1750561 is a reply to message #1750168] Thu, 22 December 2016 16:23 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

The whole week I am out of the office, but, anyhow, I try to contribute. Here is the modified MQTT file that corrects the two errors mentioned above. I hope that you can verify them and commit the code to git (because I don't have permissions). Tested with Mosquitto (and OM2M as a client to it).

Also, regarding the codec structure (HTTP and MQTT), I think that for some of these structures (for example HTTP headers) should be made as an array of unions instead of set, because in the set the user has to declare all unused headers as omit (and that's a really long list).

Best regards,
Naum.
Re: IPL4 port TCP connection problem [message #1750566 is a reply to message #1750561] Thu, 22 December 2016 16:44 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

thank you for your contribution; I'll try to verify and upload, but probably not earlier than mid next week.
Let's work on your permission for git next year, it sort of defeats the scope of open source if I'm proxying.

As for the array versus set: array is of fixed size, set of is more flexible.
Templates for such headers can be declared with { optional "implicit omit" }
which means that non-allocated fields will be automatically interpreted as of omit value.
This should solve the inconvenience.



Best regards
Elemer
Re: IPL4 port TCP connection problem [message #1750763 is a reply to message #1750566] Wed, 28 December 2016 10:01 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
HI Naum ,

updated and retagged to R.1.B.


Best regards
Elemer
Re: IPL4 port TCP connection problem [message #1751884 is a reply to message #1750763] Mon, 16 January 2017 13:33 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

Instead of opening a new thread, I will ask here, because it is related to the MQTT codec.

In the MQTT specs it says: "A single WebSocket data frame can contain multiple or partial MQTT Control Packets. The receiver MUST NOT assume that MQTT Control Packets are aligned on WebSocket frame boundaries [MQTT-6.0.0-2]." This is a situation that the MQTT Titan codec doesn't support yet.

The solution should be simple, though. In the .cc file of the codec (http://git.eclipse.org/c/titan/titan.ProtocolModules.MQTT.git/tree/src/Mqtt_v3.1.1_EncDec.cc), line 344 (first part of the condition, str.lengthof() > position), its where should be checked if there are multiple messages queued in the same TCP packet (first check the size of the packet, then search for the next mqtt request and its size). The only question that I have, is what is the best solution to organise the data here? Using sets, arrays or something else? In the attachments you can find a Wireshark capture file with sample of this type of message.

Thank you in advance.

Best regards,
Naum.
Re: IPL4 port TCP connection problem [message #1751892 is a reply to message #1751884] Mon, 16 January 2017 14:57 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

please look into the below post:
JSON in Titan part IV, usage of IPL4 test port and extracting messages from a TCP stream
https://www.eclipse.org/forums/index.php/t/1070600/


Quote:

"The TCP protocol is stream oriented, meaning that the API gives us the ability to send or receive a byte stream. There is no preservation of message boundaries. TCP can bundle up data from many send() calls into one segment, or it could break down data from one send() call into many segments - but that's transparent to applications sitting on top of TCP,
and recv() just gives you back data, with no relation to how many send() calls produced the data you get back. To be able to extract messages in general , and JSON messages in particular, a TTCN-3 or external C++ function has to be used to find the message boundary in streams; This is implemented as a function reference registration in the test port. The function is declared for the test port, but the user has to implement it depending on what session protocol is used.

In our case , the getMsg_Func plays this role; it refers the function f_GetMsgLengthJSON declared in JSON_common.ttcn , which calls
the external function f_calc_JSON_length implemented in JSON_slicer.cc."


If you register such a dissection function, you don't have to care about multiple messages; the test port will separate the messages using the dissector and send them one by one to the upper layer. This is the recommended usage.


For exact details , please see the code attached to the above post. Also , the IPL4 port documentation contains this info, search for "dissection" .



I hope this helps

Best regards
Elemer

[Updated on: Mon, 16 January 2017 14:59]

Report message to a moderator

Re: IPL4 port TCP connection problem [message #1751902 is a reply to message #1751892] Mon, 16 January 2017 17:14 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hi Elemer,

Thank you for your help. Actually, it was way simpler than I thought, the real code is this (written as in your JSON example):
INTEGER f__calc__MQTT__length(const OCTETSTRING& data){
  return  oct2int(data[1]) + 2;
}


I've tried it and works as it should, it decodes all the messages, at least from mosquitto server (tomorrow will test with an other server that I have). Smile

Where I should commit the code (two files, one .ttcn and one .cc), in the MQTT or in the IPL4 repository?

Thank you again.

Best regards,
Naum.
Re: IPL4 port TCP connection problem [message #1751954 is a reply to message #1751902] Tue, 17 January 2017 07:56 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

great. Smile
I believe it belongs to MQTT rather than IPL4.

BR Elemer
Re: IPL4 port TCP connection problem [message #1751972 is a reply to message #1751954] Tue, 17 January 2017 12:28 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

Unfortunately, I have a problem.

I have tested this with mosquitto on local with mosquitto_sub to generate messages (as in the wireshark capture in the previous post). This works flawlessly, Titan decodes all messages.

When I tested it with FIT-IoT LAB and their equipment, there are lots of MQTT messages. Until one instant, TITAN works as it should. After that, on my local machine, it produces a repeated message multiple times and after that it doesn't decode the MQTT messages. On a server with 4GB RAM, it crashes. You can see that it decodes the previous messages even if they are sent in the same TCP packet (captured in Wireshark). Do you have any idea why it is doing this?

I have included the wireshark capture and the two logs (from each machine). The request that blocks is the one before the last message in wireshark.

Thanks in advance.

Best regards,
Naum.
Re: IPL4 port TCP connection problem [message #1751977 is a reply to message #1751972] Tue, 17 January 2017 13:00 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,
we'll take a look; but we will need the code too;

please do a "make archive" and attach the created zip file.


BR

Elemer

[Updated on: Tue, 17 January 2017 14:05]

Report message to a moderator

Re: IPL4 port TCP connection problem [message #1751984 is a reply to message #1751977] Tue, 17 January 2017 14:34 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hi Elemer,

Sorry for the late answer, here is the archive.

Thanks,
Naum.
Re: IPL4 port TCP connection problem [message #1752039 is a reply to message #1751984] Wed, 18 January 2017 08:04 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

could you please try with the modified functions below:

function receiveMQTTMessage(out MQTT_v3_1_1_Message p_messageOut) runs on ARMOURComponent {
      if (connectionId == -1){ // if not already connected
	    f_cf01Up();
	  }

	  var ASP_RecvFrom v_receiveMessageBytes;
	  var boolean v_run:= true;

		tc_ac:=300.0; //5 minutes 			
        tc_ac.start;

while(v_run)
	{ 

       alt{
	    [] IPL4.receive(t_receiveMessage(connectionId)) -> value v_receiveMessageBytes{
	      f_MQTT_v3_1_1_dec(v_receiveMessageBytes.msg,p_messageOut);
	      log(p_messageOut);
		//tc_ac.stop;
	    }
	    [] IPL4.receive {
            log("Unexpected message")
           //	      setverdict(fail);
	//	tc_ac.stop;
	    }
	    [] tc_ac.timeout {
	      //setverdict(inconc);
              v_run:=false; //break the loop
	    }
	  }//endalt
	}//endwhile
}//endfunction

function receivePublish(in octetstring p_payload) runs on ARMOURComponent {
      var MQTT_v3_1_1_Message v_message;

	  receiveMQTTMessage(v_message);

		//if(match(v_message,t_publishReceiveAnything)){
		//    	receivePublish(p_payload);
		//}

}


and let me know of the result.

Best regards

Elemer
Re: IPL4 port TCP connection problem [message #1752041 is a reply to message #1752039] Wed, 18 January 2017 08:56 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

and please do the following:

add flag -g to the Makefile:

# Flags for the C++ compiler:
CXXFLAGS = -Wall -O2 -g


and compile/execute again ; this will generate debug information in the logs;

thne please translate address references in the log like below:

:
./TCP[0x5fb2f7]
./TCP[0x4174a9]
./TCP[0x417b45]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
./TCP[0x417b5c]
:


into file/line nr. information with address to line addr2line

https://sourceware.org/binutils/docs/binutils/addr2line.html

this will hopefully lead us to the fault.

Best regards
Elemer
Re: IPL4 port TCP connection problem [message #1752044 is a reply to message #1752039] Wed, 18 January 2017 09:22 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

I run the tests and the results are the same. There is one message whose payload is duplicated somehow (and it can't be decoded), and everything after that isn't decoded (raw message).

If you want you can try the test to that IP address by yourself, just tell me when will you run it because I have to restart the device for every test for now (the firmware is not finished).

Thank you,
Naum.
Re: IPL4 port TCP connection problem [message #1752158 is a reply to message #1752044] Thu, 19 January 2017 10:02 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

To conclude it here too, the problem was in the length function, because I forgot the cases where the message can be larger than 128 bytes. The correct implementation is like this:

    int multiplier, value, i, j;
    i = 0; // encoded byte
    j = 2; // additional real size
    multiplier = 1;
    value = 0;
    do {
        i++;
        value += (oct2int(data[i]) & 127) * multiplier + j;
        multiplier *= 128;
        if (multiplier > 128*128*128){
            return -1; //error case, bigger than the MQTT limit
        }
	j = 1;
    }while((oct2int(data[i]) & 128) != 0);

  return value;


Soon I will add the code in the MQTT git repository.

Best regards,
Naum.
Re: IPL4 port TCP connection problem [message #1754645 is a reply to message #1752158] Tue, 21 February 2017 09:51 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

I don't know if I should ask it here or in another thread, but however: I am using the IPL4 port and the HTTP codec to send message to a server, but there is a strange thing: the server doesn't receive the body of the message. I tried to send the message to a local server on the same machine, I tried to www.requestb.in, but it doesn't get the body. When I try the same request from Postman, everything is OK. I even tried to copy the exact same request from Postman, to ignore the HTTP codec and to insert it directly as a TCP message, but the result is the same, the body is empty.

Can you help me resolve this problem?
Thanks in advance.

Best regards,
Naum
Re: IPL4 port TCP connection problem [message #1754654 is a reply to message #1754645] Tue, 21 February 2017 10:36 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

can you send me some code you use?

Did you try to separately encode the message with the codec to see if indeed the codec is the source of the problem?

Which HTTP you use with IPL4 : the one in the HTTPmsg test port (https://github.com/eclipse/titan.TestPorts.HTTPmsg )or the HTTP protocol module ( https://github.com/eclipse/titan.ProtocolModules.HTTP2.0) ?
Did you register the message length function ?


BR

Elemer




Re: IPL4 port TCP connection problem [message #1754762 is a reply to message #1754654] Wed, 22 February 2017 07:44 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi ,
only so we don't let the suspense killing our readers:
-when sending a non-zero length body in the HTTP message, the content-length header has to be present and set correctly.

This has to be done slightly differently when one uses the protocol definition in the HTTPmsg test port or the HTTP protocol module:
For the former:

//------------------------------------------------------------------------------
function f_ContentLength (in charstring par_body)  return charstring
//------------------------------------------------------------------------------

{
  var charstring a:=int2str(lengthof (par_body))
  return a;

}

v_body:=="abcdefg"
header := { ...{ header_name := "Content-Length", header_value :=  f_ContentLength(v_body) }... }



and for the latter :

//------------------------------------------------------------------------------
function f_ContentLength (in charstring par_body)  return integer
//------------------------------------------------------------------------------
{
  return (lengthof (par_body))
}


template HTTP_Message t_message (in charstring payload) := {
                                msg := {{request_line :={POST,"/",1,1}},{
                                                ....
                                       content_length := f_ContentLength(payload).....                 },char2oct(payload)}
                }




Best regards
Elemer
Re: IPL4 port TCP connection problem [message #1755597 is a reply to message #1754762] Mon, 06 March 2017 09:00 Go to previous messageGo to next message
Naum Spaseski is currently offline Naum SpaseskiFriend
Messages: 81
Registered: February 2016
Location: Sophia Antipolis
Member

Hello Elemer,

I continue to ask questions for the port IPL4 in this thread, if you don't mind: How I can use the port without calling the functions "f_IPL4_connect()" or "f_IPL4_listen()"? Is there a possibility to configure this thorough the config file, or somewhere else outside of the testcase? Because for the old TCP and UDP ports there is no need to call any function: we specify the address in the config file and that's all.

Thank you for the response.

Best regards,
Naum
Re: IPL4 port TCP connection problem [message #1755601 is a reply to message #1755597] Mon, 06 March 2017 09:32 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
HI Naum,

I'm afraid that's not possible.

The control through code was seen as more advanced as it is more dynamic so we have abandoned the option of controlling from the config file.
In exchange now one can establish/tear down/ change several connections during one execution.
This was not possible from the static configuration based on the config file.

Best regards
Elemer





Re: IPL4 port TCP connection problem [message #1758519 is a reply to message #1755601] Wed, 29 March 2017 14:18 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Naum,

support for connect during map as controlled by parameters from the configuration file was added in the latest release R25A.


Best regards
Elemer
Previous Topic:TCCLibraries small issue
Next Topic: Using TLS/DTLS with Titan test ports part 5
Goto Forum:
  


Current Time: Fri Nov 16 18:39:19 GMT 2018

Powered by FUDForum. Page generated in 0.03849 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top