Index: extensions/_sample/hello.cpp
===================================================================
--- extensions/_sample/hello.cpp	(revision 931)
+++ extensions/_sample/hello.cpp	(revision 904)
@@ -3,5 +3,5 @@
 * Author: Sebastien Decugis <sdecugis@freediameter.net>							 *
 *													 *
-* Copyright (c) 2013, WIDE Project and NICT								 *
+* Copyright (c) 2011, WIDE Project and NICT								 *
 * All rights reserved.											 *
 * 													 *
Index: extensions/acl_wl/aw_conf.l
===================================================================
--- extensions/acl_wl/aw_conf.l	(revision 928)
+++ extensions/acl_wl/aw_conf.l	(revision 741)
@@ -3,5 +3,5 @@
 * Author: Sebastien Decugis <sdecugis@freediameter.net>							 *
 *													 *
-* Copyright (c) 2013, WIDE Project and NICT								 *
+* Copyright (c) 2011, WIDE Project and NICT								 *
 * All rights reserved.											 *
 * 													 *
@@ -93,10 +93,3 @@
 			}
 
-	/* No match */
-<*>[[:alnum:]]+		|	/* This rule is only useful to print a complete token in error messages */
-<*>.			{
-				TRACE_DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
-			 	return LEX_ERROR; 
-			}
-
 %%
Index: extensions/acl_wl/aw_conf.y
===================================================================
--- extensions/acl_wl/aw_conf.y	(revision 928)
+++ extensions/acl_wl/aw_conf.y	(revision 948)
@@ -3,5 +3,5 @@
 * Author: Sebastien Decugis <sdecugis@freediameter.net>							 *
 *													 *
-* Copyright (c) 2013, WIDE Project and NICT								 *
+* Copyright (c) 2011, WIDE Project and NICT								 *
 * All rights reserved.											 *
 * 													 *
@@ -64,5 +64,5 @@
 int aw_conf_handle(char * conffile)
 {
-	extern FILE * aw_confin;
+	FILE * aw_confin;
 	int ret;
 	
@@ -127,9 +127,4 @@
 				fqdn_added++;
 			}
-			| conffile LEX_ERROR
-			{
-				yyerror(&yylloc, conffile, "An error occurred while parsing the configuration file");
-				return EINVAL;
-			}
 			;
 
Index: extensions/app_radgw/rgwx_auth.c
===================================================================
--- extensions/app_radgw/rgwx_auth.c	(revision 928)
+++ extensions/app_radgw/rgwx_auth.c	(revision 740)
@@ -3,5 +3,5 @@
 * Author: Sebastien Decugis <sdecugis@freediameter.net>							 *
 *													 *
-* Copyright (c) 2013, WIDE Project and NICT								 *
+* Copyright (c) 2011, WIDE Project and NICT								 *
 * All rights reserved.											 *
 * 													 *
@@ -458,5 +458,5 @@
 		if (si_len) {
 			/* We already have the Session-Id, just use it */
-			CHECK_FCT( fd_sess_fromsid_msg ( si, si_len, session, NULL) );
+			CHECK_FCT( fd_sess_fromsid ( si, si_len, session, NULL) );
 		} else {
 			/* Create a new Session-Id string */
@@ -496,5 +496,4 @@
 		CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
 		CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_FIRST_CHILD, avp) );
-		CHECK_FCT( fd_msg_sess_set( *diam_fw, *session) );
 	}
 	
Index: extensions/app_radgw/rgwx_sip.c
===================================================================
--- extensions/app_radgw/rgwx_sip.c	(revision 924)
+++ extensions/app_radgw/rgwx_sip.c	(revision 816)
@@ -480,5 +480,4 @@
 	CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
 	CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_FIRST_CHILD, avp) );
-	CHECK_FCT( fd_msg_sess_set( *diam_fw, *session) );
 	
 	/*
Index: extensions/app_sip/registrationtermination.c
===================================================================
--- extensions/app_sip/registrationtermination.c	(revision 924)
+++ extensions/app_sip/registrationtermination.c	(revision 706)
@@ -148,5 +148,13 @@
 	{
 		#define APP_SIP_SID_OPT  "app_sip"
-		CHECK_FCT( fd_msg_new_session( message, (os0_t)APP_SIP_SID_OPT, CONSTSTRLEN(APP_SIP_SID_OPT) ) );
+		CHECK_FCT( fd_sess_new( &sess, fd_g_config->cnf_diamid, fd_g_config->cnf_diamid_len, (os0_t)APP_SIP_SID_OPT, CONSTSTRLEN(APP_SIP_SID_OPT) ));
+		os0_t sid;
+		size_t sidlen;
+		CHECK_FCT( fd_sess_getsid ( sess, &sid, &sidlen ));
+		CHECK_FCT( fd_msg_avp_new ( sip_dict.Session_Id, 0, &avp ));
+		value.os.data = sid;
+		value.os.len  = sidlen;
+		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ));
+		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_FIRST_CHILD, avp ));
 	}
 	
Index: extensions/test_app/ta_bench.c
===================================================================
--- extensions/test_app/ta_bench.c	(revision 928)
+++ extensions/test_app/ta_bench.c	(revision 879)
@@ -3,5 +3,5 @@
 * Author: Sebastien Decugis <sdecugis@freediameter.net>							 *
 *													 *
-* Copyright (c) 2013, WIDE Project and NICT								 *
+* Copyright (c) 2012, WIDE Project and NICT								 *
 * All rights reserved.											 *
 * 													 *
@@ -122,4 +122,5 @@
 	union avp_value val;
 	struct ta_mess_info * mi = NULL;
+	struct session *sess = NULL;
 	
 	TRACE_DEBUG(FULL, "Creating a new message for sending.");
@@ -130,5 +131,5 @@
 	/* Create a new session */
 	#define TEST_APP_SID_OPT  "app_testb"
-	CHECK_FCT_DO( fd_msg_new_session( req, (os0_t)TEST_APP_SID_OPT, CONSTSTRLEN(TEST_APP_SID_OPT) ), goto out );
+	CHECK_FCT_DO( fd_sess_new( &sess, fd_g_config->cnf_diamid, fd_g_config->cnf_diamid_len, (os0_t)TEST_APP_SID_OPT, CONSTSTRLEN(TEST_APP_SID_OPT) ), goto out );
 	
 	/* Create the random value to store with the session */
@@ -142,4 +143,17 @@
 	
 	/* Now set all AVPs values */
+	
+	/* Session-Id */
+	{
+		os0_t sid;
+		size_t sidlen;
+		CHECK_FCT_DO( fd_sess_getsid ( sess, &sid, &sidlen ), goto out );
+		CHECK_FCT_DO( fd_msg_avp_new ( ta_sess_id, 0, &avp ), goto out );
+		val.os.data = sid;
+		val.os.len  = sidlen;
+		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 */
Index: extensions/test_app/ta_cli.c
===================================================================
--- extensions/test_app/ta_cli.c	(revision 930)
+++ extensions/test_app/ta_cli.c	(revision 740)
@@ -3,5 +3,5 @@
 * Author: Sebastien Decugis <sdecugis@freediameter.net>							 *
 *													 *
-* Copyright (c) 2013, WIDE Project and NICT								 *
+* Copyright (c) 2011, WIDE Project and NICT								 *
 * All rights reserved.											 *
 * 													 *
@@ -59,6 +59,4 @@
 	struct avp * avp;
 	struct avp_hdr * hdr;
-	unsigned long dur;
-	int error = 0;
 	
 	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &ts), return );
@@ -82,13 +80,7 @@
 	if (avp) {
 		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
-		if (hdr->avp_value->i32 == mi->randval) {
-			fprintf(stderr, "%x (%s) ", hdr->avp_value->i32, "Ok");
-		} else {
-			fprintf(stderr, "%x (%s) ", hdr->avp_value->i32, "PROBLEM");
-			error++;
-		}
+		fprintf(stderr, "%x (%s) ", hdr->avp_value->i32, (hdr->avp_value->i32 == mi->randval) ? "Ok" : "PROBLEM");
 	} else {
 		fprintf(stderr, "no_Test-AVP ");
-		error++;
 	}
 	
@@ -98,9 +90,6 @@
 		CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return );
 		fprintf(stderr, "Status: %d ", hdr->avp_value->i32);
-		if (hdr->avp_value->i32 != 2001)
-			error++;
 	} else {
 		fprintf(stderr, "no_Result-Code ");
-		error++;
 	}
 	
@@ -112,5 +101,4 @@
 	} else {
 		fprintf(stderr, "no_Origin-Host ");
-		error++;
 	}
 	
@@ -122,32 +110,7 @@
 	} else {
 		fprintf(stderr, "no_Origin-Realm ");
-		error++;
-	}
-	
-	CHECK_POSIX_DO( pthread_mutex_lock(&ta_conf->stats_lock), );
-	dur = ((ts.tv_sec - mi->ts.tv_sec) * 1000000) + ((ts.tv_nsec - mi->ts.tv_nsec) / 1000);
-	if (ta_conf->stats.nb_recv) {
-		/* Ponderate in the avg */
-		ta_conf->stats.avg = (ta_conf->stats.avg * ta_conf->stats.nb_recv + dur) / (ta_conf->stats.nb_recv + 1);
-		/* Min, max */
-		if (dur < ta_conf->stats.shortest)
-			ta_conf->stats.shortest = dur;
-		if (dur > ta_conf->stats.longest)
-			ta_conf->stats.longest = dur;
-	} else {
-		ta_conf->stats.shortest = dur;
-		ta_conf->stats.longest = dur;
-		ta_conf->stats.avg = dur;
-	}
-	
-	if (error)
-		ta_conf->stats.nb_errs++;
-	else 
-		ta_conf->stats.nb_recv++;
-	
-	
-	CHECK_POSIX_DO( pthread_mutex_unlock(&ta_conf->stats_lock), );
-	
-	/* Display how long it took */
+	}
+	
+	/* Now compute how long it took */
 	if (ts.tv_nsec > mi->ts.tv_nsec) {
 		fprintf(stderr, "in %d.%06ld sec", 
@@ -159,4 +122,5 @@
 				(long)(1000000000 + ts.tv_nsec - mi->ts.tv_nsec) / 1000);
 	}
+	
 	fprintf(stderr, "\n");
 	fflush(stderr);
@@ -187,6 +151,5 @@
 	/* Create a new session */
 	#define TEST_APP_SID_OPT  "app_test"
-	CHECK_FCT_DO( fd_msg_new_session( req, (os0_t)TEST_APP_SID_OPT, CONSTSTRLEN(TEST_APP_SID_OPT) ), goto out );
-	CHECK_FCT_DO( fd_msg_sess_get(fd_g_config->cnf_dict, req, &sess, NULL), goto out );
+	CHECK_FCT_DO( fd_sess_new( &sess, fd_g_config->cnf_diamid, fd_g_config->cnf_diamid_len, (os0_t)TEST_APP_SID_OPT, CONSTSTRLEN(TEST_APP_SID_OPT) ), goto out );
 	
 	/* Create the random value to store with the session */
@@ -201,4 +164,17 @@
 	/* Now set all AVPs values */
 	
+	/* Session-Id */
+	{
+		os0_t sid;
+		size_t sidlen;
+		CHECK_FCT_DO( fd_sess_getsid ( sess, &sid, &sidlen ), goto out );
+		CHECK_FCT_DO( fd_msg_avp_new ( ta_sess_id, 0, &avp ), goto out );
+		val.os.data = sid;
+		val.os.len  = sidlen;
+		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 */
 	{
@@ -254,9 +230,4 @@
 	CHECK_FCT_DO( fd_msg_send( &req, ta_cb_ans, svg ), goto out );
 
-	/* Increment the counter */
-	CHECK_POSIX_DO( pthread_mutex_lock(&ta_conf->stats_lock), );
-	ta_conf->stats.nb_sent++;
-	CHECK_POSIX_DO( pthread_mutex_unlock(&ta_conf->stats_lock), );
-
 out:
 	return;
Index: extensions/test_sip/locationinfo.c
===================================================================
--- extensions/test_sip/locationinfo.c	(revision 924)
+++ extensions/test_sip/locationinfo.c	(revision 706)
@@ -42,4 +42,5 @@
 	struct msg * message=NULL;
 	struct avp *avp=NULL;
+	struct session *sess=NULL;
 	union avp_value value;
 	
@@ -61,5 +62,13 @@
 	// Create a new session 
 	{
-		CHECK_FCT( fd_msg_new_session( message, (os0_t)"appsip", CONSTSTRLEN("appsip") ) );
+		CHECK_FCT( fd_sess_new( &sess, fd_g_config->cnf_diamid, fd_g_config->cnf_diamid_len, (os0_t)"appsip", 6 ));
+		os0_t sid;
+		size_t sidlen;
+		CHECK_FCT( fd_sess_getsid ( sess, &sid, &sidlen ));
+		CHECK_FCT( fd_msg_avp_new ( sip_dict.Session_Id, 0, &avp ));
+		value.os.data = sid;
+		value.os.len  = sidlen;
+		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ));
+		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_FIRST_CHILD, avp ));
 	}
 	
Index: extensions/test_sip/locationinfosl.c
===================================================================
--- extensions/test_sip/locationinfosl.c	(revision 924)
+++ extensions/test_sip/locationinfosl.c	(revision 706)
@@ -42,4 +42,5 @@
 	struct msg * message=NULL;
 	struct avp *avp=NULL;
+	struct session *sess=NULL;
 	union avp_value value;
 	
@@ -61,5 +62,13 @@
 	// Create a new session 
 	{
-		CHECK_FCT( fd_msg_new_session( message, (os0_t)"appsip", CONSTSTRLEN("appsip") ) );
+		CHECK_FCT( fd_sess_new( &sess, fd_g_config->cnf_diamid, fd_g_config->cnf_diamid_len, (os0_t)"appsip", 6 ));
+		os0_t sid;
+		size_t sidlen;
+		CHECK_FCT( fd_sess_getsid ( sess, &sid, &sidlen ));
+		CHECK_FCT( fd_msg_avp_new ( sip_dict.Session_Id, 0, &avp ));
+		value.os.data = sid;
+		value.os.len  = sidlen;
+		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ));
+		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_FIRST_CHILD, avp ));
 	}
 	
Index: extensions/test_sip/serverassignment.c
===================================================================
--- extensions/test_sip/serverassignment.c	(revision 924)
+++ extensions/test_sip/serverassignment.c	(revision 706)
@@ -42,4 +42,5 @@
 	struct msg * message=NULL;
 	struct avp *avp=NULL;
+	struct session *sess=NULL;
 	union avp_value value;
 	
@@ -70,5 +71,13 @@
 	// Create a new session 
 	{
-		CHECK_FCT( fd_msg_new_session( message, (os0_t)"appsip", CONSTSTRLEN("appsip") ) );
+		CHECK_FCT( fd_sess_new( &sess, fd_g_config->cnf_diamid, fd_g_config->cnf_diamid_len, (os0_t)"appsip", 6 ));
+		os0_t sid;
+		size_t sidlen;
+		CHECK_FCT( fd_sess_getsid ( sess, &sid, &sidlen ));
+		CHECK_FCT( fd_msg_avp_new ( sip_dict.Session_Id, 0, &avp ));
+		value.os.data = sid;
+		value.os.len  = sidlen;
+		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ));
+		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_FIRST_CHILD, avp ));
 	}
 	
Index: extensions/test_sip/userauthorization.c
===================================================================
--- extensions/test_sip/userauthorization.c	(revision 924)
+++ extensions/test_sip/userauthorization.c	(revision 706)
@@ -42,4 +42,5 @@
 	struct msg * message=NULL;
 	struct avp *avp=NULL;
+	struct session *sess=NULL;
 	union avp_value value;
 	
@@ -66,5 +67,13 @@
 	// Create a new session 
 	{
-		CHECK_FCT( fd_msg_new_session( message, (os0_t)"appsip", CONSTSTRLEN("appsip") ) );
+		CHECK_FCT( fd_sess_new( &sess, fd_g_config->cnf_diamid, fd_g_config->cnf_diamid_len, (os0_t)"appsip", 6 ));
+		os0_t sid;
+		size_t sidlen;
+		CHECK_FCT( fd_sess_getsid ( sess, &sid, &sidlen ));
+		CHECK_FCT( fd_msg_avp_new ( sip_dict.Session_Id, 0, &avp ));
+		value.os.data = sid;
+		value.os.len  = sidlen;
+		CHECK_FCT( fd_msg_avp_setvalue( avp, &value ));
+		CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_FIRST_CHILD, avp ));
 	}
 	
