changeset 301:a10a3403e8bd

Update msg_update_length for cases with unknown AVP or message models (relaying messages)
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 08 Jan 2009 13:45:08 +0900
parents e76031031542
children a660025a3243
files waaad/message.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/waaad/message.c	Thu Jan 08 13:29:13 2009 +0900
+++ b/waaad/message.c	Thu Jan 08 13:45:08 2009 +0900
@@ -1953,7 +1953,6 @@
 /* Compute the lengh of an object and its subtree. */
 int msg_update_length ( void * object )
 {
-	int ret = 0;
 	size_t sz = 0;
 	dict_object_t * model;
 	
@@ -1965,13 +1964,16 @@
 	TRACE_ENTRY("%p", object);
 	
 	/* Get the model of the object. This also validates the object */
-	ret = msg_model ( object, &model );
-	
-	/* Check the object is valid */
-	CHECK_PARAMS(  (ret == 0) && (model != NULL)  );
+	CHECK_FCT( msg_model ( object, &model ) );
 	
 	/* Get the information of the model */
-	CHECK_FCT(  dict_getval(model, &dictdata)  );
+	if (model) {
+		CHECK_FCT(  dict_getval(model, &dictdata)  );
+	} else {
+		/* For unknown AVP, just don't change the size */
+		if (_C(object)->type == _MSG_AVP)
+			return 0;
+	}
 	
 	/* Deal with easy cases: AVPs without children */
 	if ((_C(object)->type == _MSG_AVP) && (dictdata.avpdata.avp_basetype != AVP_TYPE_GROUPED)) {
"Welcome to our mercurial repository"