MCPcopy Create free account
hub / github.com/OpenPrinting/cups / httpAddrGetList

Function httpAddrGetList

cups/http-addrlist.c:518–1000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516 */
517
518http_addrlist_t * /* O - List of addresses or NULL */
519httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for passive listen address */
520 int family, /* I - Address family or AF_UNSPEC */
521 const char *service) /* I - Service name or port number */
522{
523 http_addrlist_t *first, /* First address in list */
524 *addr, /* Current address in list */
525 *temp; /* New address */
526 char ipv6[64], /* IPv6 address */
527 *ipv6zone; /* Pointer to zone separator */
528 int ipv6len; /* Length of IPv6 address */
529 _cups_globals_t *cg = _cupsGlobals();
530 /* Global data */
531
532
533#ifdef DEBUG
534 _cups_debug_printf("httpAddrGetList(hostname=\"%s\", family=AF_%s, "
535 "service=\"%s\")\n",
536 hostname ? hostname : "(nil)",
537 family == AF_UNSPEC ? "UNSPEC" :
538# ifdef AF_LOCAL
539 family == AF_LOCAL ? "LOCAL" :
540# endif /* AF_LOCAL */
541# ifdef AF_INET6
542 family == AF_INET6 ? "INET6" :
543# endif /* AF_INET6 */
544 family == AF_INET ? "INET" : "???", service);
545#endif /* DEBUG */
546
547 httpInitialize();
548
549#ifdef HAVE_RES_INIT
550 /*
551 * STR #2920: Initialize resolver after failure in cups-polld
552 *
553 * If the previous lookup failed, re-initialize the resolver to prevent
554 * temporary network errors from persisting. This *should* be handled by
555 * the resolver libraries, but apparently the glibc folks do not agree.
556 *
557 * We set a flag at the end of this function if we encounter an error that
558 * requires reinitialization of the resolver functions. We then call
559 * res_init() if the flag is set on the next call here or in httpAddrLookup().
560 */
561
562 if (cg->need_res_init)
563 {
564 res_init();
565
566 cg->need_res_init = 0;
567 }
568#endif /* HAVE_RES_INIT */
569
570 /*
571 * Lookup the address the best way we can...
572 */
573
574 first = addr = NULL;
575

Callers 15

list_serviceFunction · 0.85
create_listenerFunction · 0.85
process_jobFunction · 0.85
cupsdAcceptClientFunction · 0.85
valid_hostFunction · 0.85
get_addressFunction · 0.85
scan_devicesFunction · 0.85
backendLookupFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
http_createFunction · 0.85

Calls 6

_cupsGlobalsFunction · 0.85
_cups_debug_printfFunction · 0.85
httpInitializeFunction · 0.85
_cups_strcasecmpFunction · 0.85
httpAddrFreeListFunction · 0.85
_cupsSetErrorFunction · 0.85

Tested by 3

mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68