Changeset 992:80584f0e851a in freeDiameter
- Timestamp:
- Mar 18, 2013, 12:22:32 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfdproto.h
r981 r992 2143 2143 #define MSGFL_ANSW_ERROR 0x02 /* When creating an answer message, set the 'E' bit and use the generic error ABNF instead of command-specific ABNF */ 2144 2144 #define MSGFL_ANSW_NOSID 0x04 /* When creating an answer message, do not add the Session-Id even if present in request */ 2145 #define MSGFL_MAX MSGFL_ANSW_NOSID /* The biggest valid flag value */ 2145 #define MSGFL_ANSW_NOPROXYINFO 0x08 /* When creating an answer message, do not add the Proxy-Info AVPs presents in request */ 2146 #define MSGFL_MAX MSGFL_ANSW_NOPROXYINFO /* The biggest valid flag value */ 2146 2147 2147 2148 /**************************************************/ … … 2152 2153 * 2153 2154 * PARAMETERS: 2154 * model : Pointer to a DICT_AVP dictionary object describing the avp to create, or NULL .2155 * flags : Flags to use in creation (AVPFL_* ).2156 * avp : Upon success, pointer to the new avp is stored here. 2155 * model : Pointer to a DICT_AVP dictionary object describing the avp to create, or NULL if flags are used. 2156 * flags : Flags to use in creation (AVPFL_*, see above). 2157 * avp : Upon success, pointer to the new avp is stored here. It points to reference AVP upon function call when flags are used. 2157 2158 * 2158 2159 * DESCRIPTION: … … 2193 2194 * msg : The location of the query on function call. Updated by the location of answer message on return. 2194 2195 * flag : Pass MSGFL_ANSW_ERROR to indicate if the answer is an error message (will set the 'E' bit) 2196 * : See other MSGFL_ANSW_* definition above for other flags. 2195 2197 * 2196 2198 * DESCRIPTION: -
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.