aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/db.c
AgeCommit message (Collapse)AuthorFilesLines
2011-03-03re-structure the OpenBSC directory layoutHarald Welte1-1303/+0
The new structure divides the code into a number of libraries for the BSC core functionality, MSC core functionality, Abis transport, TRAU and other bits. This doesn't introduce any functional code change but simply moves around files and alters Makefile.am accordingly. Next step would be to disentangle a lot of the inter-library dependencies and make the individual bits of code more independent.
2011-01-06misc: Remove unused variable from the db.Holger Hans Peter Freyther1-1/+0
2011-01-01[db] Fix double-quoting in libdbi backendHarald Welte1-2/+2
2011-01-01License change: We are now AGPLv3+ instead of GPLv2+Harald Welte1-6/+5
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.
2010-12-26db: Quote the IMEI string before passing it into the database.Holger Hans Peter Freyther1-2/+5
2010-12-26[db] Properly quote name and extension for SQL accessHarald Welte1-3/+10
2010-12-25db: Introduce a limit in delivery attempts for the SMS searchHolger Hans Peter Freyther1-3/+5
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-25db: Add method to load a SMS by id.Holger Hans Peter Freyther1-0/+22
2010-12-24subscr: Add a VTY command to update the subscriber from the database.Holger Hans Peter Freyther1-18/+54
2010-12-22misc: Remove gsm_subscriber.h from the db.h fileHolger Hans Peter Freyther1-0/+1
Reduce the dependencies on the header files.
2010-12-22misc: Reorder includes, move osmocore to the endHolger Hans Peter Freyther1-1/+2
2010-09-18janitor: Move the * to the variable nameHolger Hans Peter Freyther1-1/+1
2010-07-03db.c: Fix some SQL queries for ambiguous column namesSylvain Munaut1-19/+23
Thanks to Luca Bertoncello for pointing this out Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-07-03db: Use proper %llu for subscriber ID in format string.Sylvain Munaut1-8/+8
This was causing weird crashes when running in 32 bit linux. Thanks to horiz0n for taking the time to debug this with me on IRC. Written-by: horiz0n <cscan@gmx.net> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14db: Fix typo in sync_lastauthtuples SQL UPDATE stmtSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14db: Change naming convention for auth info functionsSylvain Munaut1-10/+10
- exported function have a 'db_' prefix - use 'sync' vs 'set' - use 'for' vs 'by' Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14db: Use subscriber_id as primary key for AuthKeys/AuthLastTuplesSylvain Munaut1-4/+2
It's unique and not null and we never use 'id' anyway. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-06-14db: Rename AuthTuples to AuthLastTuplesSylvain Munaut1-9/+9
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-05-14DB: don't use reserved "index" word in SQL table field nameHarald Welte1-2/+2
2010-05-13[GPRS] NS: more rate counters for BLOCK / DEAD countHarald Welte1-5/+12
2010-05-13[GPRS] NS: Start to use rate_ctr_group code from libosmocoreHarald Welte1-7/+49
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-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