Changes in include/freeDiameter/libfreeDiameter.h [29:5ba91682f0bc:20:277ec00d793e] in freeDiameter
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfreeDiameter.h
r29 r20 120 120 * 121 121 * PARAMETERS: 122 * ts : The timestamp to log, or NULL for "now"123 122 * buf : An array where the time must be stored 124 123 * len : size of the buffer 125 124 * 126 125 * DESCRIPTION: 127 * Writes the timestamp (in human readable format) in a buffer.126 * Writes the current timestamp (in human readable format) in a buffer. 128 127 * 129 128 * RETURN VALUE: 130 129 * pointer to buf. 131 130 */ 132 char * fd_log_time ( struct timespec * ts,char * buf, size_t len );131 char * fd_log_time ( char * buf, size_t len ); 133 132 134 133 … … 174 173 fd_log_debug("\t | tid:%-20s\t%s\tin %s@%s:%d\n" \ 175 174 "\t%s|%*s" format "\n", \ 176 __thn, fd_log_time( NULL,__buf, sizeof(__buf)), __PRETTY_FUNCTION__, __FILE__, __LINE__, \175 __thn, fd_log_time(__buf, sizeof(__buf)), __PRETTY_FUNCTION__, __FILE__, __LINE__, \ 177 176 (level < FULL)?"@":" ",level, "", ## args); \ 178 177 } \ … … 181 180 /* Helper for function entry -- for very detailed trace of the execution */ 182 181 #define TRACE_ENTRY(_format,_args... ) \ 183 TRACE_DEBUG(FCTS, " [enter] %s(" _format ") {" #_args "}", __PRETTY_FUNCTION__, ##_args );182 TRACE_DEBUG(FCTS, "->%s (" #_args ") = (" _format ") >", __PRETTY_FUNCTION__, ##_args ); 184 183 185 184 /* Helper for debugging by adding traces -- for debuging a specific location of the code */ … … 329 328 flag); \ 330 329 if (__rc) \ 331 fd_log_debug( "%s",(char *)gai_strerror(__rc)); \330 fd_log_debug((char *)gai_strerror(__rc)); \ 332 331 else \ 333 fd_log_debug( "%s", &__addrbuf[0]);\332 fd_log_debug(&__addrbuf[0]); \ 334 333 } else { \ 335 334 fd_log_debug("(NULL / ANY)"); \ 336 335 } \ 337 336 } 338 /* Same but with the port (service) also */ 339 #define sSA_DUMP_NODE_SERV( sa, flag ) { \ 340 sSA * __sa = (sSA *)(sa); \ 341 char __addrbuf[INET6_ADDRSTRLEN]; \ 342 char __servbuf[32]; \ 343 if (__sa) { \ 344 int __rc = getnameinfo(__sa, \ 345 sizeof(sSS), \ 346 __addrbuf, \ 347 sizeof(__addrbuf), \ 348 __servbuf, \ 349 sizeof(__servbuf), \ 350 flag); \ 351 if (__rc) \ 352 fd_log_debug("%s", (char *)gai_strerror(__rc)); \ 353 else \ 354 fd_log_debug("[%s]:%s", &__addrbuf[0],&__servbuf[0]); \ 355 } else { \ 356 fd_log_debug("(NULL / ANY)"); \ 357 } \ 358 } 359 /* Inside a debug trace */ 360 #define TRACE_DEBUG_sSA(level, prefix, sa, flags, suffix ) { \ 361 if ( TRACE_BOOL(level) ) { \ 362 char __buf[25]; \ 363 char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed"); \ 364 fd_log_debug("\t | tid:%-20s\t%s\tin %s@%s:%d\n" \ 365 "\t%s|%*s" prefix , \ 366 __thn, fd_log_time(NULL, __buf, sizeof(__buf)), __PRETTY_FUNCTION__, __FILE__, __LINE__,\ 367 (level < FULL)?"@":" ",level, ""); \ 368 sSA_DUMP_NODE_SERV( sa, flags ); \ 369 fd_log_debug(suffix "\n"); \ 370 } \ 371 } 372 337 /* if needed, add sSA_DUMP_SERVICE */ 373 338 374 339 /* A l4 protocol name (TCP / SCTP) */ … … 425 390 ( ((ts1)->tv_sec < (ts2)->tv_sec ) \ 426 391 || (((ts1)->tv_sec == (ts2)->tv_sec ) && ((ts1)->tv_nsec < (ts2)->tv_nsec) )) 427 428 429 /* Trace a binary buffer content */430 #define TRACE_DEBUG_BUFFER(level, prefix, buf, bufsz, suffix ) { \431 if ( TRACE_BOOL(level) ) { \432 int __i; \433 size_t __sz = (size_t)(bufsz); \434 uint8_t * __buf = (uint8_t *)(buf); \435 char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed"); \436 fd_log_debug("\t | tid:%-20s\t%s\tin %s@%s:%d\n" \437 "\t%s|%*s" prefix , \438 __thn, fd_log_time(NULL, __buf, sizeof(__buf)), __PRETTY_FUNCTION__, __FILE__, __LINE__,\439 (level < FULL)?"@":" ",level, ""); \440 for (__i = 0; __i < __sz; __i++) { \441 fd_log_debug("%02.2hhx", __buf[__i]); \442 } \443 fd_log_debug(suffix "\n"); \444 } \445 }446 447 392 448 393 … … 470 415 471 416 if (th_ret != NULL) { 472 TRACE_DEBUG( ANNOYING, "The thread returned the following value: %p (ignored)", th_ret);417 TRACE_DEBUG(FULL, "The thread returned the following value: %p (ignored)", th_ret); 473 418 } 474 419 … … 494 439 free(buffer); 495 440 } 496 static __inline__ void fd_cleanup_socket(void * sockptr)497 {498 if (sockptr) {499 shutdown(*(int *)sockptr, SHUT_RDWR);500 *(int *)sockptr = 0;501 }502 }503 504 441 505 442 /*============================================================*/ … … 528 465 void fd_list_insert_after ( struct fd_list * ref, struct fd_list * item ); 529 466 void fd_list_insert_before ( struct fd_list * ref, struct fd_list * item ); 530 531 /* Move a list at the end of another */532 void fd_list_move_end(struct fd_list * ref, struct fd_list * senti);533 467 534 468 /* Insert an item in an ordered list -- ordering function provided. If duplicate object found, EEXIST and it is returned in ref_duplicate */ … … 2408 2342 2409 2343 /* 2410 * FUNCTION: fd_fifo_move2411 *2412 * PARAMETERS:2413 * old : Location of a FIFO that is to be emptied and deleted.2414 * new : A FIFO that will receive the old data.2415 * loc_update : if non NULL, a place to store the pointer to new FIFO atomically with the move.2416 *2417 * DESCRIPTION:2418 * Delete a queue and move its content to another one atomically.2419 *2420 * RETURN VALUE:2421 * 0 : The queue has been destroyed successfully.2422 * EINVAL : A parameter is invalid.2423 */2424 int fd_fifo_move ( struct fifo ** old, struct fifo * new, struct fifo ** loc_update );2425 2426 /*2427 2344 * FUNCTION: fd_fifo_length 2428 2345 *
Note: See TracChangeset
for help on using the changeset viewer.