db: use int64_t as subscriber id
The SQLite db does not support uint64_t, and we are always binding the uint64_t
id actually as signed int64_t. Hence be consistent and actually handle it as
int64_t in the code as well.
This means that if we ever see a negative subscriber ID in the SQL database
(however unlikely), we will also see it negative in our log output.
The SQN handled in osmo_auth* is actually of unsigned type, and, unless we
store the SQN as 64bit hex string, we are forced to feed this unsigned value as
signed int64_t to the SQLite API. The upcoming db regression test for SQN in
change-id I0d870d405e2e0a830360d9ad19f0a3f9e09d8cf2 verifies that the SQN
uint64_t translates to signed int64_t and back as expected.
Change-Id: I83a47289a48ac37da0f712845d422e897a5e8171
diff --git a/src/db.h b/src/db.h
index ee2d801..761d88e 100644
--- a/src/db.h
+++ b/src/db.h
@@ -38,9 +38,9 @@
int db_get_auth_data(struct db_context *dbc, const char *imsi,
struct osmo_sub_auth_data *aud2g,
struct osmo_sub_auth_data *aud3g,
- uint64_t *suscr_id);
+ int64_t *subscr_id);
-int db_update_sqn(struct db_context *dbc, uint64_t 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,
@@ -57,7 +57,7 @@
struct hlr_subscriber {
struct llist_head list;
- uint64_t id;
+ int64_t id;
char imsi[GSM23003_IMSI_MAX_DIGITS+1];
char msisdn[GT_MAX_DIGITS+1];
/* imeisv? */