Module: sip-router
Branch: master
Commit: 5397c6c4d9a9b3f50561893855d7469cfbf58858
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5397c6c…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: Mon Apr 1 09:12:01 2013 +0200
outbound add config framework variable to indicate active module
---
modules/outbound/config.c | 42 ++++++++++++++++++++++++++++++++++++++++++
modules/outbound/config.h | 39 +++++++++++++++++++++++++++++++++++++++
modules/outbound/ob_mod.c | 8 +++++++-
3 files changed, 88 insertions(+), 1 deletions(-)
diff --git a/modules/outbound/config.c b/modules/outbound/config.c
new file mode 100644
index 0000000..657a433
--- /dev/null
+++ b/modules/outbound/config.c
@@ -0,0 +1,42 @@
+/*
+ * $Id$
+ * This file is part of SIP-router, a free SIP server.
+ *
+ * SIP-router 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
+ *
+ * SIP-router 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 Outbound :: Configuration
+ * \ingroup Outbound
+ */
+
+#include "../../cfg/cfg.h"
+#include "../../parser/msg_parser.h" /* method types */
+
+#include "config.h"
+
+struct cfg_group_outbound default_outbound_cfg = {
+ 0, /* Read only variable to mark if outbound is enabled */
+ };
+
+void *outbound_cfg = &default_outbound_cfg;
+
+cfg_def_t outbound_cfg_def[] = {
+ {"outbound_enabled", CFG_VAR_INT | CFG_ATOMIC | CFG_READONLY, 0, 0, 0, 0,
+ "If set to one (true) Outbound is enabled."},
+ {0, 0, 0, 0, 0, 0}
+};
diff --git a/modules/outbound/config.h b/modules/outbound/config.h
new file mode 100644
index 0000000..fc6c74a
--- /dev/null
+++ b/modules/outbound/config.h
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ *
+ * SIP-router 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 Outbound :: Configuration Framework support
+ * \ingroup outbound
+ */
+
+
+#ifndef _OUTBOUND_CONFIG_H
+#define _OUTBOUND_CONFIG_H
+
+#include "../../qvalue.h"
+
+#include "../../cfg/cfg.h"
+#include "../../str.h"
+
+struct cfg_group_outbound {
+ int outbound_active;
+};
+
+extern struct cfg_group_outbound default_outbound_cfg;
+extern void *outbound_cfg;
+extern cfg_def_t outbound_cfg_def[];
+
+extern void ds_ping_reply_codes_update(str*, str*);
+
+#endif
diff --git a/modules/outbound/ob_mod.c b/modules/outbound/ob_mod.c
index e5eea65..411e354 100644
--- a/modules/outbound/ob_mod.c
+++ b/modules/outbound/ob_mod.c
@@ -37,6 +37,7 @@
#include "../../parser/parse_uri.h"
#include "api.h"
+#include "config.h"
MODULE_VERSION
@@ -97,7 +98,12 @@ static int mod_init(void)
LM_ERR("unable to get %d cryptographically strong pseudo-"
"random bytes\n", ob_key.len);
}
-
+ if (cfg_declare("outbound", outbound_cfg_def, &default_outbound_cfg,
+ cfg_sizeof(outbound), &outbound_cfg)) {
+ LM_ERR("declaring config framework variable\n");
+ return -1;
+ }
+ default_outbound_cfg.outbound_active = 1;
return 0;
}