blob: 386a548f7ba43386858875a12b576273e1771319 [file] [log] [blame]
Harald Welteb8b85a12016-06-17 00:06:42 +02001#pragma once
2
3#include <stdint.h>
4#include <osmocom/core/linuxlist.h>
5#include <osmocom/core/fsm.h>
6#include <osmocom/core/logging.h>
7#include <osmocom/gsm/protocol/gsm_23_003.h>
8#include <osmocom/gsm/protocol/gsm_04_08_gprs.h>
9#include <osmocom/gsm/gsm23003.h>
Neels Hofmeyrcf309132017-12-14 03:57:31 +010010#include <osmocom/gsm/gsm0808.h>
Vadim Yanitskiy8a0e2582018-06-14 03:54:33 +070011#include <osmocom/gsm/gsup.h>
Neels Hofmeyr90843962017-09-04 15:04:35 +020012#include <osmocom/msc/gsm_data.h>
Harald Welteb8b85a12016-06-17 00:06:42 +020013// for GSM_NAME_LENGTH
Neels Hofmeyr90843962017-09-04 15:04:35 +020014#include <osmocom/msc/gsm_subscriber.h>
Harald Welte1ea6baf2018-07-31 19:40:52 +020015#include <osmocom/gsupclient/gsup_client.h>
Harald Welteb8b85a12016-06-17 00:06:42 +020016
Maxa263bb22017-12-27 13:23:44 +010017#define LOGGSUPP(level, gsup, fmt, args...) \
18 LOGP(DVLR, level, "GSUP(%s) " fmt, (gsup)->imsi, ## args)
19
20#define LOGVSUBP(level, vsub, fmt, args...) \
21 LOGP(DVLR, level, "SUBSCR(%s) " fmt, vlr_subscr_name(vsub), ## args)
22
Harald Welte2483f1b2016-06-19 18:06:02 +020023struct log_target;
24
Stefan Sperlingdefc3c82018-05-15 14:48:04 +020025#define VLR_SUBSCRIBER_NO_EXPIRATION 0
26#define VLR_SUBSCRIBER_LU_EXPIRATION_INTERVAL 60 /* in seconds */
27
Harald Welteb8b85a12016-06-17 00:06:42 +020028/* from 3s to 10s */
29#define GSM_29002_TIMER_S 10
30/* from 15s to 30s */
31#define GSM_29002_TIMER_M 30
32/* from 1min to 10min */
33#define GSM_29002_TIMER_ML (10*60)
34/* from 28h to 38h */
35#define GSM_29002_TIMER_L (32*60*60)
36
Harald Welteb8b85a12016-06-17 00:06:42 +020037/* VLR subscriber authentication state */
38enum vlr_subscr_auth_state {
39 /* subscriber needs to be autenticated */
40 VLR_SUB_AS_NEEDS_AUTH,
41 /* waiting for AuthInfo from HLR/AUC */
42 VLR_SUB_AS_NEEDS_AUTH_WAIT_AI,
43 /* waiting for response from subscriber */
44 VLR_SUB_AS_WAIT_RESP,
45 /* successfully authenticated */
46 VLR_SUB_AS_AUTHENTICATED,
47 /* subscriber needs re-sync */
48 VLR_SUB_AS_NEEDS_RESYNC,
49 /* waiting for AuthInfo with ReSync */
50 VLR_SUB_AS_NEEDS_AUTH_WAIT_SAI_RESYNC,
51 /* waiting for response from subscr, resync case */
52 VLR_SUB_AS_WAIT_RESP_RESYNC,
53 /* waiting for IMSI from subscriber */
54 VLR_SUB_AS_WAIT_ID_IMSI,
55 /* authentication has failed */
56 VLR_SUB_AS_AUTH_FAILED,
57};
58
59enum vlr_lu_event {
60 VLR_ULA_E_UPDATE_LA, /* Initial trigger (LU from MS) */
61 VLR_ULA_E_SEND_ID_ACK, /* Result of Send-ID from PVLR */
62 VLR_ULA_E_SEND_ID_NACK, /* Result of Send-ID from PVLR */
63 VLR_ULA_E_AUTH_RES, /* Result of auth procedure */
64 VLR_ULA_E_CIPH_RES, /* Result of Ciphering Mode Command */
65 VLR_ULA_E_ID_IMSI, /* IMSI recieved from MS */
66 VLR_ULA_E_ID_IMEI, /* IMEI received from MS */
67 VLR_ULA_E_ID_IMEISV, /* IMEISV received from MS */
68 VLR_ULA_E_HLR_LU_RES, /* HLR UpdateLocation result */
69 VLR_ULA_E_UPD_HLR_COMPL,/* UpdatE_HLR_VLR result */
70 VLR_ULA_E_LU_COMPL_SUCCESS,/* Location_Update_Completion_VLR result */
71 VLR_ULA_E_LU_COMPL_FAILURE,/* Location_Update_Completion_VLR result */
72 VLR_ULA_E_NEW_TMSI_ACK, /* TMSI Reallocation Complete */
73};
74
75enum vlr_ciph_result_cause {
76 VLR_CIPH_REJECT, /* ? */
77 VLR_CIPH_COMPL,
78};
79
80struct vlr_ciph_result {
81 enum vlr_ciph_result_cause cause;
Neels Hofmeyrfa10eda2018-03-13 01:22:01 +010082 char imeisv[GSM48_MI_SIZE];
Harald Welteb8b85a12016-06-17 00:06:42 +020083};
84
85enum vlr_subscr_security_context {
86 VLR_SEC_CTX_NONE,
87 VLR_SEC_CTX_GSM,
88 VLR_SEC_CTX_UMTS,
89};
90
91enum vlr_lu_type {
92 VLR_LU_TYPE_PERIODIC,
93 VLR_LU_TYPE_IMSI_ATTACH,
94 VLR_LU_TYPE_REGULAR,
95};
96
97#define OSMO_LBUF_DECL(name, xlen) \
98 struct { \
99 uint8_t buf[xlen]; \
100 size_t len; \
101 } name
102
103struct sgsn_mm_ctx;
104struct vlr_instance;
105
106/* The VLR subscriber is the part of the GSM subscriber state in VLR (CS) or
107 * SGSN (PS), particularly while interacting with the HLR via GSUP */
108struct vlr_subscr {
109 struct llist_head list;
110 struct vlr_instance *vlr;
111
112 /* TODO either populate from HLR or drop this completely? */
113 long long unsigned int id;
114
115 /* Data from HLR */ /* 3GPP TS 23.008 */
116 /* Always use vlr_subscr_set_imsi() to write to imsi[] */
117 char imsi[GSM23003_IMSI_MAX_DIGITS+1]; /* 2.1.1.1 */
118 char msisdn[GSM_EXTENSION_LENGTH+1]; /* 2.1.2 */
119 char name[GSM_NAME_LENGTH+1]; /* proprietary */
120 OSMO_LBUF_DECL(hlr, 16); /* 2.4.7 */
121 uint32_t periodic_lu_timer; /* 2.4.24 */
122 uint32_t age_indicator; /* 2.17.1 */
123
124 /* Authentication Data */
125 struct gsm_auth_tuple auth_tuples[5]; /* 2.3.1-2.3.4 */
126 struct gsm_auth_tuple *last_tuple;
127 enum vlr_subscr_security_context sec_ctx;
128
129 /* Data local to VLR is below */
130 uint32_t tmsi; /* 2.1.4 */
131 /* Newly allocated TMSI that was not yet acked by MS */
132 uint32_t tmsi_new;
133
134 /* some redundancy in information below? */
135 struct osmo_cell_global_id cgi; /* 2.4.16 */
136 uint16_t lac; /* 2.4.2 */
137
138 char imeisv[GSM23003_IMEISV_NUM_DIGITS+1]; /* 2.2.3 */
139 char imei[GSM23003_IMEISV_NUM_DIGITS+1]; /* 2.1.9 */
140 bool imsi_detached_flag; /* 2.7.1 */
141 bool conf_by_radio_contact_ind; /* 2.7.4.1 */
142 bool sub_dataconf_by_hlr_ind; /* 2.7.4.2 */
143 bool loc_conf_in_hlr_ind; /* 2.7.4.3 */
144 bool dormant_ind; /* 2.7.8 */
145 bool cancel_loc_rx; /* 2.7.8A */
146 bool ms_not_reachable_flag; /* 2.10.2 (MNRF) */
147 bool la_allowed;
148
149 int use_count;
Harald Welteb8b85a12016-06-17 00:06:42 +0200150
151 struct osmo_fsm_inst *lu_fsm;
152 struct osmo_fsm_inst *auth_fsm;
153 struct osmo_fsm_inst *proc_arq_fsm;
154
155 bool lu_complete;
Stefan Sperlingdefc3c82018-05-15 14:48:04 +0200156 time_t expire_lu;
Harald Welteb8b85a12016-06-17 00:06:42 +0200157
158 void *msc_conn_ref;
159
160 /* PS (SGSN) specific parts */
161 struct {
162 struct llist_head pdp_list;
163 uint8_t rac;
164 uint8_t sac;
165 struct gprs_mm_ctx *mmctx;
166 } ps;
167 /* CS (NITB/CSCN) specific parts */
168 struct {
169 /* pending requests */
170 bool is_paging;
Neels Hofmeyr2ff5bcd2017-12-15 03:02:27 +0100171 struct osmo_timer_list paging_response_timer;
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200172 /* list of struct subscr_request */
Harald Welteb8b85a12016-06-17 00:06:42 +0200173 struct llist_head requests;
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200174 uint8_t lac;
175 enum ran_type attached_via_ran;
Harald Welteb8b85a12016-06-17 00:06:42 +0200176 } cs;
177};
178
Harald Welteb8b85a12016-06-17 00:06:42 +0200179enum vlr_ciph {
180 VLR_CIPH_NONE, /*< A5/0, no encryption */
181 VLR_CIPH_A5_1, /*< A5/1, encryption */
182 VLR_CIPH_A5_2, /*< A5/2, deprecated export-grade encryption */
183 VLR_CIPH_A5_3, /*< A5/3, 'new secure' encryption */
184};
185
Neels Hofmeyrcf309132017-12-14 03:57:31 +0100186static inline uint8_t vlr_ciph_to_gsm0808_alg_id(enum vlr_ciph ciph)
187{
188 switch (ciph) {
189 default:
190 case VLR_CIPH_NONE:
191 return GSM0808_ALG_ID_A5_0;
192 case VLR_CIPH_A5_1:
193 return GSM0808_ALG_ID_A5_1;
194 case VLR_CIPH_A5_2:
195 return GSM0808_ALG_ID_A5_2;
196 case VLR_CIPH_A5_3:
197 return GSM0808_ALG_ID_A5_3;
198 }
199}
200
Harald Welteb8b85a12016-06-17 00:06:42 +0200201struct vlr_ops {
202 /* encode + transmit an AUTH REQ towards the MS.
203 * \param[in] at auth tuple providing rand, key_seq and autn.
204 * \param[in] send_autn True to send AUTN, for r99 UMTS auth.
205 */
206 int (*tx_auth_req)(void *msc_conn_ref, struct gsm_auth_tuple *at,
207 bool send_autn);
208 /* encode + transmit an AUTH REJECT towards the MS */
209 int (*tx_auth_rej)(void *msc_conn_ref);
210
211 /* encode + transmit an IDENTITY REQUEST towards the MS */
212 int (*tx_id_req)(void *msc_conn_ref, uint8_t mi_type);
213
214 int (*tx_lu_acc)(void *msc_conn_ref, uint32_t send_tmsi);
Neels Hofmeyr15809592018-04-06 02:57:51 +0200215 int (*tx_lu_rej)(void *msc_conn_ref, enum gsm48_reject_value cause);
Harald Welteb8b85a12016-06-17 00:06:42 +0200216 int (*tx_cm_serv_acc)(void *msc_conn_ref);
Neels Hofmeyr15809592018-04-06 02:57:51 +0200217 int (*tx_cm_serv_rej)(void *msc_conn_ref, enum gsm48_reject_value cause);
Harald Welteb8b85a12016-06-17 00:06:42 +0200218
Harald Welte71c51df2017-12-23 18:51:48 +0100219 int (*set_ciph_mode)(void *msc_conn_ref, bool umts_aka, bool retrieve_imeisv);
Harald Welteb8b85a12016-06-17 00:06:42 +0200220
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200221 /* UTRAN: send Common Id (when auth+ciph are complete) */
222 int (*tx_common_id)(void *msc_conn_ref);
223
Stefan Sperling3a741282018-03-13 21:11:49 +0100224 int (*tx_mm_info)(void *msc_conn_ref);
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200225
Harald Welteb8b85a12016-06-17 00:06:42 +0200226 /* notify MSC/SGSN that the subscriber data in VLR has been updated */
227 void (*subscr_update)(struct vlr_subscr *vsub);
228 /* notify MSC/SGSN that the given subscriber has been associated
229 * with this msc_conn_ref */
230 void (*subscr_assoc)(void *msc_conn_ref, struct vlr_subscr *vsub);
Vadim Yanitskiy8a0e2582018-06-14 03:54:33 +0700231
232 /* Forward a parsed GSUP message towards MSC message router */
233 int (*forward_gsup_msg)(struct vlr_subscr *vsub, struct osmo_gsup_message *gsup_msg);
Harald Welteb8b85a12016-06-17 00:06:42 +0200234};
235
236enum vlr_timer {
237 VLR_T_3250,
238 VLR_T_3260,
239 VLR_T_3270,
240 _NUM_VLR_TIMERS
241};
242
243/* An instance of the VLR codebase */
244struct vlr_instance {
245 struct llist_head subscribers;
246 struct llist_head operations;
Harald Welte1ea6baf2018-07-31 19:40:52 +0200247 struct osmo_gsup_client *gsup_client;
Harald Welteb8b85a12016-06-17 00:06:42 +0200248 struct vlr_ops ops;
Stefan Sperlingdefc3c82018-05-15 14:48:04 +0200249 struct osmo_timer_list lu_expire_timer;
Harald Welteb8b85a12016-06-17 00:06:42 +0200250 struct {
Neels Hofmeyr54a706c2017-07-18 15:39:27 +0200251 bool retrieve_imeisv_early;
252 bool retrieve_imeisv_ciphered;
Harald Welteb8b85a12016-06-17 00:06:42 +0200253 bool assign_tmsi;
254 bool check_imei_rqd;
Neels Hofmeyr33f53412017-10-29 02:11:18 +0100255 int auth_tuple_max_reuse_count;
Harald Welteb8b85a12016-06-17 00:06:42 +0200256 bool auth_reuse_old_sets_on_error;
257 bool parq_retrieve_imsi;
258 bool is_ps;
259 uint32_t timer[_NUM_VLR_TIMERS];
260 } cfg;
261 /* A free-form pointer for use by the caller */
262 void *user_ctx;
263};
264
265extern const struct value_string vlr_ciph_names[];
266static inline const char *vlr_ciph_name(enum vlr_ciph val)
267{
268 return get_value_string(vlr_ciph_names, val);
269}
270
271/* Location Updating request */
272struct osmo_fsm_inst *
273vlr_loc_update(struct osmo_fsm_inst *parent,
274 uint32_t parent_event_success,
275 uint32_t parent_event_failure,
276 void *parent_event_data,
277 struct vlr_instance *vlr, void *msc_conn_ref,
278 enum vlr_lu_type type, uint32_t tmsi, const char *imsi,
279 const struct osmo_location_area_id *old_lai,
280 const struct osmo_location_area_id *new_lai,
281 bool authentication_required,
Harald Welte71c51df2017-12-23 18:51:48 +0100282 bool ciphering_required,
Harald Welteb8b85a12016-06-17 00:06:42 +0200283 bool is_r99, bool is_utran,
284 bool assign_tmsi);
285
Neels Hofmeyr15809592018-04-06 02:57:51 +0200286void vlr_loc_update_cancel(struct osmo_fsm_inst *fi,
287 enum osmo_fsm_term_cause fsm_cause,
288 uint8_t gsm48_cause);
Harald Welteb8b85a12016-06-17 00:06:42 +0200289
290/* tell the VLR that the subscriber connection is gone */
291int vlr_subscr_disconnected(struct vlr_subscr *vsub);
Maxdcc193d2017-12-27 19:34:15 +0100292bool vlr_subscr_expire(struct vlr_subscr *vsub);
Harald Welteb8b85a12016-06-17 00:06:42 +0200293int vlr_subscr_rx_id_resp(struct vlr_subscr *vsub, const uint8_t *mi, size_t mi_len);
294int vlr_subscr_rx_auth_resp(struct vlr_subscr *vsub, bool is_r99, bool is_utran,
295 const uint8_t *res, uint8_t res_len);
296int vlr_subscr_rx_auth_fail(struct vlr_subscr *vsub, const uint8_t *auts);
Max770fbd22018-01-24 12:48:33 +0100297int vlr_subscr_tx_auth_fail_rep(const struct vlr_subscr *vsub) __attribute__((warn_unused_result));
Harald Welteb8b85a12016-06-17 00:06:42 +0200298void vlr_subscr_rx_ciph_res(struct vlr_subscr *vsub, struct vlr_ciph_result *res);
299int vlr_subscr_rx_tmsi_reall_compl(struct vlr_subscr *vsub);
300int vlr_subscr_rx_imsi_detach(struct vlr_subscr *vsub);
Harald Welteb8b85a12016-06-17 00:06:42 +0200301
302struct vlr_instance *vlr_alloc(void *ctx, const struct vlr_ops *ops);
303int vlr_start(const char *gsup_unit_name, struct vlr_instance *vlr,
304 const char *gsup_server_addr_str, uint16_t gsup_server_port);
305
306/* internal use only */
307
Neels Hofmeyr1a5bcd52017-11-18 22:19:55 +0100308void sub_pres_vlr_fsm_start(struct osmo_fsm_inst **fsm,
309 struct osmo_fsm_inst *parent,
310 struct vlr_subscr *vsub,
311 uint32_t term_event);
Harald Welteb8b85a12016-06-17 00:06:42 +0200312struct osmo_fsm_inst *
313upd_hlr_vlr_proc_start(struct osmo_fsm_inst *parent,
314 struct vlr_subscr *vsub,
315 uint32_t parent_event);
316
317struct osmo_fsm_inst *
318lu_compl_vlr_proc_start(struct osmo_fsm_inst *parent,
319 struct vlr_subscr *vsub,
320 void *msc_conn_ref,
321 uint32_t parent_event_success,
322 uint32_t parent_event_failure);
323
324
325const char *vlr_subscr_name(struct vlr_subscr *vsub);
326const char *vlr_subscr_msisdn_or_name(struct vlr_subscr *vsub);
327
328#define vlr_subscr_find_by_imsi(vlr, imsi) \
Neels Hofmeyrc36e61e2018-08-20 12:41:36 +0200329 _vlr_subscr_find_by_imsi(vlr, imsi, __FILE__, __LINE__)
Harald Welteb8b85a12016-06-17 00:06:42 +0200330#define vlr_subscr_find_or_create_by_imsi(vlr, imsi, created) \
331 _vlr_subscr_find_or_create_by_imsi(vlr, imsi, created, \
Neels Hofmeyrc36e61e2018-08-20 12:41:36 +0200332 __FILE__, __LINE__)
Harald Welteb8b85a12016-06-17 00:06:42 +0200333
334#define vlr_subscr_find_by_tmsi(vlr, tmsi) \
Neels Hofmeyrc36e61e2018-08-20 12:41:36 +0200335 _vlr_subscr_find_by_tmsi(vlr, tmsi, __FILE__, __LINE__)
Harald Welteb8b85a12016-06-17 00:06:42 +0200336#define vlr_subscr_find_or_create_by_tmsi(vlr, tmsi, created) \
337 _vlr_subscr_find_or_create_by_tmsi(vlr, tmsi, created, \
Neels Hofmeyrc36e61e2018-08-20 12:41:36 +0200338 __FILE__, __LINE__)
Harald Welteb8b85a12016-06-17 00:06:42 +0200339
340#define vlr_subscr_find_by_msisdn(vlr, msisdn) \
Neels Hofmeyrc36e61e2018-08-20 12:41:36 +0200341 _vlr_subscr_find_by_msisdn(vlr, msisdn, __FILE__, __LINE__)
Harald Welteb8b85a12016-06-17 00:06:42 +0200342
343struct vlr_subscr *_vlr_subscr_find_by_imsi(struct vlr_instance *vlr,
344 const char *imsi,
345 const char *file, int line);
346struct vlr_subscr *_vlr_subscr_find_or_create_by_imsi(struct vlr_instance *vlr,
347 const char *imsi,
348 bool *created,
349 const char *file,
350 int line);
351
352struct vlr_subscr *_vlr_subscr_find_by_tmsi(struct vlr_instance *vlr,
353 uint32_t tmsi,
354 const char *file, int line);
355struct vlr_subscr *_vlr_subscr_find_or_create_by_tmsi(struct vlr_instance *vlr,
356 uint32_t tmsi,
357 bool *created,
358 const char *file,
359 int line);
360
361struct vlr_subscr *_vlr_subscr_find_by_msisdn(struct vlr_instance *vlr,
362 const char *msisdn,
363 const char *file, int line);
364
Neels Hofmeyrc36e61e2018-08-20 12:41:36 +0200365#define vlr_subscr_get(sub) _vlr_subscr_get(sub, __FILE__, __LINE__)
366#define vlr_subscr_put(sub) _vlr_subscr_put(sub, __FILE__, __LINE__)
Harald Welteb8b85a12016-06-17 00:06:42 +0200367struct vlr_subscr *_vlr_subscr_get(struct vlr_subscr *sub, const char *file, int line);
368struct vlr_subscr *_vlr_subscr_put(struct vlr_subscr *sub, const char *file, int line);
369
370struct vlr_subscr *vlr_subscr_alloc(struct vlr_instance *vlr);
371void vlr_subscr_free(struct vlr_subscr *vsub);
372int vlr_subscr_alloc_tmsi(struct vlr_subscr *vsub);
373
374void vlr_subscr_set_imsi(struct vlr_subscr *vsub, const char *imsi);
375void vlr_subscr_set_imei(struct vlr_subscr *vsub, const char *imei);
376void vlr_subscr_set_imeisv(struct vlr_subscr *vsub, const char *imeisv);
377void vlr_subscr_set_msisdn(struct vlr_subscr *vsub, const char *msisdn);
378
379bool vlr_subscr_matches_imsi(struct vlr_subscr *vsub, const char *imsi);
380bool vlr_subscr_matches_tmsi(struct vlr_subscr *vsub, uint32_t tmsi);
381bool vlr_subscr_matches_msisdn(struct vlr_subscr *vsub, const char *msisdn);
382bool vlr_subscr_matches_imei(struct vlr_subscr *vsub, const char *imei);
383
384uint32_t vlr_timer(struct vlr_instance *vlr, uint32_t timer);
385
386int vlr_subscr_changed(struct vlr_subscr *vsub);
Max770fbd22018-01-24 12:48:33 +0100387int vlr_subscr_purge(struct vlr_subscr *vsub) __attribute__((warn_unused_result));
Neels Hofmeyr15809592018-04-06 02:57:51 +0200388void vlr_subscr_cancel_attach_fsm(struct vlr_subscr *vsub,
389 enum osmo_fsm_term_cause fsm_cause,
390 uint8_t gsm48_cause);
Harald Welteb8b85a12016-06-17 00:06:42 +0200391
Stefan Sperlingdefc3c82018-05-15 14:48:04 +0200392void vlr_subscr_enable_expire_lu(struct vlr_subscr *vsub);
Harald Welteb8b85a12016-06-17 00:06:42 +0200393
394/* Process Acccess Request FSM */
395
Harald Welteb8b85a12016-06-17 00:06:42 +0200396enum proc_arq_vlr_event {
397 PR_ARQ_E_START,
398 PR_ARQ_E_ID_IMSI,
399 PR_ARQ_E_AUTH_RES,
400 PR_ARQ_E_CIPH_RES,
401 PR_ARQ_E_UPD_LOC_RES,
402 PR_ARQ_E_TRACE_RES,
403 PR_ARQ_E_IMEI_RES,
404 PR_ARQ_E_PRES_RES,
405 PR_ARQ_E_TMSI_ACK,
406};
407
408enum vlr_parq_type {
409 VLR_PR_ARQ_T_INVALID = 0, /* to guard against unset vars */
410 VLR_PR_ARQ_T_CM_SERV_REQ,
411 VLR_PR_ARQ_T_PAGING_RESP,
412 /* FIXME: differentiate between services of 24.008 10.5.3.3 */
413};
414
415/* Process Access Request (CM SERV REQ / PAGING RESP) */
416void
417vlr_proc_acc_req(struct osmo_fsm_inst *parent,
418 uint32_t parent_event_success,
419 uint32_t parent_event_failure,
420 void *parent_event_data,
421 struct vlr_instance *vlr, void *msc_conn_ref,
422 enum vlr_parq_type type, const uint8_t *mi_lv,
423 const struct osmo_location_area_id *lai,
424 bool authentication_required,
Harald Welte71c51df2017-12-23 18:51:48 +0100425 bool ciphering_required,
Harald Welteb8b85a12016-06-17 00:06:42 +0200426 bool is_r99, bool is_utran);
427
Neels Hofmeyr15809592018-04-06 02:57:51 +0200428void vlr_parq_cancel(struct osmo_fsm_inst *fi,
429 enum osmo_fsm_term_cause fsm_cause,
430 enum gsm48_reject_value gsm48_cause);
Harald Welteb8b85a12016-06-17 00:06:42 +0200431
432void vlr_parq_fsm_init(void);
433
434int vlr_set_ciph_mode(struct vlr_instance *vlr,
435 struct osmo_fsm_inst *fi,
436 void *msc_conn_ref,
Harald Welte71c51df2017-12-23 18:51:48 +0100437 bool ciph_required,
Neels Hofmeyr2ef2da52017-12-18 01:23:42 +0100438 bool umts_aka,
Harald Welteb8b85a12016-06-17 00:06:42 +0200439 bool retrieve_imeisv);
440
Neels Hofmeyre3d72d72017-12-18 02:06:44 +0100441bool vlr_use_umts_aka(struct osmo_auth_vector *vec, bool is_r99);
442
Harald Welteb8b85a12016-06-17 00:06:42 +0200443void log_set_filter_vlr_subscr(struct log_target *target,
444 struct vlr_subscr *vlr_subscr);