Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1 | #ifndef _GSM_SUBSCR_H |
| 2 | #define _GSM_SUBSCR_H |
| 3 | |
Neels Hofmeyr | ab04fb2 | 2016-05-30 22:32:51 +0200 | [diff] [blame] | 4 | #include <stdbool.h> |
| 5 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 6 | #include <osmocom/core/linuxlist.h> |
Harald Welte | d3fa84d | 2016-04-20 17:50:17 +0200 | [diff] [blame] | 7 | #include <osmocom/gsm/protocol/gsm_23_003.h> |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 8 | |
Neels Hofmeyr | 9084396 | 2017-09-04 15:04:35 +0200 | [diff] [blame] | 9 | #include <osmocom/msc/gsm_data.h> |
Max | e6052c4 | 2016-06-30 10:25:49 +0200 | [diff] [blame] | 10 | |
Holger Hans Peter Freyther | fa530cd | 2010-07-25 18:10:02 +0800 | [diff] [blame] | 11 | #define GSM_NAME_LENGTH 160 |
Mike Haben | 2449b37 | 2009-10-26 20:36:34 +0100 | [diff] [blame] | 12 | |
| 13 | #define GSM_EXTENSION_LENGTH 15 /* MSISDN can only be 15 digits length */ |
| 14 | #define GSM_MIN_EXTEN 20000 |
| 15 | #define GSM_MAX_EXTEN 49999 |
Jan Luebbe | 5c15c85 | 2008-12-27 15:59:25 +0000 | [diff] [blame] | 16 | |
Jan Luebbe | b0dfc31 | 2009-08-12 10:12:52 +0200 | [diff] [blame] | 17 | #define GSM_SUBSCRIBER_FIRST_CONTACT 0x00000001 |
Jacob Erlbeck | 33b6dad | 2014-11-12 10:12:11 +0100 | [diff] [blame] | 18 | /* gprs_sgsn.h defines additional flags including and above bit 16 (0x10000) */ |
Jan Luebbe | b0dfc31 | 2009-08-12 10:12:52 +0200 | [diff] [blame] | 19 | |
Jan Luebbe | 5c15c85 | 2008-12-27 15:59:25 +0000 | [diff] [blame] | 20 | enum gsm_subscriber_field { |
| 21 | GSM_SUBSCRIBER_IMSI, |
| 22 | GSM_SUBSCRIBER_TMSI, |
Holger Freyther | 9c564b8 | 2009-02-09 23:39:20 +0000 | [diff] [blame] | 23 | GSM_SUBSCRIBER_EXTENSION, |
Harald Welte | be3e378 | 2009-07-05 14:06:41 +0200 | [diff] [blame] | 24 | GSM_SUBSCRIBER_ID, |
Jan Luebbe | 5c15c85 | 2008-12-27 15:59:25 +0000 | [diff] [blame] | 25 | }; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 26 | |
Holger Freyther | 4a49e77 | 2009-04-12 05:37:29 +0000 | [diff] [blame] | 27 | enum gsm_subscriber_update_reason { |
| 28 | GSM_SUBSCRIBER_UPDATE_ATTACHED, |
| 29 | GSM_SUBSCRIBER_UPDATE_DETACHED, |
Harald Welte | c2e302d | 2009-07-05 14:08:13 +0200 | [diff] [blame] | 30 | GSM_SUBSCRIBER_UPDATE_EQUIPMENT, |
Holger Freyther | 4a49e77 | 2009-04-12 05:37:29 +0000 | [diff] [blame] | 31 | }; |
| 32 | |
Neels Hofmeyr | e2f24d5 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 33 | /* |
| 34 | * Struct for pending channel requests. This is managed in the |
| 35 | * llist_head requests of each subscriber. The reference counting |
| 36 | * should work in such a way that a subscriber with a pending request |
| 37 | * remains in memory. |
| 38 | */ |
| 39 | struct subscr_request { |
| 40 | struct llist_head entry; |
| 41 | |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 42 | /* human readable label to be able to log pending request kinds */ |
| 43 | const char *label; |
| 44 | |
Neels Hofmeyr | e2f24d5 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 45 | /* the callback data */ |
| 46 | gsm_cbfn *cbfn; |
| 47 | void *param; |
| 48 | }; |
| 49 | |
| 50 | int subscr_update(struct vlr_subscr *vsub, int reason); |
Holger Hans Peter Freyther | f694d5f | 2010-12-22 14:31:34 +0100 | [diff] [blame] | 51 | |
Holger Hans Peter Freyther | d6d7aff | 2015-04-06 12:03:45 +0200 | [diff] [blame] | 52 | /* |
| 53 | * Paging handling with authentication |
| 54 | */ |
Neels Hofmeyr | e2f24d5 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 55 | struct subscr_request *subscr_request_conn(struct vlr_subscr *vsub, |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 56 | gsm_cbfn *cbfn, void *param, |
| 57 | const char *label); |
Neels Hofmeyr | e2f24d5 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 58 | |
Holger Hans Peter Freyther | d6d7aff | 2015-04-06 12:03:45 +0200 | [diff] [blame] | 59 | void subscr_remove_request(struct subscr_request *req); |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 60 | int subscr_rx_paging_response(struct msgb *msg, |
| 61 | struct gsm_subscriber_connection *conn); |
Holger Hans Peter Freyther | d6d7aff | 2015-04-06 12:03:45 +0200 | [diff] [blame] | 62 | |
Neels Hofmeyr | facd57a | 2017-12-15 03:48:48 +0100 | [diff] [blame] | 63 | void subscr_paging_cancel(struct vlr_subscr *vsub, enum gsm_paging_event event); |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 64 | int subscr_paging_dispatch(unsigned int hooknum, unsigned int event, |
| 65 | struct msgb *msg, void *data, void *param); |
Holger Freyther | 12aa50d | 2009-01-01 18:02:05 +0000 | [diff] [blame] | 66 | |
Harald Welte | d35038d | 2018-01-25 00:07:33 +0100 | [diff] [blame] | 67 | /* Find an allocated channel for a specified subscriber */ |
| 68 | struct gsm_subscriber_connection *connection_for_subscr(struct vlr_subscr *vsub); |
| 69 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 70 | #endif /* _GSM_SUBSCR_H */ |