Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Philipp Maier | 534a4b2 | 2018-11-06 17:10:31 +0100 | [diff] [blame] | 3 | #include <osmocom/core/utils.h> |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 4 | |
| 5 | /* TS 29.118 Section 9.2 */ |
| 6 | enum sgsap_msg_type { |
| 7 | /* unassigned */ |
| 8 | SGSAP_MSGT_PAGING_REQ = 0x01, |
| 9 | SGSAP_MSGT_PAGING_REJ = 0x02, |
| 10 | /* unassigned */ |
| 11 | SGSAP_MSGT_SERVICE_REQ = 0x06, |
| 12 | SGSAP_MSGT_DL_UD = 0x07, |
| 13 | SGSAP_MSGT_UL_UD = 0x08, |
| 14 | SGSAP_MSGT_LOC_UPD_REQ = 0x09, |
| 15 | SGSAP_MSGT_LOC_UPD_ACK = 0x0a, |
| 16 | SGSAP_MSGT_LOC_UPD_REJ = 0x0b, |
| 17 | SGSAP_MSGT_TMSI_REALL_CMPL = 0x0c, |
| 18 | SGSAP_MSGT_ALERT_REQ = 0x0d, |
| 19 | SGSAP_MSGT_ALERT_ACK = 0x0e, |
| 20 | SGSAP_MSGT_ALERT_REJ = 0x0f, |
| 21 | SGSAP_MSGT_UE_ACT_IND = 0x10, |
| 22 | SGSAP_MSGT_EPS_DET_IND = 0x11, |
| 23 | SGSAP_MSGT_EPS_DET_ACK = 0x12, |
| 24 | SGSAP_MSGT_IMSI_DET_IND = 0x13, |
| 25 | SGSAP_MSGT_IMSI_DET_ACK = 0x14, |
| 26 | SGSAP_MSGT_RESET_IND = 0x15, |
| 27 | SGSAP_MSGT_RESET_ACK = 0x16, |
| 28 | SGSAP_MSGT_SERVICE_ABORT_REQ = 0x17, |
| 29 | SGSAP_MSGT_MO_CSFB_IND = 0x18, |
| 30 | /* unassigned */ |
| 31 | SGSAP_MSGT_MM_INFO_REQ = 0x1a, |
| 32 | SGSAP_MSGT_RELEASE_REQ = 0x1b, |
| 33 | /* unassigned */ |
| 34 | SGSAP_MSGT_STATUS = 0x1d, |
| 35 | /* unassigned */ |
| 36 | SGSAP_MSGT_UE_UNREACHABLE = 0x1f, |
| 37 | }; |
Philipp Maier | 5986a3d | 2018-12-05 18:34:01 +0100 | [diff] [blame] | 38 | extern const struct value_string sgsap_msg_type_names[]; |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 39 | static inline const char *sgsap_msg_type_name(enum sgsap_msg_type msgt) { |
| 40 | return get_value_string(sgsap_msg_type_names, msgt); |
| 41 | } |
| 42 | |
| 43 | /* TS 29.118 Section 9.3 */ |
| 44 | enum sgsap_iei { |
| 45 | SGSAP_IE_IMSI = 0x01, |
| 46 | SGSAP_IE_VLR_NAME = 0x02, |
| 47 | SGSAP_IE_TMSI = 0x03, |
| 48 | SGSAP_IE_LAI = 0x04, |
| 49 | SGSAP_IE_CHAN_NEEDED = 0x05, |
| 50 | SGSAP_IE_EMLPP_PRIORITY = 0x06, |
| 51 | SGSAP_IE_TMSI_STATUS = 0x07, |
| 52 | SGSAP_IE_SGS_CAUSE = 0x08, |
| 53 | SGSAP_IE_MME_NAME = 0x09, |
| 54 | SGSAP_IE_EPS_LU_TYPE = 0x0a, |
| 55 | SGSAP_IE_GLOBAL_CN_ID = 0x0b, |
| 56 | SGSAP_IE_MOBILE_ID = 0x0e, |
| 57 | SGSAP_IE_REJECT_CAUSE = 0x0f, |
| 58 | SGSAP_IE_IMSI_DET_EPS_TYPE = 0x10, |
| 59 | SGSAP_IE_IMSI_DET_NONEPS_TYPE = 0x11, |
| 60 | SGSAP_IE_IMEISV = 0x15, |
| 61 | SGSAP_IE_NAS_MSG_CONTAINER = 0x16, |
| 62 | SGSAP_IE_MM_INFO = 0x17, |
| 63 | SGSAP_IE_ERR_MSG = 0x1b, |
| 64 | SGSAP_IE_CLI = 0x1c, |
| 65 | SGSAP_IE_LCS_CLIENT_ID = 0x1d, |
| 66 | SGSAP_IE_LCS_INDICATOR = 0x1e, |
| 67 | SGSAP_IE_SS_CODE = 0x1f, |
| 68 | SGSAP_IE_SERVICE_INDICATOR = 0x20, |
| 69 | SGSAP_IE_UE_TIMEZONE = 0x21, |
| 70 | SGSAP_IE_MS_CLASSMARK2 = 0x22, |
| 71 | SGSAP_IE_TAI = 0x23, |
| 72 | SGSAP_IE_EUTRAN_CGI = 0x24, |
| 73 | SGSAP_IE_UE_EMM_MODE = 0x25, |
| 74 | SGSAP_IE_ADDL_PAGING_INDICATORS = 0x26, |
| 75 | SGSAP_IE_TMSI_BASED_NRI_CONT = 0x27, |
Omar Ramadan | 76bbcbc | 2019-05-09 10:13:46 -0700 | [diff] [blame] | 76 | SGSAP_IE_MO_FALLBACK_VALUE = 0xf1, |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 77 | }; |
Philipp Maier | 5986a3d | 2018-12-05 18:34:01 +0100 | [diff] [blame] | 78 | extern const struct value_string sgsap_iei_names[]; |
Philipp Maier | 086b345 | 2018-11-15 15:04:29 +0100 | [diff] [blame] | 79 | static inline const char *sgsap_iei_name(enum sgsap_iei iei) { |
| 80 | return get_value_string(sgsap_iei_names, iei); |
| 81 | } |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 82 | |
| 83 | /* TS 29.118 Section 9.4.2 */ |
| 84 | enum sgsap_eps_lu_type { |
| 85 | SGSAP_EPS_LUT_IMSI_ATTACH = 0x01, |
| 86 | SGSAP_EPS_LUT_NORMAL = 0x02, |
| 87 | }; |
Philipp Maier | 5986a3d | 2018-12-05 18:34:01 +0100 | [diff] [blame] | 88 | extern const struct value_string sgsap_eps_lu_type_names[]; |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 89 | static inline const char *sgsap_eps_lu_type_name(enum sgsap_eps_lu_type lut) { |
| 90 | return get_value_string(sgsap_eps_lu_type_names, lut); |
| 91 | } |
| 92 | |
| 93 | /* TS 29.118 Section 9.4.7 */ |
| 94 | enum sgsap_imsi_det_eps_type { |
| 95 | SGSAP_ID_EPS_T_NETWORK_INITIATED = 0x01, |
| 96 | SGSAP_ID_EPS_T_UE_INITIATED = 0x02, |
| 97 | SGSAP_ID_EPS_T_EPS_NOT_ALLOWED = 0x03, |
| 98 | }; |
Philipp Maier | 5986a3d | 2018-12-05 18:34:01 +0100 | [diff] [blame] | 99 | extern const struct value_string sgsap_ismi_det_eps_type_names[]; |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 100 | static inline const char *sgsap_imsi_det_eps_type_name(enum sgsap_imsi_det_eps_type idt) { |
| 101 | return get_value_string(sgsap_ismi_det_eps_type_names, idt); |
| 102 | } |
| 103 | |
| 104 | /* TS 29.118 Section 9.4.8 */ |
| 105 | enum sgsap_imsi_det_noneps_type { |
| 106 | SGSAP_ID_NONEPS_T_EXPLICIT_UE_NONEPS = 0x01, |
| 107 | SGSAP_ID_NONEPS_T_COMBINED_UE_EPS_NONEPS = 0x02, |
| 108 | SGSAP_ID_NONEPS_T_IMPLICIT_UE_EPS_NONEPS = 0x03, |
| 109 | }; |
Philipp Maier | 5986a3d | 2018-12-05 18:34:01 +0100 | [diff] [blame] | 110 | extern const struct value_string sgsap_ismi_det_noneps_type_names[]; |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 111 | static inline const char *sgsap_imsi_det_noneps_type_name(enum sgsap_imsi_det_noneps_type idt) { |
| 112 | return get_value_string(sgsap_ismi_det_noneps_type_names, idt); |
| 113 | } |
| 114 | |
| 115 | /* TS 29.118 Section 9.4.17 */ |
| 116 | enum sgsap_service_ind { |
| 117 | SGSAP_SERV_IND_CS_CALL = 0x01, |
| 118 | SGSAP_SERV_IND_SMS = 0x02, |
| 119 | }; |
Philipp Maier | 5986a3d | 2018-12-05 18:34:01 +0100 | [diff] [blame] | 120 | extern const struct value_string sgsap_service_ind_names[]; |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 121 | static inline const char *sgsap_service_ind_name(enum sgsap_service_ind si) { |
| 122 | return get_value_string(sgsap_service_ind_names, si); |
| 123 | } |
| 124 | |
| 125 | /* TS 29.118 Section 9.4.18 */ |
| 126 | enum sgsap_sgs_cause { |
| 127 | SGSAP_SGS_CAUSE_IMSI_DET_EPS = 0x01, |
| 128 | SGSAP_SGS_CAUSE_IMSI_DET_EPS_NONEPS = 0x02, |
| 129 | SGSAP_SGS_CAUSE_IMSI_UNKNOWN = 0x03, |
| 130 | SGSAP_SGS_CAUSE_IMSI_DET_NON_EPS = 0x04, |
| 131 | SGSAP_SGS_CAUSE_IMSI_IMPL_DET_NON_EPS = 0x05, |
| 132 | SGSAP_SGS_CAUSE_UE_UNREACHABLE = 0x06, |
| 133 | SGSAP_SGS_CAUSE_MSG_INCOMP_STATE = 0x07, |
| 134 | SGSAP_SGS_CAUSE_MISSING_MAND_IE = 0x08, |
| 135 | SGSAP_SGS_CAUSE_INVALID_MAND_IE = 0x09, |
| 136 | SGSAP_SGS_CAUSE_COND_IE_ERROR = 0x0a, |
| 137 | SGSAP_SGS_CAUSE_SEMANT_INCORR_MSG = 0x0b, |
| 138 | SGSAP_SGS_CAUSE_MSG_UNKNOWN = 0x0c, |
| 139 | SGSAP_SGS_CAUSE_MT_CSFB_REJ_USER = 0x0d, |
| 140 | SGSAP_SGS_CAUSE_UE_TEMP_UNREACHABLE = 0x0e, |
| 141 | }; |
Philipp Maier | 5986a3d | 2018-12-05 18:34:01 +0100 | [diff] [blame] | 142 | extern const struct value_string sgsap_sgs_cause_names[]; |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 143 | static inline const char *sgsap_sgs_cause_name(enum sgsap_sgs_cause cause) { |
| 144 | return get_value_string(sgsap_sgs_cause_names, cause); |
| 145 | } |
| 146 | |
| 147 | /* TS 29.118 Section 9.4.21c */ |
| 148 | enum sgsap_ue_emm_mode { |
| 149 | SGSAP_UE_EMM_MODE_IDLE = 0x00, |
| 150 | SGSAP_UE_EMM_MODE_CONNECTED = 0x01, |
| 151 | }; |
Philipp Maier | 5986a3d | 2018-12-05 18:34:01 +0100 | [diff] [blame] | 152 | extern const struct value_string sgsap_ue_emm_mode_names[]; |
Harald Welte | 6721144 | 2018-10-07 20:10:57 +0200 | [diff] [blame] | 153 | static inline const char *sgsap_ue_emm_mode_name(enum sgsap_ue_emm_mode mode) { |
| 154 | return get_value_string(sgsap_ue_emm_mode_names, mode); |
| 155 | } |
| 156 | |
| 157 | /* TS 29.118 Section 10.1 Table 10.1.2 */ |
| 158 | #define SGS_TS5_DEFAULT 10 /* Guards the Paging Procedure at the VLR */ |
| 159 | #define SGS_TS6_2_DEFAULT 40 /* Guards the TMSI reallocation procedure */ |
| 160 | #define SGS_TS7_DEFAULT 4 /* Guards the non-EPS alert procedure */ |
| 161 | #define SGS_TS11_DEFAULT 4 /* Guards the VLR reset procedure */ |
| 162 | #define SGS_TS14_DEFAULT 10 /* Guards the UE fallback to UTRAN/GERAN */ |
| 163 | #define SGS_TS15_DEFAULT 10 /* Guards the MO UE fallback to UTRAN/GERAN */ |
| 164 | |
| 165 | /* TS 29.118 Section 10.2 Table 10.2.1 */ |
| 166 | #define SGS_NS7_DEFAULT 2 |
| 167 | #define SGS_NS11_DEFAULT 2 |
| 168 | /* TS 29.118 Section 10.2 Table 10.2.2 */ |
| 169 | #define SGS_NS8_DEFAULT 2 |
| 170 | #define SGS_NS9_DEFAULT 2 |
| 171 | #define SGS_NS10_DEFAULT 2 |
| 172 | #define SGS_NS12_DEFAULT 2 |
| 173 | |
Philipp Maier | f98c78e | 2018-12-07 10:36:28 +0100 | [diff] [blame] | 174 | /* TS 29.118 Section 6.3 */ |
| 175 | #define SGS_PORT_DEFAULT 29118 |
| 176 | |
Philipp Maier | e190e03 | 2018-12-07 12:31:08 +0100 | [diff] [blame] | 177 | /* TS 29.118 Section 9.4.13 MME Name */ |
| 178 | #define SGS_MME_NAME_LEN 55 |
| 179 | |
| 180 | /* TS 29.118 Section 9.4.22 VLR name |
| 181 | * See also: RFC1123 Section 2.1 Host Names and Numbers */ |
| 182 | #define SGS_VLR_NAME_MAXLEN 255 |
| 183 | |
Harald Welte | 9892945 | 2020-04-20 19:52:36 +0200 | [diff] [blame] | 184 | extern const struct tlv_definition sgsap_ie_tlvdef; |