diff --git a/include/osmocom/vlr/vlr.h b/include/osmocom/vlr/vlr.h index ed6438bd0..b1994d038 100644 --- a/include/osmocom/vlr/vlr.h +++ b/include/osmocom/vlr/vlr.h @@ -204,6 +204,13 @@ enum vlr_ciph { VLR_CIPH_A5_3 = 3, /*< A5/3, 'new secure' encryption */ }; +enum vlr_inval_reason { + VLR_INVAL_REASON_WITHDRAWN, /*< HLR cancel location, reason subscription withdrawn */ + VLR_INVAL_REASON_UPDATE_LOCATION, /*< HLR cancel location, reason update location */ + VLR_INVAL_REASON_LOCATION_EXPIRED, /*< Location Update timer ran out */ + VLR_INVAL_REASON_DUPLICATE_SUBSCR, /*< A newer record of the same subscriber exists. This is the old entry. */ +}; + static inline uint8_t vlr_ciph_to_gsm0808_alg_id(enum vlr_ciph ciph) { switch (ciph) { @@ -250,8 +257,8 @@ struct vlr_ops { /* notify MSC/SGSN that the given subscriber has been associated * with this msc_conn_ref */ int (*subscr_assoc)(void *msc_conn_ref, struct vlr_subscr *vsub); - /* notify MSC that the given subscriber is no longer valid */ - void (*subscr_inval)(void *msc_conn_ref, struct vlr_subscr *vsub); + /* notify MSC that the given subscriber is no longer valid. */ + void (*subscr_inval)(void *msc_conn_ref, struct vlr_subscr *vsub, enum vlr_inval_reason reason); }; /* An instance of the VLR codebase */ diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c index d9e0b5f42..de0a69373 100644 --- a/src/libmsc/gsm_04_08.c +++ b/src/libmsc/gsm_04_08.c @@ -1572,7 +1572,7 @@ static int msc_vlr_subscr_assoc(void *msc_conn_ref, return 0; } -static void msc_vlr_subscr_inval(void *msc_conn_ref, struct vlr_subscr *vsub) +static void msc_vlr_subscr_inval(void *msc_conn_ref, struct vlr_subscr *vsub, enum vlr_inval_reason reason) { /* Search vsub backwards to make sure msc_conn_ref is a valid msc_a instance. */ struct msub *msub; diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c index 95b081a99..8e053ae03 100644 --- a/src/libvlr/vlr.c +++ b/src/libvlr/vlr.c @@ -629,7 +629,7 @@ static void dedup_vsub(struct vlr_subscr *exists, struct vlr_subscr *vsub) exists->imsi); if (vlr->ops.subscr_inval) - vlr->ops.subscr_inval(exists->msc_conn_ref, exists); + vlr->ops.subscr_inval(exists->msc_conn_ref, exists, VLR_INVAL_REASON_DUPLICATE_SUBSCR); vlr_subscr_free(exists); }