changeset 1088:1d1a20a0779d

Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
author Sebastien Decugis <sdecugis@freediameter.net>
date Sat, 04 May 2013 21:25:27 +0200
parents 1c5d410788cc
children 5f622da7f259
files extensions/_sample/sample.c extensions/app_diameap/diameap_server.c extensions/app_diameap/diameap_server.h extensions/app_radgw/rgwx_acct.c extensions/app_radgw/rgwx_auth.c extensions/app_radgw/rgwx_echodrop.c extensions/app_radgw/rgwx_sip.c extensions/app_sip/app_sip.c extensions/app_sip/app_sip.h extensions/app_sip/multimediaauth.c extensions/dbg_interactive/dictionary.i extensions/dbg_interactive/endpoints.i extensions/dbg_interactive/messages.i extensions/dbg_interactive/sessions.i extensions/dbg_monitor/dbg_monitor.c extensions/dict_legacy_xml/dict_lxml_xml.c extensions/test_app/ta_cli.c extensions/test_sip/test_sip.c freeDiameterd/main.c include/freeDiameter/libfdcore.h include/freeDiameter/libfdproto.h libfdproto/fdproto-internal.h libfdproto/init.c libfdproto/log.c libfdproto/sessions.c tests/testcnx.c tests/testdict.c tests/testdisp.c tests/testfifo.c tests/testmesg.c tests/testmesg_stress.c tests/testpeers.c tests/tests.h tests/testsess.c
diffstat 34 files changed, 313 insertions(+), 242 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/_sample/sample.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/_sample/sample.c	Sat May 04 21:25:27 2013 +0200
@@ -84,7 +84,6 @@
 		rule_data.rule_max = -1;
 		CHECK_FCT( fd_dict_new ( fd_g_config->cnf_dict, DICT_RULE, &rule_data, example_avp_avp, NULL ));
 		
-		fd_dict_dump_object(example_avp_avp);
 	}
 	TRACE_DEBUG(INFO, "'Example-AVP' created without error");
 	
--- a/extensions/app_diameap/diameap_server.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/app_diameap/diameap_server.c	Sat May 04 21:25:27 2013 +0200
@@ -84,11 +84,9 @@
 
 
 
-void diameap_cli_sess_cleanup(void * arg, char * sid, void * opaque)
+void diameap_cli_sess_cleanup(struct sess_state * diameap_sess_data, os0_t sid, void * opaque)
 {
 
-	struct diameap_sess_data_sm * diameap_sess_data =
-			(struct diameap_sess_data_sm *) arg;
 	CHECK_PARAMS_DO( diameap_sess_data, return );
 
 	if (diameap_sess_data != NULL)
@@ -140,7 +138,7 @@
 
 static int diameap_initialize_diameap_sm(
 		struct diameap_state_machine * diameap_sm,
-		struct diameap_sess_data_sm * diameap_sess_data)
+		struct sess_state * diameap_sess_data)
 {
 	TRACE_ENTRY("%p %p", diameap_sm, diameap_sess_data);
 
@@ -1016,7 +1014,7 @@
 
 
 static int diameap_sess_data_new(
-		struct diameap_sess_data_sm *diameap_sess_data,
+		struct sess_state *diameap_sess_data,
 		struct diameap_state_machine *diameap_sm)
 {
 	if (!diameap_sm)
@@ -3063,7 +3061,7 @@
 {
 	TRACE_ENTRY("%p %p %p %p", rmsg, ravp, sess, action);
 
-	struct diameap_sess_data_sm * diameap_sess_data = NULL;
+	struct sess_state * diameap_sess_data = NULL;
 	struct diameap_state_machine * diameap_sm = NULL;
 	struct diameap_eap_interface eap_i;
 	struct msg *req, *ans;
@@ -3257,9 +3255,9 @@
 			;
 			TRACE_DEBUG(FULL+1,"%sStoring DiamEAP session data.",DIAMEAP_EXTENSION)
 			;
-			CHECK_MALLOC(diameap_sess_data = malloc(sizeof(struct diameap_sess_data_sm)))
+			CHECK_MALLOC(diameap_sess_data = malloc(sizeof(struct sess_state)))
 			;
-			memset(diameap_sess_data, 0, sizeof(struct diameap_sess_data_sm));
+			memset(diameap_sess_data, 0, sizeof(struct sess_state));
 			diameap_sess_data_new(diameap_sess_data, diameap_sm);
 
 			CHECK_FCT_DO(fd_sess_state_store(diameap_server_reg, sess, &diameap_sess_data),
@@ -3388,7 +3386,7 @@
 	struct disp_when when;
 
 	/*create handler for sessions */
-	CHECK_FCT(fd_sess_handler_create(&diameap_server_reg, diameap_cli_sess_cleanup, NULL));
+	CHECK_FCT(fd_sess_handler_create(&diameap_server_reg, diameap_cli_sess_cleanup, NULL, NULL));
 
 	/* Register the callback */
 	memset(&when, 0, sizeof(when));
--- a/extensions/app_diameap/diameap_server.h	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/app_diameap/diameap_server.h	Sat May 04 21:25:27 2013 +0200
@@ -39,9 +39,9 @@
 #ifndef DIAMEAP_SERVER_H_
 #define DIAMEAP_SERVER_H_
 
-
+ 
 /* session data structure to store */
-struct diameap_sess_data_sm
+struct sess_state
 {
 	int invalid_eappackets; /* Number of invalid EAP Packet received*/
 
--- a/extensions/app_radgw/rgwx_acct.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/app_radgw/rgwx_acct.c	Sat May 04 21:25:27 2013 +0200
@@ -159,6 +159,11 @@
 	uint32_t	 term_cause;	/* If not 0, the Termination-Cause to put in the STR. */
 };
 
+static DECLARE_FD_DUMP_PROTOTYPE(acct_conf_session_state_dump, struct sess_state * st)
+{
+	return fd_dump_extend( FD_DUMP_STD_PARAMS, "[rgwx sess_state](@%p): aai:%x str:%d TC:%u", st, st->auth_appl, st->send_str, st->term_cause);
+}
+
 /* Initialize the plugin */
 static int acct_conf_parse(char * conffile, struct rgwp_config ** state)
 {
@@ -171,7 +176,7 @@
 	CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) );
 	memset(new, 0, sizeof(struct rgwp_config));
 	
-	CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free, NULL ) );
+	CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, (void *)free, acct_conf_session_state_dump, NULL ) );
 	new->confstr = conffile;
 	
 	if (conffile && strstr(conffile, "nonai"))
--- a/extensions/app_radgw/rgwx_auth.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/app_radgw/rgwx_auth.c	Sat May 04 21:25:27 2013 +0200
@@ -124,6 +124,11 @@
 	int ignore_nai;
 };
 
+struct sess_state {
+	char req_auth[16];
+};
+
+
 /* Initialize the plugin */
 static int auth_conf_parse(char * confstr, struct rgwp_config ** state)
 {
@@ -136,7 +141,7 @@
 	CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) );
 	memset(new, 0, sizeof(struct rgwp_config));
 	
-	CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free, NULL ) );
+	CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, (void *)free, NULL, NULL ) );
 	new->confstr = confstr;
 	
 	if (confstr && strstr(confstr, "nonai"))
@@ -1056,11 +1061,11 @@
 
 	/* Store the request identifier in the session (if provided) */
 	{
-		unsigned char * req_auth;
-		CHECK_MALLOC(req_auth = malloc(16));
-		memcpy(req_auth, &rad_req->hdr->authenticator[0], 16);
+		struct sess_state  *st;
+		CHECK_MALLOC(st = malloc(sizeof(struct sess_state)));
+		memcpy(st->req_auth, &rad_req->hdr->authenticator[0], 16);
 		
-		CHECK_FCT( fd_sess_state_store( cs->sess_hdl, sess, &req_auth ) );
+		CHECK_FCT( fd_sess_state_store( cs->sess_hdl, sess, &st ) );
 	}
 	
 	return 0;
@@ -1076,7 +1081,7 @@
 	int ta_set = 0;
 	int no_str = 0; /* indicate if an STR is required for this server */
 	uint8_t	tuntag = 0;
-	unsigned char * req_auth = NULL;
+	struct sess_state  *st;
 	int error_cause = 0;
 	struct session * sess;
 	os0_t sid = NULL;
@@ -1088,7 +1093,7 @@
 	/* Retrieve the request identified which was stored in the session */
 	CHECK_FCT( fd_msg_sess_get(fd_g_config->cnf_dict, *diam_ans, &sess, NULL) );
 	if (sess) {
-		CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, sess, &req_auth ) );
+		CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, sess, &st ) );
 		CHECK_FCT( fd_sess_getsid(sess, &sid, &sidlen) );
 	} /* else ? */
 	
@@ -1758,7 +1763,7 @@
 											size_t len[3];
 											
 											/* We need the request authenticator */
-											CHECK_PARAMS(req_auth);
+											CHECK_PARAMS(st);
 
 											/* Retrieve the shared secret */
 											CHECK_FCT(rgw_clients_getkey(cli, &secret, &secret_len));
@@ -1777,7 +1782,7 @@
 											/* Initial b1 = MD5(S + R + A) */
 											addr[0] = secret;
 											len[0] = secret_len;
-											addr[1] = req_auth;
+											addr[1] = st->req_auth;
 											len[1] = 16;
 											addr[2] = &buf[1];
 											len[2] = 2;
@@ -1852,7 +1857,7 @@
 						size_t recv_len, send_len;
 
 						/* We need the request authenticator */
-						CHECK_PARAMS(req_auth);
+						CHECK_PARAMS(st);
 
 						/* Retrieve the shared secret */
 						CHECK_FCT(rgw_clients_getkey(cli, &secret, &secret_len));
@@ -1865,7 +1870,7 @@
 						recv_len = ahdr->avp_value->os.len >= 32 ? 32 : ahdr->avp_value->os.len;
 						send_len = ahdr->avp_value->os.len - recv_len;
 						
-						if ( ! radius_msg_add_mppe_keys(*rad_fw, req_auth, secret, secret_len, 
+						if ( ! radius_msg_add_mppe_keys(*rad_fw, st->req_auth, secret, secret_len, 
 								ahdr->avp_value->os.data + recv_len, send_len,
 								ahdr->avp_value->os.data, recv_len) ) {
 							TRACE_DEBUG(INFO, "Error while converting EAP-Master-Session-Key to RADIUS message");
@@ -1924,7 +1929,7 @@
 	}
 	
 	CHECK_FCT( fd_msg_free( aoh ) );
-	free(req_auth);
+	free(st);
 	
 	if (error_cause) {
 		if ( ! radius_msg_add_attr_int32(*rad_fw, RADIUS_ATTR_ERROR_CAUSE, error_cause) ) {
--- a/extensions/app_radgw/rgwx_echodrop.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/app_radgw/rgwx_echodrop.c	Sat May 04 21:25:27 2013 +0200
@@ -37,20 +37,31 @@
 
 #include "rgwx_echodrop.h"
 
+struct sess_state {
+	struct fd_list sentinel;
+};
+
 /* If a session is destroyed, empty the list of ed_saved_attribute */
-static void state_delete(void * arg, char * sid, void * opaque) {
-	struct fd_list * list = (struct fd_list *)arg;
-	
-	CHECK_PARAMS_DO( list, return );
-	
-	while (!FD_IS_LIST_EMPTY(list)) {
-		struct ed_saved_attribute * esa = (struct ed_saved_attribute *)(list->next);
+static void state_delete(struct sess_state * arg, os0_t sid, void * opaque) {
+	while (!FD_IS_LIST_EMPTY(&arg->sentinel)) {
+		struct ed_saved_attribute * esa = (struct ed_saved_attribute *)(arg->sentinel.next);
 		fd_list_unlink(&esa->chain);
 		free(esa);
 	}
-	free(list);
+	free(arg);
 }
 
+static DECLARE_FD_DUMP_PROTOTYPE(ed_session_state_dump, struct sess_state * st)
+{
+	struct fd_list * li;
+	CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "[rgwx sess_state](@%p):\n", st), return NULL);	
+	for (li = st->sentinel.next; li != &st->sentinel; li = li->next) {
+		struct ed_saved_attribute * esa = (struct ed_saved_attribute *)(li);
+		CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "[rgwx sess_state {esa}] t:%2hhx l:%2hhx d:", esa->attr.type, esa->attr.length), return NULL);
+		CHECK_MALLOC_DO( fd_dump_extend_hexdump(FD_DUMP_STD_PARAMS, (&esa->attr.length) + 1, esa->attr.length - 2, 0,0), return NULL);
+		CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\n"), return NULL);
+	}
+}
 
 /* Initialize the plugin and parse the configuration. */
 static int ed_conf_parse(char * conffile, struct rgwp_config ** state)
@@ -68,7 +79,7 @@
 	fd_list_init(&new->attributes, NULL);
 	
 	/* Create the session handler */
-	CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, state_delete, NULL ) );
+	CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, state_delete, ed_session_state_dump, NULL ) );
 	
 	/* Parse the configuration file */
 	CHECK_FCT( ed_conffile_parse(conffile, new) );
@@ -216,6 +227,7 @@
 	/* Save the echoed values in the session, if any */
 	if (!FD_IS_LIST_EMPTY(&echo_list)) {
 		struct session * sess;
+		struct sess_state * st;
 		
 		CHECK_FCT( fd_msg_sess_get(fd_g_config->cnf_dict, *diam_fw, &sess, NULL) );
 
@@ -228,12 +240,12 @@
 			} );
 		
 		/* Move the values in a dynamically allocated list */
-		CHECK_MALLOC( li = malloc(sizeof(struct fd_list)) );
-		fd_list_init(li, NULL);
-		fd_list_move_end(li, &echo_list);
+		CHECK_MALLOC( st = malloc(sizeof(struct sess_state)) );
+		fd_list_init(&st->sentinel, NULL);
+		fd_list_move_end(&st->sentinel, &echo_list);
 		
 		/* Save the list in the session */
-		CHECK_FCT( fd_sess_state_store( cs->sess_hdl, sess, &li ) );
+		CHECK_FCT( fd_sess_state_store( cs->sess_hdl, sess, &st ) );
 	}
 	
 	return 0;
@@ -242,8 +254,8 @@
 /* Process an answer: add the ECHO attributes back, if any */
 static int ed_diam_ans( struct rgwp_config * cs, struct msg ** diam_ans, struct radius_msg ** rad_fw, struct rgw_client * cli )
 {
-	struct fd_list * list = NULL;
 	struct session * sess;
+	struct sess_state * st;
 	
 	TRACE_ENTRY("%p %p %p %p", cs, diam_ans, rad_fw, cli);
 	CHECK_PARAMS(cs);
@@ -257,8 +269,8 @@
 	}
 	
 	/* Now try and retrieve any data from the session */
-	CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, sess, &list ) );
-	if (list == NULL) {
+	CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, sess, &st ) );
+	if (st == NULL) {
 		/* No attribute saved in the session, just return */
 		return 0;
 	}
@@ -267,8 +279,8 @@
 	
 	CHECK_PARAMS( rad_fw && *rad_fw);
 	
-	while (! FD_IS_LIST_EMPTY(list) ) {
-		struct ed_saved_attribute * esa = (struct ed_saved_attribute *)(list->next);
+	while (! FD_IS_LIST_EMPTY(&st->sentinel) ) {
+		struct ed_saved_attribute * esa = (struct ed_saved_attribute *)(st->sentinel.next);
 		
 		fd_list_unlink(&esa->chain);
 		
@@ -279,7 +291,7 @@
 		
 		free(esa);
 	}
-	free(list);
+	free(st);
 
 	return 0;
 }
--- a/extensions/app_radgw/rgwx_sip.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/app_radgw/rgwx_sip.c	Sat May 04 21:25:27 2013 +0200
@@ -133,7 +133,6 @@
 		
 		
 	} dict; /* cache of the dictionary objects we use */
-	struct session_handler * sess_hdl; /* We store RADIUS request authenticator information in the session */
 	char * confstr;
 	//Chained list of nonce
 	struct fd_list listnonce;
@@ -257,7 +256,6 @@
 	CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) );
 	memset(new, 0, sizeof(struct rgwp_config));
 	
-	CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free, NULL ) );
 	new->confstr = conffile;
 	
 	/* Resolve all dictionary objects we use */
@@ -311,8 +309,6 @@
 	TRACE_ENTRY("%p", state);
 	CHECK_PARAMS_DO( state, return );
 	
-	CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl, NULL ),  );
-	
 	nonce_deletelistnonce(state);
 	CHECK_POSIX_DO(pthread_mutex_destroy(&state->nonce_mutex), /*continue*/);
 	
@@ -320,7 +316,6 @@
 	return;
 }
 
-
 /* Handle an incoming RADIUS request */
 static int sip_rad_req( struct rgwp_config * cs, struct radius_msg * rad_req, struct radius_msg ** rad_ans, struct msg ** diam_fw, struct rgw_client * cli )
 {
@@ -716,15 +711,6 @@
 
 	//fd_msg_dump_walk(1,*diam_fw);
 	
-	/* Store the request identifier in the session */
-	{
-		unsigned char * req_sip;
-		CHECK_MALLOC(req_sip = malloc(16));
-		memcpy(req_sip, &rad_req->hdr->authenticator[0], 16);
-		
-		CHECK_FCT( fd_sess_state_store( cs->sess_hdl, sess, &req_sip ) );
-	}
-	
 	
 	return 0;
 }
@@ -856,9 +842,6 @@
 		}
 	}
 	
-	CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, sess, &req_sip ) );
-	free(req_sip);
-	
 	return 0;
 }
 
--- a/extensions/app_sip/app_sip.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/app_sip/app_sip.c	Sat May 04 21:25:27 2013 +0200
@@ -49,7 +49,6 @@
 
 
 struct disp_hdl * app_sip_default_hdl=NULL;
-struct session_handler * ds_sess_hdl;
 
 //configuration stucture
 struct as_conf * as_conf=NULL;
@@ -212,8 +211,6 @@
 	if(start_mysql_connection())
 		return EINVAL;
 	
-	CHECK_FCT(fd_sess_handler_create(&ds_sess_hdl, free, NULL));
-	
 	//Creation of thread for Registration Termination	
 	if(pthread_create(&rtr_thread, NULL,rtr_socket, NULL))
 	{
@@ -237,7 +234,6 @@
 	//TODO:unregister other callbacks
 	
 	(void) fd_disp_unregister(&app_sip_MAR_hdl, NULL);
-	CHECK_FCT_DO( fd_sess_handler_destroy(&ds_sess_hdl, NULL),return);
 	
 	
 	//We close database connection
--- a/extensions/app_sip/app_sip.h	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/app_sip/app_sip.h	Sat May 04 21:25:27 2013 +0200
@@ -212,11 +212,6 @@
 #define CODE_SIP_USER_DATA_TYPE	388
 #define CODE_SIP_AOR	122
 
-struct ds_nonce
-{
-	char *nonce;
-};
-
 //Storage for some useful AVPs
 struct app_sip_dict{
 	struct dict_object * Auth_Session_State;
--- a/extensions/app_sip/multimediaauth.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/app_sip/multimediaauth.c	Sat May 04 21:25:27 2013 +0200
@@ -35,6 +35,11 @@
 *********************************************************************************************************/
 #include "app_sip.h"
 
+struct sess_state
+{
+	char *nonce;
+};
+
 
 int app_sip_MAR_cb( struct msg ** msg, struct avp * paramavp, struct session * sess, void * opaque, enum disp_action * act)
 {
@@ -55,7 +60,7 @@
 	unsigned char *username=NULL;
 	
 	//The nonce we will store and retrieve in session
-	struct ds_nonce *storednonce=NULL;
+	struct sess_state *storednonce=NULL;
 	
 	
 	TRACE_ENTRY("%p %p %p %p", msg, paramavp, sess, act);
@@ -361,8 +366,8 @@
 									
 									
 									//We store the nonce (storednonce structure) inside the session
-									storednonce=malloc(sizeof(struct ds_nonce));
-									memset(storednonce,0,sizeof(struct ds_nonce));
+									storednonce=malloc(sizeof(struct sess_state));
+									memset(storednonce,0,sizeof(struct sess_state));
 									CHECK_MALLOC(storednonce->nonce=malloc(NONCE_SIZE*2+1));
 									memcpy(storednonce->nonce,(char *)nonce,NONCE_SIZE*2+1);
 									CHECK_FCT( fd_sess_state_store ( ds_sess_hdl, sess, &storednonce ));  
--- a/extensions/dbg_interactive/dictionary.i	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/dbg_interactive/dictionary.i	Sat May 04 21:25:27 2013 +0200
@@ -59,7 +59,10 @@
 		return;
 	}
 	void dump() {
-		fd_dict_dump($self);
+		char * buf = NULL;
+		size_t len;
+		printf("%s", fd_dict_dump(&buf, &len, NULL, $self));
+		free(buf);
 	}
 	PyObject * vendors_list() {
 		uint32_t *list = NULL, *li;
@@ -127,7 +130,10 @@
 
 %extend dict_object {
 	void dump() {
-		fd_dict_dump_object($self);
+		char * buf = NULL;
+		size_t len;
+		printf("%s", fd_dict_dump_object(&buf, &len, NULL, $self));
+		free(buf);
 	}
 	enum dict_object_type gettype() {
 		enum dict_object_type t;
--- a/extensions/dbg_interactive/endpoints.i	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/dbg_interactive/endpoints.i	Sat May 04 21:25:27 2013 +0200
@@ -125,6 +125,9 @@
 	}
 	
 	void dump() {
-		fd_ep_dump_one( "", $self );
+		char * buf = NULL;
+		size_t len;
+		printf("%s", fd_ep_dump_one(&buf, &len, NULL, $self));
+		free(buf);
 	}
 }
--- a/extensions/dbg_interactive/messages.i	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/dbg_interactive/messages.i	Sat May 04 21:25:27 2013 +0200
@@ -290,10 +290,10 @@
 	
 	/* Dump */
 	void dump (int tree = 1) {
-		if (tree)
-			fd_msg_dump_walk(0, $self);
-		else
-			fd_msg_dump_one(0, $self);
+		char * buf = NULL;
+		size_t len;
+		printf("%s", fd_msg_dump_treeview(&buf, &len, NULL, $self, NULL, 0, tree));
+		free(buf);
 	}
 	
 	/* Model */
@@ -569,10 +569,10 @@
 	
 	/* Dump */
 	void dump (int tree = 1) {
-		if (tree)
-			fd_msg_dump_walk(0, $self);
-		else
-			fd_msg_dump_one(0, $self);
+		char * buf = NULL;
+		size_t len;
+		printf("%s", fd_msg_dump_treeview(&buf, &len, NULL, $self, NULL, 0, tree));
+		free(buf);
 	}
 	
 	/* Model */
--- a/extensions/dbg_interactive/sessions.i	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/dbg_interactive/sessions.i	Sat May 04 21:25:27 2013 +0200
@@ -38,8 +38,12 @@
 /****** SESSIONS *********/
 
 %{
+struct sess_state {
+	PyObject * pystate;
+};
+
 /* call it (might be called from a different thread than the interpreter, when session times out) */
-static void call_the_python_cleanup_callback(session_state * state, os0_t sid, void * cb) {
+static void call_the_python_cleanup_callback(struct sess_state * state, os0_t sid, void * cb) {
 	PyObject *result;
 	if (!cb) {
 		fd_log_debug("Internal error: missing callback object!");
@@ -66,7 +70,7 @@
 		
 		Py_XINCREF(PyCb);
 		
-		ret = fd_sess_handler_create_internal ( &hdl, call_the_python_cleanup_callback, PyCb );
+		ret = fd_sess_handler_create ( &hdl, call_the_python_cleanup_callback, NULL, PyCb );
 		if (ret != 0) {
 			DI_ERROR(ret, NULL, NULL);
 			return NULL;
@@ -86,7 +90,10 @@
 		return;
 	}
 	void dump() {
-		fd_sess_dump_hdl(0, $self);
+		char * buf = NULL;
+		size_t len;
+		printf("%s", fd_sess_dump_hdl(&buf, &len, NULL, $self));
+		free(buf);
 	}
 }
 
@@ -165,13 +172,18 @@
 		}
 	}
 	void dump() {
-		fd_sess_dump(0, $self);
+		char * buf = NULL;
+		size_t len = 0;
+		printf("%s", fd_sess_dump(&buf, &len, NULL, $self, 1) );
+		free(buf);
 	}
 	void store(struct session_handler * handler, PyObject * DISOWN) {
 		int ret;
-		void * store = DISOWN;
+		struct sess_state * st = NULL;
+		st = malloc(sizeof(struct sess_state));
+		st->pystate = DISOWN;
 		Py_XINCREF(DISOWN);
-		ret = fd_sess_state_store_internal(handler, $self, (void *) &store);
+		ret = fd_sess_state_store(handler, $self, (void *) &st);
 		if (ret != 0) {
 			DI_ERROR(ret, NULL, NULL);
 		}
@@ -179,16 +191,19 @@
 	%newobject retrieve;
 	PyObject * retrieve(struct session_handler * handler) {
 		int ret;
+		struct sess_state * st = NULL;
 		PyObject * state = NULL;
-		ret = fd_sess_state_retrieve_internal(handler, $self, (void *) &state);
+		ret = fd_sess_state_retrieve_internal(handler, $self, (void *) &st);
 		if (ret != 0) {
 			DI_ERROR(ret, NULL, NULL);
 			return NULL;
 		}
-		if (state == NULL) {
+		if (st == NULL) {
 			Py_INCREF(Py_None);
 			return Py_None;
 		}
+		state = st->pystate;
+		free(st);
 		return state;
 	}
 }	
--- a/extensions/dbg_monitor/dbg_monitor.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/dbg_monitor/dbg_monitor.c	Sat May 04 21:25:27 2013 +0200
@@ -77,6 +77,8 @@
 {
 	int i = 0;
 	fd_log_threadname("Monitor thread");
+	char * buf = NULL;
+	size_t len;
 	
 	/* Loop */
 	while (1) {
@@ -110,7 +112,7 @@
 		for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) {
 			struct peer_hdr * p = (struct peer_hdr *)li->o;
 			
-			fd_peer_dump(p, NONE);
+			TRACE_DEBUG(INFO, "%s", fd_peer_dump(&buf, &len, NULL, p, 1));
 			
 			CHECK_FCT_DO( fd_stat_getstats(STAT_P_PSM, p, &current_count, &limit_count, &highest_count, &total_count, &total, &blocking, &last), );
 			display_info("Events, incl. recept", p->info.pi_diamid, current_count, limit_count, highest_count, total_count, &total, &blocking, &last);
@@ -122,20 +124,28 @@
 
 		CHECK_FCT_DO( pthread_rwlock_unlock(&fd_g_peers_rw), /* continue */ );
 		
-		CHECK_FCT_DO(fd_event_send(fd_g_config->cnf_main_ev, FDEV_DUMP_SERV, 0, NULL), /* continue */);
+		TRACE_DEBUG(INFO, "[dbg_monitor] Dumping servers information");
+		TRACE_DEBUG(INFO, "%s", fd_servers_dump(&buf, &len, NULL));
+		
 		sleep(1);
 	}
 	
+	free(buf);
 	return NULL;
 }
 
 /* Function called on receipt of MONITOR_SIGNAL */
 static void got_sig()
 {
-	fd_log_debug("[dbg_monitor] Dumping extra information");
-	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 */);
+	char * buf = NULL;
+	size_t len;
+	TRACE_DEBUG(INFO, "[dbg_monitor] Dumping config information");
+	TRACE_DEBUG(INFO, "%s", fd_conf_dump(&buf, &len, NULL));
+	TRACE_DEBUG(INFO, "[dbg_monitor] Dumping extensions information");
+	TRACE_DEBUG(INFO, "%s", fd_ext_dump(&buf, &len, NULL));
+	TRACE_DEBUG(INFO, "[dbg_monitor] Dumping dictionary information");
+	TRACE_DEBUG(INFO, "%s", fd_dict_dump(&buf, &len, NULL, fd_g_config->cnf_dict));
+	free(buf);
 }
 
 /* Entry point */
--- a/extensions/dict_legacy_xml/dict_lxml_xml.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/dict_legacy_xml/dict_lxml_xml.c	Sat May 04 21:25:27 2013 +0200
@@ -1808,9 +1808,6 @@
 		} );
 	
 	TRACE_DEBUG(FULL, "Conversion from '%s' to freeDiameter internal format complete.", xmlfilename);
-	if (TRACE_BOOL(ANNOYING)) {
-		fd_dict_dump(fd_g_config->cnf_dict);
-	}
 	
 	/* Done */
 	del_dict_contents(&data.dict);
--- a/extensions/test_app/ta_cli.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/test_app/ta_cli.c	Sat May 04 21:25:27 2013 +0200
@@ -45,7 +45,7 @@
 
 static struct session_handler * ta_cli_reg = NULL;
 
-struct ta_mess_info {
+struct sess_state {
 	int32_t		randval;	/* a random value to store in Test-AVP */
 	struct timespec ts;		/* Time of sending the message */
 } ;
@@ -53,7 +53,7 @@
 /* Cb called when an answer is received */
 static void ta_cb_ans(void * data, struct msg ** msg)
 {
-	struct ta_mess_info * mi = NULL;
+	struct sess_state * mi = NULL;
 	struct timespec ts;
 	struct session * sess;
 	struct avp * avp;
@@ -176,7 +176,7 @@
 	struct msg * req = NULL;
 	struct avp * avp;
 	union avp_value val;
-	struct ta_mess_info * mi = NULL, *svg;
+	struct sess_state * mi = NULL, *svg;
 	struct session *sess = NULL;
 	
 	TRACE_DEBUG(FULL, "Creating a new message for sending.");
@@ -190,7 +190,7 @@
 	CHECK_FCT_DO( fd_msg_sess_get(fd_g_config->cnf_dict, req, &sess, NULL), goto out );
 	
 	/* Create the random value to store with the session */
-	mi = malloc(sizeof(struct ta_mess_info));
+	mi = malloc(sizeof(struct sess_state));
 	if (mi == NULL) {
 		fd_log_debug("malloc failed: %s", strerror(errno));
 		goto out;
@@ -264,7 +264,7 @@
 
 int ta_cli_init(void)
 {
-	CHECK_FCT( fd_sess_handler_create(&ta_cli_reg, free, NULL) );
+	CHECK_FCT( fd_sess_handler_create(&ta_cli_reg, (void *)free, NULL, NULL) );
 	
 	CHECK_FCT( fd_event_trig_regcb(ta_conf->signal, "test_app.cli", ta_cli_test_message ) );
 	
--- a/extensions/test_sip/test_sip.c	Sat May 04 17:00:39 2013 +0200
+++ b/extensions/test_sip/test_sip.c	Sat May 04 21:25:27 2013 +0200
@@ -53,7 +53,6 @@
 
 
 struct disp_hdl * test_sip_default_hdl=NULL;
-struct session_handler * ts_sess_hdl;
 
 //configuration stucture
 struct ts_conf * ts_conf=NULL;
@@ -213,7 +212,6 @@
 		return 1;
 	*/
 	
-	CHECK_FCT(fd_sess_handler_create(&ts_sess_hdl, free, NULL));
 	//CHECK_FCT( fd_event_trig_regcb(30, "test_sip", (void *)test_sipSL_LIR_cb ) );
 	CHECK_FCT( fd_event_trig_regcb(30, "test_sip", (void *)test_sip_SAR_cb ) );
 	CHECK_FCT( fd_event_trig_regcb(31, "test_sip", (void *)test_sip_LIR_cb ) );
--- a/freeDiameterd/main.c	Sat May 04 17:00:39 2013 +0200
+++ b/freeDiameterd/main.c	Sat May 04 21:25:27 2013 +0200
@@ -209,7 +209,7 @@
 				break;
 				
 			case 'd':	/* Increase verbosity of debug messages.  */
-				fd_g_debug_lvl++;
+				fd_g_debug_lvl--;
 				break;
 				
 			case 'f':	/* Full debug for the function with this name.  */
@@ -235,7 +235,7 @@
 				break;
 				
 			case 'q':	/* Decrease verbosity then remove debug messages.  */
-				fd_g_debug_lvl--;
+				fd_g_debug_lvl++;
 				break;
 
 			case '?':	/* Invalid option.  */
--- a/include/freeDiameter/libfdcore.h	Sat May 04 17:00:39 2013 +0200
+++ b/include/freeDiameter/libfdcore.h	Sat May 04 21:25:27 2013 +0200
@@ -802,14 +802,16 @@
 /* for extensions */
 int fd_event_trig_regcb(int trigger_val, const char * module, void (*cb)(void));
 
+#ifndef SWIG
 DECLARE_FD_DUMP_PROTOTYPE(fd_event_trig_dump);
 
 /* The "old" FD_EV_DUMP_* events are replaced with direct calls to the following dump functions */
 DECLARE_FD_DUMP_PROTOTYPE(fd_conf_dump);
 DECLARE_FD_DUMP_PROTOTYPE(fd_ext_dump);
+DECLARE_FD_DUMP_PROTOTYPE(fd_servers_dump);
+#endif /* SWIG */
 DECLARE_FD_DUMP_PROTOTYPE(fd_peer_dump_list, int details);
 DECLARE_FD_DUMP_PROTOTYPE(fd_peer_dump, struct peer_hdr * p, int details);
-DECLARE_FD_DUMP_PROTOTYPE(fd_servers_dump);
 
 /*============================================================*/
 /*                         ENDPOINTS                          */
--- a/include/freeDiameter/libfdproto.h	Sat May 04 17:00:39 2013 +0200
+++ b/include/freeDiameter/libfdproto.h	Sat May 04 21:25:27 2013 +0200
@@ -221,8 +221,9 @@
 int fd_log_handler_unregister ( void );
 
 
-/* Helper function for the *dump functions that add into a buffer */
+/* Helper functions for the *dump functions that add into a buffer */
 char * fd_dump_extend(char ** buf, size_t *len, size_t *offset, const char * format, ... ) _ATTRIBUTE_PRINTFLIKE_(4,5);
+char * fd_dump_extend_hexdump(char ** buf, size_t *len, size_t *offset, uint8_t *data, size_t datalen, size_t trunc, size_t wrap );
 
 /* All dump functions follow the same prototype:
  * PARAMETERS:
@@ -1816,9 +1817,9 @@
 struct session;
 
 /* The state information that a module associate with a session -- each module defines its own data format */
-typedef void session_state;
-
-typedef DECLARE_FD_DUMP_PROTOTYPE(session_state_dump, session_state * st);
+struct sess_state; /* declare this in your own extension */
+
+typedef DECLARE_FD_DUMP_PROTOTYPE((*session_state_dump), struct sess_state * st);
 
 /* The following function must be called to activate the session expiry mechanism */
 int fd_sess_start(void);
@@ -1842,10 +1843,7 @@
  *  EINVAL 	: A parameter is invalid.
  *  ENOMEM	: Not enough memory to complete the operation
  */
-int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state * state, os0_t sid, void * opaque), session_state_dump dumper, void * opaque );
-/* Macro to avoid casting everywhere */
-#define fd_sess_handler_create( _handler, _cleanup, _dumper, _opaque ) \
-	fd_sess_handler_create_internal( (_handler), (void (*)(session_state *, os0_t, void *))(_cleanup), _dumper, (void *)(_opaque) )
+int fd_sess_handler_create ( struct session_handler ** handler, void (*cleanup)(struct sess_state * state, os0_t sid, void * opaque), session_state_dump dumper, void * opaque );
 
 	
 /*
@@ -2017,9 +2015,7 @@
  *  EALREADY	: Data was already associated with this session and client.
  *  ENOMEM	: Not enough memory to complete the operation
  */
-int fd_sess_state_store_internal ( struct session_handler * handler, struct session * session, session_state ** state );
-#define fd_sess_state_store( _handler, _session, _state ) \
-	fd_sess_state_store_internal( (_handler), (_session), (void *)(_state) )
+int fd_sess_state_store ( struct session_handler * handler, struct session * session, struct sess_state ** state );
 
 /*
  * FUNCTION:	fd_sess_state_retrieve
@@ -2039,9 +2035,7 @@
  *  0      	: *state is updated (NULL or points to the state if it was found).
  *  EINVAL 	: A parameter is invalid.
  */
-int fd_sess_state_retrieve_internal ( struct session_handler * handler, struct session * session, session_state ** state ); 
-#define fd_sess_state_retrieve( _handler, _session, _state ) \
-	fd_sess_state_retrieve_internal( (_handler), (_session), (void *)(_state) )
+int fd_sess_state_retrieve ( struct session_handler * handler, struct session * session, struct sess_state ** state ); 
 
 
 /* For debug */
--- a/libfdproto/fdproto-internal.h	Sat May 04 17:00:39 2013 +0200
+++ b/libfdproto/fdproto-internal.h	Sat May 04 21:25:27 2013 +0200
@@ -47,9 +47,6 @@
 int fd_sess_init(void);
 void fd_sess_fini(void);
 
-/* Where debug messages are sent */
-extern FILE * fd_g_debug_fstr;
-
 /* Iterator on the rules of a parent object */
 int fd_dict_iterate_rules ( struct dict_object *parent, void * data, int (*cb)(void *, struct dict_rule_data *) );
 
--- a/libfdproto/init.c	Sat May 04 17:00:39 2013 +0200
+++ b/libfdproto/init.c	Sat May 04 21:25:27 2013 +0200
@@ -57,9 +57,6 @@
 		return ret;
 	}
 	
-	/* Set the debug stream */
-	fd_g_debug_fstr = stdout;
-	
 	/* Initialize the modules that need it */
 	fd_msg_eteid_init();
 	CHECK_FCT( fd_sess_init() );
--- a/libfdproto/log.c	Sat May 04 17:00:39 2013 +0200
+++ b/libfdproto/log.c	Sat May 04 21:25:27 2013 +0200
@@ -37,11 +37,9 @@
 
 #include <stdarg.h>
 
-FILE * fd_g_debug_fstr;
-
 pthread_mutex_t fd_log_lock = PTHREAD_MUTEX_INITIALIZER;
 pthread_key_t	fd_log_thname;
-int fd_g_debug_lvl = INFO;
+int fd_g_debug_lvl = FD_LOG_NOTICE;
 
 static void fd_internal_logger( int, const char *, va_list );
 static int use_colors = 0; /* 0: not init, 1: yes, 2: no */
@@ -87,16 +85,16 @@
 }
 
 
-static void fd_internal_logger( int loglevel, const char *format, va_list ap )
+static void fd_internal_logger( int printlevel, const char *format, va_list ap )
 {
     char buf[25];
-    FILE *fstr = fd_g_debug_fstr ?: stdout;
-    int local_use_color = 0;
 
-    /* logging has been decided by macros outside already */
+    /* Do we need to trace this ? */
+    if (printlevel < fd_g_debug_lvl)
+    	return;
 
     /* add timestamp */
-    fprintf(fstr, "%s  ", fd_log_time(NULL, buf, sizeof(buf)));
+    printf("%s  ", fd_log_time(NULL, buf, sizeof(buf)));
     
     /* Use colors on stdout ? */
     if (!use_colors) {
@@ -106,22 +104,20 @@
 		use_colors = 2;
     }
     
-    /* now, this time log, do we use colors? */
-    if ((fstr == stdout) && (use_colors == 1))
-	    local_use_color = 1;
+    switch(printlevel) {
+	    case FD_LOG_ANNOYING:  printf("%s	A   ", (use_colors == 1) ? "\e[0;37m" : ""); break;
+	    case FD_LOG_DEBUG:     printf("%s DBG   ", (use_colors == 1) ? "\e[0;37m" : ""); break;
+	    case FD_LOG_NOTICE:    printf("%sNOTI   ", (use_colors == 1) ? "\e[1;37m" : ""); break;
+	    case FD_LOG_ERROR:     printf("%sERROR  ", (use_colors == 1) ? "\e[0;31m" : ""); break;
+	    case FD_LOG_FATAL:     printf("%sFATAL! ", (use_colors == 1) ? "\e[0;31m" : ""); break;
+	    default:               printf("%s ???   ", (use_colors == 1) ? "\e[0;31m" : "");
+    }
+    vprintf(format, ap);
+    if (use_colors == 1)
+	     printf("\e[00m");
+    printf("\n");
     
-    switch(loglevel) {
-	    case FD_LOG_DEBUG:  fprintf(fstr, "%s DBG   ", local_use_color ? "\e[0;37m" : ""); break;
-	    case FD_LOG_NOTICE: fprintf(fstr, "%sNOTI   ", local_use_color ? "\e[1;37m" : ""); break;
-	    case FD_LOG_ERROR:  fprintf(fstr, "%sERROR  ", local_use_color ? "\e[0;31m" : ""); break;
-	    default:            fprintf(fstr, "%s ???   ", local_use_color ? "\e[0;31m" : "");
-    }
-    vfprintf(fstr, format, ap);
-    if (local_use_color)
-	     fprintf(fstr, "\e[00m");
-    fprintf(fstr, "\n");
-    
-    fflush(fstr);
+    fflush(stdout);
 }
 
 /* Log a debug message */
@@ -211,19 +207,25 @@
 }
 
 
+static size_t sys_mempagesz = 0;
+
+static size_t get_mempagesz(void) {
+	if (!sys_mempagesz) {
+		sys_mempagesz = sysconf(_SC_PAGESIZE); /* We alloc buffer by memory pages for efficiency */
+		if (sys_mempagesz <= 0)
+			sys_mempagesz = 1024; /* default size if above call failed */
+	}
+	return sys_mempagesz;
+}
+
+
 /* Helper function for fd_*_dump. Prints the format string from 'offset' into '*buf', extends if needed. The location of buf can be updated by this function. */
 char * fd_dump_extend(char ** buf, size_t *len, size_t *offset, const char * format, ... )
 {
 	va_list ap;
 	int to_write;
 	size_t o = 0;
-	static size_t mempagesz = 0;
-	
-	if (!mempagesz) {
-		mempagesz = sysconf(_SC_PAGESIZE); /* We alloc buffer by memory pages for efficiency */
-		if (mempagesz <= 0)
-			mempagesz = 1024; /* default size if above call failed */
-	}
+	size_t mempagesz = get_mempagesz();
 	
 	/* we do not TRACE_ENTRY this one on purpose */
 	
@@ -257,3 +259,61 @@
 	
 	return *buf;
 }
+
+char * fd_dump_extend_hexdump(char ** buf, size_t *len, size_t *offset, uint8_t *data, size_t datalen, size_t trunc, size_t wrap )
+{
+	int truncated = 0;
+	size_t towrite = 0;
+	size_t o = 0;
+	int i;
+	char * p;
+	size_t mempagesz = get_mempagesz();
+#define TRUNK_MARK "[...]"
+
+	CHECK_PARAMS_DO(buf && len && data, return NULL);
+	
+	if (trunc && (datalen > trunc)) {
+		datalen = trunc;
+		truncated = 1;
+	}
+	
+	towrite = datalen * 2;
+	
+	if (wrap)
+		towrite += datalen / wrap; /* add 1 '\n' every wrap byte */
+	
+	if (truncated)
+		towrite += CONSTSTRLEN(TRUNK_MARK);
+	
+	
+	if (offset)
+		o = *offset;
+	
+	if (*buf == NULL) {
+		/* Directly allocate the size we need */
+		*len = (((towrite + o) / mempagesz) + 1 ) * mempagesz;
+		CHECK_MALLOC_DO(*buf = malloc(*len), return NULL);
+	} else if ((towrite + o) >= *len) {
+		/* There is no room in the buffer, we extend and redo */
+		size_t new_len = (((towrite + o) / mempagesz) + 1) * mempagesz;
+		CHECK_MALLOC_DO(*buf = realloc(*buf, new_len), return NULL);
+		*len = new_len;
+	}
+	
+	p = *buf + o;
+	for (i = 0; i < datalen; i++) {
+		sprintf(p, "%2hhX", data[i]);
+		p+=2;
+		if ((wrap) && ((i+1) % wrap == 0)) {
+			*p++='\n'; *p ='\0'; /* we want to ensure the buffer is always 0-terminated */
+		}
+	}
+	
+	if (truncated)
+		memcpy(p, TRUNK_MARK, CONSTSTRLEN(TRUNK_MARK));
+		
+	if (offset)
+		*offset += towrite;
+	
+	return *buf;
+}
--- a/libfdproto/sessions.c	Sat May 04 17:00:39 2013 +0200
+++ b/libfdproto/sessions.c	Sat May 04 21:25:27 2013 +0200
@@ -68,8 +68,8 @@
 struct session_handler {
 	int		  eyec;	/* An eye catcher also used to ensure the object is valid, must be SH_EYEC */
 	int		  id;	/* A unique integer to identify this handler */
-	void 		(*cleanup)(session_state *, os0_t, void *); /* The cleanup function to be called for cleaning a state */
-	session_state_dump *state_dump; /* dumper function */
+	void 		(*cleanup)(struct sess_state *, os0_t, void *); /* The cleanup function to be called for cleaning a state */
+	session_state_dump state_dump; /* dumper function */
 	void             *opaque; /* a value that is passed as is to the cleanup callback */
 };
 
@@ -80,7 +80,7 @@
 /* Data structures linked from the sessions, containing the applications states */
 struct state {
 	int			 eyec;	/* Must be SD_EYEC */
-	session_state		*state;	/* The state registered by the application, never NULL (or the whole object is deleted) */
+	struct sess_state	*state;	/* The state registered by the application, never NULL (or the whole object is deleted) */
 	struct fd_list		 chain;	/* Chaining in the list of session's states ordered by hdl->id */
 	union {
 		struct session_handler	*hdl;	/* The handler for which this state was registered */
@@ -273,7 +273,7 @@
 }
 
 /* Create a new handler */
-int fd_sess_handler_create_internal ( struct session_handler ** handler, void (*cleanup)(session_state *, os0_t, void *), session_state_dump dumper, void * opaque )
+int fd_sess_handler_create ( struct session_handler ** handler, void (*cleanup)(struct sess_state *, os0_t, void *), session_state_dump dumper, void * opaque )
 {
 	struct session_handler *new;
 	
@@ -719,7 +719,7 @@
 }
 
 /* Save a state information with a session */
-int fd_sess_state_store_internal ( struct session_handler * handler, struct session * session, session_state ** state )
+int fd_sess_state_store ( struct session_handler * handler, struct session * session, struct sess_state ** state )
 {
 	struct state *new;
 	struct fd_list * li;
@@ -772,7 +772,7 @@
 }
 
 /* Get the data back */
-int fd_sess_state_retrieve_internal ( struct session_handler * handler, struct session * session, session_state ** state )
+int fd_sess_state_retrieve ( struct session_handler * handler, struct session * session, struct sess_state ** state )
 {
 	struct fd_list * li;
 	struct state * st = NULL;
--- a/tests/testcnx.c	Sat May 04 17:00:39 2013 +0200
+++ b/tests/testcnx.c	Sat May 04 21:25:27 2013 +0200
@@ -714,7 +714,7 @@
 		#if 0
 		/* For debug: dump the object */
 		fd_log_debug("Dumping CER");
-		fd_msg_dump_walk(0, cer);
+		fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, cer, fd_g_config->cnf_dict, 0, 1));
 		#endif
 		
 		CHECK( 0, fd_msg_bufferize( cer, &cer_buf, &cer_sz ) );
--- a/tests/testdict.c	Sat May 04 17:00:39 2013 +0200
+++ b/tests/testdict.c	Sat May 04 21:25:27 2013 +0200
@@ -191,7 +191,7 @@
 		
 		CHECK(1, obj ? 1 : 0 );
 #if 1
-		fd_dict_dump_object(obj);
+		fd_log_debug("%s", fd_dict_dump_object(FD_DUMP_TEST_PARAMS, obj));
 #endif
 		CHECK( 0, fd_dict_delete(obj) );
 		cntbkp = count;
--- a/tests/testdisp.c	Sat May 04 17:00:39 2013 +0200
+++ b/tests/testdisp.c	Sat May 04 21:25:27 2013 +0200
@@ -698,7 +698,7 @@
 		CHECK( 0, app->flags.acct );
 		
 		#if 0
-		fd_conf_dump();
+		fd_log_debug("%s", fd_conf_dump(FD_DUMP_TEST_PARAMS));
 		#endif
 	}
 	
--- a/tests/testfifo.c	Sat May 04 17:00:39 2013 +0200
+++ b/tests/testfifo.c	Sat May 04 21:25:27 2013 +0200
@@ -558,8 +558,6 @@
 		
 		CHECK( 14, iter );
 		
-		/* fd_fifo_dump(0, "test", queue, NULL); */
-		
 		for (; i < td.nbr; i++) {
 			CHECK( 0, fd_fifo_tryget(queue, &item) );
 			CHECK( i, *item);
--- a/tests/testmesg.c	Sat May 04 17:00:39 2013 +0200
+++ b/tests/testmesg.c	Sat May 04 21:25:27 2013 +0200
@@ -60,8 +60,8 @@
 		
 		#if 0
 		/* For debug: dump the object */
-		fd_log_debug("Dumping Accounting-Request empty message");
-		fd_msg_dump_walk( 0, acr );
+		fd_log_debug("Dumping Accounting-Request empty message:");
+		fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, acr, fd_g_config->cnf_dict, 0, 1));
 		#endif
 	}
 	
@@ -78,9 +78,9 @@
 		#if 0
 		/* For debug: dump the object */
 		fd_log_debug("Dumping Proxy-Info AVP");
-		fd_msg_dump_walk(0, pi);
+		fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, pi, fd_g_config->cnf_dict, 0, 1));
 		fd_log_debug("Dumping dictionary model");
-		fd_dict_dump_object(pi_model);
+		fd_log_debug("%s", fd_dict_dump_object(FD_DUMP_TEST_PARAMS, pi_model));
 		#endif
 		
 	}
@@ -106,7 +106,7 @@
 		#if 0
 		/* For debug: dump the object */
 		fd_log_debug("Dumping Accounting-Request with Proxy-Info AVP at the end");
-		fd_msg_dump_walk(0, acr);
+		fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, acr, fd_g_config->cnf_dict, 0, 1));
 		#endif
 	}
 	
@@ -305,12 +305,12 @@
 				< grouped >
 						*/
 			#if 0
-			fd_dict_dump_object ( gavp );
+			fd_log_debug("%s", fd_dict_dump_object(FD_DUMP_TEST_PARAMS, gavp));
 			#endif
 		}
 		#if 0
 		{
-			fd_dict_dump_object ( vendor );
+			fd_log_debug("%s", fd_dict_dump_object(FD_DUMP_TEST_PARAMS, vendor));
 		}
 		#endif
 	}
@@ -364,7 +364,7 @@
 			CHECK( 0, fd_msg_update_length ( avpi ) );
 			#if 0
 			fd_log_debug("AVP no vendor, value 3.1415:");
-			fd_msg_dump_one(0, avpi);
+			fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0));
 			#endif
 			CHECK( 0, fd_msg_avp_hdr ( avpi, &avpdata ) );
 			CHECK( 12, avpdata->avp_len );
@@ -381,7 +381,7 @@
 			CHECK( 0, fd_msg_update_length ( avpi ) );
 			#if 0
 			fd_log_debug("AVP vendor, value 0x123456789abcdeL:");
-			fd_msg_dump_one(0, avpi);
+			fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0));
 			#endif
 			CHECK( 0, fd_msg_avp_hdr ( avpi, &avpdata ) );
 			CHECK( 20, avpdata->avp_len );
@@ -407,7 +407,7 @@
 				CHECK( 0, fd_msg_avp_setvalue ( avpi, &request.search.enum_value ) );
 				#if 0
 				fd_log_debug("AVP enum i32, value 2 (from const):");
-				fd_msg_dump_one(0, avpi);
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0));
 				#endif
 			}
 			
@@ -428,7 +428,7 @@
 				CHECK( 0, fd_msg_avp_setvalue ( avpi, &request.search.enum_value ) );
 				#if 0
 				fd_log_debug("AVP enum i32, value -5 (from const):");
-				fd_msg_dump_one(0, avpi);
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0));
 				#endif
 				/* Check the size is correct ( 12 for header + 4 for value ) */
 				CHECK( 0, fd_msg_update_length ( avpi ) );
@@ -443,7 +443,7 @@
 			CHECK( 0, fd_msg_update_length ( avpi ) );
 			#if 0
 			fd_log_debug("AVP vendor enum i32, value -10 (not const):");
-			fd_msg_dump_one(0, avpi);
+			fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0));
 			#endif
 			
 			/* Add an octetstring AVP */
@@ -458,7 +458,7 @@
 				CHECK( 0, fd_msg_update_length ( avpi ) );
 				#if 0
 				fd_log_debug("AVP octet string, 'This\\0 is a b...'");
-				fd_msg_dump_one(0, avpi);
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0));
 				#endif
 				CHECK( 0, fd_msg_avp_hdr ( avpi, &avpdata ) );
 				CHECK( 101, avpdata->avp_len );
@@ -487,7 +487,7 @@
 				CHECK( 0, fd_msg_avp_setvalue ( avpi, &request.search.enum_value ) );
 				#if 0
 				fd_log_debug("AVP Enumuerated OctetString (from const):");
-				fd_msg_dump_one(0, avpi);
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0));
 				#endif
 				/* Check the size is correct ( 12 for header + 5 for value ) */
 				CHECK( 0, fd_msg_update_length ( avpi ) );
@@ -512,7 +512,7 @@
 				CHECK( 0, fd_msg_avp_setvalue ( avpi, &request.search.enum_value ) );
 				#if 0
 				fd_log_debug("AVP Enumuerated OctetString (from const):");
-				fd_msg_dump_one(0, avpi);
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpi, fd_g_config->cnf_dict, 0, 0));
 				#endif
 				/* Check the size is correct ( 12 for header + 3 for value ) */
 				CHECK( 0, fd_msg_update_length ( avpi ) );
@@ -534,7 +534,7 @@
 				CHECK( 0, fd_msg_avp_setvalue ( avpch, &value ) );
 				#if 0
 				fd_log_debug("AVP octet string, '1234678'");
-				fd_msg_dump_one(0, avpch);
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpch, fd_g_config->cnf_dict, 0, 0));
 				#endif
 				CHECK( 0, fd_msg_update_length ( avpch ) );
 				CHECK( 0, fd_msg_avp_hdr ( avpch, &avpdata ) );
@@ -547,7 +547,7 @@
 				CHECK( 0, fd_msg_avp_setvalue ( avpch, &value ) );
 				#if 0
 				fd_log_debug("AVP octet string, '12346789'");
-				fd_msg_dump_one(0, avpch);
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, avpch, fd_g_config->cnf_dict, 0, 0));
 				#endif
 			  }
 			
@@ -579,7 +579,7 @@
 			 */
 			CHECK( 0, fd_msg_update_length ( msg ) );
 			#if 0
-			fd_msg_dump_walk(0, msg);
+			fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1));
 			#endif
 			CHECK( 344, msgdata->msg_length );
 			
@@ -659,7 +659,7 @@
 			CPYBUF();
 			CHECK( 0, fd_msg_parse_buffer( &buf_cpy, 344, &msg) );
 			#if 0
-			fd_msg_dump_walk(0, msg);
+			fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1));
 			#endif
 			
 			/* reinit the msg */
@@ -732,7 +732,7 @@
 				CHECK( 0, fd_msg_parse_dict( msg, fd_g_config->cnf_dict, NULL ) );
 				
 				#if 0
-				fd_msg_dump_walk(0, msg);
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1));
 				#endif
 				
 				/* reset */
@@ -768,7 +768,7 @@
 				
 				CHECK( 0, fd_msg_bufferize( msg, &buftmp, NULL ) );				
 				
-				fd_msg_dump_walk(0, msg);
+				fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1));
 				
 				TODO("Check the Failed-AVP is as expected");
 				
@@ -782,7 +782,7 @@
 			CHECK( 0, fd_msg_parse_buffer( &buf, 344, &msg) );
 			CHECK( 0, fd_msg_parse_dict( msg, fd_g_config->cnf_dict, NULL ) );
 			#if 0
-			fd_msg_dump_walk(0, msg);
+			fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1));
 			#endif
 		}
 		
@@ -1335,14 +1335,14 @@
 			
 			/* Okay, now delete the message and parse the buffer, then check we obtain the same values back */
 			#if 0
-			fd_msg_dump_walk(0, msg);
+			fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1));
 			#endif
 			CHECK( 0, fd_msg_free( msg ) );
 			
 			CHECK( 0, fd_msg_parse_buffer( &buf, 148, &msg) );
 			CHECK( 0, fd_msg_parse_dict( msg, fd_g_config->cnf_dict, NULL ) );
 			#if 0
-			fd_msg_dump_walk(0, msg);
+			fd_log_debug("%s", fd_msg_dump_treeview(FD_DUMP_TEST_PARAMS, msg, fd_g_config->cnf_dict, 0, 1));
 			#endif
 			
 			CHECK( 0, fd_msg_browse ( msg, MSG_BRW_FIRST_CHILD, &avp, NULL) );
--- a/tests/testmesg_stress.c	Sat May 04 17:00:39 2013 +0200
+++ b/tests/testmesg_stress.c	Sat May 04 21:25:27 2013 +0200
@@ -196,15 +196,7 @@
 			     *1 [ enumos ]
 				< grouped >
 						*/
-			#if 0
-			fd_dict_dump_object ( gavp );
-			#endif
 		}
-		#if 0
-		{
-			fd_dict_dump_object ( vendor );
-		}
-		#endif
 	}
 	
 	/* Now create some values and check the length is correctly handled */
--- a/tests/testpeers.c	Sat May 04 17:00:39 2013 +0200
+++ b/tests/testpeers.c	Sat May 04 21:25:27 2013 +0200
@@ -56,7 +56,7 @@
 			CHECK( 0, fd_peer_add(&inf, __FILE__, NULL, NULL));
 		}
 	}
-	fd_peer_dump_list(0);
+	fd_log_debug("%s", fd_peer_dump_list(FD_DUMP_TEST_PARAMS, 0));
 	/* Check we are able to find again any of these */
 	{
 		int i;
--- a/tests/tests.h	Sat May 04 17:00:39 2013 +0200
+++ b/tests/tests.h	Sat May 04 21:25:27 2013 +0200
@@ -67,31 +67,36 @@
 
 /* Define the macro to fail a test with a message */
 #define FAILTEST( message... ){				\
-	TRACE_ERROR(message);				\
-	TRACE_ERROR("FAILED: %s ", __STRIPPED_FILE__);	\
+	LOG_F(message);					\
+	LOG_F("FAILED: %s ", __STRIPPED_FILE__);	\
+	free(tbuf);					\
 	exit(FAIL);					\
 }
 
 /* Define the macro to pass a test */
 #define PASSTEST( ){					\
-	TRACE_NOTICE("PASS: %s", __STRIPPED_FILE__);	\
+	LOG_N("PASS: %s", __STRIPPED_FILE__);		\
 	(void)fd_core_shutdown();			\
 	(void)fd_core_wait_shutdown_complete();		\
 	(void)fd_thr_term(&signal_thr);			\
+	free(tbuf);					\
 	exit(PASS);					\
 }
 
-static int test_verbo = 0;
 static struct fd_config conf;
 extern struct fd_config * fd_g_config;
 
+/* for dumps */
+static char * tbuf = NULL; size_t tbuflen = 0;
+#define FD_DUMP_TEST_PARAMS &tbuf, &tbuflen, NULL
+
+
 /* Define the standard check routines */
 #define CHECK( _val, _assert ){				\
-	if (test_verbo > 0) {				\
-		TRACE_NOTICE("CHECK( %s == %s )",	\
+	LOG_D("CHECK( %s == %s )",			\
 				#_assert,		\
 				#_val);			\
-	}{						\
+	{						\
 	__typeof__ (_val) __ret = (_assert);		\
 	if (__ret != (_val)) {				\
 		FAILTEST( "%s:%d: CHECK FAILED : %s == %lx != %lx",	\
@@ -142,11 +147,11 @@
 	while ((c = getopt (argc, argv, "dqnf:F:g:")) != -1) {
 		switch (c) {
 			case 'd':	/* Increase verbosity of debug messages.  */
-				test_verbo++;
+				fd_g_debug_lvl--;
 				break;
 				
 			case 'q':	/* Decrease verbosity.  */
-				test_verbo--;
+				fd_g_debug_lvl++;
 				break;
 			
 			case 'n':	/* Disable the timeout of the test.  */
@@ -177,7 +182,6 @@
 				return;
 		}
 	}
-	fd_g_debug_lvl = (test_verbo > 0) ? (test_verbo - 1) : 0;
 	if (!no_timeout) {
 		alarm(TEST_TIMEOUT);
 	}
--- a/tests/testsess.c	Sat May 04 17:00:39 2013 +0200
+++ b/tests/testsess.c	Sat May 04 21:25:27 2013 +0200
@@ -42,14 +42,14 @@
 #define TEST_SID	(os0_t)TEST_SID_IN
 
 #define TEST_EYEC	0x7e57e1ec
-struct mystate {
+struct sess_state {
 	int	eyec;	/* TEST_EYEC */
 	os0_t   sid; 	/* the session with which the data was registered */
 	int  *  freed;	/* location where to write the freed status */
 	void *  opaque; /* if opaque was provided, this is the value we expect */
 };
 
-static void mycleanup( struct mystate * data, os0_t sid, void * opaque )
+static void mycleanup( struct sess_state * data, os0_t sid, void * opaque )
 {
 	/* sanity */
 	CHECK( 1, sid ? 1 : 0 );
@@ -66,12 +66,12 @@
 	free(data);
 }
 
-static __inline__ struct mystate * new_state(os0_t sid, int *freed) 
+static __inline__ struct sess_state * new_state(os0_t sid, int *freed) 
 {
-	struct mystate *new;
-	new = malloc(sizeof(struct mystate));
+	struct sess_state *new;
+	new = malloc(sizeof(struct sess_state));
 	CHECK( 1, new ? 1 : 0 );
-	memset(new, 0, sizeof(struct mystate));
+	memset(new, 0, sizeof(struct sess_state));
 	new->eyec = TEST_EYEC;
 	new->sid = os0dup(sid, strlen((char *)sid));
 	CHECK( 1, new->sid ? 1 : 0 );
@@ -105,14 +105,14 @@
 	/* Test functions related to handlers (simple situation) */
 	{
 		void * testptr = NULL;
-		CHECK( 0, fd_sess_handler_create ( &hdl1, mycleanup, NULL ) );
-		CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, NULL ) );
+		CHECK( 0, fd_sess_handler_create ( &hdl1, mycleanup, NULL, NULL ) );
+		CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, NULL, NULL ) );
 		CHECK( 0, fd_sess_handler_destroy( &hdl2, &testptr ) );
 		CHECK( 1, testptr == NULL ? 1 : 0 );
-		CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, g_opaque ) );
+		CHECK( 0, fd_sess_handler_create ( &hdl2, mycleanup, NULL, g_opaque ) );
 		#if 0
-		fd_sess_dump_hdl(0, hdl1);
-		fd_sess_dump_hdl(0, hdl2);
+		fd_log_debug("%s\n", fd_sess_dump_hdl(FD_DUMP_TEST_PARAMS, hdl1));
+		fd_log_debug("%s\n", fd_sess_dump_hdl(FD_DUMP_TEST_PARAMS, hdl2));
 		#endif
 	}
 	
@@ -122,8 +122,8 @@
 		CHECK( 0, fd_sess_new( &sess1, TEST_DIAM_ID, CONSTSTRLEN(TEST_DIAM_ID), NULL, 0 ) );
 		CHECK( 0, fd_sess_new( &sess2, TEST_DIAM_ID, CONSTSTRLEN(TEST_DIAM_ID), NULL, 0 ) );
 		#if 0
-		fd_sess_dump(0, sess1);
-		fd_sess_dump(0, sess2);
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1));
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1));
 		#endif
 		
 		/* Check both string start with the diameter Id, but are different */
@@ -140,8 +140,8 @@
 		CHECK( 0, fd_sess_new( &sess1, TEST_DIAM_ID, 0, TEST_OPT, 0 ) );
 		CHECK( 0, fd_sess_new( &sess2, TEST_DIAM_ID, CONSTSTRLEN(TEST_DIAM_ID), TEST_OPT, CONSTSTRLEN(TEST_OPT_IN) - 1 ) );
 		#if 0
-		fd_sess_dump(0, sess1);
-		fd_sess_dump(0, sess2);
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1));
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1));
 		#endif
 		
 		CHECK( 0, fd_sess_getsid(sess1, &str1, &str1len) );
@@ -164,8 +164,8 @@
 		CHECK( sess3, sess1 );
 		CHECK( 0, fd_sess_new( &sess2, NULL, 0, TEST_SID, CONSTSTRLEN(TEST_SID_IN) - 1 ) );
 		#if 0
-		fd_sess_dump(0, sess1);
-		fd_sess_dump(0, sess2);
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1));
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1));
 		#endif
 		CHECK( 0, fd_sess_getsid(sess1, &str1, &str1len) );
 		CHECK( 0, fd_sess_getsid(sess2, &str2, &str2len) );
@@ -210,7 +210,7 @@
 	
 	/* Test fd_sess_reclaim */
 	{
-		struct mystate *tms;
+		struct sess_state *tms;
 		
 		CHECK( 0, fd_sess_fromsid( TEST_SID, CONSTSTRLEN(TEST_SID_IN), &sess1, &new ) );
 		CHECK( 1, new ? 1 : 0 );
@@ -270,7 +270,7 @@
 	
 	/* Test states operations */
 	{
-		struct mystate * ms[6], *tms;
+		struct sess_state * ms[6], *tms;
 		int freed[6];
 		struct timespec timeout;
 		void * testptr = NULL;
@@ -294,7 +294,7 @@
 		CHECK( 1, ms[1] ? 1 : 0 );
 		
 		#if 0
-		fd_sess_dump(0, sess1);
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1));
 		#endif
 		
 		CHECK( 0, fd_sess_state_retrieve( hdl1, sess1, &ms[0] ) );
@@ -331,9 +331,9 @@
 		CHECK( 0, fd_sess_state_store ( hdl2, sess3, &ms[5] ) );
 		
 		#if 0
-		fd_sess_dump(0, sess1);
-		fd_sess_dump(0, sess2);
-		fd_sess_dump(0, sess3);
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1));
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1));
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess3, 1));
 		#endif
 		
 		/* Destroy session 3 */
@@ -356,8 +356,8 @@
 		CHECK( 1, testptr == g_opaque ? 1 : 0 );
 		
 		#if 1
-		fd_sess_dump(0, sess1);
-		fd_sess_dump(0, sess2);
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1));
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1));
 		#endif
 		
 		/* Create again session 3, check that no data is associated to it */
@@ -372,8 +372,8 @@
 		CHECK( 0, clock_gettime(CLOCK_REALTIME, &timeout) );
 		CHECK( 0, fd_sess_settimeout( sess2, &timeout) );
 		#if 1
-		fd_sess_dump(0, sess1);
-		fd_sess_dump(0, sess2);
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess1, 1));
+		fd_log_debug("%s\n", fd_sess_dump(FD_DUMP_TEST_PARAMS, sess2, 1));
 		#endif
 		timeout.tv_sec = 0;
 		timeout.tv_nsec= 50000000; /* 50 ms */
"Welcome to our mercurial repository"