Index: c/app_test.conf.sample
===================================================================
--- doc/app_test.conf.sample	(revision 94)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#######################
-# This file contains the description of configuration and general information about the
-# "App_test" extension.
-
-# This extension provides a simple way to send a predefined message over the Diameter Network.
-# It may be used to test the Routing or other base mechanisms from the Diameter network.
-
-# In order to enable this extension, the main freeDiameter configuration file
-# must contain the following declaration:
-# LoadExtension = "extensions/app_test.fdx" : "/path/to/app_test.conf" ;
-# Note that the conffile may be omitted, in which case default parameters will be assumed.
-#######################
-
-
-#######################
-# Configuration of the test message
-
-# This application is defined as a Vendor-Specific application. 
-# Since waaad does not have a IANA-assigned Vendor ID, we let a configurable value here:
-# vendor-id = 999999;
-
-# The application id. Same remark as previously.
-# appli-id = 999999;
-
-# The command code for Test-Request and Test-Answer. The range 0xfffffe-ffffff (dec: 16777215) is reserved for experimental use.
-# cmd-id = 16777214;
-
-# The AVP id for the test.
-# avp-id = 345678;
-
-#######################
-# Configuration of the extension behavior
-
-# The mode for the extension.
-# - server: Answer incoming requests. The signal is ignored.
-# - client: Send a request when the signal is received, and measure the time to receiving answer.
-# - both: acts as client and server
-# mode = both;
-
-#######################
-# Client-specific configuration
-
-# The Destination-Realm for the message
-# (default is sending to same realm as local peer).
-# dest-realm = "foreign.net";
-
-# The Destination-Host for the message.
-# (default is not providing this AVP).
-# dest-host = "server.foreign.net";
-
-# The signal that triggers sending the test message
-# Note: Symbolic names are now recognized, you must use integers
-# signal = 10;
Index: doc/test_app.conf.sample
===================================================================
--- doc/test_app.conf.sample	(revision 120)
+++ doc/test_app.conf.sample	(revision 120)
@@ -0,0 +1,53 @@
+#######################
+# This file contains the description of configuration and general information about the
+# "App_test" extension.
+
+# This extension provides a simple way to send a predefined message over the Diameter Network.
+# It may be used to test the Routing or other base mechanisms from the Diameter network.
+
+# In order to enable this extension, the main freeDiameter configuration file
+# must contain the following declaration:
+# LoadExtension = "extensions/app_test.fdx" : "/path/to/app_test.conf" ;
+# Note that the conffile may be omitted, in which case default parameters will be assumed.
+#######################
+
+
+#######################
+# Configuration of the test message
+
+# This application is defined as a Vendor-Specific application. 
+# Since waaad does not have a IANA-assigned Vendor ID, we let a configurable value here:
+# vendor-id = 999999;
+
+# The application id. Same remark as previously.
+# appli-id = 999999;
+
+# The command code for Test-Request and Test-Answer. The range 0xfffffe-ffffff (dec: 16777215) is reserved for experimental use.
+# cmd-id = 16777214;
+
+# The AVP id for the test.
+# avp-id = 345678;
+
+#######################
+# Configuration of the extension behavior
+
+# The mode for the extension.
+# - server: Answer incoming requests. The signal is ignored.
+# - client: Send a request when the signal is received, and measure the time to receiving answer.
+# - both: acts as client and server
+# mode = both;
+
+#######################
+# Client-specific configuration
+
+# The Destination-Realm for the message
+# (default is sending to same realm as local peer).
+# dest-realm = "foreign.net";
+
+# The Destination-Host for the message.
+# (default is not providing this AVP).
+# dest-host = "server.foreign.net";
+
+# The signal that triggers sending the test message
+# Note: Symbolic names are now recognized, you must use integers
+# signal = 10;
Index: extensions/CMakeLists.txt
===================================================================
--- extensions/CMakeLists.txt	(revision 118)
+++ extensions/CMakeLists.txt	(revision 120)
@@ -57,5 +57,5 @@
 
 ####
-# Debug / development extensions
+# Debug / test extensions
 
 OPTION(BUILD_SAMPLE "Build sample.fdx? (Simple extension to demonstrate extension mechanism, for developpers only)" OFF)
@@ -64,21 +64,21 @@
 	ENDIF (BUILD_SAMPLE)
 
-OPTION(BUILD_MONITOR "Build monitor.fdx? (display periodical debug information on the console)" OFF)
-	IF (BUILD_MONITOR)
+OPTION(BUILD_DBG_MONITOR "Build dbg_monitor.fdx? (display periodical debug information on the console)" OFF)
+	IF (BUILD_DBG_MONITOR)
 	   SUBDIRS(dbg_monitor)
-	ENDIF (BUILD_MONITOR)
+	ENDIF (BUILD_DBG_MONITOR)
 
-OPTION(BUILD_RT_ANY "Build rt_any? (Routing extension randomly sending message to any peer available, for testing purpose only)" OFF)
- 	IF (BUILD_RT_ANY)
- 	   SUBDIRS(rt_any)
- 	ENDIF (BUILD_RT_ANY)
+OPTION(BUILD_DBG_RT "Build dbg_rt.fdx? (Routing extension for debugging the routing module)" OFF)
+ 	IF (BUILD_DBG_RT)
+ 	   SUBDIRS(dbg_rt)
+ 	ENDIF (BUILD_DBG_RT)
 
-OPTION(BUILD_RT_DEBUG "Build rt_debug? (Routing extension for debugging the routing module)" OFF)
- 	IF (BUILD_RT_DEBUG)
- 	   SUBDIRS(rt_debug)
- 	ENDIF (BUILD_RT_DEBUG)
+OPTION(BUILD_TEST_APP "Build test_app.fdx? (Testing application to send dummy message to another peer, for testing purpose only)" OFF)
+ 	IF (BUILD_TEST_APP)
+ 	   SUBDIRS(test_app)
+ 	ENDIF (BUILD_TEST_APP)
 
-OPTION(BUILD_APP_TEST "Build app_test? (Testing application to send dummy message to another peer, for testing purpose only)" OFF)
- 	IF (BUILD_APP_TEST)
- 	   SUBDIRS(app_test)
- 	ENDIF (BUILD_APP_TEST)
+OPTION(BUILD_TEST_RT_ANY "Build test_rt_any.fdx? (Routing extension randomly sending message to any peer available, for testing purpose only)" OFF)
+ 	IF (BUILD_TEST_RT_ANY)
+ 	   SUBDIRS(test_rt_any)
+ 	ENDIF (BUILD_TEST_RT_ANY)
Index: tensions/app_test/CMakeLists.txt
===================================================================
--- extensions/app_test/CMakeLists.txt	(revision 93)
+++ 	(revision )
@@ -1,23 +1,0 @@
-# The dict_nasreq extension
-PROJECT("Test Diameter Application" C)
-
-# Parser files
-BISON_FILE(atst_conf.y)
-FLEX_FILE(atst_conf.l)
-SET_SOURCE_FILES_PROPERTIES(lex.atst_conf.c atst_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}")
-
-# List of source files
-SET( APP_TEST_SRC
-	app_test.c
-	app_test.h
-	lex.atst_conf.c
-	atst_conf.tab.c
-	atst_conf.tab.h
-	atst_sig.c
-	atst_dict.c
-	atst_serv.c
-	atst_cli.c
-)
-
-# Compile as a module
-FD_ADD_EXTENSION(app_test ${APP_TEST_SRC})
Index: tensions/app_test/app_test.c
===================================================================
--- extensions/app_test/app_test.c	(revision 108)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* 
- * Test application for freeDiameter.
- */
-
-#include "app_test.h"
-#include <signal.h>
-
-/* Initialize the configuration */
-struct atst_conf * atst_conf = NULL;
-static struct atst_conf _conf;
-
-static int atst_conf_init(void)
-{
-	atst_conf = &_conf;
-	memset(atst_conf, 0, sizeof(struct atst_conf));
-	
-	/* Set the default values */
-	atst_conf->vendor_id  = 999999;		/* Dummy value */
-	atst_conf->appli_id   = 0xffffff;	/* dummy value */
-	atst_conf->cmd_id     = 0xfffffe;	/* Experimental */
-	atst_conf->avp_id     = 0xffffff;	/* dummy value */
-	atst_conf->mode       = MODE_SERV | MODE_CLI;
-	atst_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
-	atst_conf->dest_host  = NULL;
-	atst_conf->signal     = APP_TEST_DEFAULT_SIGNAL;
-	
-	return 0;
-}
-
-static void atst_conf_dump(void)
-{
-	if (!TRACE_BOOL(INFO))
-		return;
-	fd_log_debug( "------- app_test configuration dump: ---------\n");
-	fd_log_debug( " Vendor Id .......... : %u\n", atst_conf->vendor_id);
-	fd_log_debug( " Application Id ..... : %u\n", atst_conf->appli_id);
-	fd_log_debug( " Command Id ......... : %u\n", atst_conf->cmd_id);
-	fd_log_debug( " AVP Id ............. : %u\n", atst_conf->avp_id);
-	fd_log_debug( " Mode ............... : %s%s\n", atst_conf->mode & MODE_SERV ? "Serv" : "", atst_conf->mode & MODE_CLI ? "Cli" : "" );
-	fd_log_debug( " Destination Realm .. : %s\n", atst_conf->dest_realm ?: "- none -");
-	fd_log_debug( " Destination Host ... : %s\n", atst_conf->dest_host ?: "- none -");
-	fd_log_debug( " Signal ............. : %i\n", atst_conf->signal);
-	fd_log_debug( "------- /app_test configuration dump ---------\n");
-}
-
-/* entry point */
-static int atst_entry(char * conffile)
-{
-	TRACE_ENTRY("%p", conffile);
-	
-	/* Initialize configuration */
-	CHECK_FCT( atst_conf_init() );
-	
-	/* Parse configuration file */
-	if (conffile != NULL) {
-		CHECK_FCT( atst_conf_handle(conffile) );
-	}
-	
-	TRACE_DEBUG(INFO, "Extension APP/Test initialized with configuration: '%s'", conffile);
-	atst_conf_dump();
-	
-	/* Install objects definitions for this test application */
-	CHECK_FCT( atst_dict_init() );
-	
-	/* Install the handlers for incoming messages */
-	if (atst_conf->mode & MODE_SERV) {
-		CHECK_FCT( atst_serv_init() );
-	}
-	
-	/* Start the signal handler thread */
-	if (atst_conf->mode & MODE_CLI) {
-		CHECK_FCT( atst_cli_init() );
-	}
-	
-	/* Advertise the support for the test application in the peer */
-	CHECK_FCT( fd_disp_app_support ( atst_appli, atst_vendor, 1, 0 ) );
-	
-	return 0;
-}
-
-/* Unload */
-void fd_ext_fini(void)
-{
-	if (atst_conf->mode & MODE_CLI)
-		atst_cli_fini();
-	if (atst_conf->mode & MODE_SERV)
-		atst_serv_fini();
-}
-
-EXTENSION_ENTRY("app_test", atst_entry);
Index: tensions/app_test/app_test.h
===================================================================
--- extensions/app_test/app_test.h	(revision 97)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* Header file for the app_test extension. 
- *
- *  This extension provides a way to send configurable messages on the network
- *
- *  See the app_test.conf.sample file for the format of the configuration file.
- */
- 
-#include <freeDiameter/extension.h>
-
-#ifndef APP_TEST_DEFAULT_SIGNAL
-#define APP_TEST_DEFAULT_SIGNAL	SIGUSR1
-#endif /* APP_TEST_DEFAULT_SIGNAL */
-
-
-/* Mode for the extension */
-#define MODE_SERV	0x1
-#define	MODE_CLI	0x2
-
-/* The module configuration */
-struct atst_conf {
-	uint32_t	vendor_id;	/* default 999999 */
-	uint32_t	appli_id;	/* default 123456 */
-	uint32_t	cmd_id;		/* default 234567 */
-	uint32_t	avp_id;		/* default 345678 */
-	int		mode;		/* default MODE_SERV | MODE_CLI */
-	char 	*	dest_realm;	/* default local realm */
-	char 	*	dest_host;	/* default NULL */
-	int 		signal;		/* default APP_TEST_DEFAULT_SIGNAL */
-};
-extern struct atst_conf * atst_conf;
-
-/* Parse the configuration file */
-int atst_conf_handle(char * conffile);
-
-/* Start or stop the signal handler */
-int atst_sig_init(void (*cb)(void));
-void atst_sig_fini(void);
-
-/* Handle incoming messages (server) */
-int atst_serv_init(void);
-void atst_serv_fini(void);
-
-/* Create outgoing message (client) */
-int atst_cli_init(void);
-void atst_cli_fini(void);
-
-/* Initialize dictionary definitions */
-int atst_dict_init(void);
-
-
-/* Some global variables for dictionary */
-extern struct dict_object * atst_vendor;
-extern struct dict_object * atst_appli;
-extern struct dict_object * atst_cmd_r;
-extern struct dict_object * atst_cmd_a;
-extern struct dict_object * atst_avp;
-
-extern struct dict_object * atst_sess_id;
-extern struct dict_object * atst_origin_host;
-extern struct dict_object * atst_origin_realm;
-extern struct dict_object * atst_dest_host;
-extern struct dict_object * atst_dest_realm;
-extern struct dict_object * atst_res_code;
Index: tensions/app_test/atst_cli.c
===================================================================
--- extensions/app_test/atst_cli.c	(revision 99)
+++ 	(revision )
@@ -1,243 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* Create and send a message, and receive it */
-
-/* Note that we use both sessions and the argument to answer callback to pass the same value.
- * This is just for the purpose of checking everything went OK.
- */
-
-#include "app_test.h"
-
-#include <stdio.h>
-
-static struct session_handler * atst_cli_reg = NULL;
-
-struct atst_mess_info {
-	int32_t		randval;	/* a random value to store in Test-AVP */
-	struct timespec ts;		/* Time of sending the message */
-} ;
-
-/* Cb called when an answer is received */
-static void atst_cb_ans(void * data, struct msg ** msg)
-{
-	struct atst_mess_info * mi = NULL;
-	struct timespec ts;
-	struct session * sess;
-	struct avp * avp;
-	struct avp_hdr * hdr;
-	
-	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &ts), return );
-
-	/* Search the session, retrieve its data */
-	{
-		int new;
-		CHECK_FCT_DO( fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &sess, &new), return );
-		ASSERT( new == 0 );
-		
-		CHECK_FCT_DO( fd_sess_state_retrieve( atst_cli_reg, sess, &mi ), return );
-		TRACE_DEBUG( INFO, "%p %p", mi, data);
-		ASSERT( (void *)mi == data );
-	}
-	
-	/* Now log content of the answer */
-	fprintf(stderr, "RECV ");
-	
-	/* Value of Test-AVP */
-	CHECK_FCT_DO( fd_msg_search_avp ( *msg, atst_avp, &avp), return );
-	if (avp) {
-		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
-		fprintf(stderr, "%x (%s) ", hdr->avp_value->i32, (hdr->avp_value->i32 == mi->randval) ? "Ok" : "PROBLEM");
-	} else {
-		fprintf(stderr, "no_Test-AVP ");
-	}
-	
-	/* Value of Result Code */
-	CHECK_FCT_DO( fd_msg_search_avp ( *msg, atst_res_code, &avp), return );
-	if (avp) {
-		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
-		fprintf(stderr, "Status: %d ", hdr->avp_value->i32);
-	} else {
-		fprintf(stderr, "no_Result-Code ");
-	}
-	
-	/* Value of Origin-Host */
-	CHECK_FCT_DO( fd_msg_search_avp ( *msg, atst_origin_host, &avp), return );
-	if (avp) {
-		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
-		fprintf(stderr, "From '%.*s' ", hdr->avp_value->os.len, hdr->avp_value->os.data);
-	} else {
-		fprintf(stderr, "no_Origin-Host ");
-	}
-	
-	/* Value of Origin-Realm */
-	CHECK_FCT_DO( fd_msg_search_avp ( *msg, atst_origin_realm, &avp), return );
-	if (avp) {
-		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
-		fprintf(stderr, "('%.*s') ", hdr->avp_value->os.len, hdr->avp_value->os.data);
-	} else {
-		fprintf(stderr, "no_Origin-Realm ");
-	}
-	
-	/* Now compute how long it took */
-	if (ts.tv_nsec > mi->ts.tv_nsec) {
-		fprintf(stderr, "in %d.%06ld sec", 
-				(int)(ts.tv_sec - mi->ts.tv_sec),
-				(long)(ts.tv_nsec - mi->ts.tv_nsec) / 1000);
-	} else {
-		fprintf(stderr, "in %d.%06ld sec", 
-				(int)(ts.tv_sec + 1 - mi->ts.tv_sec),
-				(long)(1000000000 + ts.tv_nsec - mi->ts.tv_nsec) / 1000);
-	}
-	
-	fprintf(stderr, "\n");
-	fflush(stderr);
-	
-	/* Free the message */
-	CHECK_FCT_DO(fd_msg_free(*msg), return);
-	*msg = NULL;
-	
-	free(mi);
-	
-	return;
-}
-
-/* Create a test message */
-static void atst_cli_test_message(void)
-{
-	struct msg * req = NULL;
-	struct avp * avp;
-	union avp_value val;
-	struct atst_mess_info * mi = NULL, *svg;
-	struct session *sess = NULL;
-	
-	TRACE_DEBUG(FULL, "Creating a new message for sending.");
-	
-	/* Create the request from template */
-	CHECK_FCT_DO( fd_msg_new( atst_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out );
-	
-	/* Create a new session */
-	CHECK_FCT_DO( fd_sess_new( &sess, fd_g_config->cnf_diamid, "app_test", 8 ), goto out );
-	
-	/* Create the random value to store with the session */
-	mi = malloc(sizeof(struct atst_mess_info));
-	if (mi == NULL) {
-		fd_log_debug("malloc failed: %s", strerror(errno));
-		goto out;
-	}
-	
-	mi->randval = (int32_t)random();
-	
-	/* Now set all AVPs values */
-	
-	/* Session-Id */
-	{
-		char * sid;
-		CHECK_FCT_DO( fd_sess_getsid ( sess, &sid ), goto out );
-		CHECK_FCT_DO( fd_msg_avp_new ( atst_sess_id, 0, &avp ), goto out );
-		val.os.data = sid;
-		val.os.len  = strlen(sid);
-		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out );
-		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_FIRST_CHILD, avp ), goto out );
-		
-	}
-	
-	/* Set the Destination-Realm AVP */
-	{
-		CHECK_FCT_DO( fd_msg_avp_new ( atst_dest_realm, 0, &avp ), goto out  );
-		val.os.data = (unsigned char *)(atst_conf->dest_realm);
-		val.os.len  = strlen(atst_conf->dest_realm);
-		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
-		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
-	}
-	
-	/* Set the Destination-Host AVP if needed*/
-	if (atst_conf->dest_host) {
-		CHECK_FCT_DO( fd_msg_avp_new ( atst_dest_host, 0, &avp ), goto out  );
-		val.os.data = (unsigned char *)(atst_conf->dest_host);
-		val.os.len  = strlen(atst_conf->dest_host);
-		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
-		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
-	}
-	
-	/* Set Origin-Host & Origin-Realm */
-	CHECK_FCT_DO( fd_msg_add_origin ( req, 0 ), goto out  );
-	
-	
-	/* Set the Test-AVP AVP */
-	{
-		CHECK_FCT_DO( fd_msg_avp_new ( atst_avp, 0, &avp ), goto out  );
-		val.i32 = mi->randval;
-		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
-		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
-	}
-	
-	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out );
-	
-	/* Keep a pointer to the session data for debug purpose, in real life we would not need it */
-	svg = mi;
-	
-	/* Store this value in the session */
-	CHECK_FCT_DO( fd_sess_state_store ( atst_cli_reg, sess, &mi ), goto out ); 
-	
-	/* Log sending the message */
-	fprintf(stderr, "SEND %x to '%s' (%s)\n", svg->randval, atst_conf->dest_realm, atst_conf->dest_host?:"-" );
-	fflush(stderr);
-	
-	/* Send the request */
-	CHECK_FCT_DO( fd_msg_send( &req, atst_cb_ans, svg ), goto out );
-
-out:
-	TRACE_DEBUG(FULL, "Client function terminated");	
-	return;
-}
-
-int atst_cli_init(void)
-{
-	CHECK_FCT( fd_sess_handler_create(&atst_cli_reg, free) );
-	
-	CHECK_FCT( atst_sig_init(atst_cli_test_message) );
-	
-	return 0;
-}
-
-void atst_cli_fini(void)
-{
-	(void) fd_sess_handler_destroy(&atst_cli_reg);
-	
-	atst_sig_fini();
-	
-	return;
-};
Index: tensions/app_test/atst_conf.l
===================================================================
--- extensions/app_test/atst_conf.l	(revision 93)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* Lex extension's configuration parser.
- *
- * The configuration file contains a default priority, and a list of peers with optional overwite priority.
- * -- see the app_test.conf.sample file for more detail.
- */
-
-%{
-#include "app_test.h"
-/* Include yacc tokens definitions */
-#include "atst_conf.tab.h"
-
-/* Update the column information */
-#define YY_USER_ACTION { 						\
-	yylloc->first_column = yylloc->last_column + 1; 		\
-	yylloc->last_column = yylloc->first_column + yyleng - 1;	\
-}
-
-/* Avoid warning with newer flex */
-#define YY_NO_INPUT
-
-%}
-
-%option bison-bridge bison-locations
-%option noyywrap
-%option nounput
-
-%%
-
-	/* Update the line count */
-\n			{
-				yylloc->first_line++; 
-				yylloc->last_line++; 
-				yylloc->last_column=0; 
-			}
-	 
-	/* Eat all spaces but not new lines */
-([[:space:]]{-}[\n])+	;
-	/* Eat all comments */
-#.*$			;
-
-	/* Recognize any integer */
-[-]?[[:digit:]]+		{
-				/* Convert this to an integer value */
-				int ret=0;
-				ret = sscanf(yytext, "%i", &yylval->integer);
-				if (ret != 1) {
-					/* No matching: an error occurred */
-					fd_log_debug("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
-					return LEX_ERROR; /* trig an error in yacc parser */
-					/* Maybe we could REJECT instead of failing here? */
-				}
-				return INTEGER;
-			}
-
-	/* Recognize quoted strings */
-\"[[:alnum:].-]+\"	{
-				/* Match a string. expected only ASCII characters, '-' and '.'. The validation is done in yacc */
-				yylval->string = strdup(yytext+1);
-				if (!yylval->string) {
-					fd_log_debug("Unable to copy the string '%s': %s\n", yytext, strerror(errno));
-					TRACE_DEBUG(INFO, "strdup failed");
-					return LEX_ERROR; /* trig an error in yacc parser */
-				}
-				yylval->string[strlen(yytext) - 2] = '\0';
-				return QSTRING;
-			}
-			
-	/* Recognize the tokens */	
-(?i:"vendor-id")	{
-				return VENDOR_ID;
-			}
-
-(?i:"appli-id")		{
-				return APPLI_ID;
-			}
-
-(?i:"cmd-id")		{
-				return CMD_ID;
-			}
-
-(?i:"avp-id")		{
-				return AVP_ID;
-			}
-
-(?i:"mode")		{
-				return MODE;
-			}
-
-(?i:"server")		{
-				yylval->integer = MODE_SERV;
-				return INTEGER;
-			}
-
-(?i:"client")		{
-				yylval->integer = MODE_CLI;
-				return INTEGER;
-			}
-
-(?i:"both")		{
-				yylval->integer = MODE_SERV | MODE_CLI;
-				return INTEGER;
-			}
-
-(?i:"dest-realm")	{
-				return DEST_REALM;
-			}
-
-(?i:"dest-host")	{
-				return DEST_HOST;
-			}
-
-(?i:"Signal")		{
-				return SIGNAL;
-			}
-
-			
-	/* Valid single characters for yyparse */
-[=;]			{ return yytext[0]; }
-
-	/* Unrecognized sequence, if it did not match any previous pattern */
-[^[:space:]"*=>;\n]+	{ 
-				fd_log_debug("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
-			 	return LEX_ERROR; 
-			}
-
-%%
Index: tensions/app_test/atst_conf.y
===================================================================
--- extensions/app_test/atst_conf.y	(revision 93)
+++ 	(revision )
@@ -1,200 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* Yacc extension's configuration parser.
- * See doc/app_test.conf.sample for configuration file format
- */
-
-/* For development only : */
-%debug 
-%error-verbose
-
-/* The parser receives the configuration file filename as parameter */
-%parse-param {char * conffile}
-
-/* Keep track of location */
-%locations 
-%pure-parser
-
-%{
-#include "app_test.h"
-#include "atst_conf.tab.h"	/* bison is not smart enough to define the YYLTYPE before including this code, so... */
-
-#include <string.h>
-#include <errno.h>
-
-/* Forward declaration */
-int yyparse(char * conffile);
-
-/* Parse the configuration file */
-int atst_conf_handle(char * conffile)
-{
-	extern FILE * atst_confin;
-	int ret;
-	
-	TRACE_ENTRY("%p", conffile);
-	
-	TRACE_DEBUG (FULL, "Parsing configuration file: %s...", conffile);
-	
-	atst_confin = fopen(conffile, "r");
-	if (atst_confin == NULL) {
-		ret = errno;
-		fd_log_debug("Unable to open extension configuration file %s for reading: %s\n", conffile, strerror(ret));
-		TRACE_DEBUG (INFO, "Error occurred, message logged -- configuration file.");
-		return ret;
-	}
-
-	ret = yyparse(conffile);
-
-	fclose(atst_confin);
-
-	if (ret != 0) {
-		TRACE_DEBUG (INFO, "Unable to parse the configuration file.");
-		return EINVAL;
-	}
-	
-	return 0;
-}
-
-/* The Lex parser prototype */
-int atst_conflex(YYSTYPE *lvalp, YYLTYPE *llocp);
-
-/* Function to report the errors */
-void yyerror (YYLTYPE *ploc, char * conffile, char const *s)
-{
-	TRACE_DEBUG(INFO, "Error in configuration parsing");
-	
-	if (ploc->first_line != ploc->last_line)
-		fd_log_debug("%s:%d.%d-%d.%d : %s\n", conffile, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s);
-	else if (ploc->first_column != ploc->last_column)
-		fd_log_debug("%s:%d.%d-%d : %s\n", conffile, ploc->first_line, ploc->first_column, ploc->last_column, s);
-	else
-		fd_log_debug("%s:%d.%d : %s\n", conffile, ploc->first_line, ploc->first_column, s);
-}
-
-%}
-
-/* Values returned by lex for token */
-%union {
-	char 		*string;	/* The string is allocated by strdup in lex.*/
-	int		 integer;	/* Store integer values */
-}
-
-/* In case of error in the lexical analysis */
-%token 		LEX_ERROR
-
-/* Key words */
-%token 		VENDOR_ID
-%token 		APPLI_ID
-%token 		CMD_ID
-%token 		AVP_ID
-%token 		MODE
-%token 		DEST_REALM
-%token 		DEST_HOST
-%token 		SIGNAL
-
-/* Tokens and types for routing table definition */
-/* A (de)quoted string (malloc'd in lex parser; it must be freed after use) */
-%token <string>	QSTRING
-
-/* An integer value */
-%token <integer> INTEGER
-
-
-
-/* -------------------------------------- */
-%%
-
-	/* The grammar definition */
-conffile:		/* empty grammar is OK */
-			| conffile vendor
-			| conffile appli
-			| conffile cmd
-			| conffile avp
-			| conffile mode
-			| conffile dstrealm
-			| conffile dsthost
-			| conffile signal
-			;
-
-vendor:			VENDOR_ID '=' INTEGER ';'
-			{
-				atst_conf->vendor_id = $3;
-			}
-			;
-
-appli:			APPLI_ID '=' INTEGER ';'
-			{
-				atst_conf->appli_id = $3;
-			}
-			;
-
-cmd:			CMD_ID '=' INTEGER ';'
-			{
-				atst_conf->cmd_id = $3;
-			}
-			;
-
-avp:			AVP_ID '=' INTEGER ';'
-			{
-				atst_conf->avp_id = $3;
-			}
-			;
-
-mode:			MODE '=' INTEGER ';'
-			{
-				atst_conf->mode = $3;
-			}
-			;
-
-dstrealm:		DEST_REALM '=' QSTRING ';'
-			{
-				free(atst_conf->dest_realm);
-				atst_conf->dest_realm = $3;
-			}
-			;
-
-dsthost:		DEST_HOST '=' QSTRING ';'
-			{
-				free(atst_conf->dest_host);
-				atst_conf->dest_host = $3;
-			}
-			;
-
-signal:			SIGNAL '=' INTEGER ';'
-			{
-				atst_conf->signal = $3;
-			}
-			;
Index: tensions/app_test/atst_dict.c
===================================================================
--- extensions/app_test/atst_dict.c	(revision 93)
+++ 	(revision )
@@ -1,151 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* Install the dictionary objects */
-
-#include "app_test.h"
-
-struct dict_object * atst_vendor = NULL;
-struct dict_object * atst_appli = NULL;
-struct dict_object * atst_cmd_r = NULL;
-struct dict_object * atst_cmd_a = NULL;
-struct dict_object * atst_avp = NULL;
-
-struct dict_object * atst_sess_id = NULL;
-struct dict_object * atst_origin_host = NULL;
-struct dict_object * atst_origin_realm = NULL;
-struct dict_object * atst_dest_host = NULL;
-struct dict_object * atst_dest_realm = NULL;
-struct dict_object * atst_res_code = NULL;
-
-int atst_dict_init(void)
-{
-	TRACE_DEBUG(FULL, "Initializing the dictionary for test");
-	
-	/* Create the Test Vendor */
-	{
-		struct dict_vendor_data data;
-		data.vendor_id = atst_conf->vendor_id;
-		data.vendor_name = "app_test vendor";
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_VENDOR, &data, NULL, &atst_vendor));
-	}
-	
-	/* Create the Test Application */
-	{
-		struct dict_application_data data;
-		data.application_id = atst_conf->appli_id;
-		data.application_name = "app_test application";
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_APPLICATION, &data, atst_vendor, &atst_appli));
-	}
-	
-	/* Create the Test-Request & Test-Answer commands */
-	{
-		struct dict_cmd_data data;
-		data.cmd_code = atst_conf->cmd_id;
-		data.cmd_name = "Test-Request";
-		data.cmd_flag_mask = CMD_FLAG_PROXIABLE | CMD_FLAG_REQUEST;
-		data.cmd_flag_val  = CMD_FLAG_PROXIABLE | CMD_FLAG_REQUEST;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, atst_appli, &atst_cmd_r));
-		data.cmd_name = "Test-Answer";
-		data.cmd_flag_val  = CMD_FLAG_PROXIABLE;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, atst_appli, &atst_cmd_a));
-	}
-	
-	/* Create the Test AVP */
-	{
-		struct dict_avp_data data;
-		data.avp_code = atst_conf->avp_id;
-		data.avp_vendor = atst_conf->vendor_id;
-		data.avp_name = "Test-AVP";
-		data.avp_flag_mask = AVP_FLAG_VENDOR;
-		data.avp_flag_val = AVP_FLAG_VENDOR;
-		data.avp_basetype = AVP_TYPE_INTEGER32;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &atst_avp));
-	}
-	
-	/* Now resolve some other useful AVPs */
-	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &atst_sess_id, ENOENT) );
-	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Host", &atst_origin_host, ENOENT) );
-	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Realm", &atst_origin_realm, ENOENT) );
-	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Host", &atst_dest_host, ENOENT) );
-	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &atst_dest_realm, ENOENT) );
-	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Result-Code", &atst_res_code, ENOENT) );
-	
-	/* Create the rules for Test-Request and Test-Answer */
-	{
-		struct dict_rule_data data;
-		data.rule_min = 1;
-		data.rule_max = 1;
-		
-		/* Session-Id is in first position */
-		data.rule_avp = atst_sess_id;
-		data.rule_position = RULE_FIXED_HEAD;
-		data.rule_order = 1;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
-		
-		data.rule_position = RULE_REQUIRED;
-		/* Test-AVP is mandatory */
-		data.rule_avp = atst_avp;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
-		
-		/* idem for Origin Host and Realm */
-		data.rule_avp = atst_origin_host;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
-		
-		data.rule_avp = atst_origin_realm;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
-		
-		/* And Result-Code is mandatory for answers only */
-		data.rule_avp = atst_res_code;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_a, NULL));
-		
-		/* And Destination-Realm for requests only */
-		data.rule_avp = atst_dest_realm;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
-		
-		/* And Destination-Host optional for requests only */
-		data.rule_position = RULE_OPTIONAL;
-		data.rule_min = 0;
-		data.rule_avp = atst_dest_host;
-		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, atst_cmd_r, NULL));
-		
-	}
-	
-	return 0;
-}
Index: tensions/app_test/atst_serv.c
===================================================================
--- extensions/app_test/atst_serv.c	(revision 112)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* Install the dispatch callbacks */
-
-#include "app_test.h"
-
-static struct disp_hdl * atst_hdl_fb = NULL; /* handler for fallback cb */
-static struct disp_hdl * atst_hdl_tr = NULL; /* handler for Test-Request req cb */
-
-/* Default callback for the application. */
-static int atst_fb_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
-{
-	/* This CB should never be called */
-	TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act);
-	
-	fd_log_debug("Unexpected message received!\n");
-	
-	return ENOTSUP;
-}
-
-/* Callback for incoming Test-Request messages */
-static int atst_tr_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
-{
-	struct msg *ans, *qry;
-	union avp_value val;
-	
-	TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act);
-	
-	if (msg == NULL)
-		return EINVAL;
-	
-	/* Create answer header */
-	qry = *msg;
-	CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, msg, 0 ) );
-	ans = *msg;
-	
-	/* Set the Test-AVP AVP */
-	{
-		struct avp * src = NULL;
-		struct avp_hdr * hdr = NULL;
-		
-		CHECK_FCT( fd_msg_search_avp ( qry, atst_avp, &src) );
-		CHECK_FCT( fd_msg_avp_hdr( src, &hdr )  );
-		
-		CHECK_FCT( fd_msg_avp_new ( atst_avp, 0, &avp ) );
-		CHECK_FCT( fd_msg_avp_setvalue( avp, hdr->avp_value ) );
-		CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, avp ) );
-	}
-	
-	/* Set the Origin-Host, Origin-Realm, Result-Code AVPs */
-	CHECK_FCT( fd_msg_rescode_set( ans, "DIAMETER_SUCCESS", NULL, NULL, 1 ) );
-	
-	/* Send the answer */
-	CHECK_FCT( fd_msg_send( msg, NULL, NULL ) );
-	
-	return 0;
-}
-
-int atst_serv_init(void)
-{
-	struct disp_when data;
-	
-	TRACE_DEBUG(FULL, "Initializing dispatch callbacks for test");
-	
-	memset(&data, 0, sizeof(data));
-	data.app = atst_appli;
-	data.command = atst_cmd_r;
-	
-	/* fallback CB if command != Test-Request received */
-	CHECK_FCT( fd_disp_register( atst_fb_cb, DISP_HOW_APPID, &data, &atst_hdl_fb ) );
-	
-	/* Now specific handler for Test-Request */
-	CHECK_FCT( fd_disp_register( atst_tr_cb, DISP_HOW_CC, &data, &atst_hdl_tr ) );
-	
-	return 0;
-}
-
-void atst_serv_fini(void)
-{
-	if (atst_hdl_fb) {
-		(void) fd_disp_unregister(&atst_hdl_fb);
-	}
-	if (atst_hdl_tr) {
-		(void) fd_disp_unregister(&atst_hdl_tr);
-	}
-	
-	return;
-}
Index: tensions/app_test/atst_sig.c
===================================================================
--- extensions/app_test/atst_sig.c	(revision 98)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* Install the signal handler */
-
-#include "app_test.h"
-
-static pthread_t th = (pthread_t) NULL;
-
-static void * atst_sig_th(void * arg)
-{
-	int sig;
-	int ret;
-	sigset_t ss;
-	void (*cb)(void) = arg;
-	
-	fd_log_threadname ( "app_test signal handler" );
-	
-	sigemptyset(&ss);
-	sigaddset(&ss, atst_conf->signal);
-	
-	while (1) {
-		ret = sigwait(&ss, &sig);
-		if (ret != 0) {
-			fd_log_debug("sigwait failed in the app_test extension: %s", strerror(errno));
-			break;
-		}
-		
-		TRACE_DEBUG(FULL, "Signal caught, calling function...");
-		
-		/* Call the cb function */
-		(*cb)();
-		
-	}
-	
-	return NULL;
-}
-
-int atst_sig_init(void (*cb)(void))
-{
-	return pthread_create( &th, NULL, atst_sig_th, (void *)cb );
-}
-
-void atst_sig_fini(void)
-{
-	void * th_ret = NULL;
-	
-	if (th != (pthread_t) NULL) {
-		(void) pthread_cancel(th);
-		(void) pthread_join(th, &th_ret);
-	}
-	
-	return;
-}
Index: extensions/dbg_monitor/CMakeLists.txt
===================================================================
--- extensions/dbg_monitor/CMakeLists.txt	(revision 10)
+++ extensions/dbg_monitor/CMakeLists.txt	(revision 120)
@@ -1,3 +1,3 @@
 # Monitoring extension
 PROJECT("Monitor extension" C)
-FD_ADD_EXTENSION(dbg_monitor monitor.c)
+FD_ADD_EXTENSION(dbg_monitor dbg_monitor.c)
Index: extensions/dbg_monitor/dbg_monitor.c
===================================================================
--- extensions/dbg_monitor/dbg_monitor.c	(revision 120)
+++ extensions/dbg_monitor/dbg_monitor.c	(revision 120)
@@ -0,0 +1,106 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* Monitoring extension:
+ - periodically display queues and peers information
+ - upon SIGUSR2, display additional debug information
+ */
+
+#include <freeDiameter/extension.h>
+#include <signal.h>
+
+#ifndef MONITOR_SIGNAL
+#define MONITOR_SIGNAL	SIGUSR2
+#endif /* MONITOR_SIGNAL */
+
+static int 	 monitor_main(char * conffile);
+
+EXTENSION_ENTRY("dbg_monitor", monitor_main);
+
+/* Function called on receipt of SIGUSR1 */
+static void got_sig(int signal)
+{
+	fd_log_debug("[dbg_monitor] Dumping extra information\n");
+	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_DICT, 0, NULL), /* continue */);
+	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_CONFIG, 0, NULL), /* continue */);
+	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_EXT, 0, NULL), /* continue */);
+}
+/* Thread to display periodical debug information */
+static pthread_t thr;
+static void * mn_thr(void * arg)
+{
+	sigset_t sig;
+	struct sigaction act;
+	fd_log_threadname("Monitor thread");
+	
+	/* Catch signal SIGUSR1 */
+	memset(&act, 0, sizeof(act));
+	act.sa_handler = got_sig;
+	CHECK_SYS_DO( sigaction(MONITOR_SIGNAL, &act, NULL), /* conitnue */ );
+	sigemptyset(&sig);
+	sigaddset(&sig, MONITOR_SIGNAL);
+	CHECK_POSIX_DO(  pthread_sigmask(SIG_UNBLOCK, &sig, NULL), /* conitnue */  );
+	
+	/* Loop */
+	while (1) {
+		#ifdef DEBUG
+		sleep(30);
+		#else /* DEBUG */
+		sleep(3600); /* 1 hour */
+		#endif /* DEBUG */
+		fd_log_debug("[dbg_monitor] Dumping current information\n");
+		CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_QUEUES, 0, NULL), /* continue */);
+		CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_SERV, 0, NULL), /* continue */);
+		CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_PEERS, 0, NULL), /* continue */);
+		pthread_testcancel();
+	}
+	
+	return NULL;
+}
+
+static int monitor_main(char * conffile)
+{
+	TRACE_ENTRY("%p", conffile);
+	CHECK_POSIX( pthread_create( &thr, NULL, mn_thr, NULL ) );
+	return 0;
+}
+
+void fd_ext_fini(void)
+{
+	TRACE_ENTRY();
+	CHECK_FCT_DO( fd_thr_term(&thr), /* continue */ );
+	return ;
+}
+
Index: tensions/dbg_monitor/monitor.c
===================================================================
--- extensions/dbg_monitor/monitor.c	(revision 97)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* Monitoring extension:
- - periodically display queues and peers information
- - upon SIGUSR2, display additional debug information
- */
-
-#include <freeDiameter/extension.h>
-#include <signal.h>
-
-#ifndef MONITOR_SIGNAL
-#define MONITOR_SIGNAL	SIGUSR2
-#endif /* MONITOR_SIGNAL */
-
-static int 	 monitor_main(char * conffile);
-
-EXTENSION_ENTRY("monitor", monitor_main);
-
-/* Function called on receipt of SIGUSR1 */
-static void got_sig(int signal)
-{
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_DICT, 0, NULL), /* continue */);
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_CONFIG, 0, NULL), /* continue */);
-	CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_EXT, 0, NULL), /* continue */);
-}
-/* Thread to display periodical debug information */
-static pthread_t thr;
-static void * mn_thr(void * arg)
-{
-	sigset_t sig;
-	struct sigaction act;
-	fd_log_threadname("Monitor thread");
-	
-	/* Catch signal SIGUSR1 */
-	memset(&act, 0, sizeof(act));
-	act.sa_handler = got_sig;
-	CHECK_SYS_DO( sigaction(MONITOR_SIGNAL, &act, NULL), /* conitnue */ );
-	sigemptyset(&sig);
-	sigaddset(&sig, MONITOR_SIGNAL);
-	CHECK_POSIX_DO(  pthread_sigmask(SIG_UNBLOCK, &sig, NULL), /* conitnue */  );
-	
-	/* Loop */
-	while (1) {
-		#ifdef DEBUG
-		sleep(30);
-		#else /* DEBUG */
-		sleep(3600); /* 1 hour */
-		#endif /* DEBUG */
-		TRACE_DEBUG(NONE, "Monitor information");
-		CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_QUEUES, 0, NULL), /* continue */);
-		CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_SERV, 0, NULL), /* continue */);
-		CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_PEERS, 0, NULL), /* continue */);
-		pthread_testcancel();
-	}
-	
-	return NULL;
-}
-
-static int monitor_main(char * conffile)
-{
-	TRACE_ENTRY("%p", conffile);
-	CHECK_POSIX( pthread_create( &thr, NULL, mn_thr, NULL ) );
-	return 0;
-}
-
-void fd_ext_fini(void)
-{
-	TRACE_ENTRY();
-	CHECK_FCT_DO( fd_thr_term(&thr), /* continue */ );
-	return ;
-}
-
Index: extensions/dbg_rt/CMakeLists.txt
===================================================================
--- extensions/dbg_rt/CMakeLists.txt	(revision 120)
+++ extensions/dbg_rt/CMakeLists.txt	(revision 120)
@@ -0,0 +1,5 @@
+# The rt_debug extension
+PROJECT("Routing module debug extension" C)
+
+# Compile as a module
+FD_ADD_EXTENSION(dbg_rt dbg_rt.c)
Index: extensions/dbg_rt/dbg_rt.c
===================================================================
--- extensions/dbg_rt/dbg_rt.c	(revision 120)
+++ extensions/dbg_rt/dbg_rt.c	(revision 120)
@@ -0,0 +1,100 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* 
+ * Debug-only extension for routing module; 
+ * displays state information at the end of routing information process.
+ */
+#include <freeDiameter/extension.h>
+
+static struct fd_rt_fwd_hdl * fwd_hdl = NULL;
+static struct fd_rt_out_hdl * out_hdl = NULL;
+
+/* Proxying debug callback */
+static int dbgrt_fwd_cb(void * cbdata, struct msg ** msg)
+{
+	TRACE_ENTRY("%p %p", cbdata, msg);
+	
+	fd_log_debug("[dbg_rt] FWD routing message: %p\n", msg ? *msg : NULL);
+	if (msg)
+		fd_msg_dump_walk(INFO, *msg);
+	
+	return 0;
+}
+
+/* Path selection debug callback */
+static int dbgrt_out_cb(void * cbdata, struct msg * msg, struct fd_list * candidates)
+{
+	struct fd_list * li;
+	
+	TRACE_ENTRY("%p %p %p", cbdata, msg, candidates);
+	
+	fd_log_debug("[dbg_rt] OUT routing message: %p\n", msg);
+	fd_msg_dump_walk(INFO, msg);
+	fd_log_debug("[dbg_rt] Current list of candidates (%p)\n", msg);
+	
+	for (li = candidates->next; li != candidates; li = li->next) {
+		struct rtd_candidate *c = (struct rtd_candidate *) li;
+		fd_log_debug("[dbg_rt]   - %d\t%s\n", c->score, c->diamid);
+	}
+	
+	return 0;
+}
+
+/* Register the callbacks to the daemon */
+static int dbgrt_main(char * conffile)
+{
+	TRACE_ENTRY("%p", conffile);
+	
+	CHECK_FCT( fd_rt_fwd_register ( dbgrt_fwd_cb, NULL, RT_FWD_ALL, &fwd_hdl ) );
+	CHECK_FCT( fd_rt_out_register ( dbgrt_out_cb, NULL, -1 /* so that it is called late */, &out_hdl ) );
+
+	return 0;
+}
+
+/* Cleanup the callbacks */
+void fd_ext_fini(void)
+{
+	TRACE_ENTRY();
+	
+	/* Unregister the modules */
+	CHECK_FCT_DO( fd_rt_fwd_unregister ( fwd_hdl, NULL ), /* continue */ );
+	CHECK_FCT_DO( fd_rt_out_unregister ( out_hdl, NULL ), /* continue */ );
+	
+	return ;
+}
+
+/* Define the entry point function */
+EXTENSION_ENTRY("dbg_rt", dbgrt_main);
Index: tensions/rt_any/CMakeLists.txt
===================================================================
--- extensions/rt_any/CMakeLists.txt	(revision 118)
+++ 	(revision )
@@ -1,5 +1,0 @@
-# The rt_debug extension
-PROJECT("Random routing extension (for tests)" C)
-
-# Compile as a module
-FD_ADD_EXTENSION(rt_any rt_any.c)
Index: tensions/rt_any/rt_any.c
===================================================================
--- extensions/rt_any/rt_any.c	(revision 118)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* 
- * Test-only extension for routing: gives a random positive score to any candidate peer.
- */
-#include <freeDiameter/extension.h>
-#include <stdlib.h>
-
-/* The callback */
-static int rtany_out_cb(void * cbdata, struct msg * msg, struct fd_list * candidates)
-{
-	struct fd_list * li;
-	
-	TRACE_ENTRY("%p %p %p", cbdata, msg, candidates);
-	
-	for (li = candidates->next; li != candidates; li = li->next) {
-		struct rtd_candidate *c = (struct rtd_candidate *) li;
-		c->score = (int)lrand48();
-	}
-	
-	return 0;
-}
-
-static struct fd_rt_out_hdl * out_hdl = NULL;
-
-/* Register the callbacks to the daemon */
-static int rtany_main(char * conffile)
-{
-	TRACE_ENTRY("%p", conffile);
-	CHECK_FCT( fd_rt_out_register ( rtany_out_cb, NULL, 0 /* we call it late so that it replaces previous scores */, &out_hdl ) );
-	return 0;
-}
-
-/* Cleanup the callbacks */
-void fd_ext_fini(void)
-{
-	TRACE_ENTRY();
-	CHECK_FCT_DO( fd_rt_out_unregister ( out_hdl, NULL ), /* continue */ );
-	return ;
-}
-
-/* Define the entry point function */
-EXTENSION_ENTRY("rt_any", rtany_main);
Index: tensions/rt_debug/CMakeLists.txt
===================================================================
--- extensions/rt_debug/CMakeLists.txt	(revision 117)
+++ 	(revision )
@@ -1,5 +1,0 @@
-# The rt_debug extension
-PROJECT("Routing module debug extension" C)
-
-# Compile as a module
-FD_ADD_EXTENSION(rt_debug rt_debug.c)
Index: tensions/rt_debug/rt_debug.c
===================================================================
--- extensions/rt_debug/rt_debug.c	(revision 117)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
-*													 *
-* Copyright (c) 2009, WIDE Project and NICT								 *
-* All rights reserved.											 *
-* 													 *
-* Redistribution and use of this software in source and binary forms, with or without modification, are  *
-* permitted provided that the following conditions are met:						 *
-* 													 *
-* * Redistributions of source code must retain the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer.										 *
-*    													 *
-* * Redistributions in binary form must reproduce the above 						 *
-*   copyright notice, this list of conditions and the 							 *
-*   following disclaimer in the documentation and/or other						 *
-*   materials provided with the distribution.								 *
-* 													 *
-* * Neither the name of the WIDE Project or NICT nor the 						 *
-*   names of its contributors may be used to endorse or 						 *
-*   promote products derived from this software without 						 *
-*   specific prior written permission of WIDE Project and 						 *
-*   NICT.												 *
-* 													 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
-* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
-* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
-* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
-*********************************************************************************************************/
-
-/* 
- * Debug-only extension for routing module; 
- * displays state information at the end of routing information process.
- */
-#include <freeDiameter/extension.h>
-
-static struct fd_rt_fwd_hdl * fwd_hdl = NULL;
-static struct fd_rt_out_hdl * out_hdl = NULL;
-
-/* Proxying debug callback */
-static int rtdebug_fwd_cb(void * cbdata, struct msg ** msg)
-{
-	TRACE_ENTRY("%p %p", cbdata, msg);
-	
-	fd_log_debug("[rt_debug] FWD routing message: %p\n", msg ? *msg : NULL);
-	if (msg)
-		fd_msg_dump_walk(INFO, *msg);
-	
-	return 0;
-}
-
-/* Path selection debug callback */
-static int rtdebug_out_cb(void * cbdata, struct msg * msg, struct fd_list * candidates)
-{
-	struct fd_list * li;
-	
-	TRACE_ENTRY("%p %p %p", cbdata, msg, candidates);
-	
-	fd_log_debug("[rt_debug] OUT routing message: %p\n", msg);
-	fd_msg_dump_walk(INFO, msg);
-	fd_log_debug("[rt_debug] Current list of candidates (%p)\n", msg);
-	
-	for (li = candidates->next; li != candidates; li = li->next) {
-		struct rtd_candidate *c = (struct rtd_candidate *) li;
-		fd_log_debug("[rt_debug]   - %d\t%s\n", c->score, c->diamid);
-	}
-	
-	return 0;
-}
-
-/* Register the callbacks to the daemon */
-static int rtdebug_main(char * conffile)
-{
-	TRACE_ENTRY("%p", conffile);
-	
-	CHECK_FCT( fd_rt_fwd_register ( rtdebug_fwd_cb, NULL, RT_FWD_ALL, &fwd_hdl ) );
-	CHECK_FCT( fd_rt_out_register ( rtdebug_out_cb, NULL, -1 /* so that it is called late */, &out_hdl ) );
-
-	return 0;
-}
-
-/* Cleanup the callbacks */
-void fd_ext_fini(void)
-{
-	TRACE_ENTRY();
-	
-	/* Unregister the modules */
-	CHECK_FCT_DO( fd_rt_fwd_unregister ( fwd_hdl, NULL ), /* continue */ );
-	CHECK_FCT_DO( fd_rt_out_unregister ( out_hdl, NULL ), /* continue */ );
-	
-	return ;
-}
-
-/* Define the entry point function */
-EXTENSION_ENTRY("rt_debug", rtdebug_main);
Index: extensions/test_app/CMakeLists.txt
===================================================================
--- extensions/test_app/CMakeLists.txt	(revision 120)
+++ extensions/test_app/CMakeLists.txt	(revision 120)
@@ -0,0 +1,23 @@
+# The dict_nasreq extension
+PROJECT("Test Diameter Application" C)
+
+# Parser files
+BISON_FILE(ta_conf.y)
+FLEX_FILE(ta_conf.l)
+SET_SOURCE_FILES_PROPERTIES(lex.ta_conf.c ta_conf.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}")
+
+# List of source files
+SET( APP_TEST_SRC
+	test_app.h
+	test_app.c
+	lex.ta_conf.c
+	ta_conf.tab.c
+	ta_conf.tab.h
+	ta_sig.c
+	ta_dict.c
+	ta_cli.c
+	ta_serv.c
+)
+
+# Compile as a module
+FD_ADD_EXTENSION(test_app ${APP_TEST_SRC})
Index: extensions/test_app/ta_cli.c
===================================================================
--- extensions/test_app/ta_cli.c	(revision 120)
+++ extensions/test_app/ta_cli.c	(revision 120)
@@ -0,0 +1,243 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* Create and send a message, and receive it */
+
+/* Note that we use both sessions and the argument to answer callback to pass the same value.
+ * This is just for the purpose of checking everything went OK.
+ */
+
+#include "test_app.h"
+
+#include <stdio.h>
+
+static struct session_handler * ta_cli_reg = NULL;
+
+struct ta_mess_info {
+	int32_t		randval;	/* a random value to store in Test-AVP */
+	struct timespec ts;		/* Time of sending the message */
+} ;
+
+/* Cb called when an answer is received */
+static void ta_cb_ans(void * data, struct msg ** msg)
+{
+	struct ta_mess_info * mi = NULL;
+	struct timespec ts;
+	struct session * sess;
+	struct avp * avp;
+	struct avp_hdr * hdr;
+	
+	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &ts), return );
+
+	/* Search the session, retrieve its data */
+	{
+		int new;
+		CHECK_FCT_DO( fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &sess, &new), return );
+		ASSERT( new == 0 );
+		
+		CHECK_FCT_DO( fd_sess_state_retrieve( ta_cli_reg, sess, &mi ), return );
+		TRACE_DEBUG( INFO, "%p %p", mi, data);
+		ASSERT( (void *)mi == data );
+	}
+	
+	/* Now log content of the answer */
+	fprintf(stderr, "RECV ");
+	
+	/* Value of Test-AVP */
+	CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_avp, &avp), return );
+	if (avp) {
+		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
+		fprintf(stderr, "%x (%s) ", hdr->avp_value->i32, (hdr->avp_value->i32 == mi->randval) ? "Ok" : "PROBLEM");
+	} else {
+		fprintf(stderr, "no_Test-AVP ");
+	}
+	
+	/* Value of Result Code */
+	CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_res_code, &avp), return );
+	if (avp) {
+		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
+		fprintf(stderr, "Status: %d ", hdr->avp_value->i32);
+	} else {
+		fprintf(stderr, "no_Result-Code ");
+	}
+	
+	/* Value of Origin-Host */
+	CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_origin_host, &avp), return );
+	if (avp) {
+		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
+		fprintf(stderr, "From '%.*s' ", hdr->avp_value->os.len, hdr->avp_value->os.data);
+	} else {
+		fprintf(stderr, "no_Origin-Host ");
+	}
+	
+	/* Value of Origin-Realm */
+	CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_origin_realm, &avp), return );
+	if (avp) {
+		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
+		fprintf(stderr, "('%.*s') ", hdr->avp_value->os.len, hdr->avp_value->os.data);
+	} else {
+		fprintf(stderr, "no_Origin-Realm ");
+	}
+	
+	/* Now compute how long it took */
+	if (ts.tv_nsec > mi->ts.tv_nsec) {
+		fprintf(stderr, "in %d.%06ld sec", 
+				(int)(ts.tv_sec - mi->ts.tv_sec),
+				(long)(ts.tv_nsec - mi->ts.tv_nsec) / 1000);
+	} else {
+		fprintf(stderr, "in %d.%06ld sec", 
+				(int)(ts.tv_sec + 1 - mi->ts.tv_sec),
+				(long)(1000000000 + ts.tv_nsec - mi->ts.tv_nsec) / 1000);
+	}
+	
+	fprintf(stderr, "\n");
+	fflush(stderr);
+	
+	/* Free the message */
+	CHECK_FCT_DO(fd_msg_free(*msg), return);
+	*msg = NULL;
+	
+	free(mi);
+	
+	return;
+}
+
+/* Create a test message */
+static void ta_cli_test_message(void)
+{
+	struct msg * req = NULL;
+	struct avp * avp;
+	union avp_value val;
+	struct ta_mess_info * mi = NULL, *svg;
+	struct session *sess = NULL;
+	
+	TRACE_DEBUG(FULL, "Creating a new message for sending.");
+	
+	/* Create the request from template */
+	CHECK_FCT_DO( fd_msg_new( ta_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out );
+	
+	/* Create a new session */
+	CHECK_FCT_DO( fd_sess_new( &sess, fd_g_config->cnf_diamid, "app_test", 8 ), goto out );
+	
+	/* Create the random value to store with the session */
+	mi = malloc(sizeof(struct ta_mess_info));
+	if (mi == NULL) {
+		fd_log_debug("malloc failed: %s", strerror(errno));
+		goto out;
+	}
+	
+	mi->randval = (int32_t)random();
+	
+	/* Now set all AVPs values */
+	
+	/* Session-Id */
+	{
+		char * sid;
+		CHECK_FCT_DO( fd_sess_getsid ( sess, &sid ), goto out );
+		CHECK_FCT_DO( fd_msg_avp_new ( ta_sess_id, 0, &avp ), goto out );
+		val.os.data = sid;
+		val.os.len  = strlen(sid);
+		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out );
+		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_FIRST_CHILD, avp ), goto out );
+		
+	}
+	
+	/* Set the Destination-Realm AVP */
+	{
+		CHECK_FCT_DO( fd_msg_avp_new ( ta_dest_realm, 0, &avp ), goto out  );
+		val.os.data = (unsigned char *)(ta_conf->dest_realm);
+		val.os.len  = strlen(ta_conf->dest_realm);
+		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
+		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
+	}
+	
+	/* Set the Destination-Host AVP if needed*/
+	if (ta_conf->dest_host) {
+		CHECK_FCT_DO( fd_msg_avp_new ( ta_dest_host, 0, &avp ), goto out  );
+		val.os.data = (unsigned char *)(ta_conf->dest_host);
+		val.os.len  = strlen(ta_conf->dest_host);
+		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
+		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
+	}
+	
+	/* Set Origin-Host & Origin-Realm */
+	CHECK_FCT_DO( fd_msg_add_origin ( req, 0 ), goto out  );
+	
+	
+	/* Set the Test-AVP AVP */
+	{
+		CHECK_FCT_DO( fd_msg_avp_new ( ta_avp, 0, &avp ), goto out  );
+		val.i32 = mi->randval;
+		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
+		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
+	}
+	
+	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out );
+	
+	/* Keep a pointer to the session data for debug purpose, in real life we would not need it */
+	svg = mi;
+	
+	/* Store this value in the session */
+	CHECK_FCT_DO( fd_sess_state_store ( ta_cli_reg, sess, &mi ), goto out ); 
+	
+	/* Log sending the message */
+	fprintf(stderr, "SEND %x to '%s' (%s)\n", svg->randval, ta_conf->dest_realm, ta_conf->dest_host?:"-" );
+	fflush(stderr);
+	
+	/* Send the request */
+	CHECK_FCT_DO( fd_msg_send( &req, ta_cb_ans, svg ), goto out );
+
+out:
+	TRACE_DEBUG(FULL, "Client function terminated");	
+	return;
+}
+
+int ta_cli_init(void)
+{
+	CHECK_FCT( fd_sess_handler_create(&ta_cli_reg, free) );
+	
+	CHECK_FCT( ta_sig_init(ta_cli_test_message) );
+	
+	return 0;
+}
+
+void ta_cli_fini(void)
+{
+	(void) fd_sess_handler_destroy(&ta_cli_reg);
+	
+	ta_sig_fini();
+	
+	return;
+};
Index: extensions/test_app/ta_conf.l
===================================================================
--- extensions/test_app/ta_conf.l	(revision 120)
+++ extensions/test_app/ta_conf.l	(revision 120)
@@ -0,0 +1,161 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* Lex extension's configuration parser.
+ *
+ * The configuration file contains a default priority, and a list of peers with optional overwite priority.
+ * -- see the app_test.conf.sample file for more detail.
+ */
+
+%{
+#include "test_app.h"
+/* Include yacc tokens definitions */
+#include "ta_conf.tab.h"
+
+/* Update the column information */
+#define YY_USER_ACTION { 						\
+	yylloc->first_column = yylloc->last_column + 1; 		\
+	yylloc->last_column = yylloc->first_column + yyleng - 1;	\
+}
+
+/* Avoid warning with newer flex */
+#define YY_NO_INPUT
+
+%}
+
+%option bison-bridge bison-locations
+%option noyywrap
+%option nounput
+
+%%
+
+	/* Update the line count */
+\n			{
+				yylloc->first_line++; 
+				yylloc->last_line++; 
+				yylloc->last_column=0; 
+			}
+	 
+	/* Eat all spaces but not new lines */
+([[:space:]]{-}[\n])+	;
+	/* Eat all comments */
+#.*$			;
+
+	/* Recognize any integer */
+[-]?[[:digit:]]+		{
+				/* Convert this to an integer value */
+				int ret=0;
+				ret = sscanf(yytext, "%i", &yylval->integer);
+				if (ret != 1) {
+					/* No matching: an error occurred */
+					fd_log_debug("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
+					return LEX_ERROR; /* trig an error in yacc parser */
+					/* Maybe we could REJECT instead of failing here? */
+				}
+				return INTEGER;
+			}
+
+	/* Recognize quoted strings */
+\"[[:alnum:].-]+\"	{
+				/* Match a string. expected only ASCII characters, '-' and '.'. The validation is done in yacc */
+				yylval->string = strdup(yytext+1);
+				if (!yylval->string) {
+					fd_log_debug("Unable to copy the string '%s': %s\n", yytext, strerror(errno));
+					TRACE_DEBUG(INFO, "strdup failed");
+					return LEX_ERROR; /* trig an error in yacc parser */
+				}
+				yylval->string[strlen(yytext) - 2] = '\0';
+				return QSTRING;
+			}
+			
+	/* Recognize the tokens */	
+(?i:"vendor-id")	{
+				return VENDOR_ID;
+			}
+
+(?i:"appli-id")		{
+				return APPLI_ID;
+			}
+
+(?i:"cmd-id")		{
+				return CMD_ID;
+			}
+
+(?i:"avp-id")		{
+				return AVP_ID;
+			}
+
+(?i:"mode")		{
+				return MODE;
+			}
+
+(?i:"server")		{
+				yylval->integer = MODE_SERV;
+				return INTEGER;
+			}
+
+(?i:"client")		{
+				yylval->integer = MODE_CLI;
+				return INTEGER;
+			}
+
+(?i:"both")		{
+				yylval->integer = MODE_SERV | MODE_CLI;
+				return INTEGER;
+			}
+
+(?i:"dest-realm")	{
+				return DEST_REALM;
+			}
+
+(?i:"dest-host")	{
+				return DEST_HOST;
+			}
+
+(?i:"Signal")		{
+				return SIGNAL;
+			}
+
+			
+	/* Valid single characters for yyparse */
+[=;]			{ return yytext[0]; }
+
+	/* Unrecognized sequence, if it did not match any previous pattern */
+[^[:space:]"*=>;\n]+	{ 
+				fd_log_debug("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
+			 	return LEX_ERROR; 
+			}
+
+%%
Index: extensions/test_app/ta_conf.y
===================================================================
--- extensions/test_app/ta_conf.y	(revision 120)
+++ extensions/test_app/ta_conf.y	(revision 120)
@@ -0,0 +1,200 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* Yacc extension's configuration parser.
+ * See doc/app_test.conf.sample for configuration file format
+ */
+
+/* For development only : */
+%debug 
+%error-verbose
+
+/* The parser receives the configuration file filename as parameter */
+%parse-param {char * conffile}
+
+/* Keep track of location */
+%locations 
+%pure-parser
+
+%{
+#include "test_app.h"
+#include "ta_conf.tab.h"	/* bison is not smart enough to define the YYLTYPE before including this code, so... */
+
+#include <string.h>
+#include <errno.h>
+
+/* Forward declaration */
+int yyparse(char * conffile);
+
+/* Parse the configuration file */
+int ta_conf_handle(char * conffile)
+{
+	extern FILE * ta_confin;
+	int ret;
+	
+	TRACE_ENTRY("%p", conffile);
+	
+	TRACE_DEBUG (FULL, "Parsing configuration file: %s...", conffile);
+	
+	ta_confin = fopen(conffile, "r");
+	if (ta_confin == NULL) {
+		ret = errno;
+		fd_log_debug("Unable to open extension configuration file %s for reading: %s\n", conffile, strerror(ret));
+		TRACE_DEBUG (INFO, "Error occurred, message logged -- configuration file.");
+		return ret;
+	}
+
+	ret = yyparse(conffile);
+
+	fclose(ta_confin);
+
+	if (ret != 0) {
+		TRACE_DEBUG (INFO, "Unable to parse the configuration file.");
+		return EINVAL;
+	}
+	
+	return 0;
+}
+
+/* The Lex parser prototype */
+int ta_conflex(YYSTYPE *lvalp, YYLTYPE *llocp);
+
+/* Function to report the errors */
+void yyerror (YYLTYPE *ploc, char * conffile, char const *s)
+{
+	TRACE_DEBUG(INFO, "Error in configuration parsing");
+	
+	if (ploc->first_line != ploc->last_line)
+		fd_log_debug("%s:%d.%d-%d.%d : %s\n", conffile, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s);
+	else if (ploc->first_column != ploc->last_column)
+		fd_log_debug("%s:%d.%d-%d : %s\n", conffile, ploc->first_line, ploc->first_column, ploc->last_column, s);
+	else
+		fd_log_debug("%s:%d.%d : %s\n", conffile, ploc->first_line, ploc->first_column, s);
+}
+
+%}
+
+/* Values returned by lex for token */
+%union {
+	char 		*string;	/* The string is allocated by strdup in lex.*/
+	int		 integer;	/* Store integer values */
+}
+
+/* In case of error in the lexical analysis */
+%token 		LEX_ERROR
+
+/* Key words */
+%token 		VENDOR_ID
+%token 		APPLI_ID
+%token 		CMD_ID
+%token 		AVP_ID
+%token 		MODE
+%token 		DEST_REALM
+%token 		DEST_HOST
+%token 		SIGNAL
+
+/* Tokens and types for routing table definition */
+/* A (de)quoted string (malloc'd in lex parser; it must be freed after use) */
+%token <string>	QSTRING
+
+/* An integer value */
+%token <integer> INTEGER
+
+
+
+/* -------------------------------------- */
+%%
+
+	/* The grammar definition */
+conffile:		/* empty grammar is OK */
+			| conffile vendor
+			| conffile appli
+			| conffile cmd
+			| conffile avp
+			| conffile mode
+			| conffile dstrealm
+			| conffile dsthost
+			| conffile signal
+			;
+
+vendor:			VENDOR_ID '=' INTEGER ';'
+			{
+				ta_conf->vendor_id = $3;
+			}
+			;
+
+appli:			APPLI_ID '=' INTEGER ';'
+			{
+				ta_conf->appli_id = $3;
+			}
+			;
+
+cmd:			CMD_ID '=' INTEGER ';'
+			{
+				ta_conf->cmd_id = $3;
+			}
+			;
+
+avp:			AVP_ID '=' INTEGER ';'
+			{
+				ta_conf->avp_id = $3;
+			}
+			;
+
+mode:			MODE '=' INTEGER ';'
+			{
+				ta_conf->mode = $3;
+			}
+			;
+
+dstrealm:		DEST_REALM '=' QSTRING ';'
+			{
+				free(ta_conf->dest_realm);
+				ta_conf->dest_realm = $3;
+			}
+			;
+
+dsthost:		DEST_HOST '=' QSTRING ';'
+			{
+				free(ta_conf->dest_host);
+				ta_conf->dest_host = $3;
+			}
+			;
+
+signal:			SIGNAL '=' INTEGER ';'
+			{
+				ta_conf->signal = $3;
+			}
+			;
Index: extensions/test_app/ta_dict.c
===================================================================
--- extensions/test_app/ta_dict.c	(revision 120)
+++ extensions/test_app/ta_dict.c	(revision 120)
@@ -0,0 +1,151 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* Install the dictionary objects */
+
+#include "test_app.h"
+
+struct dict_object * ta_vendor = NULL;
+struct dict_object * ta_appli = NULL;
+struct dict_object * ta_cmd_r = NULL;
+struct dict_object * ta_cmd_a = NULL;
+struct dict_object * ta_avp = NULL;
+
+struct dict_object * ta_sess_id = NULL;
+struct dict_object * ta_origin_host = NULL;
+struct dict_object * ta_origin_realm = NULL;
+struct dict_object * ta_dest_host = NULL;
+struct dict_object * ta_dest_realm = NULL;
+struct dict_object * ta_res_code = NULL;
+
+int ta_dict_init(void)
+{
+	TRACE_DEBUG(FULL, "Initializing the dictionary for test");
+	
+	/* Create the Test Vendor */
+	{
+		struct dict_vendor_data data;
+		data.vendor_id = ta_conf->vendor_id;
+		data.vendor_name = "app_test vendor";
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_VENDOR, &data, NULL, &ta_vendor));
+	}
+	
+	/* Create the Test Application */
+	{
+		struct dict_application_data data;
+		data.application_id = ta_conf->appli_id;
+		data.application_name = "app_test application";
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_APPLICATION, &data, ta_vendor, &ta_appli));
+	}
+	
+	/* Create the Test-Request & Test-Answer commands */
+	{
+		struct dict_cmd_data data;
+		data.cmd_code = ta_conf->cmd_id;
+		data.cmd_name = "Test-Request";
+		data.cmd_flag_mask = CMD_FLAG_PROXIABLE | CMD_FLAG_REQUEST;
+		data.cmd_flag_val  = CMD_FLAG_PROXIABLE | CMD_FLAG_REQUEST;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, ta_appli, &ta_cmd_r));
+		data.cmd_name = "Test-Answer";
+		data.cmd_flag_val  = CMD_FLAG_PROXIABLE;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, ta_appli, &ta_cmd_a));
+	}
+	
+	/* Create the Test AVP */
+	{
+		struct dict_avp_data data;
+		data.avp_code = ta_conf->avp_id;
+		data.avp_vendor = ta_conf->vendor_id;
+		data.avp_name = "Test-AVP";
+		data.avp_flag_mask = AVP_FLAG_VENDOR;
+		data.avp_flag_val = AVP_FLAG_VENDOR;
+		data.avp_basetype = AVP_TYPE_INTEGER32;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &ta_avp));
+	}
+	
+	/* Now resolve some other useful AVPs */
+	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &ta_sess_id, ENOENT) );
+	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Host", &ta_origin_host, ENOENT) );
+	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Realm", &ta_origin_realm, ENOENT) );
+	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Host", &ta_dest_host, ENOENT) );
+	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &ta_dest_realm, ENOENT) );
+	CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Result-Code", &ta_res_code, ENOENT) );
+	
+	/* Create the rules for Test-Request and Test-Answer */
+	{
+		struct dict_rule_data data;
+		data.rule_min = 1;
+		data.rule_max = 1;
+		
+		/* Session-Id is in first position */
+		data.rule_avp = ta_sess_id;
+		data.rule_position = RULE_FIXED_HEAD;
+		data.rule_order = 1;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
+		
+		data.rule_position = RULE_REQUIRED;
+		/* Test-AVP is mandatory */
+		data.rule_avp = ta_avp;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
+		
+		/* idem for Origin Host and Realm */
+		data.rule_avp = ta_origin_host;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
+		
+		data.rule_avp = ta_origin_realm;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
+		
+		/* And Result-Code is mandatory for answers only */
+		data.rule_avp = ta_res_code;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL));
+		
+		/* And Destination-Realm for requests only */
+		data.rule_avp = ta_dest_realm;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
+		
+		/* And Destination-Host optional for requests only */
+		data.rule_position = RULE_OPTIONAL;
+		data.rule_min = 0;
+		data.rule_avp = ta_dest_host;
+		CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL));
+		
+	}
+	
+	return 0;
+}
Index: extensions/test_app/ta_serv.c
===================================================================
--- extensions/test_app/ta_serv.c	(revision 120)
+++ extensions/test_app/ta_serv.c	(revision 120)
@@ -0,0 +1,121 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* Install the dispatch callbacks */
+
+#include "test_app.h"
+
+static struct disp_hdl * ta_hdl_fb = NULL; /* handler for fallback cb */
+static struct disp_hdl * ta_hdl_tr = NULL; /* handler for Test-Request req cb */
+
+/* Default callback for the application. */
+static int ta_fb_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
+{
+	/* This CB should never be called */
+	TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act);
+	
+	fd_log_debug("Unexpected message received!\n");
+	
+	return ENOTSUP;
+}
+
+/* Callback for incoming Test-Request messages */
+static int ta_tr_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
+{
+	struct msg *ans, *qry;
+	union avp_value val;
+	
+	TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act);
+	
+	if (msg == NULL)
+		return EINVAL;
+	
+	/* Create answer header */
+	qry = *msg;
+	CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, msg, 0 ) );
+	ans = *msg;
+	
+	/* Set the Test-AVP AVP */
+	{
+		struct avp * src = NULL;
+		struct avp_hdr * hdr = NULL;
+		
+		CHECK_FCT( fd_msg_search_avp ( qry, ta_avp, &src) );
+		CHECK_FCT( fd_msg_avp_hdr( src, &hdr )  );
+		
+		CHECK_FCT( fd_msg_avp_new ( ta_avp, 0, &avp ) );
+		CHECK_FCT( fd_msg_avp_setvalue( avp, hdr->avp_value ) );
+		CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, avp ) );
+	}
+	
+	/* Set the Origin-Host, Origin-Realm, Result-Code AVPs */
+	CHECK_FCT( fd_msg_rescode_set( ans, "DIAMETER_SUCCESS", NULL, NULL, 1 ) );
+	
+	/* Send the answer */
+	CHECK_FCT( fd_msg_send( msg, NULL, NULL ) );
+	
+	return 0;
+}
+
+int ta_serv_init(void)
+{
+	struct disp_when data;
+	
+	TRACE_DEBUG(FULL, "Initializing dispatch callbacks for test");
+	
+	memset(&data, 0, sizeof(data));
+	data.app = ta_appli;
+	data.command = ta_cmd_r;
+	
+	/* fallback CB if command != Test-Request received */
+	CHECK_FCT( fd_disp_register( ta_fb_cb, DISP_HOW_APPID, &data, &ta_hdl_fb ) );
+	
+	/* Now specific handler for Test-Request */
+	CHECK_FCT( fd_disp_register( ta_tr_cb, DISP_HOW_CC, &data, &ta_hdl_tr ) );
+	
+	return 0;
+}
+
+void ta_serv_fini(void)
+{
+	if (ta_hdl_fb) {
+		(void) fd_disp_unregister(&ta_hdl_fb);
+	}
+	if (ta_hdl_tr) {
+		(void) fd_disp_unregister(&ta_hdl_tr);
+	}
+	
+	return;
+}
Index: extensions/test_app/ta_sig.c
===================================================================
--- extensions/test_app/ta_sig.c	(revision 120)
+++ extensions/test_app/ta_sig.c	(revision 120)
@@ -0,0 +1,86 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* Install the signal handler */
+
+#include "test_app.h"
+
+static pthread_t th = (pthread_t) NULL;
+
+static void * ta_sig_th(void * arg)
+{
+	int sig;
+	int ret;
+	sigset_t ss;
+	void (*cb)(void) = arg;
+	
+	fd_log_threadname ( "app_test signal handler" );
+	
+	sigemptyset(&ss);
+	sigaddset(&ss, ta_conf->signal);
+	
+	while (1) {
+		ret = sigwait(&ss, &sig);
+		if (ret != 0) {
+			fd_log_debug("sigwait failed in the app_test extension: %s", strerror(errno));
+			break;
+		}
+		
+		TRACE_DEBUG(FULL, "Signal caught, calling function...");
+		
+		/* Call the cb function */
+		(*cb)();
+		
+	}
+	
+	return NULL;
+}
+
+int ta_sig_init(void (*cb)(void))
+{
+	return pthread_create( &th, NULL, ta_sig_th, (void *)cb );
+}
+
+void ta_sig_fini(void)
+{
+	void * th_ret = NULL;
+	
+	if (th != (pthread_t) NULL) {
+		(void) pthread_cancel(th);
+		(void) pthread_join(th, &th_ret);
+	}
+	
+	return;
+}
Index: extensions/test_app/test_app.c
===================================================================
--- extensions/test_app/test_app.c	(revision 120)
+++ extensions/test_app/test_app.c	(revision 120)
@@ -0,0 +1,125 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* 
+ * Test application for freeDiameter.
+ */
+
+#include "test_app.h"
+#include <signal.h>
+
+/* Initialize the configuration */
+struct ta_conf * ta_conf = NULL;
+static struct ta_conf _conf;
+
+static int ta_conf_init(void)
+{
+	ta_conf = &_conf;
+	memset(ta_conf, 0, sizeof(struct ta_conf));
+	
+	/* Set the default values */
+	ta_conf->vendor_id  = 999999;		/* Dummy value */
+	ta_conf->appli_id   = 0xffffff;	/* dummy value */
+	ta_conf->cmd_id     = 0xfffffe;	/* Experimental */
+	ta_conf->avp_id     = 0xffffff;	/* dummy value */
+	ta_conf->mode       = MODE_SERV | MODE_CLI;
+	ta_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm);
+	ta_conf->dest_host  = NULL;
+	ta_conf->signal     = TEST_APP_DEFAULT_SIGNAL;
+	
+	return 0;
+}
+
+static void ta_conf_dump(void)
+{
+	if (!TRACE_BOOL(INFO))
+		return;
+	fd_log_debug( "------- app_test configuration dump: ---------\n");
+	fd_log_debug( " Vendor Id .......... : %u\n", ta_conf->vendor_id);
+	fd_log_debug( " Application Id ..... : %u\n", ta_conf->appli_id);
+	fd_log_debug( " Command Id ......... : %u\n", ta_conf->cmd_id);
+	fd_log_debug( " AVP Id ............. : %u\n", ta_conf->avp_id);
+	fd_log_debug( " Mode ............... : %s%s\n", ta_conf->mode & MODE_SERV ? "Serv" : "", ta_conf->mode & MODE_CLI ? "Cli" : "" );
+	fd_log_debug( " Destination Realm .. : %s\n", ta_conf->dest_realm ?: "- none -");
+	fd_log_debug( " Destination Host ... : %s\n", ta_conf->dest_host ?: "- none -");
+	fd_log_debug( " Signal ............. : %i\n", ta_conf->signal);
+	fd_log_debug( "------- /app_test configuration dump ---------\n");
+}
+
+/* entry point */
+static int ta_entry(char * conffile)
+{
+	TRACE_ENTRY("%p", conffile);
+	
+	/* Initialize configuration */
+	CHECK_FCT( ta_conf_init() );
+	
+	/* Parse configuration file */
+	if (conffile != NULL) {
+		CHECK_FCT( ta_conf_handle(conffile) );
+	}
+	
+	TRACE_DEBUG(INFO, "Extension Test_App initialized with configuration: '%s'", conffile);
+	ta_conf_dump();
+	
+	/* Install objects definitions for this test application */
+	CHECK_FCT( ta_dict_init() );
+	
+	/* Install the handlers for incoming messages */
+	if (ta_conf->mode & MODE_SERV) {
+		CHECK_FCT( ta_serv_init() );
+	}
+	
+	/* Start the signal handler thread */
+	if (ta_conf->mode & MODE_CLI) {
+		CHECK_FCT( ta_cli_init() );
+	}
+	
+	/* Advertise the support for the test application in the peer */
+	CHECK_FCT( fd_disp_app_support ( ta_appli, ta_vendor, 1, 0 ) );
+	
+	return 0;
+}
+
+/* Unload */
+void fd_ext_fini(void)
+{
+	if (ta_conf->mode & MODE_CLI)
+		ta_cli_fini();
+	if (ta_conf->mode & MODE_SERV)
+		ta_serv_fini();
+}
+
+EXTENSION_ENTRY("test_app", ta_entry);
Index: extensions/test_app/test_app.h
===================================================================
--- extensions/test_app/test_app.h	(revision 120)
+++ extensions/test_app/test_app.h	(revision 120)
@@ -0,0 +1,98 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* Header file for the app_test extension. 
+ *
+ *  This extension provides a way to send configurable messages on the network
+ *
+ *  See the app_test.conf.sample file for the format of the configuration file.
+ */
+ 
+#include <freeDiameter/extension.h>
+
+#ifndef TEST_APP_DEFAULT_SIGNAL
+#define TEST_APP_DEFAULT_SIGNAL	SIGUSR1
+#endif /* TEST_APP_DEFAULT_SIGNAL */
+
+
+/* Mode for the extension */
+#define MODE_SERV	0x1
+#define	MODE_CLI	0x2
+
+/* The module configuration */
+struct ta_conf {
+	uint32_t	vendor_id;	/* default 999999 */
+	uint32_t	appli_id;	/* default 123456 */
+	uint32_t	cmd_id;		/* default 234567 */
+	uint32_t	avp_id;		/* default 345678 */
+	int		mode;		/* default MODE_SERV | MODE_CLI */
+	char 	*	dest_realm;	/* default local realm */
+	char 	*	dest_host;	/* default NULL */
+	int 		signal;		/* default TEST_APP_DEFAULT_SIGNAL */
+};
+extern struct ta_conf * ta_conf;
+
+/* Parse the configuration file */
+int ta_conf_handle(char * conffile);
+
+/* Start or stop the signal handler */
+int ta_sig_init(void (*cb)(void));
+void ta_sig_fini(void);
+
+/* Handle incoming messages (server) */
+int ta_serv_init(void);
+void ta_serv_fini(void);
+
+/* Create outgoing message (client) */
+int ta_cli_init(void);
+void ta_cli_fini(void);
+
+/* Initialize dictionary definitions */
+int ta_dict_init(void);
+
+
+/* Some global variables for dictionary */
+extern struct dict_object * ta_vendor;
+extern struct dict_object * ta_appli;
+extern struct dict_object * ta_cmd_r;
+extern struct dict_object * ta_cmd_a;
+extern struct dict_object * ta_avp;
+
+extern struct dict_object * ta_sess_id;
+extern struct dict_object * ta_origin_host;
+extern struct dict_object * ta_origin_realm;
+extern struct dict_object * ta_dest_host;
+extern struct dict_object * ta_dest_realm;
+extern struct dict_object * ta_res_code;
Index: extensions/test_rt_any/CMakeLists.txt
===================================================================
--- extensions/test_rt_any/CMakeLists.txt	(revision 120)
+++ extensions/test_rt_any/CMakeLists.txt	(revision 120)
@@ -0,0 +1,5 @@
+# The rt_debug extension
+PROJECT("Random routing extension (for tests)" C)
+
+# Compile as a module
+FD_ADD_EXTENSION(test_rt_any test_rt_any.c)
Index: extensions/test_rt_any/test_rt_any.c
===================================================================
--- extensions/test_rt_any/test_rt_any.c	(revision 120)
+++ extensions/test_rt_any/test_rt_any.c	(revision 120)
@@ -0,0 +1,76 @@
+/*********************************************************************************************************
+* Software License Agreement (BSD License)                                                               *
+* Author: Sebastien Decugis <sdecugis@nict.go.jp>							 *
+*													 *
+* Copyright (c) 2009, WIDE Project and NICT								 *
+* All rights reserved.											 *
+* 													 *
+* Redistribution and use of this software in source and binary forms, with or without modification, are  *
+* permitted provided that the following conditions are met:						 *
+* 													 *
+* * Redistributions of source code must retain the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer.										 *
+*    													 *
+* * Redistributions in binary form must reproduce the above 						 *
+*   copyright notice, this list of conditions and the 							 *
+*   following disclaimer in the documentation and/or other						 *
+*   materials provided with the distribution.								 *
+* 													 *
+* * Neither the name of the WIDE Project or NICT nor the 						 *
+*   names of its contributors may be used to endorse or 						 *
+*   promote products derived from this software without 						 *
+*   specific prior written permission of WIDE Project and 						 *
+*   NICT.												 *
+* 													 *
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 	 *
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 	 *
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
+* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF   *
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.								 *
+*********************************************************************************************************/
+
+/* 
+ * Test-only extension for routing: gives a random positive score to any candidate peer.
+ */
+#include <freeDiameter/extension.h>
+#include <stdlib.h>
+
+/* The callback */
+static int tra_out_cb(void * cbdata, struct msg * msg, struct fd_list * candidates)
+{
+	struct fd_list * li;
+	
+	TRACE_ENTRY("%p %p %p", cbdata, msg, candidates);
+	
+	for (li = candidates->next; li != candidates; li = li->next) {
+		struct rtd_candidate *c = (struct rtd_candidate *) li;
+		c->score = (int)lrand48();
+	}
+	
+	return 0;
+}
+
+static struct fd_rt_out_hdl * out_hdl = NULL;
+
+/* Register the callbacks to the daemon */
+static int tra_main(char * conffile)
+{
+	TRACE_ENTRY("%p", conffile);
+	CHECK_FCT( fd_rt_out_register ( tra_out_cb, NULL, 0 /* we call it late so that it replaces previous scores */, &out_hdl ) );
+	return 0;
+}
+
+/* Cleanup the callbacks */
+void fd_ext_fini(void)
+{
+	TRACE_ENTRY();
+	CHECK_FCT_DO( fd_rt_out_unregister ( out_hdl, NULL ), /* continue */ );
+	return ;
+}
+
+/* Define the entry point function */
+EXTENSION_ENTRY("test_rt_any", tra_main);
