Closed michaelrsweet closed 1 year ago
[dnssd d921af68f] Initial skeleton of new DNS-SD API (Issue #19)
The proposed API manages all DNS-SD requests/registrations on a separate thread represented by the cups_dnssd_t
context structure/pointer. Deleting the DNS-SD context also deletes all pending requests/registrations. The semantics of the service API reflect Avahi's peculiar handling of services as part of a named group, but we can simulate that with mDNSResponder and WinDNS.
Create/destroy DNS-SD context:
void cupsDNSSDDelete(cups_dnssd_t *dns);
cups_dnssd_t *cupsDNSSDNew(cups_dnssd_error_cb_t error_cb, void *cb_data);
Create/destroy browsing request:
void cupsDNSSDBrowseDelete(cups_dnssd_browse_t *browser);
cups_dnssd_browse_t *cupsDNSSDBrowseNew(cups_dnssd_t *dns, uint32_t if_index, const char *types, const char *domains, cups_dnssd_browse_cb_t browse_cb, void *cb_data);
Create/destroy query request:
void cupsDNSSDQueryDelete(cups_dnssd_query_t *query);
cups_dnssd_query_t *cupsDNSSDQueryNew(cups_dnssd_t *dns, uint32_t if_index, const char *types, const char *domains, cups_dnssd_query_cb_t query_cb, void *cb_data);
Create/restore resolve request:
void cupsDNSSDResolveDelete(cups_dnssd_resolve_t *res);
cups_dnssd_resolve_t *cupsDNSSDResolveNew(cups_dnssd_t *dns, uint32_t if_index, const char *types, const char *domains, cups_dnssd_resolve_cb_t resolve_cb, void *cb_data);
Create/destroy named services. Each service has a name and one or more instances:
bool cupsDNSSDServiceAdd(cups_dnssd_service_t *service, uint32_t if_index, const char *types, const char *domains, const char *host, uint16_t port, size_t num_txt, cups_option_t *txt);
void cupsDNSSDServiceDelete(cups_dnssd_service_t *service);
cups_dnssd_service_t *cupsDNSSDServiceNew(cups_dnssd_t *dns, const char *name, cups_dnssd_service_cb_t cb, void *cb_data);
bool cupsDNSSDServicePublish(cups_dnssd_service_t *service);
bool cupsDNSSDServiceSetLocation(cups_dnssd_service_t *service, const char *geo_uri);
Mostly done, just have the Windows DNS-SD APIs to support.
Created #29 to track usage of the Windows DNS-SD APIs. Closing this one.
Currently the various bits of CUPS, PAPPL, etc. have a conditional mess of code that use the Avahi or mDNSResponder APIs to do DNS-SD discovery and sharing. This continues to be a major pain, and CUPS should have a common API that developers can use to access whatever the local API/service is for this. Goals: