changeset 100:50665bb608fd

Added the 'disable_relay' option in the configuration file
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 23 Jul 2008 10:53:27 +0900
parents d5fcb2af8c5a
children 54c7f5120aa5
files doc/waaad.conf.sample include/waaad/conf-api.h waaad/conf-gram.y waaad/conf-token.l waaad/conf.c waaad/main.c
diffstat 6 files changed, 30 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/doc/waaad.conf.sample	Wed Jul 23 10:35:16 2008 +0900
+++ b/doc/waaad.conf.sample	Wed Jul 23 10:53:27 2008 +0900
@@ -6,24 +6,32 @@
 
 [general]
 
+# The Diameter-Id of this peer.
+# This must be a valid FQDN that resolves to the local host.
+# Default: no default
+diameter-id = "test.local";
+
 # Where the messages are sent?
 # Valid values: console, syslog.
 # Multiple values are allowed. Separator is ','. Example:
 ## Log = console, syslog;
 # Default: console
-log = console;
-
-# The Diameter-Id of this peer.
-# This must be a valid FQDN that resolves to the local host.
-# Default: no default
-diameter-id = "test.local";
+# log = console;
 
 # The Tc timer of this peer.
 # This is the delay before an attempt is made to reconnect a disconnected peer.
 # The value is expressed in seconds. The recommended value is 30 seconds.
 # Default: 30
-tctimer = 30;
+# tctimer = 30;
 
+# Disable the relaying of Diameter messages?
+# For messages not handled locally, the default behavior is to forward the
+# message to another peer if any is available, according to the routing 
+# mechanism. 
+# If this variable is set to non-0 value, then the messages are not relayed and
+# the "0xffffff" application is not advertised in CER/CEA exchanges.
+# Default: 0
+# disable_relay = 0;
 
 [extensions]
 
--- a/include/waaad/conf-api.h	Wed Jul 23 10:35:16 2008 +0900
+++ b/include/waaad/conf-api.h	Wed Jul 23 10:53:27 2008 +0900
@@ -51,6 +51,8 @@
 	
 	int		 tctimer;		/* The value in seconds of the Tc timer */
 	
+	int		 disable_relay;		/* if != 0, the local host do not relay Diameter messages */
+	
 } ext_conf_t; /* One should use the always-defined "g_pconf" pointer to access these fields */
 
 /* Now define the type of the structure that contains the callback to pass to extensions */
--- a/waaad/conf-gram.y	Wed Jul 23 10:35:16 2008 +0900
+++ b/waaad/conf-gram.y	Wed Jul 23 10:53:27 2008 +0900
@@ -170,6 +170,7 @@
 %token		GEN_LOG_SYSLOG
 %token		GEN_DIAMID
 %token		GEN_TCTIMER
+%token		GEN_DISABLERELAY
 
 /* In the "extension" section */
 %token 		SECTION_EXTENSION
@@ -236,6 +237,7 @@
 			| general_content gen_log 
 			| general_content gen_diamid
 			| general_content gen_tctimer
+			| general_content gen_disablerelay
 			;
 
 gen_log:		GEN_LOG '=' gen_log_type ';'
@@ -291,6 +293,12 @@
 			}
 			;
 
+gen_disablerelay:	GEN_DISABLERELAY '=' INTEGER ';'
+			{
+				pconfig->pub.disable_relay = $3;
+			}
+			;
+
 	/* Define the [extensions] section grammar */
 extensions_section:	SECTION_EXTENSION extensions_content
 			;
--- a/waaad/conf-token.l	Wed Jul 23 10:35:16 2008 +0900
+++ b/waaad/conf-token.l	Wed Jul 23 10:53:27 2008 +0900
@@ -123,6 +123,8 @@
 
 (?i:"TcTimer")		{ return GEN_TCTIMER;				} /* Specify the Tc timer value */
 
+(?i:"Disable_Relay")	{ return GEN_DISABLERELAY;			} /* Is relaying disabled? */
+
 	/* The EXTENSION section tokens */
 (?i:"[extensions]")	{ return SECTION_EXTENSION; 			} /* enter the Extension section */
 
--- a/waaad/conf.c	Wed Jul 23 10:35:16 2008 +0900
+++ b/waaad/conf.c	Wed Jul 23 10:53:27 2008 +0900
@@ -80,6 +80,7 @@
 	TRACE_DEBUG( INFO, "--- Parsed configuration : ---");
 	TRACE_DEBUG( INFO, "  Diameter-Id : %s", g_pconf->diameter_identity);
 	TRACE_DEBUG( INFO, "  Tc timer    : %d", g_pconf->tctimer);
+	TRACE_DEBUG( INFO, "  Relaying    : %s", g_pconf->disable_relay ? "Disabled" : "Enabled");
 	TRACE_DEBUG( INFO, "------------------------------");
 }
 
--- a/waaad/main.c	Wed Jul 23 10:35:16 2008 +0900
+++ b/waaad/main.c	Wed Jul 23 10:53:27 2008 +0900
@@ -229,8 +229,10 @@
 	/* Load the extensions */
 	ext_load();
 	
+	#if 0
 	/* DEBUG: dump the dictionary content */
 	dump_dictionary();
+	#endif /* 0 */
 
 	/* Allow the peer module to start */
 	ret = peer_start();
"Welcome to our mercurial repository"