blob: 22141f454f9a3442b8c5b172763def081afd0432 [file] [log] [blame]
Harald Welte00a067f2017-09-13 23:27:17 +02001module MGCP_Types {
2 import from SDP_Types all;
3
4 type charstring MgcpVerb ("EPCF", "CRCX", "MDCX", "DLCX", "RQNT", "NTFY",
5 "AUEP", "AUCX", "RSIP") with {
Harald Welte7dc5d372017-11-24 20:41:04 +01006 /* see https://www.eclipse.org/forums/index.php/t/1088893/ on why this
7 * match expression is needed here */
8 variant "TEXT_CODING(,convert=upper_case,'((EPCF)|(CRCX)|(MDCX)|(DLCX)|(RQNT)|(NTFY)|(AUEP)|(AUCX)|(RSIP))',case_insensitive)"
Harald Welte00a067f2017-09-13 23:27:17 +02009 };
10 type charstring MgcpTransId (pattern "\d#(1,9)");
11 type charstring MgcpEndpoint (pattern "*@*");
Harald Welte3c6ebb92017-09-16 00:56:57 +080012 type hexstring MgcpCallId length(1..32); /* 3.2.2.2 */
13 type hexstring MgcpConnectionId length(1..32); /* 3.2.2.5 */
14 type hexstring MgcpRequestId length(1..32); /* 3.2.2.18 */
Harald Welte00a067f2017-09-13 23:27:17 +020015 type charstring MgcpResponseCode (pattern "\d#(3)");
16
17 type charstring MgcpInfoCode ("B", "C", "I", "N", "X", "L", "M", "R",
18 "S", "D", "O", "P", "E", "Z", "Q", "T",
19 "RC", "LC", "A", "ES", "RM", "RD", "PL",
20 "MD", "X-Osmo-CP") with {
21 variant "TEXT_CODING(,convert=upper_case,'([BCINXLMRSDOPEZQTA])|(RC)|(LC)|(ES)|(RM)|(RD)|(PL)|(MD)|(X-Osmo-CP)',case_insensitive)"
22 };
23
Harald Welte3c6ebb92017-09-16 00:56:57 +080024 /* 3.2.2.6 */
25 type charstring MgcpConnectionMode ("sendonly", "recvonly", "sendrecv", "confrnce",
26 "inactive", "loopback", "conttest", "netwloop",
27 "netwtest");
28
29 /* 3.2.2.10 */
30 type charstring MgcpLocalConnOptKeys ("a", "p", "b", "t", "e", "gc", "s", "r", "k",
31 "nt", "r");
32
Harald Welte00a067f2017-09-13 23:27:17 +020033 type charstring MgcpVersion (pattern "\d.\d") with {
34 variant "BEGIN('MGCP ')"
35 }
36
37 type record MgcpCommandLine {
38 MgcpVerb verb,
39 MgcpTransId trans_id,
40 MgcpEndpoint ep,
41 MgcpVersion ver
42 } with {
43 variant "SEPARATOR(' ', '[\t ]+')"
44 //variant "END('\r\n', '(\n)|(\r\n)')"
45 variant "END('\r\n', '([\r\n])|(\r\n)')"
46 }
47
Harald Welte00a067f2017-09-13 23:27:17 +020048 type record MgcpParameter {
49 MgcpInfoCode code,
50 charstring val optional
51 } with {
52 variant "BEGIN('')"
53 variant "SEPARATOR(': ', ':[\t ]+')"
54 //variant "END('\r\n', '(\n)|(\r\n)')"
55 variant "END('\r\n', '([\r\n])|(\r\n)')"
56 }
57
Harald Weltee636afd2017-09-17 16:24:09 +080058 type set of MgcpParameter MgcpParameterList with {
Harald Welte00a067f2017-09-13 23:27:17 +020059 variant "BEGIN('')"
60 };
61
Harald Welte00a067f2017-09-13 23:27:17 +020062 type record MgcpCommand {
63 MgcpCommandLine line,
64 MgcpParameterList params optional,
Harald Welte12000e22017-09-14 22:43:08 +080065 SDP_Message sdp optional
Harald Welte00a067f2017-09-13 23:27:17 +020066 } with {
67 variant "BEGIN('')"
68 variant (sdp) "BEGIN('\r\n','([\r\n])|(\r\n)')"
69 }
70
71 external function enc_MgcpCommand(in MgcpCommand id) return charstring
72 with { extension "prototype(convert) encode(TEXT)" };
73 external function dec_MgcpCommand(in charstring id) return MgcpCommand
74 with { extension "prototype(convert) decode(TEXT)" };
75
76 type record MgcpResponseLine {
77 MgcpResponseCode code,
78 MgcpTransId trans_id,
79 charstring string optional
80 } with {
81 variant "SEPARATOR(' ', '[\t ]+')"
82 //variant "END('\r\n', '(\n)|(\r\n)')"
83 variant "END('\r\n', '([\r\n])|(\r\n)')"
84 }
85
86 type record MgcpResponse {
87 MgcpResponseLine line,
88 MgcpParameterList params optional,
Harald Welte12000e22017-09-14 22:43:08 +080089 SDP_Message sdp optional
Harald Welte00a067f2017-09-13 23:27:17 +020090 } with {
91 variant "BEGIN('')"
92 variant (sdp) "BEGIN('\r\n','([\r\n])|(\r\n)')"
93 }
94
95 external function enc_MgcpResponse(in MgcpResponse id) return charstring
96 with { extension "prototype(convert) encode(TEXT)" };
97 external function dec_MgcpResponse(in charstring id) return MgcpResponse
98 with { extension "prototype(convert) decode(TEXT)" };
99
Harald Welte2c6dba12017-09-16 00:50:08 +0800100 type union MgcpMessage {
101 MgcpCommand command,
102 MgcpResponse response
103 } with {
104 variant "BEGIN('')"
105 }
106
107 external function enc_MgcpMessage(in MgcpMessage id) return charstring
108 with { extension "prototype(convert) encode(TEXT)" };
109 external function dec_MgcpMessage(in charstring id) return MgcpMessage
110 with { extension "prototype(convert) decode(TEXT)" };
111
Harald Welte00a067f2017-09-13 23:27:17 +0200112
113} with { encode "TEXT" }