| /* (C) 2017 by Harald Welte <laforge@gnumonks.org> */ |
| |
| module IPA_Types { |
| |
| import from Osmocom_Types all; |
| |
| type enumerated IpaStreamId { |
| IPAC_PROTO_RSL (0), |
| IPAC_PROTO_OSMO (238), |
| IPAC_PROTO_MGCP_OLD (252), |
| IPAC_PROTO_SCCP (253), |
| IPAC_PROTO_CCM (254), |
| IPAC_PROTO_OML (255) |
| } with { variant "FIELDLENGTH(8)" } |
| |
| type enumerated IpaExtStreamId { |
| IPAC_PROTO_EXT_CTRL ('00'H), |
| IPAC_PROTO_EXT_MGCP ('01'H), |
| IPAC_PROTO_EXT_LAC ('02'H), |
| IPAC_PROTO_EXT_SMSC ('03'H), |
| IPAC_PROTO_EXT_ORC ('04'H), |
| IPAC_PROTO_EXT_GSUP ('05'H), |
| IPAC_PROTO_EXT_OAP ('06'H) |
| } with { variant "FIELDLENGTH(8)" } |
| |
| external function enc_PDU_IPA(in PDU_IPA pdu) return octetstring |
| with { extension "prototype(convert)" |
| extension "encode(RAW)" |
| } |
| |
| external function dec_PDU_IPA(in octetstring stream) return PDU_IPA |
| with { extension "prototype(convert)" |
| extension "decode(RAW)" |
| } |
| |
| type record PDU_IPA |
| { |
| uint16_t lengthInd, |
| IpaStreamId streamId, |
| IpaExtStreamId streamIdExt optional, |
| octetstring payloadData |
| } with { |
| variant (lengthInd) "LENGTHTO(streamIdExt,payloadData)"; |
| variant (lengthInd) "FIELDLENGTH(16)"; |
| variant (lengthInd) "BYTEORDER(last)"; |
| variant (streamIdExt) "PRESENCE(streamId=IPAC_PROTO_OSMO)"; |
| } |
| |
| |
| type enumerated IpaCcmMsgtype { |
| IPAC_MSGT_PING ('00'H), |
| IPAC_MSGT_PONG ('01'H), |
| IPAC_MSGT_ID_GET ('04'H), |
| IPAC_MSGT_ID_RESP ('05'H), |
| IPAC_MSGT_ID_ACK ('06'H) |
| } with { variant "FIELDLENGTH(8)" } |
| |
| type enumerated IpaCcmIdTag { |
| IPAC_IDTAG_SERNR ('00'H), |
| IPAC_IDTAG_UNITNAME ('01'H), |
| IPAC_IDTAG_LOCATION1 ('02'H), |
| IPAC_IDTAG_LOCATION2 ('03'H), |
| IPAC_IDTAG_EQUIPVERS ('04'H), |
| IPAC_IDTAG_SWVERSION ('05'H), |
| IPAC_IDTAG_IPADDR ('06'H), |
| IPAC_IDTAG_MACADDR ('07'H), |
| IPAC_IDTAG_UNIT ('08'H) |
| } with { variant "FIELDLENGTH(8)" } |
| |
| |
| type record IpaCcmGetPart { |
| uint8_t one, |
| IpaCcmIdTag tag |
| } |
| type set of IpaCcmGetPart IpaCcmIdGet; |
| |
| type record IpaCcmRespPart { |
| uint16_t len, |
| IpaCcmIdTag tag, |
| charstring data |
| } with { variant (len) "LENGTHTO(data,tag)" } |
| type set of IpaCcmRespPart IpaCcmIdResp; |
| |
| type union IpaCcmUnion { |
| IpaCcmIdGet get, |
| IpaCcmIdResp resp, |
| octetstring other |
| } |
| |
| type record PDU_IPA_CCM { |
| IpaCcmMsgtype msg_type, |
| IpaCcmUnion u optional |
| } with { variant (u) "CROSSTAG( |
| get, msg_type = IPAC_MSGT_ID_GET; |
| resp, msg_type = IPAC_MSGT_ID_RESP; |
| other, OTHERWISE; |
| )" }; |
| |
| |
| external function enc_PDU_IPA_CCM(in PDU_IPA_CCM pdu) return octetstring |
| with { extension "prototype(convert)" |
| extension "encode(RAW)" |
| } |
| |
| external function dec_PDU_IPA_CCM(in octetstring stream) return PDU_IPA_CCM |
| with { extension "prototype(convert)" |
| extension "decode(RAW)" |
| } |
| |
| |
| } with { encode "RAW" } |