Changeset 892:b2e8f1a3ef76 in freeDiameter
- Timestamp:
- Nov 19, 2012, 4:58:40 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfdproto.h
r891 r892 2025 2025 2026 2026 /* Some flags used in the functions bellow */ 2027 #define AVPFL_SET_BLANK_VALUE 0x01 /* When creating an AVP, initialize its value to a blank area */ 2028 #define AVPFL_MAX AVPFL_SET_BLANK_VALUE /* The biggest valid flag value */ 2027 #define AVPFL_SET_BLANK_VALUE 0x01 /* When creating an AVP, initialize its value to a blank area */ 2028 #define AVPFL_SET_RAWDATA_FROM_AVP 0x02 /* When creating an AVP, initialize its rawdata area from an existing AVP -- it is only blank padding (for error reporting) */ 2029 #define AVPFL_MAX AVPFL_SET_RAWDATA_FROM_AVP /* The biggest valid flag value */ 2029 2030 2030 2031 #define MSGFL_ALLOC_ETEID 0x01 /* When creating a message, a new end-to-end ID is allocated and set in the message */ -
libfdcore/messages.c
r891 r892 241 241 242 242 /* Create a new AVP with a copy of the data of the invalid or missing AVP */ 243 CHECK_FCT( fd_msg_avp_new( NULL, AVPFL_SET_BLANK_VALUE, &optavp_cpy) ); 243 optavp_cpy = optavp; 244 CHECK_FCT( fd_msg_avp_new( NULL, AVPFL_SET_BLANK_VALUE | AVPFL_SET_RAWDATA_FROM_AVP, &optavp_cpy) ); 244 245 245 246 CHECK_FCT( fd_msg_avp_hdr(optavp, &opt_hdr) ); -
libfdproto/messages.c
r891 r892 232 232 } 233 233 234 if (flags & AVPFL_SET_RAWDATA_FROM_AVP) { 235 new->avp_rawlen = (*avp)->avp_public.avp_len - GETAVPHDRSZ( (*avp)->avp_public.avp_flags ); 236 if (new->avp_rawlen) { 237 CHECK_MALLOC( new->avp_rawdata = malloc(new->avp_rawlen) ); 238 memset(new->avp_rawdata, 0xFF, new->avp_rawlen); 239 } 240 } 241 234 242 /* The new object is ready, return */ 235 243 *avp = new; -
tests/testmesg.c
r891 r892 757 757 #if 1 758 758 { 759 unsigned char * buftmp = NULL; 759 760 /* Check the parse or error works as expected */ 760 761 CPYBUF(); … … 767 768 CHECK( EBADMSG, fd_msg_parse_or_error( &msg ) ); 768 769 770 CHECK( 0, fd_msg_bufferize( msg, &buftmp, NULL ) ); 771 772 fd_msg_dump_walk(0, msg); 773 769 774 TODO("Check the Failed-AVP is as expected"); 770 775 771 fd_msg_dump_walk(0, msg);772 776 773 777 /* reset */ 774 778 CHECK( 0, fd_msg_free ( msg ) ); 779 free(buftmp); 775 780 } 776 781 #endif
Note: See TracChangeset
for help on using the changeset viewer.