blob: 61a3ac47c1b04e8c2a816572902df66a731601f2 [file] [log] [blame]
Jan Luebbefaaa49c2008-12-27 01:07:07 +00001/* (C) 2008 by Jan Luebbe <jluebbe@debian.org>
Holger Freyther12aa50d2009-01-01 18:02:05 +00002 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
Jan Luebbefaaa49c2008-12-27 01:07:07 +00003 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef _DB_H
22#define _DB_H
23
Jan Luebbe5c15c852008-12-27 15:59:25 +000024#include <sys/types.h>
Jan Luebbefaaa49c2008-12-27 01:07:07 +000025
Jan Luebbe5c15c852008-12-27 15:59:25 +000026#include <openbsc/gsm_subscriber.h>
Jan Luebbefaaa49c2008-12-27 01:07:07 +000027
Holger Freyther12aa50d2009-01-01 18:02:05 +000028/* one time initialisation */
Holger Freytherbde36102008-12-28 22:51:39 +000029int db_init(const char *name);
Jan Luebbefaaa49c2008-12-27 01:07:07 +000030int db_prepare();
31int db_fini();
32
Holger Freyther12aa50d2009-01-01 18:02:05 +000033/* subscriber management */
34struct gsm_subscriber* db_create_subscriber(char *imsi);
Holger Freytherca362a62009-01-04 21:05:01 +000035struct gsm_subscriber* db_get_subscriber(enum gsm_subscriber_field field, const char *subscr);
Holger Freyther12aa50d2009-01-01 18:02:05 +000036int db_sync_subscriber(struct gsm_subscriber* subscriber);
Jan Luebbe5c15c852008-12-27 15:59:25 +000037int db_subscriber_alloc_tmsi(struct gsm_subscriber* subscriber);
Holger Freyther12aa50d2009-01-01 18:02:05 +000038int db_subscriber_assoc_imei(struct gsm_subscriber* subscriber, char *imei);
Jan Luebbefaaa49c2008-12-27 01:07:07 +000039
Harald Welte7e310b12009-03-30 20:56:32 +000040/* SMS store-and-forward */
41int db_sms_store(struct gsm_sms *sms);
42struct gsm_sms *db_sms_get_unsent(int min_id);
43int db_sms_mark_sent(struct gsm_sms *sms);
Jan Luebbefaaa49c2008-12-27 01:07:07 +000044#endif /* _DB_H */