Harald Welte | 00566f5 | 2017-11-21 16:43:49 +0100 | [diff] [blame] | 1 | /* (C) 2017 by Harald Welte <laforge@gnumonks.org> */ |
| 2 | |
| 3 | module IPA_Types { |
| 4 | |
| 5 | import from Osmocom_Types all; |
| 6 | |
Harald Welte | d86cdc6 | 2017-11-22 00:45:07 +0100 | [diff] [blame] | 7 | type enumerated IpaStreamId { |
| 8 | IPAC_PROTO_RSL (0), |
| 9 | IPAC_PROTO_OSMO (238), |
| 10 | IPAC_PROTO_MGCP_OLD (252), |
| 11 | IPAC_PROTO_SCCP (253), |
| 12 | IPAC_PROTO_CCM (254), |
| 13 | IPAC_PROTO_OML (255) |
| 14 | } with { variant "FIELDLENGTH(8)" } |
| 15 | |
| 16 | type enumerated IpaExtStreamId { |
| 17 | IPAC_PROTO_EXT_CTRL ('00'H), |
| 18 | IPAC_PROTO_EXT_MGCP ('01'H), |
| 19 | IPAC_PROTO_EXT_LAC ('02'H), |
| 20 | IPAC_PROTO_EXT_SMSC ('03'H), |
| 21 | IPAC_PROTO_EXT_ORC ('04'H), |
| 22 | IPAC_PROTO_EXT_GSUP ('05'H), |
| 23 | IPAC_PROTO_EXT_OAP ('06'H) |
| 24 | } with { variant "FIELDLENGTH(8)" } |
Harald Welte | 00566f5 | 2017-11-21 16:43:49 +0100 | [diff] [blame] | 25 | |
| 26 | external function enc_PDU_IPA(in PDU_IPA pdu) return octetstring |
| 27 | with { extension "prototype(convert)" |
| 28 | extension "encode(RAW)" |
| 29 | } |
| 30 | |
| 31 | external function dec_PDU_IPA(in octetstring stream) return PDU_IPA |
| 32 | with { extension "prototype(convert)" |
| 33 | extension "decode(RAW)" |
| 34 | } |
| 35 | |
| 36 | type record PDU_IPA |
| 37 | { |
| 38 | uint16_t lengthInd, |
| 39 | IpaStreamId streamId, |
| 40 | octetstring payloadData |
| 41 | } with { |
Harald Welte | d86cdc6 | 2017-11-22 00:45:07 +0100 | [diff] [blame] | 42 | variant (lengthInd) "LENGTHTO(payloadData)"; |
Harald Welte | 00566f5 | 2017-11-21 16:43:49 +0100 | [diff] [blame] | 43 | variant (lengthInd) "FIELDLENGTH(16)"; |
| 44 | variant (lengthInd) "BYTEORDER(last)"; |
Harald Welte | 00566f5 | 2017-11-21 16:43:49 +0100 | [diff] [blame] | 45 | } |
| 46 | |
Harald Welte | d86cdc6 | 2017-11-22 00:45:07 +0100 | [diff] [blame] | 47 | |
| 48 | type enumerated IpaCcmMsgtype { |
| 49 | IPAC_MSGT_PING ('00'H), |
| 50 | IPAC_MSGT_PONG ('01'H), |
| 51 | IPAC_MSGT_ID_GET ('04'H), |
| 52 | IPAC_MSGT_ID_RESP ('05'H), |
| 53 | IPAC_MSGT_ID_ACK ('06'H) |
| 54 | } with { variant "FIELDLENGTH(8)" } |
| 55 | |
| 56 | type enumerated IpaCcmIdTag { |
| 57 | IPAC_IDTAG_SERNR ('00'H), |
| 58 | IPAC_IDTAG_UNITNAME ('01'H), |
| 59 | IPAC_IDTAG_LOCATION1 ('02'H), |
| 60 | IPAC_IDTAG_LOCATION2 ('03'H), |
| 61 | IPAC_IDTAG_EQUIPVERS ('04'H), |
| 62 | IPAC_IDTAG_SWVERSION ('05'H), |
| 63 | IPAC_IDTAG_IPADDR ('06'H), |
| 64 | IPAC_IDTAG_MACADDR ('07'H), |
| 65 | IPAC_IDTAG_UNIT ('08'H) |
| 66 | } with { variant "FIELDLENGTH(8)" } |
| 67 | |
| 68 | |
| 69 | type record IpaCcmGetPart { |
| 70 | uint8_t one, |
| 71 | IpaCcmIdTag tag |
Harald Welte | 00566f5 | 2017-11-21 16:43:49 +0100 | [diff] [blame] | 72 | } |
Harald Welte | d86cdc6 | 2017-11-22 00:45:07 +0100 | [diff] [blame] | 73 | type set of IpaCcmGetPart IpaCcmIdGet; |
| 74 | |
| 75 | type record IpaCcmRespPart { |
| 76 | uint16_t len, |
| 77 | IpaCcmIdTag tag, |
| 78 | charstring data |
| 79 | } with { variant (len) "LENGTHTO(data,tag)" } |
| 80 | type set of IpaCcmRespPart IpaCcmIdResp; |
| 81 | |
| 82 | type union IpaCcmUnion { |
| 83 | IpaCcmIdGet get, |
| 84 | IpaCcmIdResp resp, |
| 85 | octetstring other |
| 86 | } |
| 87 | |
| 88 | type record PDU_IPA_CCM { |
| 89 | IpaCcmMsgtype msg_type, |
| 90 | IpaCcmUnion u optional |
| 91 | } with { variant "" }; |
| 92 | |
| 93 | |
| 94 | external function enc_PDU_IPA_CCM(in PDU_IPA_CCM pdu) return octetstring |
| 95 | with { extension "prototype(convert)" |
| 96 | extension "encode(RAW)" |
| 97 | } |
| 98 | |
| 99 | external function dec_PDU_IPA_CCM(in octetstring stream) return PDU_IPA_CCM |
| 100 | with { extension "prototype(convert)" |
| 101 | extension "decode(RAW)" |
| 102 | } |
| 103 | |
| 104 | |
| 105 | } with { encode "RAW" } |