aboutsummaryrefslogtreecommitdiffstats
path: root/src/db_hlr.c
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-03-06 13:17:39 +0100
committerOliver Smith <osmith@sysmocom.de>2019-05-13 08:55:18 +0200
commitcd2af5ead7a6fbba3e7b3df620536619a10ef356 (patch)
tree4002c7261eba14be13850ce4fbe80054f196c95f /src/db_hlr.c
parente21b45aecddbf388f22ab4832f4a8f5bf41a2ddc (diff)
db_hlr.c: db_subscr_create(): add flags argument
Allow creating new subscribers without giving them access to CS or PS. This will be used by the create-subscriber-on-demand feature. Related: OS#2542 Change-Id: I1a6dd85387723dab5487c53b33d2d9ec6d05d006
Diffstat (limited to 'src/db_hlr.c')
-rw-r--r--src/db_hlr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/db_hlr.c b/src/db_hlr.c
index 3ba457c..40209c5 100644
--- a/src/db_hlr.c
+++ b/src/db_hlr.c
@@ -44,9 +44,10 @@
/*! Add new subscriber record to the HLR database.
* \param[in,out] dbc database context.
* \param[in] imsi ASCII string of IMSI digits, is validated.
+ * \param[in] flags Bitmask of DB_SUBSCR_FLAG_*.
* \returns 0 on success, -EINVAL on invalid IMSI, -EIO on database error.
*/
-int db_subscr_create(struct db_context *dbc, const char *imsi)
+int db_subscr_create(struct db_context *dbc, const char *imsi, uint8_t flags)
{
sqlite3_stmt *stmt;
int rc;
@@ -61,6 +62,10 @@ int db_subscr_create(struct db_context *dbc, const char *imsi)
if (!db_bind_text(stmt, "$imsi", imsi))
return -EIO;
+ if (!db_bind_int(stmt, "$nam_cs", (flags & DB_SUBSCR_FLAG_NAM_CS) != 0))
+ return -EIO;
+ if (!db_bind_int(stmt, "$nam_ps", (flags & DB_SUBSCR_FLAG_NAM_PS) != 0))
+ return -EIO;
/* execute the statement */
rc = sqlite3_step(stmt);