| module MGCP_Types { |
| import from SDP_Types all; |
| |
| type charstring MgcpVerb ("EPCF", "CRCX", "MDCX", "DLCX", "RQNT", "NTFY", |
| "AUEP", "AUCX", "RSIP") with { |
| variant "TEXT_CODING(,convert=upper_case,,case_insensitive)" |
| }; |
| type charstring MgcpTransId (pattern "\d#(1,9)"); |
| type charstring MgcpEndpoint (pattern "*@*"); |
| /* 3.2.2.5 */ |
| type hexstring MgcpConnectionId length(32); |
| type charstring MgcpResponseCode (pattern "\d#(3)"); |
| |
| type charstring MgcpInfoCode ("B", "C", "I", "N", "X", "L", "M", "R", |
| "S", "D", "O", "P", "E", "Z", "Q", "T", |
| "RC", "LC", "A", "ES", "RM", "RD", "PL", |
| "MD", "X-Osmo-CP") with { |
| variant "TEXT_CODING(,convert=upper_case,'([BCINXLMRSDOPEZQTA])|(RC)|(LC)|(ES)|(RM)|(RD)|(PL)|(MD)|(X-Osmo-CP)',case_insensitive)" |
| }; |
| |
| type charstring MgcpVersion (pattern "\d.\d") with { |
| variant "BEGIN('MGCP ')" |
| } |
| |
| type record MgcpCommandLine { |
| MgcpVerb verb, |
| MgcpTransId trans_id, |
| MgcpEndpoint ep, |
| MgcpVersion ver |
| } with { |
| variant "SEPARATOR(' ', '[\t ]+')" |
| //variant "END('\r\n', '(\n)|(\r\n)')" |
| variant "END('\r\n', '([\r\n])|(\r\n)')" |
| } |
| |
| external function enc_MgcpCommandLine(in MgcpCommandLine id) return charstring |
| with { extension "prototype(convert) encode(TEXT)" }; |
| external function dec_MgcpCommandLine(in charstring id) return MgcpCommandLine |
| with { extension "prototype(convert) decode(TEXT)" }; |
| |
| type record MgcpParameter { |
| MgcpInfoCode code, |
| charstring val optional |
| } with { |
| variant "BEGIN('')" |
| variant "SEPARATOR(': ', ':[\t ]+')" |
| //variant "END('\r\n', '(\n)|(\r\n)')" |
| variant "END('\r\n', '([\r\n])|(\r\n)')" |
| } |
| |
| external function enc_MgcpParameter(in MgcpParameter id) return charstring |
| with { extension "prototype(convert) encode(TEXT)" }; |
| external function dec_MgcpParameter(in charstring id) return MgcpParameter |
| with { extension "prototype(convert) decode(TEXT)" }; |
| |
| type record of MgcpParameter MgcpParameterList with { |
| variant "BEGIN('')" |
| }; |
| |
| external function enc_MgcpParameterList(in MgcpParameterList id) return charstring |
| with { extension "prototype(convert) encode(TEXT)" }; |
| external function dec_MgcpParameterList(in charstring id) return MgcpParameterList |
| with { extension "prototype(convert) decode(TEXT)" }; |
| |
| type record MgcpCommand { |
| MgcpCommandLine line, |
| MgcpParameterList params optional, |
| Sdp sdp optional |
| } with { |
| variant "BEGIN('')" |
| variant (sdp) "BEGIN('\r\n','([\r\n])|(\r\n)')" |
| } |
| |
| external function enc_MgcpCommand(in MgcpCommand id) return charstring |
| with { extension "prototype(convert) encode(TEXT)" }; |
| external function dec_MgcpCommand(in charstring id) return MgcpCommand |
| with { extension "prototype(convert) decode(TEXT)" }; |
| |
| type record MgcpResponseLine { |
| MgcpResponseCode code, |
| MgcpTransId trans_id, |
| charstring string optional |
| } with { |
| variant "SEPARATOR(' ', '[\t ]+')" |
| //variant "END('\r\n', '(\n)|(\r\n)')" |
| variant "END('\r\n', '([\r\n])|(\r\n)')" |
| } |
| |
| type record MgcpResponse { |
| MgcpResponseLine line, |
| MgcpParameterList params optional, |
| Sdp sdp optional |
| } with { |
| variant "BEGIN('')" |
| variant (sdp) "BEGIN('\r\n','([\r\n])|(\r\n)')" |
| } |
| |
| external function enc_MgcpResponse(in MgcpResponse id) return charstring |
| with { extension "prototype(convert) encode(TEXT)" }; |
| external function dec_MgcpResponse(in charstring id) return MgcpResponse |
| with { extension "prototype(convert) decode(TEXT)" }; |
| |
| |
| } with { encode "TEXT" } |