From 0174a284e8bb82606e61587a143df1b96f838f86 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 14 Jul 2013 20:00:26 +0200 Subject: add map_operations.hrl as well as rec4op/class4op/timer4op --- include/map_operations.hrl | 101 +++++++++++++++++++++++++++++++++++++++++ src/map_helper.erl | 109 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 include/map_operations.hrl diff --git a/include/map_operations.hrl b/include/map_operations.hrl new file mode 100644 index 0000000..f28fcbe --- /dev/null +++ b/include/map_operations.hrl @@ -0,0 +1,101 @@ +% from MAP-MobileServiceOperations.asn 3GPP TS 29.002 V9.3.0 (2010-09) +-define(MAP_OP_UPDATE_LOCATION, 2). +-define(MAP_OP_CANCEL_LOCATION, 3). +-define(MAP_OP_PURGE_MS, 67). +-define(MAP_OP_SEND_IDENTIFICATION, 55). +-define(MAP_OP_UPDATE_GRPS_LOCATION, 23). +-define(MAP_OP_PROVIDE_SUBSCR_INFO, 70). +-define(MAP_OP_ANYTIME_INTERROGATION, 71). +-define(MAP_OP_ANYTIME_SUBSCR_INTERR, 62). +-define(MAP_OP_ANYTIME_MODIFICATION, 65). +-define(MAP_OP_NOTE_SUBSCR_DAT_MODIF, 5). +-define(MAP_OP_PREPARE_HANDOVER, 68). +-define(MAP_OP_SEND_END_SIGNAL, 29). +-define(MAP_OP_PROC_ACC_SIGNALLING, 33). +-define(MAP_OP_FWD_ACC_SIGNALLING, 34). +-define(MAP_OP_PREPARE_SUBSEQ_HO, 69). +-define(MAP_OP_SEND_AUTH_INFO, 56). +-define(MAP_OP_AUTH_FAIL_REPORT, 15). +-define(MAP_OP_CHECK_IMEI, 43). +-define(MAP_OP_INSERT_SUBSCR_DATA, 7). +-define(MAP_OP_DELETE_SUBSCR_DATA, 8). +-define(MAP_OP_RESET, 37). +-define(MAP_OP_FW_CHECK_SS, 38). +-define(MAP_OP_RESTORE_DATA, 57). +-define(MAP_OP_SRI_FOR_GPRS, 24). +-define(MAP_OP_FAILURE_REPORT, 25). +-define(MAP_OP_NOTE_MS_PRESENT_GPRS, 26). +-define(MAP_OP_NOTE_MM_EVENT, 89). + +% from ShortMessageOperations.asn +-define(MAP_OP_SRI_FOR_SM, 45). +-define(MAP_OP_MO_FORWARD_SM, 46). +-define(MAP_OP_MT_FORWARD_SM, 44). +-define(MAP_OP_REPORT_SM_DEL_STATUS, 47). +-define(MAP_OP_NOTE_SUBSCR_PRESENT, 48). +-define(MAP_OP_ALERT_SC_NO_RESULT, 49). +-define(MAP_OP_ALERT_SC, 64). +-define(MAP_OP_INFORM_SC, 63). +-define(MAP_OP_READY_FOR_SM, 66). +-define(MAP_OP_MT_FW_SMS_VGCS, 21). + +% from SS-Operations.asn 3GPP TS 24.080 V9.1.0 +-define(MAP_OP_NOTIFY_SS, 16). +-define(MAP_OP_PROC_USS_DATA, 19). +-define(MAP_OP_LCS_PER_LOC_CANCEL, 109). +-define(MAP_OP_LCS_LOC_UPD, 110). +-define(MAP_OP_LCS_PER_LOC_REQ, 111). +-define(MAP_OP_LCS_AREA_EVT_CANCEL, 112). +-define(MAP_OP_LCS_AREA_EVT_REP, 113). +-define(MAP_OP_LCS_AREA_EVT_REQ, 114). +-define(MAP_OP_LCS_MOLR, 115). +-define(MAP_OP_LCS_LOC_NOTIF, 116). +-define(MAP_OP_CALL_DEFLECTION, 117). +-define(MAP_OP_USER_USER_SVC, 118). +-define(MAP_OP_ACC_REG_CC_ENTRY, 119). +-define(MAP_OP_FW_CUG_INFO, 120). +-define(MAP_OP_SPLIT_MPTY, 121). +-define(MAP_OP_RETR_MPTY, 122). +-define(MAP_OP_HOLD_MPTY, 123). +-define(MAP_OP_BUILD_MPTY, 124). +-define(MAP_OP_FW_CHG_ADVICE, 125). +-define(MAP_OP_EXPLICIT_CT, 126). + +% from SupplementaryServiceOperations.asn +-define(MAP_OP_REGISTER_SS, 10). +-define(MAP_OP_ERASE_SS, 11). +-define(MAP_OP_ACTIVATE_SS, 12). +-define(MAP_OP_DEACTIVATE_SS, 13). +-define(MAP_OP_INTERROGATE_SS, 14). +-define(MAP_OP_PROC_USS_REQ, 59). +-define(MAP_OP_USS_REQ, 60). +-define(MAP_OP_USS_NOTIFY, 61). +-define(MAP_OP_REGISTER_PW, 17). +-define(MAP_OP_GET_PW, 18). +-define(MAP_OP_SS_INVOC_NOTIF, 72). +-define(MAP_OP_REGISTER_CC_ENTRY, 76). +-define(MAP_OP_ERASE_CC_ENTRY, 77). + +% from MAP-CallHandlingOperations.asn +-define(MAP_OP_SEND_ROUTING_INFO, 22). +-define(MAP_OP_PROVIDE_ROAMING_NR, 4). +-define(MAP_OP_RESUME_CALL_HANDLING, 6). +-define(MAP_OP_SET_REPORTING_STATE, 73). +-define(MAP_OP_STATUS_REPORT, 74). +-define(MAP_OP_REMOTE_USER_FREE, 75). +-define(MAP_OP_IST_ALERT, 87). +-define(MAP_OP_IST_COMMAND, 88). +-define(MAP_OP_RELEASE_RESOURCES, 20). + +% from MAP-LocationServiceOperations.asn +-define(MAP_OP_SRI_FOR_LCS, 85). +-define(MAP_OP_PROV_SUBSCR_LOC, 83). +-define(MAP_OP_SUBSCR_LOC_REPORT, 86). + +% FIXME: GroupCallOperations, OandMOperations, SecureTransportOperations + +% maximum values as gvin in TS 09.02 / 17.1.2 +-define(MAP_INV_TIMER_S, 10*1000). +-define(MAP_INV_TIMER_M, 30*1000). +-define(MAP_INV_TIMER_ML, 10*60*1000). +-define(MAP_INV_TIMER_L, 38*60*60*1000). diff --git a/src/map_helper.erl b/src/map_helper.erl index 0ccbd72..f25a5f6 100644 --- a/src/map_helper.erl +++ b/src/map_helper.erl @@ -36,8 +36,10 @@ -include_lib("osmo_ss7/include/isup.hrl"). -include_lib("osmo_map/include/map.hrl"). +-include_lib("osmo_map/include/map_operations.hrl"). --export([postproc/2, postproc_gt/2, postproc_imsi/2, postproc_msisdn/2]). +-export([postproc/2, postproc_gt/2, postproc_imsi/2, postproc_msisdn/2, + encode_op/3, decode_op/3, timer4op/1, class4op/1]). postproc(M=#'UpdateLocationArg'{imsi = Imsi, 'msc-Number' = Msc, 'vlr-Number' = Vlr, 'v-gmlc-Address' = Gmlc}, Mode) -> @@ -132,3 +134,108 @@ postproc_msisdn([], pre) -> postproc_msisdn(In, pre) -> map_codec:encode_map_tbcd(In). + +rec4op({local, ?MAP_OP_SEND_IDENTIFICATION}) -> 'UpdateLocation'; +rec4op({local, ?MAP_OP_CANCEL_LOCATION}) -> 'CancelLocation'; +rec4op({local, ?MAP_OP_PURGE_MS}) -> 'PurgeMS-'; +rec4op({local, ?MAP_OP_SEND_IDENTIFICATION}) -> 'SendIdentification'; +rec4op({local, ?MAP_OP_UPDATE_GRPS_LOCATION}) -> 'UpdateGprsLocation'; +rec4op({local, ?MAP_OP_PROVIDE_SUBSCR_INFO}) -> 'ProvideSubscriberInfo'; +rec4op({local, ?MAP_OP_ANYTIME_INTERROGATION}) -> 'AnyTimeInterrogation'; +rec4op({local, ?MAP_OP_ANYTIME_SUBSCR_INTERR}) -> 'AnyTimeSubscriptionInterrogation'; +rec4op({local, ?MAP_OP_ANYTIME_MODIFICATION}) -> 'AnyTimeModification'; +rec4op({local, ?MAP_OP_NOTE_SUBSCR_DAT_MODIF}) -> 'NoteSubscriberDataModified'; +rec4op({local, ?MAP_OP_PREPARE_HANDOVER}) -> 'PrepareHO-'; +rec4op({local, ?MAP_OP_SEND_END_SIGNAL}) -> 'SendEndSignal-'; +rec4op({local, ?MAP_OP_PROC_ACC_SIGNALLING}) -> 'ProcessAccessSignalling-'; +rec4op({local, ?MAP_OP_FWD_ACC_SIGNALLING}) -> 'ForwardAccessSignalling-'; +rec4op({local, ?MAP_OP_PREPARE_SUBSEQ_HO}) -> 'PrepareSubsequentHO-'; +rec4op({local, ?MAP_OP_SEND_AUTH_INFO}) -> 'SendAuthenticationInfo'; +rec4op({local, ?MAP_OP_AUTH_FAIL_REPORT}) -> 'AuthenticationFailureReport'; +rec4op({local, ?MAP_OP_CHECK_IMEI}) -> 'CheckIMEI-'; +rec4op({local, ?MAP_OP_INSERT_SUBSCR_DATA}) -> 'InsertSubscriberData'; +rec4op({local, ?MAP_OP_DELETE_SUBSCR_DATA}) -> 'DeleteSubscriberData'; +rec4op({local, ?MAP_OP_RESET}) -> 'Reset'; +rec4op({local, ?MAP_OP_FW_CHECK_SS}) -> {error, 'FIXME'}; +rec4op({local, ?MAP_OP_RESTORE_DATA}) -> 'RestoreData'; +rec4op({local, ?MAP_OP_SRI_FOR_GPRS}) -> 'SendRoutingInfoForGprs'; +rec4op({local, ?MAP_OP_FAILURE_REPORT}) -> 'FailureReport'; +rec4op({local, ?MAP_OP_NOTE_MS_PRESENT_GPRS}) -> 'NoteMsPresentForGprs'; +rec4op({local, ?MAP_OP_NOTE_MM_EVENT}) -> 'NoteMM-Event'; +rec4op({local, ?MAP_OP_SRI_FOR_SM}) -> 'SendRoutingInfo'; +rec4op({local, ?MAP_OP_MO_FORWARD_SM}) -> 'MO-ForwardSM-'; +rec4op({local, ?MAP_OP_MT_FORWARD_SM}) -> 'MT-ForwardSM-'; +rec4op({local, ?MAP_OP_REPORT_SM_DEL_STATUS}) -> 'ReportSM-DeliveryStatus'; +rec4op({local, ?MAP_OP_NOTE_SUBSCR_PRESENT}) -> {error, 'FIXME'}; +rec4op({local, ?MAP_OP_ALERT_SC_NO_RESULT}) -> {error, 'FIXME'}; +rec4op({local, ?MAP_OP_ALERT_SC}) -> 'AlertServiceCentre'; +rec4op({local, ?MAP_OP_INFORM_SC}) -> 'InformServiceCentre'; +rec4op({local, ?MAP_OP_READY_FOR_SM}) -> 'ReadyForSM-'; +rec4op({local, ?MAP_OP_MT_FW_SMS_VGCS}) -> 'MT-ForwardSM-VGCS-'; +% FIXME: SS-Operations.asn, SupplementaryServiceOperations, MAP-CallHandlingOperations, MAP-LocationServiceOperations + +argres(arg) -> "Arg"; +argres(argument) -> "Arg"; +argres(res) -> "Res"; +argres(result) -> "Res". + +decode_op(_, _, <<>>) -> + undefined; +decode_op(_, _, []) -> + undefined; +decode_op({local, Op}, ArgRes, Enc) when is_binary(Enc) or is_list(Enc) -> + case rec4op({local, Op}) of + {error, Err} -> + {error, Err}; + TypePrefix -> + RecType = list_to_atom(TypePrefix ++ argres(ArgRes)), + map_only:decode(RecType, Enc) + end. + +encode_op({local, Op}, ArgRes, Dec) -> + case rec4op({local, Op}) of + {error, Err} -> + {error, Err}; + TypePrefix -> + RecType = list_to_atom(TypePrefix ++ argres(ArgRes)), + map_only_encode(RecType, Dec) + end. + +timer4op({local, Op}) when is_integer(Op) -> + timer4op(Op); + +timer4op(?MAP_OP_SEND_IDENTIFICATION) -> ?MAP_INV_TIMER_S; +timer4op(?MAP_OP_SEND_END_SIGNAL) -> ?MAP_INV_TIMER_L; +timer4op(?MAP_OP_PROC_ACC_SIGNALLING) -> ?MAP_INV_TIMER_S; +timer4op(?MAP_OP_FWD_ACC_SIGNALLING) -> ?MAP_INV_TIMER_S; +timer4op(?MAP_OP_FW_CHECK_SS) -> ?MAP_INV_TIMER_S; +timer4op(?MAP_OP_MO_FORWARD_SM) -> ?MAP_INV_TIMER_ML; +timer4op(?MAP_OP_MT_FORWARD_SM) -> ?MAP_INV_TIMER_ML; +timer4op(?MAP_OP_REPORT_SM_DEL_STATUS) -> ?MAP_INV_TIMER_S; +timer4op(?MAP_OP_ALERT_SC) -> ?MAP_INV_TIMER_S; +timer4op(?MAP_OP_INFORM_SC) -> ?MAP_INV_TIMER_S; +timer4op(?MAP_OP_MT_FW_SMS_VGCS) -> ?MAP_INV_TIMER_ML; +timer4op(?MAP_OP_PROC_USS_REQ) -> ?MAP_INV_TIMER_ML; +timer4op(?MAP_OP_USS_REQ) -> ?MAP_INV_TIMER_ML; +timer4op(?MAP_OP_USS_NOTIFY) -> ?MAP_INV_TIMER_ML; +timer4op(?MAP_OP_REGISTER_PW) -> ?MAP_INV_TIMER_ML; +timer4op(?MAP_OP_PROV_SUBSCR_LOC) -> ?MAP_INV_TIMER_ML; +% FIXME: GroupCallOperations, OandMOperations, SecureTransportOperations +timer4op(Op) when is_integer(Op) -> ?MAP_INV_TIMER_M. + +class4op({local, Op}) when is_integer(Op) -> + class4op(Op); +class4op(?MAP_OP_SEND_END_SIGNAL) -> 3; +class4op(?MAP_OP_PROC_ACC_SIGNALLING) -> 4; +class4op(?MAP_OP_FWD_ACC_SIGNALLING) -> 4; +class4op(?MAP_OP_RESET) -> 4; +class4op(?MAP_OP_FW_CHECK_SS) -> 4; +class4op(?MAP_OP_NOTE_SUBSCR_PRESENT) -> 4; +class4op(?MAP_OP_ALERT_SC_NO_RESULT) -> 4; +class4op(?MAP_OP_INFORM_SC) -> 4; +class4op(?MAP_OP_NOTIFY_SS) -> 4; +class4op(?MAP_OP_FW_CHG_ADVICE) -> 3; +class4op(?MAP_OP_FW_CUG_INFO) -> 4; +class4op(?MAP_OP_GET_PW) -> 3; +% FIXME: GroupCallOperations, OandMOperations, SecureTransportOperations +class4op(Op) when is_integer(Op) -> 1. -- cgit v1.2.3