2
0
Эх сурвалжийг харах

Integrate functions and parameters from kamailio sources.

This patch adds db_bind_api function from kamailio sources to the list
of exported functions. Also we call the mod_init function from kamailio
sources at the and of the mod_init function in pg_mod.c. To make this
possible I added a new header file and removed static from the mod_init
function declaration.
Jan Janak 16 жил өмнө
parent
commit
f0546a246d

+ 3 - 6
modules/db_postgres/km_db_postgres.c

@@ -38,14 +38,11 @@
 #include "../../lib/srdb1/db_con.h"
 #include "../../lib/srdb1/db_con.h"
 #include "../../lib/srdb1/db.h"
 #include "../../lib/srdb1/db.h"
 #include "km_dbase.h"
 #include "km_dbase.h"
+#include "km_db_postgres.h"
 
 
 
 
 /*MODULE_VERSION*/
 /*MODULE_VERSION*/
 
 
-int db_postgres_bind_api(db_func_t *dbb);
-
-static int mod_init(void);
-
 /*
 /*
  * PostgreSQL database module interface
  * PostgreSQL database module interface
  */
  */
@@ -66,14 +63,14 @@ struct kam_module_exports kam_exports = {
 	0,        /* exported MI functions */
 	0,        /* exported MI functions */
 	0,        /* exported pseudo-variables */
 	0,        /* exported pseudo-variables */
 	0,        /* extra processes */
 	0,        /* extra processes */
-	mod_init, /* module initialization function */
+	km_postgres_mod_init, /* module initialization function */
 	0,        /* response function*/
 	0,        /* response function*/
 	0,        /* destroy function */
 	0,        /* destroy function */
 	0         /* per-child init function */
 	0         /* per-child init function */
 };
 };
 
 
 
 
-static int mod_init(void)
+int km_postgres_mod_init(void)
 {
 {
 	return 0;
 	return 0;
 }
 }

+ 39 - 0
modules/db_postgres/km_db_postgres.h

@@ -0,0 +1,39 @@
+/*
+ * $Id$ 
+ *
+ * Copyright (C) 2001-2003 FhG Fokus
+ * Copyright (C) 2008 1&1 Internet AG
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio 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
+ *
+ * Kamailio 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*! \file
+ *  \brief DB_POSTGRES :: Core
+ *  \ingroup db_postgres
+ *  Module: \ref db_postgres
+ */
+
+#ifndef _KM_DB_POSTGRES_H
+#define _KM_DB_POSTGRES_H
+
+#include "../../lib/srdb1/db.h"
+
+int db_postgres_bind_api(db_func_t *dbb);
+
+int km_postgres_mod_init(void);
+
+#endif /* _KM_DB_POSTGRES_H */

+ 3 - 1
modules/db_postgres/pg_mod.c

@@ -42,6 +42,7 @@
 #include "pg_cmd.h"
 #include "pg_cmd.h"
 #include "pg_res.h"
 #include "pg_res.h"
 #include "pg_fld.h"
 #include "pg_fld.h"
+#include "km_db_postgres.h"
 
 
 #include "../../sr_module.h"
 #include "../../sr_module.h"
 
 
@@ -77,6 +78,7 @@ static cmd_export_t cmds[] = {
 	{"db_next",   (cmd_function)pg_cmd_next, 0, 0, 0},
 	{"db_next",   (cmd_function)pg_cmd_next, 0, 0, 0},
 	{"db_setopt", (cmd_function)pg_setopt, 0, 0, 0},
 	{"db_setopt", (cmd_function)pg_setopt, 0, 0, 0},
 	{"db_getopt", (cmd_function)pg_getopt, 0, 0, 0},
 	{"db_getopt", (cmd_function)pg_getopt, 0, 0, 0},
+	{"db_bind_api", (cmd_function)db_postgres_bind_api, 0, 0, 0},
 	{0, 0, 0, 0, 0}
 	{0, 0, 0, 0, 0}
 };
 };
 
 
@@ -538,7 +540,7 @@ static int pg_mod_init(void)
 	}
 	}
 	return -1;
 	return -1;
 #endif /* PG_TEST */
 #endif /* PG_TEST */
-	return 0;
+	return km_postgres_mod_init();
 }
 }
 
 
 /** @} */
 /** @} */