blob: eef42f6fb66db3ced8fd0b158d4a9a6cfe5ff898 [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 Freytherc7b86f92009-06-06 13:54:20 +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 */
Harald Welte9176bd42009-07-23 18:46:00 +020034struct gsm_subscriber* db_create_subscriber(struct gsm_network *net,
35 char *imsi);
36struct gsm_subscriber* db_get_subscriber(struct gsm_network *net,
37 enum gsm_subscriber_field field,
38 const char *subscr);
Holger Freyther12aa50d2009-01-01 18:02:05 +000039int db_sync_subscriber(struct gsm_subscriber* subscriber);
Jan Luebbe5c15c852008-12-27 15:59:25 +000040int db_subscriber_alloc_tmsi(struct gsm_subscriber* subscriber);
Holger Freyther12aa50d2009-01-01 18:02:05 +000041int db_subscriber_assoc_imei(struct gsm_subscriber* subscriber, char *imei);
Jan Luebbefaaa49c2008-12-27 01:07:07 +000042
Harald Welte7e310b12009-03-30 20:56:32 +000043/* SMS store-and-forward */
44int db_sms_store(struct gsm_sms *sms);
Harald Welte9176bd42009-07-23 18:46:00 +020045struct gsm_sms *db_sms_get_unsent(struct gsm_network *net, int min_id);
Harald Welte2ebabca2009-08-09 19:05:21 +020046struct gsm_sms *db_sms_get_unsent_for_subscr(struct gsm_subscriber *subscr);
Harald Welte7e310b12009-03-30 20:56:32 +000047int db_sms_mark_sent(struct gsm_sms *sms);
Jan Luebbefaaa49c2008-12-27 01:07:07 +000048#endif /* _DB_H */