| module Osmocom_CTRL_Types { |
| |
| type charstring CtrlVerb ("GET", "SET") with { |
| /* see https://www.eclipse.org/forums/index.php/t/1088893/ on why this |
| * match expression is needed here */ |
| variant "TEXT_CODING(,convert=upper_case,'((GET)|(SET)|(TRAP))',case_insensitive)" |
| }; |
| |
| type charstring CtrlReplyToken ("REPLY") with { |
| variant "TEXT_CODING(,convert=upper_case,'(REPLY)',case_insensitive)" |
| }; |
| |
| type charstring CtrlId (pattern "\d#(1,9)"); |
| type charstring CtrlVariable (pattern "[^, \{\}\[\]\(\)<>\|~\\\^`'\"\?=;/\+\*&%$\#!]*"); |
| type charstring CtrlValue (pattern "[^ ]"); |
| type charstring CtrlReason; |
| |
| |
| type record CtrlCommand { |
| CtrlVerb verb, |
| CtrlId id, |
| CtrlVariable variable, |
| CtrlValue val optional /* only for SET */ |
| } with { |
| variant "SEPARATOR(' ',)" |
| }; |
| |
| type record CtrlResponse { |
| CtrlVerb verb, |
| CtrlReplyToken repl, |
| CtrlId id, |
| CtrlVariable variable, |
| CtrlValue val |
| } with { |
| variant "TEXT_CODING(,,'* REPLY *',case_insensitive)" |
| variant "SEPARATOR(' ',)" |
| }; |
| |
| type record CtrlError { |
| CtrlId id, |
| CtrlReason reason |
| } with { |
| variant "BEGIN('ERROR ',,case_insensitive)" |
| variant "SEPARATOR(' ',)" |
| }; |
| |
| type record CtrlTrap { |
| CtrlVariable variable, |
| CtrlValue val |
| } with { |
| variant "BEGIN('TRAP ',,case_insensitive)" |
| variant "SEPARATOR(' ',)" |
| }; |
| |
| type union CtrlMessage { |
| CtrlCommand cmd, |
| CtrlResponse resp, |
| CtrlError err, |
| CtrlTrap trap |
| }; |
| |
| external function enc_CtrlMessage(in CtrlMessage id) return charstring |
| with { extension "prototype(convert) encode(TEXT)"}; |
| |
| external function dec_CtrlMessage(in charstring id) return CtrlMessage |
| with { extension "prototype(convert) decode(TEXT)"}; |
| |
| |
| } with { encode "TEXT" } |