Changes in include/freeDiameter/libfreeDiameter.h [20:277ec00d793e:29:5ba91682f0bc] in freeDiameter
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfreeDiameter.h
r20 r29 120 120 * 121 121 * PARAMETERS: 122 * ts : The timestamp to log, or NULL for "now" 122 123 * buf : An array where the time must be stored 123 124 * len : size of the buffer 124 125 * 125 126 * DESCRIPTION: 126 * Writes the currenttimestamp (in human readable format) in a buffer.127 * Writes the timestamp (in human readable format) in a buffer. 127 128 * 128 129 * RETURN VALUE: 129 130 * pointer to buf. 130 131 */ 131 char * fd_log_time ( char * buf, size_t len );132 char * fd_log_time ( struct timespec * ts, char * buf, size_t len ); 132 133 133 134 … … 173 174 fd_log_debug("\t | tid:%-20s\t%s\tin %s@%s:%d\n" \ 174 175 "\t%s|%*s" format "\n", \ 175 __thn, fd_log_time( __buf, sizeof(__buf)), __PRETTY_FUNCTION__, __FILE__, __LINE__, \176 __thn, fd_log_time(NULL, __buf, sizeof(__buf)), __PRETTY_FUNCTION__, __FILE__, __LINE__, \ 176 177 (level < FULL)?"@":" ",level, "", ## args); \ 177 178 } \ … … 180 181 /* Helper for function entry -- for very detailed trace of the execution */ 181 182 #define TRACE_ENTRY(_format,_args... ) \ 182 TRACE_DEBUG(FCTS, " ->%s (" #_args ") = (" _format ") >", __PRETTY_FUNCTION__, ##_args );183 TRACE_DEBUG(FCTS, "[enter] %s(" _format ") {" #_args "}", __PRETTY_FUNCTION__, ##_args ); 183 184 184 185 /* Helper for debugging by adding traces -- for debuging a specific location of the code */ … … 328 329 flag); \ 329 330 if (__rc) \ 330 fd_log_debug( (char *)gai_strerror(__rc)); \331 fd_log_debug("%s", (char *)gai_strerror(__rc)); \ 331 332 else \ 332 fd_log_debug( &__addrbuf[0]);\333 fd_log_debug("%s", &__addrbuf[0]); \ 333 334 } else { \ 334 335 fd_log_debug("(NULL / ANY)"); \ 335 336 } \ 336 337 } 337 /* if needed, add sSA_DUMP_SERVICE */ 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 338 373 339 374 /* A l4 protocol name (TCP / SCTP) */ … … 390 425 ( ((ts1)->tv_sec < (ts2)->tv_sec ) \ 391 426 || (((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 392 447 393 448 … … 415 470 416 471 if (th_ret != NULL) { 417 TRACE_DEBUG( FULL, "The thread returned the following value: %p (ignored)", th_ret);472 TRACE_DEBUG(ANNOYING, "The thread returned the following value: %p (ignored)", th_ret); 418 473 } 419 474 … … 439 494 free(buffer); 440 495 } 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 441 504 442 505 /*============================================================*/ … … 465 528 void fd_list_insert_after ( struct fd_list * ref, struct fd_list * item ); 466 529 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); 467 533 468 534 /* Insert an item in an ordered list -- ordering function provided. If duplicate object found, EEXIST and it is returned in ref_duplicate */ … … 2342 2408 2343 2409 /* 2410 * FUNCTION: fd_fifo_move 2411 * 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 /* 2344 2427 * FUNCTION: fd_fifo_length 2345 2428 *
Note: See TracChangeset
for help on using the changeset viewer.