Changeset 992:80584f0e851a in freeDiameter for libfdproto/messages.c
- Timestamp:
- Mar 18, 2013, 12:22:32 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/messages.c
r979 r992 301 301 } 302 302 303 static int bufferize_avp(unsigned char * buffer, size_t buflen, size_t * offset, struct avp * avp); 304 static int parsebuf_list(unsigned char * buf, size_t buflen, struct fd_list * head); 305 303 306 /* Create answer from a request */ 304 307 int fd_msg_new_answer_from_req ( struct dictionary * dict, struct msg ** msg, int flags ) … … 360 363 } 361 364 365 /* Add all Proxy-Info AVPs from the query if any */ 366 if (! (flags & MSGFL_ANSW_NOPROXYINFO)) { 367 struct avp * avp; 368 CHECK_FCT( fd_msg_browse(qry, MSG_BRW_FIRST_CHILD, &avp, NULL) ); 369 while (avp) { 370 if ( (avp->avp_public.avp_code == AC_PROXY_INFO) 371 && (avp->avp_public.avp_vendor == 0) ) { 372 /* We found a Proxy-Info, need to duplicate it in the answer */ 373 374 /* In order to avoid dealing with all different possibilities of states, we just create a buffer then parse it */ 375 unsigned char * buf = NULL; 376 size_t offset = 0; 377 378 CHECK_FCT( fd_msg_update_length(avp) ); 379 CHECK_MALLOC( buf = malloc(avp->avp_public.avp_len) ); 380 CHECK_FCT( bufferize_avp(buf, avp->avp_public.avp_len, &offset, avp) ); 381 382 /* Now we directly parse this buffer into the new message list */ 383 CHECK_FCT( parsebuf_list(buf, avp->avp_public.avp_len, &ans->msg_chain.children) ); 384 385 /* Done for this AVP */ 386 free(buf); 387 } 388 /* move to next AVP in the message, we can have several Proxy-Info instances */ 389 CHECK_FCT( fd_msg_browse(avp, MSG_BRW_NEXT, &avp, NULL) ); 390 } 391 } 392 362 393 /* associate with query */ 363 394 ans->msg_query = qry;
Note: See TracChangeset
for help on using the changeset viewer.