Neels Hofmeyr | 1971b67 | 2020-01-23 04:40:51 +0100 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include <osmocom/core/linuxlist.h> |
| 4 | #include <osmocom/hlr/proxy.h> |
| 5 | |
| 6 | enum proxy_mm_fsm_event { |
| 7 | PROXY_MM_EV_SUBSCR_INVALID, |
| 8 | PROXY_MM_EV_RX_GSUP_LU, |
| 9 | PROXY_MM_EV_RX_GSUP_SAI, |
| 10 | PROXY_MM_EV_RX_SUBSCR_DATA, |
| 11 | PROXY_MM_EV_RX_GSUP_ISD_RESULT, |
| 12 | PROXY_MM_EV_RX_AUTH_TUPLES, |
| 13 | }; |
| 14 | |
| 15 | enum proxy_to_home_fsm_event { |
| 16 | PROXY_TO_HOME_EV_HOME_HLR_RESOLVED, |
| 17 | PROXY_TO_HOME_EV_RX_INSERT_SUBSCRIBER_DATA_REQ, |
| 18 | PROXY_TO_HOME_EV_RX_UPDATE_LOCATION_RESULT, |
| 19 | PROXY_TO_HOME_EV_RX_SEND_AUTH_INFO_RESULT, |
| 20 | PROXY_TO_HOME_EV_CHECK_TUPLES, |
| 21 | PROXY_TO_HOME_EV_CONFIRM_LU, |
| 22 | }; |
| 23 | |
| 24 | extern struct llist_head proxy_mm_list; |
| 25 | |
| 26 | struct proxy_mm_auth_cache { |
| 27 | struct llist_head entry; |
| 28 | uint64_t db_id; |
| 29 | struct osmo_auth_vector auth_vectors[OSMO_GSUP_MAX_NUM_AUTH_INFO]; |
| 30 | size_t num_auth_vectors; |
| 31 | unsigned int sent_to_vlr_count; |
| 32 | }; |
| 33 | |
| 34 | struct proxy_mm { |
| 35 | struct llist_head entry; |
| 36 | struct osmo_gsup_peer_id vlr_name; |
| 37 | char imsi[GSM23003_IMSI_MAX_DIGITS+1]; |
| 38 | bool is_ps; |
| 39 | struct osmo_fsm_inst *mm_fi; |
| 40 | struct osmo_fsm_inst *to_home_fi; |
| 41 | struct llist_head auth_cache; |
| 42 | }; |
| 43 | |
| 44 | struct proxy_mm *proxy_mm_alloc(const struct osmo_gsup_peer_id *vlr_name, |
| 45 | bool is_ps, |
| 46 | const char *imsi); |
| 47 | |
| 48 | void proxy_mm_add_auth_vectors(struct proxy_mm *proxy_mm, |
| 49 | const struct osmo_auth_vector *auth_vectors, size_t num_auth_vectors); |
| 50 | struct proxy_mm_auth_cache *proxy_mm_get_auth_vectors(struct proxy_mm *proxy_mm); |
| 51 | void proxy_mm_use_auth_vectors(struct proxy_mm *proxy_mm, struct proxy_mm_auth_cache *ac); |
| 52 | void proxy_mm_discard_auth_vectors(struct proxy_mm *proxy_mm, struct proxy_mm_auth_cache *ac); |
| 53 | |
| 54 | bool proxy_mm_subscriber_data_known(const struct proxy_mm *proxy_mm); |