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

Function http_resolve_cb

cups/http-support.c:2288–2467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2286 */
2287
2288static void DNSSD_API
2289http_resolve_cb(
2290 DNSServiceRef sdRef, /* I - Service reference */
2291 DNSServiceFlags flags, /* I - Results flags */
2292 uint32_t interfaceIndex, /* I - Interface number */
2293 DNSServiceErrorType errorCode, /* I - Error, if any */
2294 const char *fullName, /* I - Full service name */
2295 const char *hostTarget, /* I - Hostname */
2296 uint16_t port, /* I - Port number */
2297 uint16_t txtLen, /* I - Length of TXT record */
2298 const unsigned char *txtRecord, /* I - TXT record data */
2299 void *context) /* I - Pointer to URI buffer */
2300{
2301 _http_uribuf_t *uribuf = (_http_uribuf_t *)context;
2302 /* URI buffer */
2303 const char *scheme, /* URI scheme */
2304 *hostptr, /* Pointer into hostTarget */
2305 *reskey, /* "rp" or "rfo" */
2306 *resdefault; /* Default path */
2307 char resource[257], /* Remote path */
2308 fqdn[256]; /* FQDN of the .local name */
2309 const void *value; /* Value from TXT record */
2310 uint8_t valueLen; /* Length of value */
2311
2312
2313 DEBUG_printf(("4http_resolve_cb(sdRef=%p, flags=%x, interfaceIndex=%u, errorCode=%d, fullName=\"%s\", hostTarget=\"%s\", port=%u, txtLen=%u, txtRecord=%p, context=%p)", (void *)sdRef, flags, interfaceIndex, errorCode, fullName, hostTarget, port, txtLen, (void *)txtRecord, context));
2314
2315 /*
2316 * If we have a UUID, compare it...
2317 */
2318
2319 if (uribuf->uuid &&
2320 (value = TXTRecordGetValuePtr(txtLen, txtRecord, "UUID",
2321 &valueLen)) != NULL)
2322 {
2323 char uuid[256]; /* UUID value */
2324
2325 memcpy(uuid, value, valueLen);
2326 uuid[valueLen] = '\0';
2327
2328 if (_cups_strcasecmp(uuid, uribuf->uuid))
2329 {
2330 if (uribuf->options & _HTTP_RESOLVE_STDERR)
2331 fprintf(stderr, "DEBUG: Found UUID %s, looking for %s.", uuid,
2332 uribuf->uuid);
2333
2334 DEBUG_printf(("5http_resolve_cb: Found UUID %s, looking for %s.", uuid,
2335 uribuf->uuid));
2336 return;
2337 }
2338 }
2339
2340 /*
2341 * Figure out the scheme from the full name...
2342 */
2343
2344 if (strstr(fullName, "._ipps") || strstr(fullName, "._ipp-tls"))
2345 scheme = "ipps";

Callers

nothing calls this directly

Calls 8

TXTRecordGetValuePtrFunction · 0.85
_cups_strcasecmpFunction · 0.85
httpAddrGetListFunction · 0.85
httpAddrLengthFunction · 0.85
httpAddrStringFunction · 0.85
httpAddrFreeListFunction · 0.85
httpAssembleURIfFunction · 0.85
httpAssembleURIFunction · 0.85

Tested by

no test coverage detected