Mercurial > hg > waaad
changeset 122:9a341105760a
Added support for TwTimer in configuration
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 07 Aug 2008 11:25:59 +0900 |
parents | 9f2cd378d020 |
children | d1cef88ac5f2 |
files | doc/waaad.conf.sample include/waaad/conf-api.h waaad/conf-gram.y waaad/conf-token.l waaad/conf.c |
diffstat | 5 files changed, 27 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/waaad.conf.sample Thu Aug 07 11:25:42 2008 +0900 +++ b/doc/waaad.conf.sample Thu Aug 07 11:25:59 2008 +0900 @@ -28,6 +28,13 @@ # Default: 30 # tctimer = 30; +# The Tw timer of this peer. +# This is the delay before a watchdog message is sent, as described in RFC 3539. +# The value is expressed in seconds. The default value is 30 seconds. Value must +# be greater or equal to 6 seconds. See details in the RFC. +# Default: 30 +# twtimer = 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
--- a/include/waaad/conf-api.h Thu Aug 07 11:25:42 2008 +0900 +++ b/include/waaad/conf-api.h Thu Aug 07 11:25:59 2008 +0900 @@ -53,6 +53,8 @@ int tctimer; /* The value in seconds of the Tc timer */ + int twtimer; /* The value in seconds of the Tw 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 */
--- a/waaad/conf-gram.y Thu Aug 07 11:25:42 2008 +0900 +++ b/waaad/conf-gram.y Thu Aug 07 11:25:59 2008 +0900 @@ -172,6 +172,7 @@ %token GEN_PORT %type <u16> gen_port_val %token GEN_TCTIMER +%token GEN_TWTIMER %token GEN_DISABLERELAY /* In the "extension" section */ @@ -240,6 +241,7 @@ | general_content gen_diamid | general_content gen_port | general_content gen_tctimer + | general_content gen_twtimer | general_content gen_disablerelay ; @@ -312,6 +314,17 @@ } ; +gen_twtimer: GEN_TWTIMER '=' INTEGER ';' + { + if ($3 >= 6) { + pconfig->pub.twtimer = $3; + } else { + log_error("The TwTimer value (%d) is invalid. It must be >= 6. Exiting...\n", $3); + YYERROR; + } + } + ; + gen_disablerelay: GEN_DISABLERELAY '=' INTEGER ';' { pconfig->pub.disable_relay = $3;
--- a/waaad/conf-token.l Thu Aug 07 11:25:42 2008 +0900 +++ b/waaad/conf-token.l Thu Aug 07 11:25:59 2008 +0900 @@ -125,6 +125,8 @@ (?i:"TcTimer") { return GEN_TCTIMER; } /* Specify the Tc timer value */ +(?i:"TwTimer") { return GEN_TWTIMER; } /* Specify the Tw timer value */ + (?i:"DisableRelay") { return GEN_DISABLERELAY; } /* Is relaying disabled? */ /* The EXTENSION section tokens */
--- a/waaad/conf.c Thu Aug 07 11:25:42 2008 +0900 +++ b/waaad/conf.c Thu Aug 07 11:25:59 2008 +0900 @@ -71,8 +71,9 @@ /* The default port */ conf->pub.local_port = 3868; - /* The default tctimer value */ + /* The default tctimer and twtimer values */ conf->pub.tctimer = 30; + conf->pub.twtimer = 30; return 0; } @@ -84,6 +85,7 @@ TRACE_DEBUG( INFO, " Diameter-Id : %s", g_pconf->diameter_identity); TRACE_DEBUG( INFO, " Local port : %hd",g_pconf->local_port); TRACE_DEBUG( INFO, " Tc timer : %d", g_pconf->tctimer); + TRACE_DEBUG( INFO, " Tw timer : %d", g_pconf->twtimer); TRACE_DEBUG( INFO, " Relaying : %s", g_pconf->disable_relay ? "Disabled" : "Enabled"); TRACE_DEBUG( INFO, "------------------------------"); }