Lines Matching +full:- +full:scheme
4 * Copyright 2007-2017 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
13 * This file is subject to the Apple OS-Developed Software exception.
20 #include "cups-private.h"
31 # include <avahi-client/client.h>
32 # include <avahi-client/lookup.h>
33 # include <avahi-common/simple-watch.h>
145 * 'httpAssembleURI()' - Assemble a uniform resource identifier from its
156 http_uri_status_t /* O - URI status */
158 http_uri_coding_t encoding, /* I - Encoding flags */ in httpAssembleURI()
159 char *uri, /* I - URI buffer */ in httpAssembleURI()
160 int urilen, /* I - Size of URI buffer */ in httpAssembleURI()
161 const char *scheme, /* I - Scheme name */ in httpAssembleURI() argument
162 const char *username, /* I - Username */ in httpAssembleURI()
163 const char *host, /* I - Hostname or address */ in httpAssembleURI()
164 int port, /* I - Port number */ in httpAssembleURI()
165 const char *resource) /* I - Resource */ in httpAssembleURI()
175 if (!uri || urilen < 1 || !scheme || port < 0) in httpAssembleURI()
184 * Assemble the URI starting with the scheme... in httpAssembleURI()
187 end = uri + urilen - 1; in httpAssembleURI()
188 ptr = http_copy_encode(uri, scheme, end, NULL, NULL, 0); in httpAssembleURI()
193 if (!strcmp(scheme, "geo") || !strcmp(scheme, "mailto") || !strcmp(scheme, "tel")) in httpAssembleURI()
251 * URI format. Since DNS-SD service names can sometimes look like in httpAssembleURI()
275 * We have a link-local address, add "[v1." prefix... in httpAssembleURI()
291 * We have a normal (or RFC 6874 link-local) address, add "[" prefix... in httpAssembleURI()
314 if (ptr >= (end - 2)) in httpAssembleURI()
342 * "reg-name" ABNF rule; anything <= SP or >= DEL plus % gets automatically in httpAssembleURI()
343 * percent-encoded. in httpAssembleURI()
359 snprintf(ptr, (size_t)(end - ptr + 1), ":%d", port); in httpAssembleURI()
404 * Nul-terminate the URI buffer and return with no errors... in httpAssembleURI()
424 * 'httpAssembleURIf()' - Assemble a uniform resource identifier from its
436 http_uri_status_t /* O - URI status */
438 http_uri_coding_t encoding, /* I - Encoding flags */ in httpAssembleURIf()
439 char *uri, /* I - URI buffer */ in httpAssembleURIf()
440 int urilen, /* I - Size of URI buffer */ in httpAssembleURIf()
441 const char *scheme, /* I - Scheme name */ in httpAssembleURIf() argument
442 const char *username, /* I - Username */ in httpAssembleURIf()
443 const char *host, /* I - Hostname or address */ in httpAssembleURIf()
444 int port, /* I - Port number */ in httpAssembleURIf()
445 const char *resourcef, /* I - Printf-style resource */ in httpAssembleURIf()
446 ...) /* I - Additional arguments as needed */ in httpAssembleURIf()
457 if (!uri || urilen < 1 || !scheme || port < 0 || !resourcef) in httpAssembleURIf()
479 return (httpAssembleURI(encoding, uri, urilen, scheme, username, host, in httpAssembleURIf()
485 * 'httpAssembleUUID()' - Assemble a name-based UUID URN conforming to RFC 4122.
487 * This function creates a unique 128-bit identifying number using the server
496 char * /* I - UUID string */
497 httpAssembleUUID(const char *server, /* I - Server name */ in httpAssembleUUID()
498 int port, /* I - Port number */ in httpAssembleUUID()
499 const char *name, /* I - Object name or NULL */ in httpAssembleUUID()
500 int number, /* I - Object number or 0 */ in httpAssembleUUID()
501 char *buffer, /* I - String buffer */ in httpAssembleUUID()
502 size_t bufsize) /* I - Size of buffer */ in httpAssembleUUID()
529 "urn:uuid:%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" in httpAssembleUUID()
541 * 'httpDecode64()' - Base64-decode a string.
549 char * /* O - Decoded string */
550 httpDecode64(char *out, /* I - String to write to */ in httpDecode64()
551 const char *in) /* I - String to read from */ in httpDecode64()
567 * 'httpDecode64_2()' - Base64-decode a string.
576 char * /* O - Decoded string */
577 httpDecode64_2(char *out, /* I - String to write to */ in httpDecode64_2()
578 int *outlen, /* IO - Size of output string */ in httpDecode64_2()
579 const char *in) /* I - String to read from */ in httpDecode64_2()
603 * Convert from base-64 to bytes... in httpDecode64_2()
606 for (outptr = out, outend = out + *outlen - 1, pos = 0; *in != '\0'; in ++) in httpDecode64_2()
613 base64 = (unsigned)(*in - 'A'); in httpDecode64_2()
615 base64 = (unsigned)(*in - 'a' + 26); in httpDecode64_2()
617 base64 = (unsigned)(*in - '0' + 52); in httpDecode64_2()
666 *outlen = (int)(outptr - out); in httpDecode64_2()
673 * 'httpEncode64()' - Base64-encode a string.
681 char * /* O - Encoded string */
682 httpEncode64(char *out, /* I - String to write to */ in httpEncode64()
683 const char *in) /* I - String to read from */ in httpEncode64()
690 * 'httpEncode64_2()' - Base64-encode a string.
695 char * /* O - Encoded string */
696 httpEncode64_2(char *out, /* I - String to write to */ in httpEncode64_2()
697 int outlen, /* I - Maximum size of output string */ in httpEncode64_2()
698 const char *in, /* I - String to read from */ in httpEncode64_2()
699 int inlen) /* I - Size of input string */ in httpEncode64_2()
720 * Convert bytes to base-64... in httpEncode64_2()
723 for (outptr = out, outend = out + outlen - 1; inlen > 0; in ++, inlen --) in httpEncode64_2()
741 inlen --; in httpEncode64_2()
760 inlen --; in httpEncode64_2()
783 * 'httpGetDateString()' - Get a formatted date/time string from a time value.
788 const char * /* O - Date/time string */
789 httpGetDateString(time_t t) /* I - Time in seconds */ in httpGetDateString()
794 return (httpGetDateString2(t, cg->http_date, sizeof(cg->http_date))); in httpGetDateString()
799 * 'httpGetDateString2()' - Get a formatted date/time string from a time value.
804 const char * /* O - Date/time string */
805 httpGetDateString2(time_t t, /* I - Time in seconds */ in httpGetDateString2()
806 char *s, /* I - String buffer */ in httpGetDateString2()
807 int slen) /* I - Size of string buffer */ in httpGetDateString2()
814 …", http_days[tdate->tm_wday], tdate->tm_mday, http_months[tdate->tm_mon], tdate->tm_year + 1900, t… in httpGetDateString2()
823 * 'httpGetDateTime()' - Get a time value from a formatted date/time string.
826 time_t /* O - Time in seconds */
827 httpGetDateTime(const char *s) /* I - Date/time string */ in httpGetDateTime()
872 days = leap_days[i] + day - 1; in httpGetDateTime()
874 days = normal_days[i] + day - 1; in httpGetDateTime()
878 days += (year - 1970) * 365 + /* 365 days per year (normally) */ in httpGetDateTime()
879 ((year - 1) / 4 - 492) - /* + leap days */ in httpGetDateTime()
880 ((year - 1) / 100 - 19) + /* - 100 year days */ in httpGetDateTime()
881 ((year - 1) / 400 - 4); /* + 400 year days */ in httpGetDateTime()
890 * 'httpSeparate()' - Separate a Universal Resource Identifier into its
899 httpSeparate(const char *uri, /* I - Universal Resource Identifier */ in httpSeparate()
900 char *scheme, /* O - Scheme [32] (http, https, etc.) */ in httpSeparate() argument
901 char *username, /* O - Username [1024] */ in httpSeparate()
902 char *host, /* O - Hostname [1024] */ in httpSeparate()
903 int *port, /* O - Port number to use */ in httpSeparate()
904 char *resource) /* O - Resource/filename [1024] */ in httpSeparate()
906 httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, 32, username, in httpSeparate()
913 * 'httpSeparate2()' - Separate a Universal Resource Identifier into its
923 httpSeparate2(const char *uri, /* I - Universal Resource Identifier */ in httpSeparate2()
924 char *scheme, /* O - Scheme (http, https, etc.) */ in httpSeparate2() argument
925 int schemelen, /* I - Size of scheme buffer */ in httpSeparate2()
926 char *username, /* O - Username */ in httpSeparate2()
927 int usernamelen, /* I - Size of username buffer */ in httpSeparate2()
928 char *host, /* O - Hostname */ in httpSeparate2()
929 int hostlen, /* I - Size of hostname buffer */ in httpSeparate2()
930 int *port, /* O - Port number to use */ in httpSeparate2()
931 char *resource, /* O - Resource/filename */ in httpSeparate2()
932 int resourcelen) /* I - Size of resource buffer */ in httpSeparate2()
934 httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, schemelen, username, in httpSeparate2()
940 * 'httpSeparateURI()' - Separate a Universal Resource Identifier into its
946 http_uri_status_t /* O - Result of separation */
948 http_uri_coding_t decoding, /* I - Decoding flags */ in httpSeparateURI()
949 const char *uri, /* I - Universal Resource Identifier */ in httpSeparateURI()
950 char *scheme, /* O - Scheme (http, https, etc.) */ in httpSeparateURI() argument
951 int schemelen, /* I - Size of scheme buffer */ in httpSeparateURI()
952 char *username, /* O - Username */ in httpSeparateURI()
953 int usernamelen, /* I - Size of username buffer */ in httpSeparateURI()
954 char *host, /* O - Hostname */ in httpSeparateURI()
955 int hostlen, /* I - Size of hostname buffer */ in httpSeparateURI()
956 int *port, /* O - Port number to use */ in httpSeparateURI()
957 char *resource, /* O - Resource/filename */ in httpSeparateURI()
958 int resourcelen) /* I - Size of resource buffer */ in httpSeparateURI()
970 if (scheme && schemelen > 0) in httpSeparateURI()
971 *scheme = '\0'; in httpSeparateURI()
989 if (!uri || !port || !scheme || schemelen <= 0 || !username || in httpSeparateURI()
998 * Grab the scheme portion of the URI... in httpSeparateURI()
1009 strlcpy(scheme, "ipp", (size_t)schemelen); in httpSeparateURI()
1018 strlcpy(scheme, "file", (size_t)schemelen); in httpSeparateURI()
1024 * Standard URI with scheme... in httpSeparateURI()
1027 for (ptr = scheme, end = scheme + schemelen - 1; in httpSeparateURI()
1031 "0123456789-+.", *uri) != NULL) in httpSeparateURI()
1040 *scheme = '\0'; in httpSeparateURI()
1051 if (!strcmp(scheme, "http")) in httpSeparateURI()
1053 else if (!strcmp(scheme, "https")) in httpSeparateURI()
1055 else if (!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")) in httpSeparateURI()
1057 else if (!_cups_strcasecmp(scheme, "lpd")) in httpSeparateURI()
1059 else if (!strcmp(scheme, "socket")) /* Not yet registered with IANA... */ in httpSeparateURI()
1061 else if (strcmp(scheme, "file") && strcmp(scheme, "mailto") && strcmp(scheme, "tel")) in httpSeparateURI()
1186 "-._~" /* unreserved */ in httpSeparateURI()
1187 "%" /* pct-encoded */ in httpSeparateURI()
1188 "!$&'()*+,;=" /* sub-delims */ in httpSeparateURI()
1210 * Validate hostname for file scheme - only empty and localhost are in httpSeparateURI()
1214 if (!strcmp(scheme, "file") && strcmp(host, "localhost") && host[0]) in httpSeparateURI()
1270 uri = http_copy_decode(resource + 1, uri, resourcelen - 1, NULL, in httpSeparateURI()
1289 resourcelen - (int)(resptr - resource), NULL, in httpSeparateURI()
1309 * 'httpStateString()' - Return the string describing a HTTP state value.
1314 const char * /* O - State string */
1315 httpStateString(http_state_t state) /* I - HTTP state value */ in httpStateString()
1320 return (http_states[state - HTTP_STATE_ERROR]); in httpStateString()
1325 * '_httpStatus()' - Return the localized string describing a HTTP status code.
1330 const char * /* O - Localized status string */
1331 _httpStatus(cups_lang_t *lang, /* I - Language */ in _httpStatus()
1332 http_status_t status) /* I - HTTP status code */ in _httpStatus()
1423 * 'httpStatus()' - Return a short string describing a HTTP status code.
1429 const char * /* O - Localized status string */
1430 httpStatus(http_status_t status) /* I - HTTP status code */ in httpStatus()
1435 if (!cg->lang_default) in httpStatus()
1436 cg->lang_default = cupsLangDefault(); in httpStatus()
1438 return (_httpStatus(cg->lang_default, status)); in httpStatus()
1442 * 'httpURIStatusString()' - Return a string describing a URI status code.
1447 const char * /* O - Localized status string */
1449 http_uri_status_t status) /* I - URI status code */ in httpURIStatusString()
1455 if (!cg->lang_default) in httpURIStatusString()
1456 cg->lang_default = cupsLangDefault(); in httpURIStatusString()
1479 s = _("Bad scheme in URI"); in httpURIStatusString()
1488 s = _("Missing scheme in URI"); in httpURIStatusString()
1491 s = _("Unknown scheme in URI"); in httpURIStatusString()
1502 return (_cupsLangString(cg->lang_default, s)); in httpURIStatusString()
1508 * '_cups_hstrerror()' - hstrerror() emulation function for Solaris and others.
1511 const char * /* O - Error string */
1512 _cups_hstrerror(int error) /* I - Error number */ in _cups_hstrerror()
1533 * '_httpDecodeURI()' - Percent-decode a HTTP request URI.
1536 char * /* O - Decoded URI or NULL on error */
1537 _httpDecodeURI(char *dst, /* I - Destination buffer */ in _httpDecodeURI()
1538 const char *src, /* I - Source URI */ in _httpDecodeURI()
1539 size_t dstsize) /* I - Size of destination buffer */ in _httpDecodeURI()
1549 * '_httpEncodeURI()' - Percent-encode a HTTP request URI.
1552 char * /* O - Encoded URI */
1553 _httpEncodeURI(char *dst, /* I - Destination buffer */ in _httpEncodeURI()
1554 const char *src, /* I - Source URI */ in _httpEncodeURI()
1555 size_t dstsize) /* I - Size of destination buffer */ in _httpEncodeURI()
1557 http_copy_encode(dst, src, dst + dstsize - 1, NULL, NULL, 1); in _httpEncodeURI()
1563 * '_httpResolveURI()' - Resolve a DNS-SD URI.
1566 const char * /* O - Resolved URI */
1568 const char *uri, /* I - DNS-SD URI */ in _httpResolveURI()
1569 char *resolved_uri, /* I - Buffer for resolved URI */ in _httpResolveURI()
1570 size_t resolved_size, /* I - Size of URI buffer */ in _httpResolveURI()
1571 int options, /* I - Resolve options */ in _httpResolveURI()
1572 int (*cb)(void *context), /* I - Continue callback function */ in _httpResolveURI()
1573 void *context) /* I - Context pointer for callback */ in _httpResolveURI()
1575 char scheme[32], /* URI components... */ in _httpResolveURI() local
1592 if ((status = httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, in _httpResolveURI()
1593 sizeof(scheme), userpass, sizeof(userpass), in _httpResolveURI()
1597 if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, in _httpResolveURI()
1598 sizeof(scheme), userpass, sizeof(userpass), in _httpResolveURI()
1604 _cupsLangPrintFilter(stderr, "ERROR", _("Bad device-uri \"%s\"."), uri); in _httpResolveURI()
1623 int offline = 0; /* offline-report state set? */ in _httpResolveURI()
1628 DNSServiceRef ref, /* DNS-SD master service reference */ in _httpResolveURI()
1629 domainref = NULL,/* DNS-SD service reference for domain */ in _httpResolveURI()
1630 ippref = NULL, /* DNS-SD service reference for network IPP */ in _httpResolveURI()
1631 ippsref = NULL, /* DNS-SD service reference for network IPPS */ in _httpResolveURI()
1632 localref; /* DNS-SD service reference for .local */ in _httpResolveURI()
1652 for (regtype = strstr(hostname, "._tcp") - 2; in _httpResolveURI()
1654 regtype --) in _httpResolveURI()
1700 fputs("STATE: +connecting-to-device\n", stderr); in _httpResolveURI()
1713 if (!strcmp(scheme, "ippusb")) in _httpResolveURI()
1743 if ((timeout = end_time - time(NULL)) > 2) in _httpResolveURI()
1798 else if (extrasent == 0 && !strcmp(scheme, "ippusb")) in _httpResolveURI()
1811 else if (extrasent == 1 && !strcmp(scheme, "ippusb")) in _httpResolveURI()
1826 * If it hasn't resolved within 5 seconds set the offline-report in _httpResolveURI()
1827 * printer-state-reason... in _httpResolveURI()
1833 fputs("STATE: +offline-report\n", stderr); in _httpResolveURI()
1905 * If it hasn't resolved within 5 seconds set the offline-report in _httpResolveURI()
1906 * printer-state-reason... in _httpResolveURI()
1912 fputs("STATE: +offline-report\n", stderr); in _httpResolveURI()
1937 fputs("STATE: -connecting-to-device,offline-report\n", stderr); in _httpResolveURI()
1942 fputs("STATE: -connecting-to-device\n", stderr); in _httpResolveURI()
1948 * No DNS-SD support... in _httpResolveURI()
1975 * 'http_client_cb()' - Client callback for resolving URI.
1980 AvahiClient *client, /* I - Client information */ in http_client_cb()
1981 AvahiClientState state, /* I - Current state */ in http_client_cb()
1982 void *context) /* I - Pointer to URI buffer */ in http_client_cb()
1996 avahi_simple_poll_quit(uribuf->poll); in http_client_cb()
2003 * 'http_copy_decode()' - Copy and decode a URI.
2006 static const char * /* O - New source pointer or NULL on error */
2007 http_copy_decode(char *dst, /* O - Destination buffer */ in http_copy_decode()
2008 const char *src, /* I - Source pointer */ in http_copy_decode()
2009 int dstsize, /* I - Destination size */ in http_copy_decode()
2010 const char *term, /* I - Terminating characters */ in http_copy_decode()
2011 int decode) /* I - Decode %-encoded values */ in http_copy_decode()
2023 for (ptr = dst, end = dst + dstsize - 1; in http_copy_decode()
2033 * Grab a hex-encoded character... in http_copy_decode()
2038 quoted = (tolower(*src) - 'a' + 10) << 4; in http_copy_decode()
2040 quoted = (*src - '0') << 4; in http_copy_decode()
2044 quoted |= tolower(*src) - 'a' + 10; in http_copy_decode()
2046 quoted |= *src - '0'; in http_copy_decode()
2053 * Bad hex-encoded character... in http_copy_decode()
2076 * 'http_copy_encode()' - Copy and encode a URI.
2079 static char * /* O - End of current URI */
2080 http_copy_encode(char *dst, /* O - Destination buffer */ in http_copy_encode()
2081 const char *src, /* I - Source pointer */ in http_copy_encode()
2082 char *dstend, /* I - End of destination buffer */ in http_copy_encode()
2083 const char *reserved, /* I - Extra reserved characters */ in http_copy_encode()
2084 const char *term, /* I - Terminating characters */ in http_copy_encode()
2085 int encode) /* I - %-encode reserved chars? */ in http_copy_encode()
2126 * 'http_resolve_cb()' - Build a device URI for the given service name.
2131 DNSServiceRef sdRef, /* I - Service reference */ in http_resolve_cb()
2132 DNSServiceFlags flags, /* I - Results flags */ in http_resolve_cb()
2133 uint32_t interfaceIndex, /* I - Interface number */ in http_resolve_cb()
2134 DNSServiceErrorType errorCode, /* I - Error, if any */ in http_resolve_cb()
2135 const char *fullName, /* I - Full service name */ in http_resolve_cb()
2136 const char *hostTarget, /* I - Hostname */ in http_resolve_cb()
2137 uint16_t port, /* I - Port number */ in http_resolve_cb()
2138 uint16_t txtLen, /* I - Length of TXT record */ in http_resolve_cb()
2139 const unsigned char *txtRecord, /* I - TXT record data */ in http_resolve_cb()
2140 void *context) /* I - Pointer to URI buffer */ in http_resolve_cb()
2144 const char *scheme, /* URI scheme */ in http_resolve_cb() local
2160 if (uribuf->uuid && in http_resolve_cb()
2169 if (_cups_strcasecmp(uuid, uribuf->uuid)) in http_resolve_cb()
2171 if (uribuf->options & _HTTP_RESOLVE_STDERR) in http_resolve_cb()
2173 uribuf->uuid); in http_resolve_cb()
2176 uribuf->uuid)); in http_resolve_cb()
2182 * Figure out the scheme from the full name... in http_resolve_cb()
2185 if (strstr(fullName, "._ipps") || strstr(fullName, "._ipp-tls")) in http_resolve_cb()
2186 scheme = "ipps"; in http_resolve_cb()
2187 else if (strstr(fullName, "._ipp") || strstr(fullName, "._fax-ipp")) in http_resolve_cb()
2188 scheme = "ipp"; in http_resolve_cb()
2190 scheme = "http"; in http_resolve_cb()
2192 scheme = "https"; in http_resolve_cb()
2194 scheme = "lpd"; in http_resolve_cb()
2195 else if (strstr(fullName, "._pdl-datastream.")) in http_resolve_cb()
2196 scheme = "socket"; in http_resolve_cb()
2198 scheme = "riousbprint"; in http_resolve_cb()
2204 if ((uribuf->options & _HTTP_RESOLVE_FAXOUT) && in http_resolve_cb()
2205 (!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")) && in http_resolve_cb()
2206 !TXTRecordGetValuePtr(txtLen, txtRecord, "printer-type", &valueLen)) in http_resolve_cb()
2253 if ((uribuf->options & _HTTP_RESOLVE_FQDN) && in http_resolve_cb()
2254 (hostptr = hostTarget + strlen(hostTarget) - 7) > hostTarget && in http_resolve_cb()
2259 * getting the IP address of the .local name and then do reverse-lookups... in http_resolve_cb()
2270 for (addr = addrlist; addr; addr = addr->next) in http_resolve_cb()
2272 …int error = getnameinfo(&(addr->addr.addr), (socklen_t)httpAddrLength(&(addr->addr)), fqdn, sizeof… in http_resolve_cb()
2278 if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn || in http_resolve_cb()
2288 httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)), in http_resolve_cb()
2301 if ((!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")) && in http_resolve_cb()
2302 !strcmp(uribuf->resource, "/cups")) in http_resolve_cb()
2303 …httpAssembleURIf(HTTP_URI_CODING_ALL, uribuf->buffer, (int)uribuf->bufsize, scheme, NULL, hostTarg… in http_resolve_cb()
2305 …httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, (int)uribuf->bufsize, scheme, NULL, hostTarge… in http_resolve_cb()
2307 DEBUG_printf(("5http_resolve_cb: Resolved URI is \"%s\"...", uribuf->buffer)); in http_resolve_cb()
2312 * 'http_poll_cb()' - Wait for input on the specified file descriptors.
2321 static int /* O - Number of file descriptors matching */
2323 struct pollfd *pollfds, /* I - File descriptors */ in http_poll_cb()
2324 unsigned int num_pollfds, /* I - Number of file descriptors */ in http_poll_cb()
2325 int timeout, /* I - Timeout in milliseconds (used) */ in http_poll_cb()
2326 void *context) /* I - User data (unused) */ in http_poll_cb()
2336 * 'http_resolve_cb()' - Build a device URI for the given service name.
2341 AvahiServiceResolver *resolver, /* I - Resolver (unused) */ in http_resolve_cb()
2342 AvahiIfIndex interface, /* I - Interface index (unused) */ in http_resolve_cb()
2343 AvahiProtocol protocol, /* I - Network protocol (unused) */ in http_resolve_cb()
2344 AvahiResolverEvent event, /* I - Event (found, etc.) */ in http_resolve_cb()
2345 const char *name, /* I - Service name */ in http_resolve_cb()
2346 const char *type, /* I - Registration type */ in http_resolve_cb()
2347 const char *domain, /* I - Domain (unused) */ in http_resolve_cb()
2348 const char *hostTarget, /* I - Hostname */ in http_resolve_cb()
2349 const AvahiAddress *address, /* I - Address (unused) */ in http_resolve_cb()
2350 uint16_t port, /* I - Port number */ in http_resolve_cb()
2351 AvahiStringList *txt, /* I - TXT record */ in http_resolve_cb()
2352 AvahiLookupResultFlags flags, /* I - Lookup flags (unused) */ in http_resolve_cb()
2353 void *context) /* I - Pointer to URI buffer */ in http_resolve_cb()
2357 const char *scheme, /* URI scheme */ in http_resolve_cb() local
2378 avahi_simple_poll_quit(uribuf->poll); in http_resolve_cb()
2386 if (uribuf->uuid && (pair = avahi_string_list_find(txt, "UUID")) != NULL) in http_resolve_cb()
2395 if (_cups_strcasecmp(uuid, uribuf->uuid)) in http_resolve_cb()
2397 if (uribuf->options & _HTTP_RESOLVE_STDERR) in http_resolve_cb()
2399 uribuf->uuid); in http_resolve_cb()
2402 uribuf->uuid)); in http_resolve_cb()
2408 * Figure out the scheme from the full name... in http_resolve_cb()
2412 scheme = "ipp"; in http_resolve_cb()
2414 scheme = "lpd"; in http_resolve_cb()
2415 else if (strstr(type, "_pdl-datastream.")) in http_resolve_cb()
2416 scheme = "socket"; in http_resolve_cb()
2418 scheme = "riousbprint"; in http_resolve_cb()
2420 if (!strncmp(type, "_ipps.", 6) || !strncmp(type, "_ipp-tls.", 9)) in http_resolve_cb()
2421 scheme = "ipps"; in http_resolve_cb()
2422 else if (!strncmp(type, "_ipp.", 5) || !strncmp(type, "_fax-ipp.", 9)) in http_resolve_cb()
2423 scheme = "ipp"; in http_resolve_cb()
2425 scheme = "http"; in http_resolve_cb()
2427 scheme = "https"; in http_resolve_cb()
2429 scheme = "lpd"; in http_resolve_cb()
2430 else if (!strncmp(type, "_pdl-datastream.", 16)) in http_resolve_cb()
2431 scheme = "socket"; in http_resolve_cb()
2435 avahi_simple_poll_quit(uribuf->poll); in http_resolve_cb()
2443 if ((uribuf->options & _HTTP_RESOLVE_FAXOUT) && in http_resolve_cb()
2444 (!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")) && in http_resolve_cb()
2445 !avahi_string_list_find(txt, "printer-type")) in http_resolve_cb()
2493 if ((uribuf->options & _HTTP_RESOLVE_FQDN) && in http_resolve_cb()
2494 (hostptr = hostTarget + strlen(hostTarget) - 6) > hostTarget && in http_resolve_cb()
2499 * getting the IP address of the .local name and then do reverse-lookups... in http_resolve_cb()
2510 for (addr = addrlist; addr; addr = addr->next) in http_resolve_cb()
2512 …int error = getnameinfo(&(addr->addr.addr), (socklen_t)httpAddrLength(&(addr->addr)), fqdn, sizeof… in http_resolve_cb()
2518 if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn || in http_resolve_cb()
2528 httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)), in http_resolve_cb()
2541 httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, (int)uribuf->bufsize, scheme, in http_resolve_cb()
2543 DEBUG_printf(("5http_resolve_cb: Resolved URI is \"%s\".", uribuf->buffer)); in http_resolve_cb()
2545 avahi_simple_poll_quit(uribuf->poll); in http_resolve_cb()