diff libfdproto/messages.c @ 1098:f38d77f9cfd3

Initial implementation of the hook mechanism
author Sebastien Decugis <sdecugis@freediameter.net>
date Thu, 09 May 2013 11:59:34 +0800
parents 97a257c80de0
children 40b48a3997a2
line wrap: on
line diff
--- a/libfdproto/messages.c	Mon May 06 18:49:59 2013 +0800
+++ b/libfdproto/messages.c	Thu May 09 11:59:34 2013 +0800
@@ -136,7 +136,7 @@
 		}		 msg_cb;		/* Callback to be called when an answer is received, or timeout expires, if not NULL */
 	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 fd_msg_pmdl	 msg_pmdl;		/* list of permessagedata structures. */
 };
 
 /* Macro to compute the message header size */
@@ -673,6 +673,10 @@
 		CHECK_FCT_DO( fd_sess_reclaim_msg ( &_M(obj)->msg_sess ), /* continue */);
 	}
 	
+	if ((obj->type == MSG_MSG) && (_M(obj)->msg_pmdl.sentinel.o != NULL)) {
+		((void (*)(struct fd_msg_pmdl *))_M(obj)->msg_pmdl.sentinel.o)(&_M(obj)->msg_pmdl);
+	}
+	
 	/* free the object */
 	free(obj);
 	
@@ -1497,6 +1501,13 @@
 	return 0;
 }
 
+/* Retrieve the location of the pmd list for the message; return NULL if failed */
+struct fd_msg_pmdl * fd_msg_pmdl_get(struct msg * msg)
+{
+	CHECK_PARAMS_DO( CHECK_MSG(msg), return NULL );
+	return &msg->msg_pmdl;
+}
+
 
 /******************* End-to-end counter *********************/
 static uint32_t fd_eteid;
"Welcome to our mercurial repository"