osmo-ttcn3-hacks/mgw/MGCP_Types.ttcn

102 lines
2.9 KiB
Plaintext

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)')"
}
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)')"
}
type record of MgcpParameter MgcpParameterList with {
variant "BEGIN('')"
};
type record MgcpCommand {
MgcpCommandLine line,
MgcpParameterList params optional,
SDP_Message 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_Message 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)" };
type union MgcpMessage {
MgcpCommand command,
MgcpResponse response
} with {
variant "BEGIN('')"
}
external function enc_MgcpMessage(in MgcpMessage id) return charstring
with { extension "prototype(convert) encode(TEXT)" };
external function dec_MgcpMessage(in charstring id) return MgcpMessage
with { extension "prototype(convert) decode(TEXT)" };
} with { encode "TEXT" }