db: add GPL headers and integrate with autofoo

This commit is contained in:
Jan Luebbe 2008-12-27 01:07:07 +00:00
parent 5b6cfaf933
commit faaa49ca51
6 changed files with 91 additions and 27 deletions

View File

@ -1,2 +1,2 @@
noinst_HEADERS = abis_nm.h abis_rsl.h debug.h gsm_04_08.h gsm_data.h \
noinst_HEADERS = abis_nm.h abis_rsl.h debug.h db.h gsm_04_08.h gsm_data.h \
gsm_subscriber.h linuxlist.h msgb.h select.h tlv.h

46
include/openbsc/db.h Normal file
View File

@ -0,0 +1,46 @@
/* (C) 2008 by Jan Luebbe <jluebbe@debian.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef _DB_H
#define _DB_H
#include <stdint.h>
#define NUMBER_LENGTH 32
typedef struct {
uint64_t imsi;
uint64_t tmsi;
char number[NUMBER_LENGTH];
uint16_t lac;
} db_subscriber;
int db_init();
int db_prepare();
int db_fini();
int db_insert_imei(uint64_t imei);
int db_insert_imsi(uint64_t imsi);
int db_imsi_set_tmsi(uint64_t imsi, uint64_t tmsi);
int db_imsi_set_lac(uint64_t imsi, uint16_t lac);
int db_imsi_get_subscriber(uint64_t imsi, db_subscriber* subscriber);
int db_tmsi_get_subscriber(uint64_t tmsi, db_subscriber* subscriber);
#endif /* _DB_H */

View File

@ -1,7 +1,10 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-Wall
sbin_PROGRAMS = bsc_hack
sbin_PROGRAMS = bsc_hack db_test
bsc_hack_SOURCES = bsc_hack.c misdn.c abis_rsl.c abis_nm.c gsm_04_08.c gsm_data.c \
gsm_subscriber.c msgb.c select.c chan_alloc.c
db_test_SOURCES = db_test.c db.c
db_test_LDADD = -ldl -ldbi

View File

@ -1,4 +1,23 @@
#include "db.h"
/* (C) 2008 by Jan Luebbe <jluebbe@debian.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <openbsc/db.h>
#include <stdio.h>
#include <dbi/dbi.h>

View File

@ -1,23 +0,0 @@
#include <stdint.h>
#define NUMBER_LENGTH 32
typedef struct {
uint64_t imsi;
uint64_t tmsi;
char number[NUMBER_LENGTH];
uint16_t lac;
} db_subscriber;
int db_init();
int db_prepare();
int db_fini();
int db_insert_imei(uint64_t imei);
int db_insert_imsi(uint64_t imsi);
int db_imsi_set_tmsi(uint64_t imsi, uint64_t tmsi);
int db_imsi_set_lac(uint64_t imsi, uint16_t lac);
int db_imsi_get_subscriber(uint64_t imsi, db_subscriber* subscriber);
int db_tmsi_get_subscriber(uint64_t tmsi, db_subscriber* subscriber);

View File

@ -1,4 +1,23 @@
#include "db.h"
/* (C) 2008 by Jan Luebbe <jluebbe@debian.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <openbsc/db.h>
#include <stdio.h>