Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » TEXT codec and unions(strange behavior when decoding TEXT to union type)
TEXT codec and unions [message #1772830] Sat, 16 September 2017 01:41 Go to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 50
Registered: July 2017
Location: Berlin, Germany
Member

I'm currently implementing a minimal MGCP (RFC3435) encoder/parser using the TITAN TEXT coder. Source code can be found in http://git.osmocom.org/osmo-ttcn3-hacks/tree/mgw/MGCP_Types.ttcn and http://git.osmocom.org/osmo-ttcn3-hacks/tree/mgw/MGCP_Test.ttcn

I define a text-coded type "MgcpCommand" and "MgcpResponse", as well as a union of both types called "MgcpMessage".

All seems fine if I use the generated dec_MgcpCommand() or dec_MgcpResponse() functions to decode either a MGCP command or a response. However, when putting both together into the union "MgcpMessage", and calling dec_MgcpMessage(), the decoder fails in a weird way.

Assuming I have the following string which I might have received from a peer: "510 23 FAIL\r\n", then calling dec_MgcpResponse("510 23 FAIL\r\n") will result in the expected
{ line := { code := "510", trans_id := "23", string := "FAIL" }, params := { }, sdp := omit }
.

However, when calling dec_MgcpMessage() on the same input string, the result will be
{ response := { line := { code := "510 23", trans_id := "FAIL", string := omit }, params := { }, sdp := omit } }
, i.e. suddenly the Code + TransactionId both end up inthe "code" field, and the "string" ends up in "trans_id", which is clearly wrong.

So somehow the TEXT decoder detects that the received text is not a MgcpCommand (probably by the first token not matching MgcpVerb) and calles the decoder for MgcpResponse - but then the decode fails, despite an explicit dec_MgcpResponse on the string doing the right thing.

Does anyone have an idea what's going on here? As I'm using the encoder/decoder in a dual-faced port on top of IPL4asp(udp) and I have to behave both as call agent as well as a controller, I would prefer to keep the code generic, rather than having one translation port or dual-faced port per role.
Re: TEXT codec and unions [message #1772834 is a reply to message #1772830] Sat, 16 September 2017 05:55 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 854
Registered: January 2015
Senior Member
Hi Harald,

this looks like a fault in the generated codec;

Let me come back to you.

Best regards
Elemer



Re: TEXT codec and unions [message #1772873 is a reply to message #1772834] Mon, 18 September 2017 08:19 Go to previous message
Bence Janos Szabo is currently offline Bence Janos SzaboFriend
Messages: 9
Registered: April 2017
Junior Member
Hello Harald,

There is a workaround for your problem until we can fix this issue in the codec.

If you modify your MgcpVerb type to this: (I added a matching expression)

type charstring MgcpVerb ("EPCF", "CRCX", "MDCX", "DLCX", "RQNT", "NTFY",
          "AUEP", "AUCX", "RSIP") with {
    variant "TEXT_CODING(,convert=upper_case,'((EPCF)|(CRCX)|(MDCX)|(DLCX)|(RQNT)|(NTFY)|(AUEP)|(AUCX)|(RSIP))',case_insensitive)"
  };


This works on the example you provided, and should work on the other testcases too.

Best regards,
Bence

[Updated on: Mon, 18 September 2017 08:34]

Report message to a moderator

Previous Topic:MQTT over Websocket in Titan
Next Topic:Help needed on Structure UDP Example
Goto Forum:
  


Current Time: Fri Nov 16 17:44:02 GMT 2018

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

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

Back to the top