blob: 53fa7be5cebf627facbfd15b7c57e0e8afd5b184 [file] [log] [blame]
Neels Hofmeyr6d804b12017-02-18 22:20:46 +01001/* GSM subscriber details for use in BSC land */
2
3#pragma once
4
5#include <stdint.h>
6
7#include <osmocom/core/linuxlist.h>
8#include <osmocom/gsm/protocol/gsm_23_003.h>
Neels Hofmeyr2c612452020-05-26 03:33:24 +02009#include <osmocom/gsm/gsm48.h>
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010010
11struct log_target;
12
13struct bsc_subscr {
14 struct llist_head entry;
15 int use_count;
16
17 char imsi[GSM23003_IMSI_MAX_DIGITS+1];
18 uint32_t tmsi;
19 uint16_t lac;
20};
21
22const char *bsc_subscr_name(struct bsc_subscr *bsub);
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020023const char *bsc_subscr_id(struct bsc_subscr *bsub);
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010024
25struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list,
26 const char *imsi);
27struct bsc_subscr *bsc_subscr_find_or_create_by_tmsi(struct llist_head *list,
28 uint32_t tmsi);
Neels Hofmeyr2c612452020-05-26 03:33:24 +020029struct bsc_subscr *bsc_subscr_find_or_create_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi);
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010030
31struct bsc_subscr *bsc_subscr_find_by_imsi(struct llist_head *list,
32 const char *imsi);
33struct bsc_subscr *bsc_subscr_find_by_tmsi(struct llist_head *list,
34 uint32_t tmsi);
Neels Hofmeyr2c612452020-05-26 03:33:24 +020035struct bsc_subscr *bsc_subscr_find_by_mi(struct llist_head *list, const struct osmo_mobile_identity *mi);
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010036
37void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi);
38
39struct bsc_subscr *_bsc_subscr_get(struct bsc_subscr *bsub,
40 const char *file, int line);
41struct bsc_subscr *_bsc_subscr_put(struct bsc_subscr *bsub,
42 const char *file, int line);
Neels Hofmeyrc649c3f2018-08-20 12:40:43 +020043#define bsc_subscr_get(bsub) _bsc_subscr_get(bsub, __FILE__, __LINE__)
44#define bsc_subscr_put(bsub) _bsc_subscr_put(bsub, __FILE__, __LINE__)
Neels Hofmeyr6d804b12017-02-18 22:20:46 +010045
46void log_set_filter_bsc_subscr(struct log_target *target,
47 struct bsc_subscr *bsub);