aboutsummaryrefslogtreecommitdiffstats
path: root/include/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-06-19 18:06:02 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 17:40:52 +0200
commit9066b74c1fe5439c79e82cff9ab0fdb503a33332 (patch)
tree68489deee447c38f0d3efcfdfa715ec041b0be3f /include/openbsc
parent9ccd6621fb236377c0b71d334f64bede02ec32e7 (diff)
Use libvlr in libmsc (large refactoring)
Original libvlr code is by Harald Welte <laforge@gnumonks.org>, polished and tweaked by Neels Hofmeyr <nhofmeyr@sysmocom.de>. This is a long series of trial-and-error development collapsed in one patch. This may be split in smaller commits if reviewers prefer that. If we can keep it as one, we have saved ourselves the additional separation work. SMS: The SQL based lookup of SMS for attached subscribers no longer works since the SQL database no longer has the subscriber data. Replace with a round-robin on the SMS recipient MSISDNs paired with a VLR subscriber RAM lookup whether the subscriber is currently attached. If there are many SMS for not-attached subscribers in the SMS database, this will become inefficient: a DB hit returns a pending SMS, the RAM lookup will reveal that the subscriber is not attached, after which the DB is hit for the next SMS. It would become more efficient e.g. by having an MSISDN based hash list for the VLR subscribers and by marking non-attached SMS recipients in the SMS database so that they can be excluded with the SQL query already. There is a sanity limit to do at most 100 db hits per attempt to find a pending SMS. So if there are more than 100 stored SMS waiting for their recipients to actually attach to the MSC, it may take more than one SMS queue trigger to deliver SMS for subscribers that are actually attached. This is not very beautiful, but is merely intended to carry us over to a time when we have a proper separate SMSC entity. Introduce gsm_subscriber_connection ref-counting in libmsc. Remove/Disable VTY and CTRL commands to create subscribers, which is now a task of the OsmoHLR. Adjust the python tests accordingly. Remove VTY cmd subscriber-keep-in-ram. Use OSMO_GSUP_PORT = 4222 instead of 2222. See I4222e21686c823985be8ff1f16b1182be8ad6175. So far use the LAC from conn->bts, will be replaced by conn->lac in Id3705236350d5f69e447046b0a764bbabc3d493c. Related: OS#1592 OS#1974 Change-Id: I639544a6cdda77a3aafc4e3446a55393f60e4050
Diffstat (limited to 'include/openbsc')
-rw-r--r--include/openbsc/Makefile.am1
-rw-r--r--include/openbsc/abis_rsl.h1
-rw-r--r--include/openbsc/auth.h4
-rw-r--r--include/openbsc/bsc_api.h3
-rw-r--r--include/openbsc/chan_alloc.h2
-rw-r--r--include/openbsc/db.h45
-rw-r--r--include/openbsc/gsm_04_08.h6
-rw-r--r--include/openbsc/gsm_04_11.h10
-rw-r--r--include/openbsc/gsm_data.h69
-rw-r--r--include/openbsc/gsm_data_shared.h1
-rw-r--r--include/openbsc/gsm_subscriber.h92
-rw-r--r--include/openbsc/osmo_msc.h69
-rw-r--r--include/openbsc/signal.h4
-rw-r--r--include/openbsc/silent_call.h4
-rw-r--r--include/openbsc/token_auth.h7
-rw-r--r--include/openbsc/transaction.h7
-rw-r--r--include/openbsc/vlr.h3
-rw-r--r--include/openbsc/vty.h1
18 files changed, 147 insertions, 182 deletions
diff --git a/include/openbsc/Makefile.am b/include/openbsc/Makefile.am
index 532328cb..456a4a2d 100644
--- a/include/openbsc/Makefile.am
+++ b/include/openbsc/Makefile.am
@@ -79,7 +79,6 @@ noinst_HEADERS = \
sms_queue.h \
socket.h \
system_information.h \
- token_auth.h \
transaction.h \
trau_mux.h \
trau_upqueue.h \
diff --git a/include/openbsc/abis_rsl.h b/include/openbsc/abis_rsl.h
index 400e09f6..f983fcee 100644
--- a/include/openbsc/abis_rsl.h
+++ b/include/openbsc/abis_rsl.h
@@ -30,7 +30,6 @@
struct gsm_bts;
struct gsm_lchan;
-struct gsm_subscriber;
struct gsm_bts_trx_ts;
#define GSM48_LEN2PLEN(a) (((a) << 2) | 1)
diff --git a/include/openbsc/auth.h b/include/openbsc/auth.h
index 61811316..b314bbf1 100644
--- a/include/openbsc/auth.h
+++ b/include/openbsc/auth.h
@@ -4,7 +4,6 @@
#include <osmocom/core/utils.h>
struct gsm_auth_tuple;
-struct gsm_subscriber;
enum auth_action {
AUTH_ERROR = -1, /* Internal error */
@@ -20,7 +19,4 @@ static inline const char *auth_action_str(enum auth_action a)
return get_value_string(auth_action_names, a);
}
-int auth_get_tuple_for_subscr(struct gsm_auth_tuple *atuple,
- struct gsm_subscriber *subscr, int key_seq);
-
#endif /* _AUTH_H */
diff --git a/include/openbsc/bsc_api.h b/include/openbsc/bsc_api.h
index 3a931199..40068d6e 100644
--- a/include/openbsc/bsc_api.h
+++ b/include/openbsc/bsc_api.h
@@ -41,6 +41,9 @@ struct bsc_api {
*/
void (*mr_config)(struct gsm_subscriber_connection *conn,
struct gsm_lchan *lchan, int full_rate);
+
+ /** Callback for additional actions during conn cleanup */
+ void (*conn_cleanup)(struct gsm_subscriber_connection *conn);
};
int bsc_api_init(struct gsm_network *network, struct bsc_api *api);
diff --git a/include/openbsc/chan_alloc.h b/include/openbsc/chan_alloc.h
index 78242e5b..7388e14c 100644
--- a/include/openbsc/chan_alloc.h
+++ b/include/openbsc/chan_alloc.h
@@ -25,7 +25,7 @@
struct gsm_subscriber_connection;
/* Find an allocated channel for a specified subscriber */
-struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr);
+struct gsm_subscriber_connection *connection_for_subscr(struct vlr_subscr *vsub);
/* Allocate a logical channel (SDCCH, TCH, ...) */
struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type, int allow_bigger);
diff --git a/include/openbsc/db.h b/include/openbsc/db.h
index bb90705a..988c9bd6 100644
--- a/include/openbsc/db.h
+++ b/include/openbsc/db.h
@@ -29,53 +29,26 @@ struct gsm_network;
struct gsm_auth_info;
struct gsm_auth_tuple;
struct gsm_sms;
-struct gsm_subscriber;
/* one time initialisation */
int db_init(const char *name);
int db_prepare(void);
int db_fini(void);
-/* subscriber management */
-struct gsm_subscriber *db_create_subscriber(const char *imsi, uint64_t smin,
- uint64_t smax, bool alloc_exten);
-struct gsm_subscriber *db_get_subscriber(enum gsm_subscriber_field field,
- const char *subscr);
-int db_sync_subscriber(struct gsm_subscriber *subscriber);
-int db_subscriber_expire(void *priv, void (*callback)(void *priv, long long unsigned int id));
-int db_subscriber_alloc_tmsi(struct gsm_subscriber *subscriber);
-int db_subscriber_alloc_exten(struct gsm_subscriber *subscriber, uint64_t smin,
- uint64_t smax);
-int db_subscriber_alloc_token(struct gsm_subscriber *subscriber, uint32_t* token);
-int db_subscriber_assoc_imei(struct gsm_subscriber *subscriber, char *imei);
-int db_subscriber_delete(struct gsm_subscriber *subscriber);
-int db_sync_equipment(struct gsm_equipment *equip);
-int db_subscriber_update(struct gsm_subscriber *subscriber);
-int db_subscriber_list_active(void (*list_cb)(struct gsm_subscriber*,void*), void*);
-
-/* auth info */
-int db_get_authinfo_for_subscr(struct gsm_auth_info *ainfo,
- struct gsm_subscriber *subscr);
-int db_sync_authinfo_for_subscr(struct gsm_auth_info *ainfo,
- struct gsm_subscriber *subscr);
-int db_get_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple,
- struct gsm_subscriber *subscr);
-int db_sync_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple,
- struct gsm_subscriber *subscr);
-
/* SMS store-and-forward */
int db_sms_store(struct gsm_sms *sms);
struct gsm_sms *db_sms_get(struct gsm_network *net, unsigned long long id);
-struct gsm_sms *db_sms_get_unsent(struct gsm_network *net, unsigned long long min_id);
-struct gsm_sms *db_sms_get_unsent_by_subscr(struct gsm_network *net, unsigned long long min_subscr_id, unsigned int failed);
-struct gsm_sms *db_sms_get_unsent_for_subscr(struct gsm_subscriber *subscr);
+struct gsm_sms *db_sms_get_next_unsent(struct gsm_network *net,
+ unsigned long long min_sms_id,
+ unsigned int max_failed);
+struct gsm_sms *db_sms_get_next_unsent_rr_msisdn(struct gsm_network *net,
+ const char *last_msisdn,
+ unsigned int max_failed);
+struct gsm_sms *db_sms_get_unsent_for_subscr(struct vlr_subscr *vsub,
+ unsigned int max_failed);
int db_sms_mark_delivered(struct gsm_sms *sms);
int db_sms_inc_deliver_attempts(struct gsm_sms *sms);
-
-/* APDU blob storage */
-int db_apdu_blob_store(struct gsm_subscriber *subscr,
- uint8_t apdu_id_flags, uint8_t len,
- uint8_t *apdu);
+int db_sms_delete_by_msisdn(const char *msisdn);
/* Statistics counter storage */
struct osmo_counter;
diff --git a/include/openbsc/gsm_04_08.h b/include/openbsc/gsm_04_08.h
index a8b2de95..c40d96d6 100644
--- a/include/openbsc/gsm_04_08.h
+++ b/include/openbsc/gsm_04_08.h
@@ -9,7 +9,6 @@
struct msgb;
struct gsm_bts;
-struct gsm_subscriber;
struct gsm_network;
struct gsm_trans;
struct gsm_subscriber_connection;
@@ -26,14 +25,15 @@ static inline struct msgb *gsm48_msgb_alloc_name(const char *name)
name);
}
+void cm_service_request_concludes(struct gsm_subscriber_connection *conn,
+ struct msgb *msg);
+
/* config options controlling the behaviour of the lower leves */
void gsm0408_allow_everyone(int allow);
-void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
void gsm0408_clear_all_trans(struct gsm_network *net, int protocol);
int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg);
int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id);
-int gsm0408_new_conn(struct gsm_subscriber_connection *conn);
enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *bts, uint8_t ra);
/* don't use "enum gsm_chreq_reason_t" to avoid circular dependency */
int get_reason_by_chreq(uint8_t ra, int neci);
diff --git a/include/openbsc/gsm_04_11.h b/include/openbsc/gsm_04_11.h
index 017c8876..3305e3e6 100644
--- a/include/openbsc/gsm_04_11.h
+++ b/include/openbsc/gsm_04_11.h
@@ -3,6 +3,10 @@
#include <osmocom/gsm/protocol/gsm_04_11.h>
+struct vlr_subscr;
+struct gsm_subscriber_connection;
+struct gsm_trans;
+
#define UM_SAPI_SMS 3 /* See GSM 04.05/04.06 */
/* SMS deliver PDU */
@@ -29,10 +33,12 @@ int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn, struct msgb *msg);
struct gsm_sms *sms_alloc(void);
void sms_free(struct gsm_sms *sms);
-struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver, struct gsm_subscriber *sender, int dcs, const char *text);
+struct gsm_sms *sms_from_text(struct vlr_subscr *receiver,
+ struct vlr_subscr *sender,
+ int dcs, const char *text);
void _gsm411_sms_trans_free(struct gsm_trans *trans);
-int gsm411_send_sms_subscr(struct gsm_subscriber *subscr,
+int gsm411_send_sms_subscr(struct vlr_subscr *vsub,
struct gsm_sms *sms);
int gsm411_send_sms(struct gsm_subscriber_connection *conn,
struct gsm_sms *sms);
diff --git a/include/openbsc/gsm_data.h b/include/openbsc/gsm_data.h
index a9740510..fa2fed77 100644
--- a/include/openbsc/gsm_data.h
+++ b/include/openbsc/gsm_data.h
@@ -24,6 +24,8 @@
struct mncc_sock_state;
struct gsm_subscriber_group;
struct bsc_subscr;
+struct vlr_instance;
+struct vlr_subscr;
#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
@@ -70,20 +72,6 @@ struct gsm_auth_tuple {
#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */
/*
- * LOCATION UPDATING REQUEST state
- *
- * Our current operation is:
- * - Get imei/tmsi
- * - Accept/Reject according to global policy
- */
-struct gsm_loc_updating_operation {
- struct osmo_timer_list updating_timer;
- unsigned int waiting_for_imsi : 1;
- unsigned int waiting_for_imei : 1;
- unsigned int key_seq : 4;
-};
-
-/*
* AUTHENTICATION/CIPHERING state
*/
struct gsm_security_operation {
@@ -120,16 +108,34 @@ enum ran_type {
RAN_UTRAN_IU, /* 3G / Iu-interface (IuCS or IuPS) */
};
+struct gsm_classmark {
+ bool classmark1_set;
+ struct gsm48_classmark1 classmark1;
+ uint8_t classmark2_len;
+ uint8_t classmark2[3];
+ uint8_t classmark3_len;
+ uint8_t classmark3[14]; /* if cm3 gets extended by spec, it will be truncated */
+};
+
/* active radio connection of a mobile subscriber */
struct gsm_subscriber_connection {
+ /* global linked list of subscriber_connections */
struct llist_head entry;
- /* To whom we are allocated at the moment */
- struct gsm_subscriber *subscr;
+ /* usage count. If this drops to zero, we start the release
+ * towards A/Iu */
+ uint32_t use_count;
+
+ /* The MS has opened the conn with a CM Service Request, and we shall
+ * keep it open for an actual request (or until timeout). */
+ bool received_cm_service_request;
- /* libbsc subscriber information */
+ /* libbsc subscriber information (if available) */
struct bsc_subscr *bsub;
+ /* libmsc/libvlr subscriber information (if available) */
+ struct vlr_subscr *vsub;
+
/* LU expiration handling */
uint8_t expire_timer_stopped;
/* SMS helpers for libmsc */
@@ -138,10 +144,11 @@ struct gsm_subscriber_connection {
/*
* Operations that have a state and might be pending
*/
- struct gsm_loc_updating_operation *loc_operation;
struct gsm_security_operation *sec_operation;
struct gsm_anchor_operation *anch_operation;
+ struct osmo_fsm_inst *conn_fsm;
+
/* Are we part of a special "silent" call */
int silent_call;
@@ -156,7 +163,7 @@ struct gsm_subscriber_connection {
/* back pointers */
struct gsm_network *network;
- int in_release;
+ bool in_release;
struct gsm_lchan *lchan; /* BSC */
struct gsm_lchan *ho_lchan; /* BSC */
struct gsm_bts *bts; /* BSC */
@@ -167,6 +174,8 @@ struct gsm_subscriber_connection {
/* connected via 2G or 3G? */
enum ran_type via_ran;
+
+ struct gsm_classmark classmark;
};
@@ -312,6 +321,7 @@ struct gsm_network {
char *authorized_reg_str;
enum gsm48_reject_value reject_cause;
int a5_encryption;
+ bool authentication_required;
int neci;
int send_mm_info;
struct {
@@ -375,17 +385,8 @@ struct gsm_network {
/* MSC data in case we are a true BSC */
struct osmo_bsc_data *bsc_data;
- /* subscriber related features */
- bool auto_create_subscr;
- bool auto_assign_exten;
- uint64_t ext_min;
- uint64_t ext_max;
- struct gsm_subscriber_group *subscr_group;
struct gsm_sms_queue *sms_queue;
- /* nitb related control */
- int avoid_tmsi;
-
/* control interface */
struct ctrl_handle *ctrl;
@@ -409,6 +410,12 @@ struct gsm_network {
* not require gsm_data.h). In an MSC-without-BSC environment, this
* pointer is NULL to indicate absence of a bsc_subscribers list. */
struct llist_head *bsc_subscribers;
+
+ /* MSC: GSUP server address of the HLR */
+ const char *gsup_server_addr_str;
+ uint16_t gsup_server_port;
+
+ struct vlr_instance *vlr;
};
struct osmo_esme;
@@ -431,7 +438,7 @@ struct gsm_sms_addr {
struct gsm_sms {
unsigned long long id;
- struct gsm_subscriber *receiver;
+ struct vlr_subscr *receiver;
struct gsm_sms_addr src, dst;
enum gsm_sms_source_id source;
@@ -582,7 +589,7 @@ extern const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1];
/* control interface handling */
int bsc_base_ctrl_cmds_install(void);
-int msc_ctrl_cmds_install(void);
+int msc_ctrl_cmds_install(struct gsm_network *net);
/* dependency handling */
void bts_depend_mark(struct gsm_bts *bts, int dep);
@@ -593,4 +600,6 @@ int bts_depend_is_depedency(struct gsm_bts *base, struct gsm_bts *other);
int gsm_bts_get_radio_link_timeout(const struct gsm_bts *bts);
void gsm_bts_set_radio_link_timeout(struct gsm_bts *bts, int value);
+bool classmark_is_r99(struct gsm_classmark *cm);
+
#endif /* _GSM_DATA_H */
diff --git a/include/openbsc/gsm_data_shared.h b/include/openbsc/gsm_data_shared.h
index 4c71a075..0790807b 100644
--- a/include/openbsc/gsm_data_shared.h
+++ b/include/openbsc/gsm_data_shared.h
@@ -95,7 +95,6 @@ enum bts_gprs_mode {
};
struct gsm_lchan;
-struct gsm_subscriber;
struct gsm_mncc;
struct osmo_rtp_socket;
struct rtp_socket;
diff --git a/include/openbsc/gsm_subscriber.h b/include/openbsc/gsm_subscriber.h
index 7e656145..c65b8a31 100644
--- a/include/openbsc/gsm_subscriber.h
+++ b/include/openbsc/gsm_subscriber.h
@@ -19,63 +19,8 @@
#define GSM_SUBSCRIBER_NO_EXPIRATION 0x0
-struct vty;
-struct sgsn_mm_ctx;
-struct sgsn_subscriber_data;
-
struct subscr_request;
-struct gsm_subscriber_group {
- struct gsm_network *net;
-
- int keep_subscr;
-};
-
-struct gsm_equipment {
- long long unsigned int id;
- char imei[GSM23003_IMEISV_NUM_DIGITS+1];
- char name[GSM_NAME_LENGTH];
-
- struct gsm48_classmark1 classmark1;
- uint8_t classmark2_len;
- uint8_t classmark2[3];
- uint8_t classmark3_len;
- uint8_t classmark3[14];
-};
-
-struct gsm_subscriber {
- struct gsm_subscriber_group *group;
- long long unsigned int id;
- char imsi[GSM23003_IMSI_MAX_DIGITS+1];
- uint32_t tmsi;
- uint16_t lac;
- char name[GSM_NAME_LENGTH];
- char extension[GSM_EXTENSION_LENGTH];
- int authorized;
- time_t expire_lu;
-
- /* Don't delete subscribers even if group->keep_subscr is not set */
- int keep_in_ram;
-
- /* Temporary field which is not stored in the DB/HLR */
- uint32_t flags;
-
- /* Every user can only have one equipment in use at any given
- * point in time */
- struct gsm_equipment equipment;
-
- /* for internal management */
- int use_count;
- struct llist_head entry;
-
- /* pending requests */
- int is_paging;
- struct llist_head requests;
-
- /* GPRS/SGSN related fields */
- struct sgsn_subscriber_data *sgsn_data;
-};
-
enum gsm_subscriber_field {
GSM_SUBSCRIBER_IMSI,
GSM_SUBSCRIBER_TMSI,
@@ -89,42 +34,17 @@ enum gsm_subscriber_update_reason {
GSM_SUBSCRIBER_UPDATE_EQUIPMENT,
};
-struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr);
-struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr);
-struct gsm_subscriber *subscr_create_subscriber(struct gsm_subscriber_group *sgrp,
- const char *imsi);
-struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_subscriber_group *sgrp,
- uint32_t tmsi);
-struct gsm_subscriber *subscr_get_by_imsi(struct gsm_subscriber_group *sgrp,
- const char *imsi);
-struct gsm_subscriber *subscr_get_by_extension(struct gsm_subscriber_group *sgrp,
- const char *ext);
-struct gsm_subscriber *subscr_get_by_id(struct gsm_subscriber_group *sgrp,
- unsigned long long id);
-struct gsm_subscriber *subscr_get_or_create(struct gsm_subscriber_group *sgrp,
- const char *imsi);
-int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason);
-struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_subscriber_group *sgrp,
- uint32_t tmsi);
-struct gsm_subscriber *subscr_active_by_imsi(struct gsm_subscriber_group *sgrp,
- const char *imsi);
-
-char *subscr_name(struct gsm_subscriber *subscr);
-
-int subscr_purge_inactive(struct gsm_subscriber_group *sgrp);
-void subscr_update_from_db(struct gsm_subscriber *subscr);
-void subscr_expire(struct gsm_subscriber_group *sgrp);
-int subscr_update_expire_lu(struct gsm_subscriber *subscr, struct gsm_bts *bts);
+int subscr_update(struct vlr_subscr *vsub, struct gsm_bts *bts, int reason);
/*
* Paging handling with authentication
*/
-struct subscr_request *subscr_request_channel(struct gsm_subscriber *subscr,
- int type, gsm_cbfn *cbfn, void *param);
+struct subscr_request *subscr_request_channel(struct vlr_subscr *vsub,
+ int channel_type,
+ gsm_cbfn *cbfn, void *param);
void subscr_remove_request(struct subscr_request *req);
-/* internal */
-struct gsm_subscriber *subscr_alloc(void);
-extern struct llist_head active_subscribers;
+int subscr_paging_dispatch(unsigned int hooknum, unsigned int event,
+ struct msgb *msg, void *data, void *param);
#endif /* _GSM_SUBSCR_H */
diff --git a/include/openbsc/osmo_msc.h b/include/openbsc/osmo_msc.h
index beb3f5e4..0642c910 100644
--- a/include/openbsc/osmo_msc.h
+++ b/include/openbsc/osmo_msc.h
@@ -3,9 +3,76 @@
#ifndef OSMO_MSC_H
#define OSMO_MSC_H
+#include <osmocom/core/fsm.h>
+#include <osmocom/gsm/gsup.h>
+
+#include <openbsc/gsm_data.h>
+
#include "bsc_api.h"
+#define MSC_HLR_REMOTE_IP_DEFAULT "127.0.0.1"
+#define MSC_HLR_REMOTE_PORT_DEFAULT OSMO_GSUP_PORT
+
+enum subscr_conn_fsm_event {
+ /* Mark 0 as invalid to catch uninitialized vars */
+ SUBSCR_CONN_E_INVALID = 0,
+ /* Timeout on connection establishment starts */
+ SUBSCR_CONN_E_START,
+ /* LU or Process Access FSM has determined that this conn is good */
+ SUBSCR_CONN_E_ACCEPTED,
+ /* received first reply from MS in "real" CC, SMS, USSD communication */
+ SUBSCR_CONN_E_COMMUNICATING,
+ /* Some async action has completed, check again whether all is done */
+ SUBSCR_CONN_E_BUMP,
+ /* MS/BTS/BSC originated close request */
+ SUBSCR_CONN_E_MO_CLOSE,
+ /* MSC originated close request, e.g. failed authentication */
+ SUBSCR_CONN_E_CN_CLOSE,
+};
+
+enum subscr_conn_fsm_state {
+ SUBSCR_CONN_S_INIT,
+ SUBSCR_CONN_S_NEW,
+ SUBSCR_CONN_S_ACCEPTED,
+ SUBSCR_CONN_S_COMMUNICATING,
+ SUBSCR_CONN_S_RELEASED,
+};
+
+enum subscr_conn_from {
+ SUBSCR_CONN_FROM_INVALID,
+ SUBSCR_CONN_FROM_LU,
+ SUBSCR_CONN_FROM_CM_SERVICE_REQ,
+ SUBSCR_CONN_FROM_PAGING_RESP,
+};
+
+extern const struct value_string subscr_conn_from_names[];
+static inline const char *subscr_conn_from_name(enum subscr_conn_from val)
+{
+ return get_value_string(subscr_conn_from_names, val);
+}
+
+
struct bsc_api *msc_bsc_api();
-void msc_release_connection(struct gsm_subscriber_connection *conn);
+
+int msc_create_conn_fsm(struct gsm_subscriber_connection *conn, const char *id);
+
+int msc_vlr_alloc(struct gsm_network *net);
+int msc_vlr_start(struct gsm_network *net);
+
+void msc_subscr_conn_init(void);
+bool msc_subscr_conn_is_accepted(struct gsm_subscriber_connection *conn);
+void msc_subscr_conn_communicating(struct gsm_subscriber_connection *conn);
+void msc_subscr_conn_close(struct gsm_subscriber_connection *conn,
+ uint32_t cause);
+
+#define msc_subscr_conn_get(conn) \
+ _msc_subscr_conn_get(conn, __BASE_FILE__, __LINE__)
+#define msc_subscr_conn_put(conn) \
+ _msc_subscr_conn_put(conn, __BASE_FILE__, __LINE__)
+struct gsm_subscriber_connection *
+_msc_subscr_conn_get(struct gsm_subscriber_connection *conn,
+ const char *file, int line);
+void _msc_subscr_conn_put(struct gsm_subscriber_connection *conn,
+ const char *file, int line);
#endif
diff --git a/include/openbsc/signal.h b/include/openbsc/signal.h
index d4ccf80d..49f86d61 100644
--- a/include/openbsc/signal.h
+++ b/include/openbsc/signal.h
@@ -138,10 +138,8 @@ enum signal_rf {
S_RF_GRACE,
};
-struct gsm_subscriber;
-
struct paging_signal_data {
- struct gsm_subscriber *subscr;
+ struct vlr_subscr *vsub;
struct gsm_bts *bts;
int paging_result;
diff --git a/include/openbsc/silent_call.h b/include/openbsc/silent_call.h
index 619a5432..5fec77b7 100644
--- a/include/openbsc/silent_call.h
+++ b/include/openbsc/silent_call.h
@@ -3,9 +3,9 @@
struct gsm_subscriber_connection;
-extern int gsm_silent_call_start(struct gsm_subscriber *subscr,
+extern int gsm_silent_call_start(struct vlr_subscr *vsub,
void *data, int type);
-extern int gsm_silent_call_stop(struct gsm_subscriber *subscr);
+extern int gsm_silent_call_stop(struct vlr_subscr *vsub);
#if 0
extern int silent_call_rx(struct gsm_subscriber_connection *conn, struct msgb *msg);
diff --git a/include/openbsc/token_auth.h b/include/openbsc/token_auth.h
deleted file mode 100644
index 47dc7aa9..00000000
--- a/include/openbsc/token_auth.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _TOKEN_AUTH_H
-#define _TOKEN_AUTH_H
-
-void on_dso_load_token(void);
-
-#endif /* _TOKEN_AUTH_H */
-
diff --git a/include/openbsc/transaction.h b/include/openbsc/transaction.h
index 9a87d04e..07ab7a7d 100644
--- a/include/openbsc/transaction.h
+++ b/include/openbsc/transaction.h
@@ -24,7 +24,7 @@ struct gsm_trans {
uint8_t transaction_id;
/* To whom we belong, unique identifier of remote MM entity */
- struct gsm_subscriber *subscr;
+ struct vlr_subscr *vsub;
/* The associated connection we are using to transmit messages */
struct gsm_subscriber_connection *conn;
@@ -67,13 +67,14 @@ struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
uint32_t callref);
struct gsm_trans *trans_alloc(struct gsm_network *net,
- struct gsm_subscriber *subscr,
+ struct vlr_subscr *vsub,
uint8_t protocol, uint8_t trans_id,
uint32_t callref);
void trans_free(struct gsm_trans *trans);
-int trans_assign_trans_id(struct gsm_network *net, struct gsm_subscriber *subscr,
+int trans_assign_trans_id(struct gsm_network *net, struct vlr_subscr *vsub,
uint8_t protocol, uint8_t ti_flag);
int trans_has_conn(const struct gsm_subscriber_connection *conn);
+void trans_conn_closed(struct gsm_subscriber_connection *conn);
#endif
diff --git a/include/openbsc/vlr.h b/include/openbsc/vlr.h
index 90e3d7a1..17cb2ae3 100644
--- a/include/openbsc/vlr.h
+++ b/include/openbsc/vlr.h
@@ -11,6 +11,8 @@
// for GSM_NAME_LENGTH
#include <openbsc/gsm_subscriber.h>
+struct log_target;
+
/* from 3s to 10s */
#define GSM_29002_TIMER_S 10
/* from 15s to 30s */
@@ -20,7 +22,6 @@
/* from 28h to 38h */
#define GSM_29002_TIMER_L (32*60*60)
-
/* VLR subscriber authentication state */
enum vlr_subscr_auth_state {
/* subscriber needs to be autenticated */
diff --git a/include/openbsc/vty.h b/include/openbsc/vty.h
index 60b7d2d7..0cb0eec4 100644
--- a/include/openbsc/vty.h
+++ b/include/openbsc/vty.h
@@ -38,6 +38,7 @@ enum bsc_vty_node {
SMPP_NODE,
SMPP_ESME_NODE,
GTPHUB_NODE,
+ HLR_NODE,
};
extern int bsc_vty_is_config_node(struct vty *vty, int node);