Neels Hofmeyr | 7299215 | 2020-09-19 02:36:08 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <osmocom/core/linuxlist.h> |
| 4 | #include <osmocom/core/fsm.h> |
| 5 | #include <osmocom/core/use_count.h> |
| 6 | #include <osmocom/gsm/gsm48.h> |
| 7 | #include <osmocom/gsm/gsm0808.h> |
| 8 | |
| 9 | struct smlc_subscr { |
| 10 | struct llist_head entry; |
| 11 | struct osmo_use_count use_count; |
| 12 | |
| 13 | struct osmo_mobile_identity imsi; |
| 14 | struct gsm0808_cell_id cell_id; |
| 15 | |
| 16 | struct osmo_fsm_inst *loc_req; |
| 17 | }; |
| 18 | |
| 19 | struct smlc_subscr *smlc_subscr_find_or_create(const struct osmo_mobile_identity *imsi, const char *use_token); |
| 20 | struct smlc_subscr *smlc_subscr_find(const struct osmo_mobile_identity *imsi, const char *use_token); |
| 21 | |
| 22 | int smlc_subscr_to_str_buf(char *buf, size_t buf_len, const struct smlc_subscr *smlc_subscr); |
| 23 | char *smlc_subscr_to_str_c(void *ctx, const struct smlc_subscr *smlc_subscr); |
| 24 | |
| 25 | struct smlc_subscr *smlc_subscr_find_or_create(const struct osmo_mobile_identity *imsi, const char *use_token); |
| 26 | |
| 27 | #define smlc_subscr_get(smlc_subscr, use) \ |
| 28 | OSMO_ASSERT(osmo_use_count_get_put(&(smlc_subscr)->use_count, use, 1) == 0) |
| 29 | #define smlc_subscr_put(smlc_subscr, use) \ |
| 30 | OSMO_ASSERT(osmo_use_count_get_put(&(smlc_subscr)->use_count, use, -1) == 0) |