db: add GPL headers and integrate with autofoo
diff --git a/include/openbsc/Makefile.am b/include/openbsc/Makefile.am
index 73e9330..a779cb9 100644
--- a/include/openbsc/Makefile.am
+++ b/include/openbsc/Makefile.am
@@ -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
diff --git a/include/openbsc/db.h b/include/openbsc/db.h
new file mode 100644
index 0000000..9501ec8
--- /dev/null
+++ b/include/openbsc/db.h
@@ -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 */
diff --git a/src/Makefile.am b/src/Makefile.am
index 868ac7b..bf55f26 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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
diff --git a/src/db.c b/src/db.c
index 904281a..1c412c2 100644
--- a/src/db.c
+++ b/src/db.c
@@ -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>
diff --git a/src/db.h b/src/db.h
deleted file mode 100644
index edf1655..0000000
--- a/src/db.h
+++ /dev/null
@@ -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);
-
diff --git a/src/db_test.c b/src/db_test.c
index 82dde49..ebfae2f 100644
--- a/src/db_test.c
+++ b/src/db_test.c
@@ -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>