Changeset 1093:44f3e48dfe27 in freeDiameter for include
- Timestamp:
- May 6, 2013, 5:33:22 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfdproto.h
r1088 r1093 222 222 223 223 224 /* Helper functions for the *dump functions that add into a buffer */ 225 char * fd_dump_extend(char ** buf, size_t *len, size_t *offset, const char * format, ... ) _ATTRIBUTE_PRINTFLIKE_(4,5); 226 char * fd_dump_extend_hexdump(char ** buf, size_t *len, size_t *offset, uint8_t *data, size_t datalen, size_t trunc, size_t wrap ); 227 228 /* All dump functions follow the same prototype: 229 * PARAMETERS: 230 * buf : *buf can be NULL on entry, it will be malloc'd. Otherwise it can be realloc'd if needed. 224 /* All dump functions follow this same prototype: 225 * PARAMETERS: 226 * buf : *buf can be NULL on entry, it will be malloc'd. Otherwise it is realloc'd if needed. 231 227 * len : the current size of the buffer (in/out) 232 228 * offset: (optional) if provided, starts writing dump at offset in the buffer, and updated upon exit. if NULL, starts at offset O. … … 234 230 * RETURN VALUE: 235 231 * *buf upon success, NULL upon failure. 236 * After the buffer has been used, it should be freed. 232 * 233 * REMARKS: 234 * - After the buffer has been used, it should be freed. 235 * - Depending on the function, the created string may be multi-line. However, it should never be terminated with a '\n'. 237 236 */ 238 237 #define DECLARE_FD_DUMP_PROTOTYPE( function_name, args... ) \ 239 238 char * function_name(char ** buf, size_t *len, size_t *offset, ##args) 240 239 240 241 /* Helper functions for the *dump functions that add into a buffer */ 242 DECLARE_FD_DUMP_PROTOTYPE( fd_dump_extend, const char * format, ... ) _ATTRIBUTE_PRINTFLIKE_(4,5); 243 DECLARE_FD_DUMP_PROTOTYPE( fd_dump_extend_hexdump, uint8_t *data, size_t datalen, size_t trunc, size_t wrap ); 244 245 246 /* Some helpers macro for writing such *_dump routine */ 241 247 #define FD_DUMP_STD_PARAMS buf, len, offset 248 #define FD_DUMP_HANDLE_OFFSET() size_t o = 0; if (!offset) offset = &o 249 #define FD_DUMP_HANDLE_TRAIL() while ((*buf) && (*offset > 0) && ((*buf)[*offset - 1] == '\n')) { *offset -= 1; (*buf)[*offset] = '\0'; } 250 242 251 243 252 … … 1016 1025 VENDOR_BY_ID = 10, /* "what" points to a vendor_id_t */ 1017 1026 VENDOR_BY_NAME, /* "what" points to a char * */ 1018 VENDOR_OF_APPLICATION /* "what" points to a struct dict_object containing an application (see below) */ 1027 VENDOR_OF_APPLICATION, /* "what" points to a struct dict_object containing an application (see below) */ 1028 VENDOR_OF_AVP, /* "what" points to a struct dict_object containing an avp (see below) */ 1019 1029 }; 1020 1030 … … 1405 1415 1406 1416 /* For dumping flags and values */ 1407 #define DUMP_AVPFL_str "%c%c" 1408 #define DUMP_AVPFL_val(_val) (_val & AVP_FLAG_VENDOR)?'V':'-' , (_val & AVP_FLAG_MANDATORY)?'M':'-' 1417 #define DUMP_AVPFL_str "%c%c%s%s%s%s%s%s" 1418 #define DUMP_AVPFL_val(_val) (_val & AVP_FLAG_VENDOR)?'V':'-' , (_val & AVP_FLAG_MANDATORY)?'M':'-', \ 1419 (_val & AVP_FLAG_RESERVED3)?"3":"", (_val & AVP_FLAG_RESERVED4)?"4":"", \ 1420 (_val & AVP_FLAG_RESERVED5)?"5":"", (_val & AVP_FLAG_RESERVED6)?"6":"", (_val & AVP_FLAG_RESERVED7)?"7":"", (_val & AVP_FLAG_RESERVED8)?"8":"" 1409 1421 1410 1422 /* Type to hold data associated to an avp */ … … 1555 1567 1556 1568 /* For dumping flags and values */ 1557 #define DUMP_CMDFL_str "%c%c%c%c" 1558 #define DUMP_CMDFL_val(_val) (_val & CMD_FLAG_REQUEST)?'R':'-' , (_val & CMD_FLAG_PROXIABLE)?'P':'-' , (_val & CMD_FLAG_ERROR)?'E':'-' , (_val & CMD_FLAG_RETRANSMIT)?'T':'-' 1569 #define DUMP_CMDFL_str "%c%c%c%c%s%s%s%s" 1570 #define DUMP_CMDFL_val(_val) (_val & CMD_FLAG_REQUEST)?'R':'-' , (_val & CMD_FLAG_PROXIABLE)?'P':'-' , (_val & CMD_FLAG_ERROR)?'E':'-' , (_val & CMD_FLAG_RETRANSMIT)?'T':'-', \ 1571 (_val & CMD_FLAG_RESERVED5)?"5":"", (_val & CMD_FLAG_RESERVED6)?"6":"", (_val & CMD_FLAG_RESERVED7)?"7":"", (_val & CMD_FLAG_RESERVED8)?"8":"" 1559 1572 1560 1573 /* Type to hold data associated to a command */
Note: See TracChangeset
for help on using the changeset viewer.