Changeset 24:bd83ce9328ed in freeDiameter for include
- Timestamp:
- Oct 21, 2009, 6:42:45 PM (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- include/freeDiameter
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/CMakeLists.txt
r23 r24 13 13 IF (NOT DISABLE_SCTP) 14 14 OPTION(DEBUG_SCTP "Verbose SCTP (for debug)?" OFF) 15 OPTION(SCTP_USE_MAPPED_ADDRESSES "Use v6-mapped v4 addresses in SCTP (workaround some SCTP limitations)?" OFF) 15 16 ENDIF (NOT DISABLE_SCTP) 16 17 -
include/freeDiameter/freeDiameter-host.h.in
r23 r24 46 46 #cmakedefine DISABLE_SCTP 47 47 #cmakedefine DEBUG_SCTP 48 #cmakedefine SCTP_USE_MAPPED_ADDRESSES 48 49 #cmakedefine ERRORS_ON_TODO 49 50 #cmakedefine DEBUG -
include/freeDiameter/freeDiameter.h
r23 r24 118 118 struct fd_endpoint { 119 119 struct fd_list chain; /* link in cnf_endpoints list */ 120 120 121 union { 121 sSS ss; /* the socket information. List is always ordered by ss value (memcmp) */122 sSS ss; /* the socket information. List is always ordered by ss value (memcmp) -- see fd_ep_add_merge */ 122 123 sSA4 sin; 123 124 sSA6 sin6; 124 125 sSA sa; 125 126 }; 126 struct { 127 unsigned conf : 1; /* This endpoint is statically configured in a configuration file */ 128 unsigned disc : 1; /* This endpoint was resolved from the Diameter Identity or other DNS query */ 129 unsigned adv : 1; /* This endpoint was advertized in Diameter CER/CEA exchange */ 130 unsigned ll : 1; /* Lower layer mechanism provided this endpoint */ 131 132 /* To add: a validity timestamp for DNS records ? How do we retrieve this lifetime from DNS ? */ 133 134 } meta; /* Additional information about the endpoint */ 135 }; 136 137 /* Add a new entry in a list of endpoints -- merge if the sockaddr was already there */ 138 int fd_ep_add_merge( struct fd_list * list, sSA * sa, socklen_t sl, int conf, int disc, int adv, int ll ); 127 128 #define EP_FL_CONF (1 << 0) /* This endpoint is statically configured in a configuration file */ 129 #define EP_FL_DISC (1 << 1) /* This endpoint was resolved from the Diameter Identity or other DNS query */ 130 #define EP_FL_ADV (1 << 2) /* This endpoint was advertized in Diameter CER/CEA exchange */ 131 #define EP_FL_LL (1 << 3) /* Lower layer mechanism provided this endpoint */ 132 #define EP_FL_PRIMARY (1 << 4) /* This endpoint is primary in a multihomed SCTP association */ 133 uint32_t flags; /* Additional information about the endpoint */ 134 135 /* To add: a validity timestamp for DNS records ? How do we retrieve this lifetime from DNS ? */ 136 }; 139 137 140 138 /* Applications */ … … 468 466 469 467 468 /***************************************/ 469 /* Endpoints lists helpers */ 470 /***************************************/ 471 472 int fd_ep_add_merge( struct fd_list * list, sSA * sa, socklen_t sl, uint32_t flags ); 473 int fd_ep_filter( struct fd_list * list, uint32_t flags ); 474 int fd_ep_clearflags( struct fd_list * list, uint32_t flags ); 475 476 477 470 478 #endif /* _FREEDIAMETER_H */ -
include/freeDiameter/libfreeDiameter.h
r23 r24 336 336 } \ 337 337 } 338 /* Same, for a service */ 339 #define sSA_DUMP_SERV( sa, flag ) { \ 340 sSA * __sa = (sSA *)(sa); \ 341 char __servbuf[32]; \ 342 if (__sa) { \ 343 int __rc = getnameinfo(__sa, \ 344 sizeof(sSS), \ 345 NULL, \ 346 0, \ 347 __servbuf, \ 348 sizeof(__servbuf), \ 349 flag); \ 350 if (__rc) \ 351 fd_log_debug("%s", (char *)gai_strerror(__rc)); \ 352 else \ 353 fd_log_debug("%s", &__servbuf[0]); \ 354 } else { \ 355 fd_log_debug("(unknown)"); \ 356 } \ 357 } 358 /* Combine both */ 338 /* Same but with the port (service) also */ 359 339 #define sSA_DUMP_NODE_SERV( sa, flag ) { \ 360 340 sSA * __sa = (sSA *)(sa); \ … … 376 356 fd_log_debug("(NULL / ANY)"); \ 377 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 } \ 378 371 } 379 372 … … 481 474 free(buffer); 482 475 } 476 static __inline__ void fd_cleanup_socket(void * sockptr) 477 { 478 if (sockptr) { 479 shutdown(*(int *)sockptr, SHUT_RDWR); 480 *(int *)sockptr = 0; 481 } 482 } 483 483 484 484 485 /*============================================================*/
Note: See TracChangeset
for help on using the changeset viewer.