aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/db.c
AgeCommit message (Collapse)AuthorFilesLines
2010-03-30db: Fix aliasing warning by casting the signed char to a structHolger Hans Peter Freyther1-3/+6
When we have assigned the cn we will use mempcy to copy the one byte into the target. Use a static assert to assure that the type have the same size. warning: dereferencing type-punned pointer will break strict-aliasing rules
2010-03-29[misc] Remove whitespace from the end of the line.Holger Hans Peter Freyther1-3/+3
2010-03-25db: Fix a bug where no pending SMS were foundHolger Hans Peter Freyther1-2/+2
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-02-20split 'libosmocore' from openbsc codebaseHarald Welte1-2/+2
This library is intended to collect all generic/common funcitionality of all Osmocom.org projects, including OpenBSC but also OsmocomBB The library currently includes the following modules: bitvec, comp128, gsm_utils, msgb, select, signal, statistics, talloc, timer, tlv_parse, linuxlist msgb allocation error debugging had to be temporarily disabled as it depends on 'debug.c' functionality which at the moment remains in OpenBSC
2010-01-03db: Add methods to set auth{info,tuple} for a subscriberSylvain Munaut1-0/+125
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-01-03db: Fix bad size comparison when retrieving KiSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-01-03db: Add issued/use_count/key_seq fields to AuthTuplesSylvain Munaut1-3/+9
Theses will be useful to know if we can reuse the tuples or if we should renew. The 'issued' is currently purely informative. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-01-03db: Fix type of algorithm_id (NUMERIC -> INTEGER)Sylvain Munaut1-2/+2
This fixes a DB warning and no need for NUMERIC here. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-01-03db: Fix missing commas in AuthTuples table creationSylvain Munaut1-3/+3
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2009-12-26[db] A new subscriber is an INFO event, not NOTICEHarald Welte (local)1-1/+1
2009-12-26'classmark1' is not an integer field in the databaseHarald Welte (local)1-1/+3
2009-12-24Converrt the database later to use DEBUGP/LOGP instead of stderrHarald Welte1-34/+43
2009-12-24db: coding style cleanupHarald Welte1-46/+58
2009-12-24fix merge artefact from db.cHarald Welte1-0/+1
2009-12-24[authentication] Code for retrieving authentication data from SQL DBHarald Welte1-0/+92
This is the first step towards supporting actual A3/A8 authentication.
2009-12-22fix sql table creation for 'Counters' tableHarald Welte1-2/+2
2009-12-22statistics: Introduce 'struct counter' instead of using unsigned longHarald Welte1-0/+28
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-22Implement a better sending of pending SMSSylvain Munaut1-0/+27
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-21[db] Fix queries for unsent SMSSylvain Munaut1-3/+5
- 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-09fix compile warning in db.cHarald Welte1-1/+1
2009-11-07change some identifiers from u_int64_t to unsigned long longHarald Welte1-1/+1
makes printf much easier on 64bit platforms...
2009-10-22[db] Fix compile warnings in db.cHolger Hans Peter Freyther1-3/+5
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-09-28[tmsi] Make the tmsi a 4 octet numberHolger Hans Peter Freyther1-8/+16
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-26Use correct capitalization on SQL statementsHarald Welte1-4/+4
otherwise, SQLite seems to return the wrong data types ?!? Signed-off-by: Mike Haben <michael.haben@btinternet.com>
2009-08-17actual code running at end of har2009Harald Welte (local)1-4/+65
2009-08-16store all APDU's received from the MS in the databaseHarald Welte (local)1-0/+31
This helps us to analyze data such as RRLP location information for later analysis.
2009-08-15don't try to deliver sms to a subscriber that's not registeredHarald Welte (local)1-4/+27
2009-08-13fix token allocation sql stringsHarald Welte (local)1-13/+15
2009-08-12fix random extension generationJan Luebbe1-1/+1
2009-08-12fix problems with tmsi uniqueness in the subscriber tableJan Luebbe1-5/+19
2009-08-12fix a wrong format specifierJan Luebbe1-1/+1
2009-08-12allocate an extension when creating the subscriberJan Luebbe1-0/+29
2009-08-12token support in the DBJan Luebbe1-0/+54
2009-08-12flag new subscriber structs in memory and send a signalJan Luebbe1-0/+1
2009-08-10db.c: Move the schema revision check after creating the tablesHolger Hans Peter Freyther1-6/+6
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-10db: Fix warning about truncating the sizeHolger Hans Peter Freyther1-1/+1
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-10misc: Add prototypes to header files, include more header filesHolger Hans Peter Freyther1-0/+1
Fix various warnings about implicit declarations of functions.
2009-08-09new db_sms_get_unsent_for_subscr() functionHarald Welte1-18/+50
The function retrieves the oldest not-yet-sent SM for the given subscriber
2009-08-09add ud_hdr_ind to SMS tableHarald Welte1-9/+45
we also implement verification of the database schema number by using the 'Meta' table.
2009-08-08first 'working' SMS implementationHarald Welte1-42/+68
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-07-27further steps towards better, transaction based SMSHarald Welte1-5/+25
2009-07-23make sure subscr->net is always setHarald Welte1-6/+12
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-05Merge branch 'master' into smsHarald Welte1-0/+38
2009-07-05Store classmark1/2/3 in equipment SQL tableHarald Welte1-0/+38
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-05further SMS workHarald Welte1-1/+24
* implement ID based lookup of gsm_subscriber from database * look-up recipient and sender subscribers from database
2009-07-05more SMS improvementsHarald Welte1-2/+6
* 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-06-10move openbsc into its own subdirectoryHarald Welte1-0/+464