aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2019-11-20 00:37:07 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2019-11-20 01:25:39 +0100
commit2f75803e5dba27b1a2afcffe753f58ee29d83987 (patch)
treeddaca8df29d59e722ea8f8ee641902430dfa8c7b /src
parent7f4dd11682186f6c2426ff9b7f6075b3c409cba1 (diff)
move headers to include/osmocom/hlr
Apply the same headers structure that we keep in most Osmocom source trees: Keep noinst_HEADERS in include/osmocom/hlr and include them using #include <osmocom/hlr/*.h> The only header kept in src/ is db_bootstrap.h, because it is generated during build time. If it was built in include/osmocom/hlr, we would need db.o to depend on db_bootstrap.h in a different subdir, which automake can't do well. Change-Id: Ic912fe27f545b85443c5fb713d8c3c8aac23c9ad
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am13
-rw-r--r--src/auc.c4
-rw-r--r--src/auc.h8
-rw-r--r--src/ctrl.c6
-rw-r--r--src/ctrl.h34
-rw-r--r--src/db.c4
-rw-r--r--src/db.h168
-rw-r--r--src/db_auc.c8
-rw-r--r--src/db_hlr.c10
-rw-r--r--src/gsup_router.c6
-rw-r--r--src/gsup_router.h26
-rw-r--r--src/gsup_send.c4
-rw-r--r--src/gsup_server.c4
-rw-r--r--src/gsup_server.h69
-rw-r--r--src/hlr.c20
-rw-r--r--src/hlr.h70
-rw-r--r--src/hlr_db_tool.c6
-rw-r--r--src/hlr_ussd.c14
-rw-r--r--src/hlr_ussd.h61
-rw-r--r--src/hlr_vty.c14
-rw-r--r--src/hlr_vty.h38
-rw-r--r--src/hlr_vty_subscr.c4
-rw-r--r--src/hlr_vty_subscr.h3
-rw-r--r--src/logging.c2
-rw-r--r--src/logging.h13
-rw-r--r--src/luop.c8
-rw-r--r--src/luop.h81
-rw-r--r--src/osmo-euse-demo.c2
-rw-r--r--src/rand.h7
29 files changed, 59 insertions, 648 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a042e4e..a5b71cf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,6 +11,7 @@ AM_CFLAGS = \
$(NULL)
AM_CPPFLAGS = -I$(top_srcdir)/include \
+ -I$(top_builddir)/include \
$(NULL)
EXTRA_DIST = \
@@ -24,18 +25,6 @@ BUILT_SOURCES = \
CLEANFILES = $(BUILT_SOURCES)
noinst_HEADERS = \
- auc.h \
- db.h \
- hlr.h \
- luop.h \
- gsup_router.h \
- gsup_server.h \
- logging.h \
- rand.h \
- ctrl.h \
- hlr_vty.h \
- hlr_vty_subscr.h \
- hlr_ussd.h \
db_bootstrap.h \
$(NULL)
diff --git a/src/auc.c b/src/auc.c
index 79c3918..28c441f 100644
--- a/src/auc.c
+++ b/src/auc.c
@@ -23,8 +23,8 @@
#include <osmocom/core/utils.h>
#include <osmocom/crypt/auth.h>
-#include "logging.h"
-#include "rand.h"
+#include <osmocom/hlr/logging.h>
+#include <osmocom/hlr/rand.h>
#define hexb(buf) osmo_hexdump_nospc((void*)buf, sizeof(buf))
#define hex(buf,sz) osmo_hexdump_nospc((void*)buf, sz)
diff --git a/src/auc.h b/src/auc.h
deleted file mode 100644
index f5b6765..0000000
--- a/src/auc.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-#include <osmocom/crypt/auth.h>
-
-int auc_compute_vectors(struct osmo_auth_vector *vec, unsigned int num_vec,
- struct osmo_sub_auth_data *aud2g,
- struct osmo_sub_auth_data *aud3g,
- const uint8_t *rand_auts, const uint8_t *auts);
diff --git a/src/ctrl.c b/src/ctrl.c
index c610d92..b78be12 100644
--- a/src/ctrl.c
+++ b/src/ctrl.c
@@ -28,9 +28,9 @@
#include <osmocom/gsm/gsm23003.h>
#include <osmocom/ctrl/ports.h>
-#include "hlr.h"
-#include "ctrl.h"
-#include "db.h"
+#include <osmocom/hlr/hlr.h>
+#include <osmocom/hlr/ctrl.h>
+#include <osmocom/hlr/db.h>
#define SEL_BY "by-"
#define SEL_BY_IMSI SEL_BY "imsi-"
diff --git a/src/ctrl.h b/src/ctrl.h
deleted file mode 100644
index 3f9ba3f..0000000
--- a/src/ctrl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* OsmoHLR Control Interface implementation */
-
-/* (C) 2017 sysmocom s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Max Suraev <msuraev@sysmocom.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#pragma once
-
-#include <osmocom/ctrl/control_if.h>
-
-enum hlr_ctrl_node {
- CTRL_NODE_SUBSCR = _LAST_CTRL_NODE,
- CTRL_NODE_SUBSCR_BY,
- _LAST_CTRL_NODE_HLR
-};
-
-int hlr_ctrl_cmds_install();
-struct ctrl_handle *hlr_controlif_setup(struct hlr *hlr);
diff --git a/src/db.c b/src/db.c
index 75ca889..ed2e568 100644
--- a/src/db.c
+++ b/src/db.c
@@ -23,8 +23,8 @@
#include <sqlite3.h>
#include <string.h>
-#include "logging.h"
-#include "db.h"
+#include <osmocom/hlr/logging.h>
+#include <osmocom/hlr/db.h>
#include "db_bootstrap.h"
/* This constant is currently duplicated in sql/hlr.sql and must be kept in sync! */
diff --git a/src/db.h b/src/db.h
deleted file mode 100644
index 15d83de..0000000
--- a/src/db.h
+++ /dev/null
@@ -1,168 +0,0 @@
-#pragma once
-
-#include <stdbool.h>
-#include <sqlite3.h>
-
-struct hlr;
-
-enum stmt_idx {
- DB_STMT_SEL_BY_IMSI,
- DB_STMT_SEL_BY_MSISDN,
- DB_STMT_SEL_BY_ID,
- DB_STMT_SEL_BY_IMEI,
- DB_STMT_UPD_VLR_BY_ID,
- DB_STMT_UPD_SGSN_BY_ID,
- DB_STMT_UPD_IMEI_BY_IMSI,
- DB_STMT_AUC_BY_IMSI,
- DB_STMT_AUC_UPD_SQN,
- DB_STMT_UPD_PURGE_CS_BY_IMSI,
- DB_STMT_UPD_PURGE_PS_BY_IMSI,
- DB_STMT_UPD_NAM_PS_BY_IMSI,
- DB_STMT_UPD_NAM_CS_BY_IMSI,
- DB_STMT_SUBSCR_CREATE,
- DB_STMT_DEL_BY_ID,
- DB_STMT_SET_MSISDN_BY_IMSI,
- DB_STMT_DELETE_MSISDN_BY_IMSI,
- DB_STMT_AUC_2G_INSERT,
- DB_STMT_AUC_2G_DELETE,
- DB_STMT_AUC_3G_INSERT,
- DB_STMT_AUC_3G_DELETE,
- DB_STMT_SET_LAST_LU_SEEN,
- DB_STMT_EXISTS_BY_IMSI,
- DB_STMT_EXISTS_BY_MSISDN,
- _NUM_DB_STMT
-};
-
-struct db_context {
- char *fname;
- sqlite3 *db;
- sqlite3_stmt *stmt[_NUM_DB_STMT];
-};
-
-/* Optional feature to make SQLite3 using talloc */
-#ifdef SQLITE_USE_TALLOC
-int db_sqlite3_use_talloc(void *ctx);
-#endif
-
-void db_remove_reset(sqlite3_stmt *stmt);
-bool db_bind_text(sqlite3_stmt *stmt, const char *param_name, const char *text);
-bool db_bind_int(sqlite3_stmt *stmt, const char *param_name, int nr);
-bool db_bind_int64(sqlite3_stmt *stmt, const char *param_name, int64_t nr);
-void db_close(struct db_context *dbc);
-struct db_context *db_open(void *ctx, const char *fname, bool enable_sqlite3_logging, bool allow_upgrades);
-
-#include <osmocom/crypt/auth.h>
-
-/* obtain the authentication data for a given imsi */
-int db_get_auth_data(struct db_context *dbc, const char *imsi,
- struct osmo_sub_auth_data *aud2g,
- struct osmo_sub_auth_data *aud3g,
- int64_t *subscr_id);
-
-int db_update_sqn(struct db_context *dbc, int64_t id,
- uint64_t new_sqn);
-
-int db_get_auc(struct db_context *dbc, const char *imsi,
- unsigned int auc_3g_ind, struct osmo_auth_vector *vec,
- unsigned int num_vec, const uint8_t *rand_auts,
- const uint8_t *auts);
-
-#include <osmocom/core/linuxlist.h>
-#include <osmocom/gsm/protocol/gsm_23_003.h>
-
-/* TODO: Get this from somewhere? */
-#define GT_MAX_DIGITS 15
-
-struct hlr_subscriber {
- struct llist_head list;
-
- int64_t id;
- char imsi[GSM23003_IMSI_MAX_DIGITS+1];
- char msisdn[GSM23003_MSISDN_MAX_DIGITS+1];
- /* imeisv? */
- char imei[GSM23003_IMEI_NUM_DIGITS+1];
- char vlr_number[32];
- char sgsn_number[32];
- char sgsn_address[GT_MAX_DIGITS+1];
- /* ggsn number + address */
- /* gmlc number */
- /* smsc number */
- uint32_t periodic_lu_timer;
- uint32_t periodic_rau_tau_timer;
- bool nam_cs;
- bool nam_ps;
- uint32_t lmsi;
- bool ms_purged_cs;
- bool ms_purged_ps;
- time_t last_lu_seen;
-};
-
-/* A format string for use with strptime(3). This format string is
- * used to parse the last_lu_seen column stored in the HLR database.
- * See https://sqlite.org/lang_datefunc.html, function datetime(). */
-#define DB_LAST_LU_SEEN_FMT "%Y-%m-%d %H:%M:%S"
-
-/* Like struct osmo_sub_auth_data, but the keys are in hexdump representation.
- * This is useful because SQLite requires them in hexdump format, and callers
- * like the VTY and CTRL interface also have them available as hexdump to begin
- * with. In the binary format, a VTY command would first need to hexparse,
- * after which the db function would again hexdump, copying to separate
- * buffers. The roundtrip can be saved by providing char* to begin with. */
-struct sub_auth_data_str {
- enum osmo_sub_auth_type type;
- enum osmo_auth_algo algo;
- union {
- struct {
- const char *opc;
- const char *k;
- uint64_t sqn;
- int opc_is_op;
- unsigned int ind_bitlen;
- } umts;
- struct {
- const char *ki;
- } gsm;
- } u;
-};
-
-#define DB_SUBSCR_FLAG_NAM_CS (1 << 1)
-#define DB_SUBSCR_FLAG_NAM_PS (1 << 2)
-
-int db_subscr_create(struct db_context *dbc, const char *imsi, uint8_t flags);
-int db_subscr_delete_by_id(struct db_context *dbc, int64_t subscr_id);
-
-int db_subscr_update_msisdn_by_imsi(struct db_context *dbc, const char *imsi,
- const char *msisdn);
-int db_subscr_update_aud_by_id(struct db_context *dbc, int64_t subscr_id,
- const struct sub_auth_data_str *aud);
-int db_subscr_update_imei_by_imsi(struct db_context *dbc, const char* imsi, const char *imei);
-
-int db_subscr_exists_by_imsi(struct db_context *dbc, const char *imsi);
-int db_subscr_exists_by_msisdn(struct db_context *dbc, const char *msisdn);
-
-int db_subscr_get_by_imsi(struct db_context *dbc, const char *imsi,
- struct hlr_subscriber *subscr);
-int db_subscr_get_by_msisdn(struct db_context *dbc, const char *msisdn,
- struct hlr_subscriber *subscr);
-int db_subscr_get_by_id(struct db_context *dbc, int64_t id,
- struct hlr_subscriber *subscr);
-int db_subscr_get_by_imei(struct db_context *dbc, const char *imei, struct hlr_subscriber *subscr);
-int db_subscr_nam(struct db_context *dbc, const char *imsi, bool nam_val, bool is_ps);
-int db_subscr_lu(struct db_context *dbc, int64_t subscr_id,
- const char *vlr_or_sgsn_number, bool is_ps);
-
-int db_subscr_purge(struct db_context *dbc, const char *by_imsi,
- bool purge_val, bool is_ps);
-
-int hlr_subscr_nam(struct hlr *hlr, struct hlr_subscriber *subscr, bool nam_val, bool is_ps);
-
-/*! Call sqlite3_column_text() and copy result to a char[].
- * \param[out] buf A char[] used as sizeof() arg(!) and osmo_strlcpy() target.
- * \param[in] stmt An sqlite3_stmt*.
- * \param[in] idx Index in stmt's returned columns.
- */
-#define copy_sqlite3_text_to_buf(buf, stmt, idx) \
- do { \
- const char *_txt = (const char *) sqlite3_column_text(stmt, idx); \
- osmo_strlcpy(buf, _txt, sizeof(buf)); \
- } while (0)
diff --git a/src/db_auc.c b/src/db_auc.c
index 2cf7143..e3a840e 100644
--- a/src/db_auc.c
+++ b/src/db_auc.c
@@ -26,10 +26,10 @@
#include <sqlite3.h>
-#include "logging.h"
-#include "db.h"
-#include "auc.h"
-#include "rand.h"
+#include <osmocom/hlr/logging.h>
+#include <osmocom/hlr/db.h>
+#include <osmocom/hlr/auc.h>
+#include <osmocom/hlr/rand.h>
#define LOGAUC(imsi, level, fmt, args ...) LOGP(DAUC, level, "IMSI='%s': " fmt, imsi, ## args)
diff --git a/src/db_hlr.c b/src/db_hlr.c
index 694ac53..e52b5ed 100644
--- a/src/db_hlr.c
+++ b/src/db_hlr.c
@@ -33,11 +33,11 @@
#include <sqlite3.h>
-#include "logging.h"
-#include "hlr.h"
-#include "db.h"
-#include "gsup_server.h"
-#include "luop.h"
+#include <osmocom/hlr/logging.h>
+#include <osmocom/hlr/hlr.h>
+#include <osmocom/hlr/db.h>
+#include <osmocom/hlr/gsup_server.h>
+#include <osmocom/hlr/luop.h>
#define LOGHLR(imsi, level, fmt, args ...) LOGP(DAUC, level, "IMSI='%s': " fmt, imsi, ## args)
diff --git a/src/gsup_router.c b/src/gsup_router.c
index df978ba..adf3af7 100644
--- a/src/gsup_router.c
+++ b/src/gsup_router.c
@@ -23,9 +23,9 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/talloc.h>
-#include "logging.h"
-#include "gsup_server.h"
-#include "gsup_router.h"
+#include <osmocom/hlr/logging.h>
+#include <osmocom/hlr/gsup_server.h>
+#include <osmocom/hlr/gsup_router.h>
/*! Find a route for the given address.
* \param[in] gs gsup server
diff --git a/src/gsup_router.h b/src/gsup_router.h
deleted file mode 100644
index bff484e..0000000
--- a/src/gsup_router.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-
-#include <stdint.h>
-#include "gsup_server.h"
-
-struct gsup_route {
- struct llist_head list;
-
- uint8_t *addr;
- struct osmo_gsup_conn *conn;
-};
-
-struct osmo_gsup_conn *gsup_route_find(struct osmo_gsup_server *gs,
- const uint8_t *addr, size_t addrlen);
-
-struct gsup_route *gsup_route_find_by_conn(const struct osmo_gsup_conn *conn);
-
-/* add a new route for the given address to the given conn */
-int gsup_route_add(struct osmo_gsup_conn *conn, const uint8_t *addr, size_t addrlen);
-
-/* delete all routes for the given connection */
-int gsup_route_del_conn(struct osmo_gsup_conn *conn);
-
-int osmo_gsup_addr_send(struct osmo_gsup_server *gs,
- const uint8_t *addr, size_t addrlen,
- struct msgb *msg);
diff --git a/src/gsup_send.c b/src/gsup_send.c
index 247a7e7..29aeaa5 100644
--- a/src/gsup_send.c
+++ b/src/gsup_send.c
@@ -21,8 +21,8 @@
#include <errno.h>
-#include "gsup_server.h"
-#include "gsup_router.h"
+#include <osmocom/hlr/gsup_server.h>
+#include <osmocom/hlr/gsup_router.h>
#include <osmocom/core/logging.h>
diff --git a/src/gsup_server.c b/src/gsup_server.c
index e75bbd7..bee6aef 100644
--- a/src/gsup_server.c
+++ b/src/gsup_server.c
@@ -27,8 +27,8 @@
#include <osmocom/gsm/gsm48_ie.h>
#include <osmocom/gsm/apn.h>
-#include "gsup_server.h"
-#include "gsup_router.h"
+#include <osmocom/hlr/gsup_server.h>
+#include <osmocom/hlr/gsup_router.h>
static void osmo_gsup_server_send(struct osmo_gsup_conn *conn,
int proto_ext, struct msgb *msg_tx)
diff --git a/src/gsup_server.h b/src/gsup_server.h
deleted file mode 100644
index 9c4d483..0000000
--- a/src/gsup_server.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#pragma once
-
-#include <osmocom/core/linuxlist.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/abis/ipa.h>
-#include <osmocom/abis/ipaccess.h>
-#include <osmocom/gsm/gsup.h>
-
-#ifndef OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN
-#define OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN 43 /* TS 24.008 10.5.4.7 */
-#endif
-
-struct osmo_gsup_conn;
-
-/* Expects message in msg->l2h */
-typedef int (*osmo_gsup_read_cb_t)(struct osmo_gsup_conn *conn, struct msgb *msg);
-
-struct osmo_gsup_server {
- /* private data of the application/user */
- void *priv;
-
- /* list of osmo_gsup_conn */
- struct llist_head clients;
-
- /* lu_operations list */
- struct llist_head *luop;
-
- struct ipa_server_link *link;
- osmo_gsup_read_cb_t read_cb;
- struct llist_head routes;
-};
-
-
-/* a single connection to a given client (SGSN, MSC) */
-struct osmo_gsup_conn {
- struct llist_head list;
-
- struct osmo_gsup_server *server;
- struct ipa_server_conn *conn;
- //struct oap_state oap_state;
- struct tlv_parsed ccm;
-
- unsigned int auc_3g_ind; /*!< IND index used for UMTS AKA SQN */
-
- /* Set when Location Update is received: */
- bool supports_cs; /* client supports OSMO_GSUP_CN_DOMAIN_CS */
- bool supports_ps; /* client supports OSMO_GSUP_CN_DOMAIN_PS */
-};
-
-
-int osmo_gsup_conn_send(struct osmo_gsup_conn *conn, struct msgb *msg);
-int osmo_gsup_conn_ccm_get(const struct osmo_gsup_conn *clnt, uint8_t **addr,
- uint8_t tag);
-
-struct osmo_gsup_server *osmo_gsup_server_create(void *ctx,
- const char *ip_addr,
- uint16_t tcp_port,
- osmo_gsup_read_cb_t read_cb,
- struct llist_head *lu_op_lst,
- void *priv);
-
-void osmo_gsup_server_destroy(struct osmo_gsup_server *gsups);
-
-int osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup,
- uint8_t *apn_buf, size_t apn_buf_size);
-int osmo_gsup_create_insert_subscriber_data_msg(struct osmo_gsup_message *gsup, const char *imsi, const char *msisdn,
- uint8_t *msisdn_enc, size_t msisdn_enc_size,
- uint8_t *apn_buf, size_t apn_buf_size,
- enum osmo_gsup_cn_domain cn_domain);
diff --git a/src/hlr.c b/src/hlr.c
index 6bfc141..0970bb1 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -37,16 +37,16 @@
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/protocol/gsm_23_003.h>
-#include "db.h"
-#include "hlr.h"
-#include "ctrl.h"
-#include "logging.h"
-#include "gsup_server.h"
-#include "gsup_router.h"
-#include "rand.h"
-#include "luop.h"
-#include "hlr_vty.h"
-#include "hlr_ussd.h"
+#include <osmocom/hlr/db.h>
+#include <osmocom/hlr/hlr.h>
+#include <osmocom/hlr/ctrl.h>
+#include <osmocom/hlr/logging.h>
+#include <osmocom/hlr/gsup_server.h>
+#include <osmocom/hlr/gsup_router.h>
+#include <osmocom/hlr/rand.h>
+#include <osmocom/hlr/luop.h>
+#include <osmocom/hlr/hlr_vty.h>
+#include <osmocom/hlr/hlr_ussd.h>
struct hlr *g_hlr;
static void *hlr_ctx = NULL;
diff --git a/src/hlr.h b/src/hlr.h
deleted file mode 100644
index 18c4a1d..0000000
--- a/src/hlr.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* OsmoHLR generic header */
-
-/* (C) 2017 sysmocom s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Max Suraev <msuraev@sysmocom.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#pragma once
-
-#include <stdbool.h>
-#include <osmocom/core/linuxlist.h>
-
-#define HLR_DEFAULT_DB_FILE_PATH "hlr.db"
-
-struct hlr_euse;
-
-struct hlr {
- /* GSUP server pointer */
- struct osmo_gsup_server *gs;
-
- /* DB context */
- char *db_file_path;
- struct db_context *dbc;
-
- /* Control Interface */
- struct ctrl_handle *ctrl;
- const char *ctrl_bind_addr;
-
- /* Local bind addr */
- char *gsup_bind_addr;
-
- struct llist_head euse_list;
- struct hlr_euse *euse_default;
- struct llist_head iuse_list;
-
- /* NCSS (call independent) session guard timeout value */
- int ncss_guard_timeout;
-
- struct llist_head ussd_routes;
-
- struct llist_head ss_sessions;
-
- bool store_imei;
-
- bool subscr_create_on_demand;
- /* Bitmask of DB_SUBSCR_FLAG_* */
- uint8_t subscr_create_on_demand_flags;
- unsigned int subscr_create_on_demand_rand_msisdn_len;
-};
-
-extern struct hlr *g_hlr;
-
-struct hlr_subscriber;
-
-void osmo_hlr_subscriber_update_notify(struct hlr_subscriber *subscr);
diff --git a/src/hlr_db_tool.c b/src/hlr_db_tool.c
index fcef597..1212018 100644
--- a/src/hlr_db_tool.c
+++ b/src/hlr_db_tool.c
@@ -29,9 +29,9 @@
#include <osmocom/core/logging.h>
#include <osmocom/core/application.h>
-#include "logging.h"
-#include "db.h"
-#include "rand.h"
+#include <osmocom/hlr/logging.h>
+#include <osmocom/hlr/db.h>
+#include <osmocom/hlr/rand.h>
struct hlr_db_tool_ctx {
/* DB context */
diff --git a/src/hlr_ussd.c b/src/hlr_ussd.c
index 1568815..00023ba 100644
--- a/src/hlr_ussd.c
+++ b/src/hlr_ussd.c
@@ -29,12 +29,12 @@
#include <string.h>
#include <errno.h>
-#include "hlr.h"
-#include "hlr_ussd.h"
-#include "gsup_server.h"
-#include "gsup_router.h"
-#include "logging.h"
-#include "db.h"
+#include <osmocom/hlr/hlr.h>
+#include <osmocom/hlr/hlr_ussd.h>
+#include <osmocom/hlr/gsup_server.h>
+#include <osmocom/hlr/gsup_router.h>
+#include <osmocom/hlr/logging.h>
+#include <osmocom/hlr/db.h>
/***********************************************************************
* core data structures expressing config from VTY
@@ -317,7 +317,7 @@ static int ss_tx_ussd_7bit(struct ss_session *ss, bool final, uint8_t invoke_id,
* Internal USSD Handlers
***********************************************************************/
-#include "db.h"
+#include <osmocom/hlr/db.h>
static int handle_ussd_own_msisdn(struct osmo_gsup_conn *conn, struct ss_session *ss,
const struct osmo_gsup_message *gsup, const struct ss_request *req)
diff --git a/src/hlr_ussd.h b/src/hlr_ussd.h
deleted file mode 100644
index 393ca6c..0000000
--- a/src/hlr_ussd.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#pragma once
-
-#include <stdbool.h>
-
-#include <osmocom/core/linuxlist.h>
-#include <osmocom/gsm/gsup.h>
-
-#include "gsup_server.h"
-
-#define NCSS_GUARD_TIMEOUT_DEFAULT 30
-
-struct hlr_ussd_route {
- /* g_hlr.routes */
- struct llist_head list;
- const char *prefix;
- bool is_external;
- union {
- struct hlr_euse *euse;
- const struct hlr_iuse *iuse;
- } u;
-};
-
-struct hlr_euse {
- /* list in the per-hlr list of EUSEs */
- struct llist_head list;
- struct hlr *hlr;
- /* name (must match the IPA ID tag) */
- const char *name;
- /* human-readable description */
- const char *description;
-
- /* GSUP connection to the EUSE, if any */
- struct osmo_gsup_conn *conn;
-};
-
-struct hlr_euse *euse_find(struct hlr *hlr, const char *name);
-struct hlr_euse *euse_alloc(struct hlr *hlr, const char *name);
-void euse_del(struct hlr_euse *euse);
-
-const struct hlr_iuse *iuse_find(const char *name);
-
-struct hlr_ussd_route *ussd_route_find_prefix(struct hlr *hlr, const char *prefix);
-struct hlr_ussd_route *ussd_route_prefix_alloc_int(struct hlr *hlr, const char *prefix,
- const struct hlr_iuse *iuse);
-struct hlr_ussd_route *ussd_route_prefix_alloc_ext(struct hlr *hlr, const char *prefix,
- struct hlr_euse *euse);
-void ussd_route_del(struct hlr_ussd_route *rt);
-
-int rx_proc_ss_req(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup);
-int rx_proc_ss_error(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup);
-
-struct ss_session;
-struct ss_request;
-
-/* Internal USSD Handler */
-struct hlr_iuse {
- const char *name;
- /* call-back to be called for any incoming USSD messages for this IUSE */
- int (*handle_ussd)(struct osmo_gsup_conn *conn, struct ss_session *ss,
- const struct osmo_gsup_message *gsup, const struct ss_request *req);
-};
diff --git a/src/hlr_vty.c b/src/hlr_vty.c
index f7c5bc8..6701cd9 100644
--- a/src/hlr_vty.c
+++ b/src/hlr_vty.c
@@ -33,12 +33,12 @@
#include <osmocom/vty/misc.h>
#include <osmocom/abis/ipa.h>
-#include "db.h"
-#include "hlr.h"
-#include "hlr_vty.h"
-#include "hlr_vty_subscr.h"
-#include "hlr_ussd.h"
-#include "gsup_server.h"
+#include <osmocom/hlr/db.h>
+#include <osmocom/hlr/hlr.h>
+#include <osmocom/hlr/hlr_vty.h>
+#include <osmocom/hlr/hlr_vty_subscr.h>
+#include <osmocom/hlr/hlr_ussd.h>
+#include <osmocom/hlr/gsup_server.h>
struct cmd_node hlr_node = {
HLR_NODE,
@@ -150,7 +150,7 @@ DEFUN(cfg_hlr_gsup_bind_ip,
* USSD Entity
***********************************************************************/
-#include "hlr_ussd.h"
+#include <osmocom/hlr/hlr_ussd.h>
#define USSD_STR "USSD Configuration\n"
#define UROUTE_STR "Routing Configuration\n"
diff --git a/src/hlr_vty.h b/src/hlr_vty.h
deleted file mode 100644
index 280b55a..0000000
--- a/src/hlr_vty.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* OsmoHLR VTY implementation */
-
-/* (C) 2016 sysmocom s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Neels Hofmeyr <nhofmeyr@sysmocom.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#pragma once
-
-#include <osmocom/core/logging.h>
-#include <osmocom/vty/vty.h>
-#include <osmocom/vty/command.h>
-#include "hlr.h"
-
-enum hlr_vty_node {
- HLR_NODE = _LAST_OSMOVTY_NODE + 1,
- GSUP_NODE,
- EUSE_NODE,
-};
-
-int hlr_vty_is_config_node(struct vty *vty, int node);
-int hlr_vty_go_parent(struct vty *vty);
-void hlr_vty_init(void);
diff --git a/src/hlr_vty_subscr.c b/src/hlr_vty_subscr.c
index 73dfab6..d2c4c81 100644
--- a/src/hlr_vty_subscr.c
+++ b/src/hlr_vty_subscr.c
@@ -28,8 +28,8 @@
#include <osmocom/vty/command.h>
#include <osmocom/core/utils.h>
-#include "hlr.h"
-#include "db.h"
+#include <osmocom/hlr/hlr.h>
+#include <osmocom/hlr/db.h>
struct vty;
diff --git a/src/hlr_vty_subscr.h b/src/hlr_vty_subscr.h
deleted file mode 100644
index 5dd0772..0000000
--- a/src/hlr_vty_subscr.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-void hlr_vty_subscriber_init(void);
diff --git a/src/logging.c b/src/logging.c
index 3fa2a69..3713ab3 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -1,5 +1,5 @@
#include <osmocom/core/utils.h>
-#include "logging.h"
+#include <osmocom/hlr/logging.h>
const struct log_info_cat hlr_log_info_cat[] = {
[DMAIN] = {
diff --git a/src/logging.h b/src/logging.h
deleted file mode 100644
index ed24075..0000000
--- a/src/logging.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#pragma once
-
-#include <osmocom/core/logging.h>
-
-enum {
- DMAIN,
- DDB,
- DGSUP,
- DAUC,
- DSS,
-};
-
-extern const struct log_info hlr_log_info;
diff --git a/src/luop.c b/src/luop.c
index aff4d81..652ce0d 100644
--- a/src/luop.c
+++ b/src/luop.c
@@ -28,10 +28,10 @@
#include <osmocom/gsm/gsup.h>
#include <osmocom/gsm/apn.h>
-#include "gsup_server.h"
-#include "gsup_router.h"
-#include "logging.h"
-#include "luop.h"
+#include <osmocom/hlr/gsup_server.h>
+#include <osmocom/hlr/gsup_router.h>
+#include <osmocom/hlr/logging.h>
+#include <osmocom/hlr/luop.h>
const struct value_string lu_state_names[] = {
{ LU_S_NULL, "NULL" },
diff --git a/src/luop.h b/src/luop.h
deleted file mode 100644
index f96593b..0000000
--- a/src/luop.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* OsmoHLR TX/RX lu operations */
-
-/* (C) 2017 sysmocom s.f.m.c. GmbH <info@sysmocom.de>
- * All Rights Reserved
- *
- * Author: Harald Welte <laforge@gnumonks.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#pragma once
-
-#include <stdbool.h>
-
-#include <osmocom/core/timer.h>
-#include <osmocom/gsm/gsup.h>
-
-#include "db.h"
-#include "gsup_server.h"
-
-#define CANCEL_TIMEOUT_SECS 30
-#define ISD_TIMEOUT_SECS 30
-
-enum lu_state {
- LU_S_NULL,
- LU_S_LU_RECEIVED,
- LU_S_CANCEL_SENT,
- LU_S_CANCEL_ACK_RECEIVED,
- LU_S_ISD_SENT,
- LU_S_ISD_ACK_RECEIVED,
- LU_S_COMPLETE,
-};
-
-extern const struct value_string lu_state_names[];
-
-struct lu_operation {
- /*! entry in global list of location update operations */
- struct llist_head list;
- /*! to which gsup_server do we belong */
- struct osmo_gsup_server *gsup_server;
- /*! state of the location update */
- enum lu_state state;
- /*! CS (false) or PS (true) Location Update? */
- bool is_ps;
- /*! currently running timer */
- struct osmo_timer_list timer;
-
- /*! subscriber related to this operation */
- struct hlr_subscriber subscr;
- /*! peer VLR/SGSN starting the request */
- uint8_t *peer;
-};
-
-
-struct lu_operation *lu_op_alloc(struct osmo_gsup_server *srv);
-struct lu_operation *lu_op_alloc_conn(struct osmo_gsup_conn *conn);
-void lu_op_statechg(struct lu_operation *luop, enum lu_state new_state);
-bool lu_op_fill_subscr(struct lu_operation *luop, struct db_context *dbc,
- const char *imsi);
-struct lu_operation *lu_op_by_imsi(const char *imsi,
- const struct llist_head *lst);
-
-void lu_op_tx_error(struct lu_operation *luop, enum gsm48_gmm_cause cause);
-void lu_op_tx_ack(struct lu_operation *luop);
-void lu_op_tx_cancel_old(struct lu_operation *luop);
-void lu_op_tx_insert_subscr_data(struct lu_operation *luop);
-void lu_op_tx_del_subscr_data(struct lu_operation *luop);
-
-void lu_op_free(struct lu_operation *luop);
diff --git a/src/osmo-euse-demo.c b/src/osmo-euse-demo.c
index 4e4ef78..e707a9c 100644
--- a/src/osmo-euse-demo.c
+++ b/src/osmo-euse-demo.c
@@ -44,7 +44,7 @@
#include <osmocom/gsupclient/gsup_client.h>
-#include "logging.h"
+#include <osmocom/hlr/logging.h>
static struct osmo_gsup_client *g_gc;
diff --git a/src/rand.h b/src/rand.h
deleted file mode 100644
index 9c5aedf..0000000
--- a/src/rand.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-
-#include <stdint.h>
-
-int rand_init(void);
-
-int rand_get(uint8_t *rand, unsigned int len);