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 |
|
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 #1772873 is a reply to message #1772834] |
Mon, 18 September 2017 08:19 |
Bence Janos Szabo 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
|
|
|
Goto Forum:
Current Time: Fri Mar 29 01:37:36 GMT 2024
Powered by FUDForum. Page generated in 0.03473 seconds
|