What API to separate DEVICE_URI?

Michael Sweet mike at easysw.com
Wed Aug 13 19:58:47 PDT 2008


keens312 wrote:
> Hi Michael,
> 
> I got an URI: mdns://PrinterName._pdl-datastream._tcp.local./?bidi
> 
> I need to convert the uri to name, type, domain.
> I expect name=PrinterName, type=_pdl-datastream._tcp and domain=local.
> 
> httpSeparateURI could only split method, username, host name and resource, and the host name is combined with type and domain.
> 
> Cocoa NSString API componentsSeparatedByString can do this but it will aslo split _pdl-datastream._tcp into two parts, this is not what I want.
> 
> Is there correct CUPS API specific to my requirements? I thinks its a frequent used function.

The cupsBackendDeviceURI function in CUPS 1.4 supports resolution of
DNS-SD service names.  We don't provide a public API to resolve any
old URI, since we don't want vendors talking directly to printers -
that's what backends are for!

If you absolutely have to talk directly to your printer (and keep in
mind that will break whatever program you are developing for a large
number of use cases!), look at the CUPS 1.4 code in cups/http-support.c
for how to extract the service name and type and look it up with the
mDNSResponder client library.

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com




More information about the cups mailing list