Poco::Zeroconf

class DNSServiceDiscovery

Library: Zeroconf
Package: ZeroCore
Header: Poco/Zeroconf/DNSServiceDiscovery.h

Description

The singleton DNSServiceDiscovery acts as entry point for Zeroconf operations browse, resolve, and domain searching. The singleton is created and returned via the instance method. Note that your application must call its shutdown() method right before exiting!

Member Summary

Member Functions: addListener, browse, discoverDomainsForBrowsing, discoverDomainsForRegister, instance, remove, removeListener, resolve, shutdown

Constructors

Destructor

~DNSServiceDiscovery protected

~DNSServiceDiscovery();

Destroys the DNSServiceDiscovery.

Member Functions

addListener

void addListener(
    DiscoveryListener & listener
);

Convenience function which registers the listener at all service specific events. Note that you don't need to implement the DiscoveryListener interface If you have a class that offers some methods with the same signature you can register them manually at the individual events.

addListener

void addListener(
    DomainListener & listener
);

Convenience function which registers the listener at all domain specific events. Note that you don't need to implement the DomainListener interface If you have a class that offers some methods with the same signature you can register them manually at the individual events.

browse

DNSServiceRef browse(
    const std::string & regType,
    const std::string & domain
);

Browses for a service on all network interfaces restricted by regType and domain (domain can be empty). Results will be sent asnychronously via the EBrowseError, EServiceFound, EServiceRemoved events.

browse

DNSServiceRef browse(
    const std::string & regType,
    const std::string & domain,
    const Poco::Net::NetworkInterface & iface
);

Browses for a service on the defined network interface restricted by regType and domain (domain can be empty). Results will be sent asnychronously via the EBrowseError, EServiceFound, EServiceRemoved events.

discoverDomainsForBrowsing

DNSServiceRef discoverDomainsForBrowsing(
    const Poco::Net::NetworkInterface & iface
);

Discovers domains for browse operations on the defined interface (use interface with index 0 to search on all interfaces) Results will be sent asnychronously via the EBrowseDomainFound, EBrowseDomainRemoved and EBrowseDomainError events.

discoverDomainsForBrowsing

DNSServiceRef discoverDomainsForBrowsing();

Discovers domains for browse operations on all network interfaces Results will be sent asnychronously via the EBrowseDomainFound, EBrowseDomainRemoved and EBrowseDomainError events.

discoverDomainsForRegister

DNSServiceRef discoverDomainsForRegister(
    const Poco::Net::NetworkInterface & iface
);

Discovers domains for service registration on the defined interface (use interface with index 0 to search on all interfaces) Results will be sent asnychronously via the ERegisterDomainFound, ERegisterDomainRemoved and ERegisterDomainError events.

discoverDomainsForRegister

DNSServiceRef discoverDomainsForRegister();

Discovers domains for service registration on all network interfaces Results will be sent asnychronously via the ERegisterDomainFound, ERegisterDomainRemoved and ERegisterDomainError events.

instance static

static DNSServiceDiscovery & instance();

Returns the instance of the singleton.

remove inline

void remove(
    DNSServiceRef ref
);

Stops the activity assigned with the DNSServiceRef, invalidates the reference

removeListener

void removeListener(
    DiscoveryListener & listener
);

Convenience function which removes the listener from all events.

removeListener

void removeListener(
    DomainListener & listener
);

Convenience function which removes the listener from all events

resolve

DNSServiceRef resolve(
    const ServiceInfo & info,
    bool searchOnAllInterfaces
);

Resolves a ServiceInfo. Call browse to retrieve the ServiceInfo required as first parameter here. Results will be sent asnychronously via the EResolveError and EServiceResolved events.

shutdown

void shutdown();

Stops all activity. Invalidates all DNSServiceRefs. THIS METHOD MUST BE INVOKED RIGHT BEFORE YOU EXIT YOUR APPLICATION!

Variables

EBrowseDomainError

Poco::BasicEvent < DomainError > EBrowseDomainError;

In case an error occurs while parsing for domains, this event signales the errorNumber

EBrowseDomainFound

Poco::BasicEvent < std::pair < DomainInfo, bool > > EBrowseDomainFound;

1st param contains the detected domain, 2nd param tells if more events will follow immediately

EBrowseDomainRemoved

Poco::BasicEvent < std::pair < DomainInfo, bool > > EBrowseDomainRemoved;

1st param contains the detected domain, 2nd param tells if more events will follow immediately

EBrowseError

Poco::BasicEvent < ServiceError > EBrowseError;

An error happend while browsing

ERegisterDomainError

Poco::BasicEvent < DomainError > ERegisterDomainError;

In case an error occurs while parsing for domains, this event signales the errorNum

ERegisterDomainFound

Poco::BasicEvent < std::pair < DomainInfo, bool > > ERegisterDomainFound;

1st param contains the detected domain, 2nd param tells if more events will follow immediately

ERegisterDomainRemoved

Poco::BasicEvent < std::pair < DomainInfo, bool > > ERegisterDomainRemoved;

1st param contains the detected domain, 2nd param tells if more events will follow immediately

EResolveError

Poco::BasicEvent < ServiceError > EResolveError;

An error happend while trying to resolve a service

EServiceFound

Poco::BasicEvent < std::pair < ServiceInfo, bool > > EServiceFound;

1st param contains serviceInfo, 2nd param tells if more events will follow immediately

EServiceRemoved

Poco::BasicEvent < std::pair < ServiceInfo, bool > > EServiceRemoved;

1st param contains serviceInfo, 2nd param tells if more events will follow immediately

EServiceResolved

Poco::BasicEvent < std::pair < ResolvedServiceInfo, bool > > EServiceResolved;

1st param contains serviceInfo, 2nd param tells if more events will follow immediately