Index: libfdproto/CMakeLists.txt
===================================================================
--- libfdproto/CMakeLists.txt	(revision 922)
+++ libfdproto/CMakeLists.txt	(revision 1078)
@@ -13,5 +13,4 @@
 	log.c
 	messages.c
-	msg_log.c
 	ostr.c
 	portability.c
Index: libfdproto/dispatch.c
===================================================================
--- libfdproto/dispatch.c	(revision 1017)
+++ libfdproto/dispatch.c	(revision 1078)
@@ -97,5 +97,5 @@
 		CHECK_FCT_DO( (r = (*hdl->cb)(msg, avp, sess, hdl->opaque, action)),
 			{
-				fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: a DISPATCH callback returned an error (%s)", strerror(r));
+				//fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: a DISPATCH callback returned an error (%s)", strerror(r));
 				fd_msg_free(*msg);
 				*msg = NULL;
Index: libfdproto/fifo.c
===================================================================
--- libfdproto/fifo.c	(revision 1073)
+++ libfdproto/fifo.c	(revision 1067)
@@ -152,5 +152,5 @@
 		for (li = queue->list.next; li != &queue->list; li = li->next) {
 			struct fifo_item * fi = (struct fifo_item *)li;
-			fd_log_debug("  [%i] item %p in fifo %p, posted:%ld.%06ld", 
+			fd_log_debug("  [%i] item %p in fifo %p, posted:ld.%06ld", 
 				i++, fi->item.o, queue, (long)fi->posted_on.tv_sec,(long)(fi->posted_on.tv_nsec/1000));
 			(*dump_item)(level, fi->item.o);
@@ -284,9 +284,32 @@
 }
 
-/* Get the information on the queue */
-int fd_fifo_getstats( struct fifo * queue, int * current_count, int * limit_count, int * highest_count, long long * total_count, 
-				           struct timespec * total, struct timespec * blocking, struct timespec * last)
-{
-	TRACE_ENTRY( "%p %p %p %p %p %p %p %p", queue, current_count, limit_count, highest_count, total_count, total, blocking, last);
+/* Get the length of the queue */
+int fd_fifo_length ( struct fifo * queue, int * length, int * max )
+{
+	TRACE_ENTRY( "%p %p %p", queue, length, max );
+	
+	/* Check the parameters */
+	CHECK_PARAMS( CHECK_FIFO( queue ) && length );
+	
+	/* lock the queue */
+	CHECK_POSIX(  pthread_mutex_lock( &queue->mtx )  );
+	
+	/* Retrieve the count */
+	*length = queue->count;
+	
+	if (max)
+		*max = queue->max;
+	
+	/* Unlock */
+	CHECK_POSIX(  pthread_mutex_unlock( &queue->mtx )  );
+	
+	/* Done */
+	return 0;
+}
+
+/* Get the timings */
+int fd_fifo_getstats( struct fifo * queue, long long *items, struct timespec * total, struct timespec * blocking, struct timespec * last)
+{
+	TRACE_ENTRY( "%p %p %p %p %p", queue, items, total, blocking, last);
 	
 	/* Check the parameters */
@@ -296,15 +319,6 @@
 	CHECK_POSIX(  pthread_mutex_lock( &queue->mtx )  );
 	
-	if (current_count)
-		*current_count = queue->count;
-	
-	if (limit_count)
-		*limit_count = queue->max;
-	
-	if (highest_count)
-		*highest_count = queue->highest_ever;
-	
-	if (total_count)
-		*total_count = queue->total_items;
+	if (items)
+		*items = queue->total_items;
 	
 	if (total)
@@ -326,5 +340,5 @@
 
 /* alternate version with no error checking */
-int fd_fifo_length ( struct fifo * queue )
+int fd_fifo_length_noerr ( struct fifo * queue )
 {
 	if ( !CHECK_FIFO( queue ) )
Index: libfdproto/messages.c
===================================================================
--- libfdproto/messages.c	(revision 1062)
+++ libfdproto/messages.c	(revision 1078)
@@ -129,6 +129,4 @@
 	DiamId_t		 msg_src_id;		/* Diameter Id of the peer this message was received from. This string is malloc'd and must be freed */
 	size_t			 msg_src_id_len;	/* cached length of this string */
-	struct timespec		 msg_ts_rcv;		/* Timestamp when this message was received from the network */
-	struct timespec		 msg_ts_sent;		/* Timestamp when this message was sent to the network */
 	
 };
@@ -734,15 +732,4 @@
 	}
 	
-	if ((msg->msg_ts_rcv.tv_sec != 0) || (msg->msg_ts_rcv.tv_nsec != 0)) {
-		tsoffset += strftime(buftime + tsoffset, sizeof(buftime) - tsoffset, "%D,%T", localtime_r( &msg->msg_ts_rcv.tv_sec , &tm ));
-		tsoffset += snprintf(buftime + tsoffset, sizeof(buftime) - tsoffset, ".%6.6ld", msg->msg_ts_rcv.tv_nsec / 1000);
-		CHECK_FCT( dump_add_str(outstr, offset, outlen, INOBJHDR "Received: %s|", INOBJHDRVAL, buftime) );
-	}
-	if ((msg->msg_ts_sent.tv_sec != 0) || (msg->msg_ts_sent.tv_nsec != 0)) {
-		tsoffset += strftime(buftime + tsoffset, sizeof(buftime) - tsoffset, "%D,%T", localtime_r( &msg->msg_ts_sent.tv_sec , &tm ));
-		tsoffset += snprintf(buftime + tsoffset, sizeof(buftime) - tsoffset, ".%6.6ld", msg->msg_ts_sent.tv_nsec / 1000);
-		CHECK_FCT( dump_add_str(outstr, offset, outlen, INOBJHDR "Sent    : %s|", INOBJHDRVAL, buftime) );
-	}
-	
 	if (!msg->msg_model) {
 		
@@ -998,5 +985,6 @@
 
 /* Dump full message */
-void fd_msg_dump_full ( int level, struct dictionary *dict, const char *prefix, msg_or_avp *obj )
+// TODO: need align with new prototype & behavior
+void fd_msg_dump_full_TODO ( int level, struct dictionary *dict, const char *prefix, msg_or_avp *obj )
 {
 	msg_or_avp * ref = obj;
@@ -1361,52 +1349,4 @@
 	
 	/* done */
-	return 0;
-}
-
-int fd_msg_ts_set_recv( struct msg * msg, struct timespec * ts )
-{
-	TRACE_ENTRY("%p %p", msg, ts);
-	
-	/* Check we received valid parameters */
-	CHECK_PARAMS( CHECK_MSG(msg) );
-	CHECK_PARAMS( ts );
-	
-	memcpy(&msg->msg_ts_rcv, ts, sizeof(struct timespec));
-	return 0;
-}
-
-int fd_msg_ts_get_recv( struct msg * msg, struct timespec * ts )
-{
-	TRACE_ENTRY("%p %p", msg, ts);
-	
-	/* Check we received valid parameters */
-	CHECK_PARAMS( CHECK_MSG(msg) );
-	CHECK_PARAMS( ts );
-	
-	memcpy(ts, &msg->msg_ts_rcv, sizeof(struct timespec));
-	return 0;
-}
-
-int fd_msg_ts_set_sent( struct msg * msg, struct timespec * ts )
-{
-	TRACE_ENTRY("%p %p", msg, ts);
-	
-	/* Check we received valid parameters */
-	CHECK_PARAMS( CHECK_MSG(msg) );
-	CHECK_PARAMS( ts );
-	
-	memcpy(&msg->msg_ts_sent, ts, sizeof(struct timespec));
-	return 0;
-}
-
-int fd_msg_ts_get_sent( struct msg * msg, struct timespec * ts )
-{
-	TRACE_ENTRY("%p %p", msg, ts);
-	
-	/* Check we received valid parameters */
-	CHECK_PARAMS( CHECK_MSG(msg) );
-	CHECK_PARAMS( ts );
-	
-	memcpy(ts, &msg->msg_ts_sent, sizeof(struct timespec));
 	return 0;
 }
@@ -2639,5 +2579,5 @@
 			*action = DISP_ACT_ERROR;
 		} else {
-			fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: Received this answer to a local query with an unsupported application %d", (*msg)->msg_public.msg_appl);
+			//fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: Received this answer to a local query with an unsupported application %d", (*msg)->msg_public.msg_appl);
 			fd_msg_free(*msg);
 			*msg = NULL;
Index: libfdproto/msg_log.c
===================================================================
--- libfdproto/msg_log.c	(revision 974)
+++ 	(revision )
@@ -1,206 +1,0 @@
-/*********************************************************************************************************
-* Software License Agreement (BSD License)                                                               *
-* Author: Sebastien Decugis <sdecugis@freediameter.net>							 *
-*													 *
-* Copyright (c) 2013, 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.								 *
-*********************************************************************************************************/
-
-/* messages logging facility */
-#include "fdproto-internal.h"
-#include <stdarg.h>
-
-/* Configuration of this module */
-static struct {
-	struct {
-		enum fd_msg_log_method 	meth;
-		const char * 		metharg;
-	} causes[FD_MSG_LOG_MAX + 1];
-	pthread_mutex_t lock;
-	int		init;
-	struct dictionary *dict;	
-} ml_conf = { .lock = PTHREAD_MUTEX_INITIALIZER, .init = 0 };
-
-
-/* Initialize the module, with a dictionary to use to better parse the messages */
-void fd_msg_log_init(struct dictionary *dict) 
-{
-	memset(&ml_conf.causes, 0, sizeof(ml_conf.causes));
-	ml_conf.init = 1;
-	ml_conf.dict = dict;
-}
-
-/* Set a configuration property */
-int fd_msg_log_config(enum fd_msg_log_cause cause, enum fd_msg_log_method method, const char * arg)
-{
-	/* Check the parameters are valid */
-	TRACE_ENTRY("%d %d %p", cause, method, arg);
-	CHECK_PARAMS( (cause >= 0) && (cause <= FD_MSG_LOG_MAX) );
-	CHECK_PARAMS( (method >= FD_MSG_LOGTO_NONE) && (method <= FD_MSG_LOGTO_DIR) );
-	CHECK_PARAMS( (method == FD_MSG_LOGTO_NONE) || (method == FD_MSG_LOGTO_DEBUGONLY) || (arg != NULL) );
-	
-	/* Lock the configuration */
-	CHECK_POSIX( pthread_mutex_lock(&ml_conf.lock) );
-	if (!ml_conf.init) {
-		ASSERT(0);
-	}
-	
-	/* Now set the parameter */
-	ml_conf.causes[cause].meth = method;
-	ml_conf.causes[cause].metharg = arg;
-	
-	if (method) {
-		TRACE_DEBUG(INFO, "Logging %s messages set to %s '%s'", 
-			(cause == FD_MSG_LOG_DROPPED) ? "DROPPED" :
-				(cause == FD_MSG_LOG_RECEIVED) ? "RECEIVED" :
-					(cause == FD_MSG_LOG_SENT) ? "SENT" :
-					(cause == FD_MSG_LOG_NODELIVER) ? "NODELIVER" :
-					(cause == FD_MSG_LOG_TIMING) ? "TIMING" :
-						"???",
-			(method == FD_MSG_LOGTO_NONE) ? "none" :
-				(method == FD_MSG_LOGTO_DEBUGONLY) ? "debug" :
-				(method == FD_MSG_LOGTO_FILE) ? "file" :
-				(method == FD_MSG_LOGTO_DIR) ? "directory" :
-					"???",
-			arg);
-	}
-	
-	CHECK_POSIX( pthread_mutex_unlock(&ml_conf.lock) );
-	
-	/* Done */
-	return 0;
-}
-
-/* Do not log anything within this one, since log lock is held */
-static void fd_cleanup_mutex_silent( void * mutex )
-{
-	(void)pthread_mutex_unlock((pthread_mutex_t *)mutex);
-}
-
-/* Really log the message */
-void fd_msg_log( enum fd_msg_log_cause cause, struct msg * msg, const char * prefix_format, ... )
-{
-	va_list ap;
-	enum fd_msg_log_method 	meth;
-	const char * 		metharg;
-	FILE * fstr;
-	
-	char buftime[256];
-	size_t offset = 0;
-	struct timespec ts;
-	struct tm tm;
-	
-	TRACE_ENTRY("%d %p %p", cause, msg, prefix_format);
-	CHECK_PARAMS_DO( (cause >= 0) && (cause <= FD_MSG_LOG_MAX),
-	{
-		TRACE_DEBUG(INFO, "Invalid cause received (%d)! Message was:", cause);
-		fd_msg_dump_walk(INFO, msg);
-	} );
-	
-	/* First retrieve the config for this message */
-	CHECK_POSIX_DO( pthread_mutex_lock(&ml_conf.lock), );
-	if (!ml_conf.init) {
-		ASSERT(0);
-	}
-	meth    = ml_conf.causes[cause].meth;
-	metharg = ml_conf.causes[cause].metharg;
-	CHECK_POSIX_DO( pthread_mutex_unlock(&ml_conf.lock), );
-	
-	/* Return now when loging is not requested */
-	if ((meth == FD_MSG_LOGTO_NONE) 
-	 || ((meth == FD_MSG_LOGTO_DEBUGONLY) && (fd_g_debug_lvl < INFO))) {
-		return;
-	}
-	
-	/* Get current time */
-	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &ts), /* continue */);
-	offset += strftime(buftime + offset, sizeof(buftime) - offset, "%D,%T", localtime_r( &ts.tv_sec , &tm ));
-	offset += snprintf(buftime + offset, sizeof(buftime) - offset, ".%6.6ld", ts.tv_nsec / 1000);
-	
-
-	/* Okay, now we will create the file descriptor */
-	switch (meth) {
-		case FD_MSG_LOGTO_DEBUGONLY:
-			fstr = fd_g_debug_fstr;
-			break;
-			
-		case FD_MSG_LOGTO_FILE:
-			TODO("Log to arg file");
-			TODO("Log a note to debug stream");
-			TRACE_DEBUG(INFO, "%s", metharg);
-			break;
-		case FD_MSG_LOGTO_DIR:
-			TODO("Log to arg directory in a new file");
-			TODO("Log a note to debug stream");
-			break;
-		default:
-			break;
-	}
-	
-	/* For file methods, let's parse the message so it looks better */
-	if (((meth != FD_MSG_LOGTO_DEBUGONLY) || (fd_g_debug_lvl > FULL)) && ml_conf.dict) {
-		CHECK_FCT_DO( fd_msg_parse_dict( msg, ml_conf.dict, NULL ), );
-	}
-	
-	/* Then dump the prefix message to this stream, & to debug stream */
-	(void)pthread_mutex_lock(&fd_log_lock);
-	pthread_cleanup_push(fd_cleanup_mutex_silent, &fd_log_lock);
-	fprintf( fstr, "\n");
-	va_start(ap, prefix_format);
-	vfprintf( fstr, prefix_format, ap);
-	va_end(ap);
-	fflush(fstr);
-	pthread_cleanup_pop(0);
-	(void)pthread_mutex_unlock(&fd_log_lock);
-	
-	fd_log_debug_fstr(fstr, " Logged: %s", buftime);
-	
-	/* And now the message itself */
-	if ((meth == FD_MSG_LOGTO_DEBUGONLY) && (fd_g_debug_lvl <= INFO)) {
-		/* dump only the header */
-		fd_msg_dump_fstr_one(msg, fstr);
-	} else {
-		/* dump the full content */
-		fd_msg_dump_fstr(msg, fstr);
-	}
-	
-	/* And finally close the stream if needed */
-	switch (meth) {
-		case FD_MSG_LOGTO_FILE:
-			TODO("close?");
-			break;
-		case FD_MSG_LOGTO_DIR:
-			TODO("close?");
-			break;
-		default:
-			break;
-	}
-}
-
Index: libfdproto/ostr.c
===================================================================
--- libfdproto/ostr.c	(revision 1070)
+++ libfdproto/ostr.c	(revision 1068)
@@ -188,5 +188,5 @@
 int fd_os_validate_DiameterIdentity(char ** id, size_t * inoutsz, int memory)
 {
-#if !defined(DIAMID_IDNA_IGNORE) && !defined(DIAMID_IDNA_REJECT)
+#if defined(DIAMID_IDNA_IGNORE) || defined(DIAMID_IDNA_REJECT)
 	int gotsize = 0;
 #endif /* defined(DIAMID_IDNA_IGNORE) || defined(DIAMID_IDNA_REJECT) */
@@ -197,5 +197,5 @@
 	if (!*inoutsz)
 		*inoutsz = strlen(*id);
-#if !defined(DIAMID_IDNA_IGNORE) && !defined(DIAMID_IDNA_REJECT)
+#if defined(DIAMID_IDNA_IGNORE) || defined(DIAMID_IDNA_REJECT)
 	else
 		gotsize = 1;
