Commit Graph

34 Commits

Author SHA1 Message Date
Max 5872641cd6 Make random MSISDN assignment optional
Previously if subscriber was automatically created it got assigned
random MSISDN number. Make it optional (defaulting to previous behavior)
by adding following:

* new optional no-extension argument for subscriber-create-on-demand vty
  command
* db unit tests
* vty test

Note: using the db made with new code might result in subscribers with
empty extension. Such subscribers cannot be deleted using old
code. Make sure not to mix db versions or manually fix it by editing
sqlite with external program.

Fixes: OS#1658
Change-Id: Ibbc2e88e4722b08854ebc631485f19ed56443cbb
2016-07-09 19:52:54 +00:00
Max 3911533651 Make random extension range configurable
Previously if subscriber was automatically created it got assigned
random MSISDN number between 20000 and 49999. Make it configurable with
new vty command "subscriber-create-on-demand random" and expand vty
tests to check it.

Change-Id: I040a1d227b0c7a1601dc7c33eccb0007941408a6
Related: OS#1658
2016-06-14 22:20:40 +00:00
Holger Hans Peter Freyther d41b7b70db nitb/ctrl: Implement a command to list all active subscribers
This is only useful for small networks. List the IMSI and MSISDN
of all active subscribers.

Fixes: SYS#266
2014-03-23 16:22:55 +01:00
Holger Hans Peter Freyther c652a5d919 nitb/ctrl: Implement creating and deleting subscribers
Sadly there is no proper foreign key relationship on the tables
that related to the Subscriber. This means we can't use a DELETE
with Cascade and need to delete everything by hand. To make things
worse maybe the SMS/Paging code is still using the subscriber
making the operation more dangerous. I had added NULL checks for
sender_id/receiver_id at 30C3 so we should not crash in this
situation.

Fixes: SYS#274
2014-03-23 14:05:49 +01:00
Alexander Chemeris 5c3e05f1d2 db,sms: Rename db_sms_mark_sent() to db_sms_mark_delivered()
In MT-SMS the message is being delivered. Make the naming follow
that. The schema still refers to "sent" while it should be "delivered"
too.
2014-03-09 10:26:11 +01:00
Holger Hans Peter Freyther abe587de66 db: Remove the struct gsm_network from the database layer
The database code should not know about the network. Move the
setting of the network pointer into the subscriber layer.
2013-10-13 13:44:54 +02:00
Jan Luebbe fe7cc1ef2e libmsc: Track and update the location update expiry
Set the subscriber expiry timeout to twice the duration of the location
update period and provide functions subscr_expire() and
db_subscriber_expire() to mark subscribers offline that have missed two
location update periods.

This patch increases the DB revision to 3, so the hlr will be
incompatible with prior versions.

We should allow 0 for T3212 as well to disable the location update
period. In that case we will need a way to indicate that in the
database.
2013-01-01 17:19:47 +01:00
Harald Welte a26aeba758 db: use ANSI (void) function declarations 2011-07-16 13:24:09 +02:00
Pablo Neira Ayuso 1c450746ce src: use namespace prefix osmo_counter*
Summary of changes:

s/struct counter/struct osmo_counter/g
s/counter_inc/osmo_counter_inc/g
s/counter_get/osmo_counter_get/g
s/counter_reset/osmo_counter_reset/g
s/counter_alloc/osmo_counter_alloc/g
s/counter_free/osmo_counter_free
2011-05-06 12:14:16 +02:00
Holger Hans Peter Freyther 30c060ba49 misc: Remove sys/types.h includes from the files
These are not needed any more. We used them for u_int
types but we now use uint which comes from stdint.h
2011-04-18 17:31:39 +02:00
Holger Hans Peter Freyther 7eb8a9a306 misc: Move from u_int to uint types of stdint.h
This was done with sed on the files.
2011-04-18 17:31:39 +02:00
Holger Hans Peter Freyther bbb96d7bf1 db: The forward declaration of the enum does not work with C++
We need to include this directly to help LCR in building.
2011-04-12 21:33:35 +02:00
Harald Welte 0e3e88ec5a License change: We are now AGPLv3+ instead of GPLv2+
The reason for this is quite simple: We want to make sure anyone
running a customized version of OpenBSC to operate a network will
have to release all custom modifiations to the source code.
2011-01-01 15:39:34 +01:00
Holger Hans Peter Freyther ae9c9d9908 db: Introduce a limit in delivery attempts for the SMS search
We do not want to attempt submitting SMS that has failed for
too many times. The failure could be due RF failure or due
a bug in the message handling.
2010-12-25 21:39:04 +01:00
Holger Hans Peter Freyther d0095e4e03 db: Add method to load a SMS by id. 2010-12-25 21:39:04 +01:00
Holger Hans Peter Freyther 0c29e5f922 subscr: Add a VTY command to update the subscriber from the database. 2010-12-24 21:40:48 +01:00
Holger Hans Peter Freyther ef3b59d5f5 misc: Remove gsm_subscriber.h from the db.h file
Reduce the dependencies on the header files.
2010-12-22 18:26:36 +01:00
Holger Hans Peter Freyther 7982c76812 db.h: Move the '*' to the other side for the gsm_subscriber 2010-10-06 00:03:20 +08:00
Holger Hans Peter Freyther bca2d60088 db: Declare db_sms_inc_deliver_attempts. 2010-09-17 00:35:46 +08:00
Sylvain Munaut 48858d20c6 db: Change naming convention for auth info functions
- exported function have a 'db_' prefix
 - use 'sync' vs 'set'
 - use 'for' vs 'by'

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14 20:43:50 +02:00
Sylvain Munaut f190bdf036 db: Rename AuthTuples to AuthLastTuples
Ultimately, we'll need to store both the last used tuple by a
subscriber and a list of known tuples (for unknown Ki). What's
currently implemented for AuthTuples is the former behavior, so
reflect that.

The second use case will be added as a separate table with separate
accessors later on.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14 20:43:50 +02:00
Harald Welte c80bb28bae [GPRS] NS: Start to use rate_ctr_group code from libosmocore
Every NS-VC now has a set of counters for incoming and outgoing
number of packets and bytes.

We also split the VTY part of the gprs_ns.c implementation into gprs_ns_vty.c
to make sure the protocol can actually be used without the VTY code being
present.
2010-05-13 11:45:07 +02:00
Holger Hans Peter Freyther 082ec465f2 db: Fix a bug where no pending SMS were found
The "sms send pending" VTY command did not work due a mismatch
of types. We are specifying a unsigned long long in the query
and provided DBI with a signed integer type. The result was a
failure do find any information.

Change the API to operate on unsigned long long that is matching
the id of the SMS and the Subscriber and the mismatch with the
query string is gone and pending SMS are sent.
2010-03-25 09:59:30 +01:00
Sylvain Munaut deab2416a7 db: Add methods to set auth{info,tuple} for a subscriber
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-01-03 10:50:34 +01:00
Sylvain Munaut d056655446 db: Add declaration for get_auth{info,tuple_for_subscriber
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-01-03 10:50:03 +01:00
Sylvain Munaut 8a8239e75d db: Fix compile warning, declare db_sms_get_unsent_by_subscr
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2009-12-24 10:13:46 +01:00
Harald Welte bdbb7448cf statistics: Introduce 'struct counter' instead of using unsigned long
This has the advantage that counters can be added all over the code
very easily, while having only one routine that stores all of the
current counter values to the database.  The counters are synced
every 60 seconds, providing relatively fine grained statistics
about the network usage as time passes by.
2009-12-22 20:42:40 +01:00
Harald Welte (local) bd72aa2aaa store all APDU's received from the MS in the database
This helps us to analyze data such as RRLP location information for
later analysis.
2009-08-16 10:40:10 +02:00
Jan Luebbe f4ac9a7895 fix problems with tmsi uniqueness in the subscriber table 2009-08-12 22:22:42 +02:00
Jan Luebbe bb7501f7ed token support in the DB 2009-08-12 22:21:56 +02:00
Holger Hans Peter Freyther 735cd9e5da misc: Add prototypes to header files, include more header files
Fix various warnings about implicit declarations of functions.
2009-08-10 07:54:02 +02:00
Harald Welte 43762f77e2 new db_sms_get_unsent_for_subscr() function
The function retrieves the oldest not-yet-sent SM for the given subscriber
2009-08-09 19:05:21 +02:00
Harald Welte 7535041ebd make sure subscr->net is always set
since a subscriber is an element of the gsm_network, we have to ensure
subscr->net is always set correctly.  We do this by using gsm_network
as an argument to all functions that resolve or create a subscriber.
2009-07-23 18:46:00 +02:00
Harald Welte 59b0468c5b move openbsc into its own subdirectory 2009-06-10 05:40:52 +08:00