Commit Graph

39 Commits

Author SHA1 Message Date
Sylvain Munaut deebb113ac db: Fix missing commas in AuthTuples table creation
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-01-03 10:13:14 +01:00
Harald Welte (local) 441e483bd4 [db] A new subscriber is an INFO event, not NOTICE 2009-12-26 22:47:48 +01:00
Harald Welte (local) 1f3ecd4050 'classmark1' is not an integer field in the database 2009-12-26 22:47:43 +01:00
Harald Welte ae1f159dc4 Converrt the database later to use DEBUGP/LOGP instead of stderr 2009-12-24 11:39:51 +01:00
Harald Welte 0b906d0e1a db: coding style cleanup 2009-12-24 11:39:51 +01:00
Harald Welte 09f7ad0ff7 fix merge artefact from db.c 2009-12-24 09:42:07 +01:00
Harald Welte 3606cc5765 [authentication] Code for retrieving authentication data from SQL DB
This is the first step towards supporting actual A3/A8 authentication.
2009-12-24 09:37:34 +01:00
Harald Welte f9a43c45ea fix sql table creation for 'Counters' table 2009-12-22 21:40:42 +01:00
Harald Welte ffa55a4e87 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
Sylvain Munaut ff1f19e199 Implement a better sending of pending SMS
The previous implementation had some shortcomings:
 - If the MIN ID given was not the exact id of the first unsent SMS,
 it would try to submit the same sms several time until id++ finally
 made id go to the next one.
 - If a subscriber had several SMS pending it would try to submit
 them individually (only to get rejected because a paging for that
 subscriber was already in progress)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2009-12-22 13:22:29 +01:00
Sylvain Munaut d5778fc4c7 [db] Fix queries for unsent SMS
- Need to use sms.id for the ORDER BY since 'subscriber' also has 'id'
- Need to add the join clause between 'SMS' and 'subscriber'
- Add a LIMIT 1 (probably no impact for the db size we're dealing with
here, but with large DB and mysql/postgresql this can help the planner)
- (fix a wrong comment in passing ...)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2009-12-21 01:09:57 +01:00
Harald Welte 4669f3d9c8 fix compile warning in db.c 2009-12-09 19:19:45 +01:00
Harald Welte d409be7fae change some identifiers from u_int64_t to unsigned long long
makes printf much easier on 64bit platforms...
2009-11-07 00:06:19 +09:00
Holger Hans Peter Freyther 2657abfe35 [db] Fix compile warnings in db.c
For the compiler classmark1 is a struct and the compiler is
unaware that it fits into an unsigned int. Use memcpy to
copy it to a u_int8_t (the compiler should inline this).

dbi_conn_quote_binary_copy works on unsigned char* change
q_apdu to be unsigned char.
2009-10-22 15:34:37 +02:00
Holger Hans Peter Freyther 2223025e21 [tmsi] Make the tmsi a 4 octet number
tmsi is four octets long, there is no need to make it a string
and then jump through hoops to convert it to a number. Keep the database
using it as a string to benefit from the NULL handling of the db.

Introduce the reserved tmsi which has all bits set to 1 according
to GSM 03.03 §2.4 and start checking for it and make sure the db
code will never allocate such a tmsi.
2009-09-28 05:14:25 +02:00
Harald Welte 55726d73d7 Use correct capitalization on SQL statements
otherwise, SQLite seems to return the wrong data types ?!?

Signed-off-by: Mike Haben <michael.haben@btinternet.com>
2009-09-26 18:54:59 +02:00
Harald Welte (local) ee4410a4f3 actual code running at end of har2009 2009-08-17 09:39:55 +02:00
Harald Welte (local) 026531ec92 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
Harald Welte (local) db552c56bb don't try to deliver sms to a subscriber that's not registered 2009-08-15 20:15:14 +02:00
Harald Welte (local) 3feef255d2 fix token allocation sql strings 2009-08-13 13:26:11 +02:00
Jan Luebbe f0b4cef137 fix random extension generation 2009-08-12 22:22:53 +02:00
Jan Luebbe 9eca37f93c fix problems with tmsi uniqueness in the subscriber table 2009-08-12 22:22:42 +02:00
Jan Luebbe 1da59edf83 fix a wrong format specifier 2009-08-12 22:22:26 +02:00
Jan Luebbe ebcce2aae1 allocate an extension when creating the subscriber 2009-08-12 22:22:20 +02:00
Jan Luebbe 31bef49be2 token support in the DB 2009-08-12 22:21:56 +02:00
Jan Luebbe b0dfc31d7d flag new subscriber structs in memory and send a signal 2009-08-12 21:03:00 +02:00
Holger Hans Peter Freyther 850326e377 db.c: Move the schema revision check after creating the tables
When starting the first time there are no tables, doing a revision
check will fail and bsc_hack will exit without tables created. Do
the revision check within db_prepare and allow new tables to be
created before.
2009-08-10 08:36:04 +02:00
Holger Hans Peter Freyther 966de68539 db: Fix warning about truncating the size
We are truncating the size and might should simply use a MIN
here to get the returned size or the maximum we can hold..
2009-08-10 08:26:07 +02:00
Holger Hans Peter Freyther 34e97495a6 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 2ebabca32a 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 d0b7b7719f add ud_hdr_ind to SMS table
we also implement verification of the database schema number by
using the 'Meta' table.
2009-08-09 19:03:42 +02:00
Harald Welte 76042188e0 first 'working' SMS implementation
we now have the full path from the MS into the database (SUBMIT), as well as
back from the database to the MS (DELIVER).  The database gets correctly
updated once a SMS has been successfully delivered.

What's still missing is the periodic scan over all undelivered messages,
trying to deliver them to the respective MS.  So far, you have to manually
trigger this on the telnet interface with 'sms send pending 1'
2009-08-08 16:03:15 +02:00
Harald Welte f3efc597d1 further steps towards better, transaction based SMS 2009-07-27 20:11:35 +02:00
Harald Welte 9176bd46e3 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 f0465bd6cb Merge branch 'master' into sms 2009-07-05 14:10:01 +02:00
Harald Welte c2e302dc84 Store classmark1/2/3 in equipment SQL table
For further evaluation/analysis, this patch stores the classmark 1, 2 and 3
values of every equipment in the SQL database.  We can use this non-volatile
data to determine the supported features for each handset that we've ever
seen on our network.
2009-07-05 14:08:13 +02:00
Harald Welte be3e3784dc further SMS work
* implement ID based lookup of gsm_subscriber from database
* look-up recipient and sender subscribers from database
2009-07-05 14:06:41 +02:00
Harald Welte b9c758b2ac more SMS improvements
* describe data structures in gsm_04_11.h
* increae LCHAN RELEASE TIMEOUT for case of long SMS
* convert header field in sql table from NUMERIC to BLOB
* initial handling for validity period
* send RP ERROR messages with meaningful RP CAUSE in case of error
2009-07-05 14:02:46 +02:00
Harald Welte 13e10daa33 move openbsc into its own subdirectory 2009-06-10 05:40:52 +08:00