Library: Zeroconf
Package: ZeroCore
Header: Poco/Zeroconf/LocalService.h
The class LocalService offers functionality for service registration
Member Functions: addRecord, getDomain, getHostName, getName, getPort, getProperties, getRegType, init, removeRecord, updateRecord
RT_HOSTADDRESS = 1
Host address.
Authoritative server.
Mail destination.
RT_MAILFORWARDER = 4
Mail forwarder.
RT_CANONICALNAME = 5
Canonical name.
Start of authority zone.
Mailbox domain name.
Mail group member.
Mail rename name.
RT_NULLRESOURCE = 10
Null resource record.
RT_WELLKNOWNSERVICE = 11
Well known service.
RT_DOMAINNAMEPTR = 12
Domain name pointer.
RT_HOSTINFO = 13
Host information.
RT_MAILBOXINFO = 14
Mailbox information.
RT_MAILROUTINGINFO = 15
Mail routing information.
RT_TEXTSTRINGS = 16
One or more text strings.
RT_RESPONSIBLEPERSON = 17
Responsible person.
RT_AFSCELLDATABASE = 18
AFS cell database.
RT_X25ADDRESS = 19
X_25 calling address.
RT_ISDNADDRESS = 20
ISDN calling address.
RT_ROUTER = 21
Router.
RT_NSAPADDRESS = 22
NSAP address.
RT_REVERSENSAPLOOKUP = 23
Reverse NSAP lookup (deprecated).
RT_SECSIGNATURE = 24
Security signature.
RT_SECKEY = 25
Security key.
RT_X400MAILMAPPING = 26
X.400 mail mapping.
RT_GEOGRAPHICALPOS = 27
Geographical position (withdrawn).
RT_DEPREC_IP6ADDRESS = 28
Ip6 Address.
RT_LOCATIONINFO = 29
Location Information.
RT_SECNEXTDOMAIN = 30
Next domain (security).
RT_ENDPOINTID = 31
Endpoint identifier.
RT_NIMRODLOCATOR = 32
Nimrod Locator.
RT_SERVERSELECTION = 33
Server Selection.
RT_ATMADDRESS = 34
ATM Address
RT_NAMEAUTHORITYPTR = 35
Naming Authority PoinTeR
RT_KEYEXCHANGE = 36
Key Exchange
RT_CERTRECORD = 37
Certification record
RT_IP6ADDRESS = 38
IPv6 address (deprecates AAAA)
RT_DNAME = 39
Non-terminal DNAME (for IPv6)
RT_KITCHENSINK = 40
Kitchen sink (experimental)
RT_OPT = 41
EDNS0 option (meta-RR)
RT_TRANSACTIONKEY = 249
Transaction key
RT_TRANSACTIONSIG = 250
Transaction signature.
RT_INCRZONETRANSFER = 251
Incremental zone transfer.
RT_TRANSFERZONEAUTHORITY = 252
Transfer zone of authority.
RT_TRANSFERMAILBOX = 253
Transfer mailbox records.
RT_TRANSFERMAILAGENTS = 254
Transfer mail agent records.
RT_ANY = 255
Wildcard match.
LocalService();
Creates the LocalService.
~LocalService();
Destroys the LocalService.
DNSRecordRef addRecord(
LocalService::RecordType type,
Poco::UInt16 size,
const void * pData,
Poco::UInt32 ttl
);
Adds a record to a service, the maximum size of a record is 65535 bytes, which is stored as opaque payload in pData. The returned value is guaranteed to be not equal 0.
const std::string & getDomain() const;
Returns the domain the service is running in. Will be empty until the service successfully registered.
const std::string & getHostName() const;
Returns the hostname which was passed to init
const std::string & getName() const;
Returns the name of the service. Will be empty until the service successfully registered.
Poco::UInt16 getPort() const;
Returns the port which was passed to init
const Properties & getProperties() const;
Returns the properties which were passed to init
const std::string & getRegType() const;
Returns the regtype of the service.
void init(
bool remote,
bool enableAutoRenaming,
const Poco::Net::NetworkInterface & iface,
const std::string & proposedName,
const std::string & regType,
const std::string & domain,
const std::string & hostName,
Poco::UInt16 port,
const Properties & prop
);
Initializes the LocalService, starts registration. Make sure that you are registered to the Events before calling this method remote specifies if the service is viewable in other sub networks or only on localhost. If enableAutoRenaming is set to true, and in the network another service is found with the same name, your service will be automatically renamed. If set to false and a conflict is found an ERegistrationFailed event is thrown. proposedName can be empty, then a default name is chosen. Use the interface with index 0 to advertise a service on all network interfaces. Note that a remote value of false will override the interface value and limit it to localhost only. regType is mandatory (see http://www.dns-sd.org/ServiceTypes.html for possible values) domain is optional and will be set to a default value (most likely: "local.") if empty hostName can be empty but you must specify a hostName when creating proxy registrations for services running on other machines. prop allows to specify service specific properties
void removeRecord(
DNSRecordRef ref
);
Removes a record. ref must not be 0. This method will invalidate ref.
void updateRecord(
DNSRecordRef ref,
Poco::UInt16 size,
const void * pData,
Poco::UInt32 ttl
);
Updates a record, note that an update where ref = 0 will change the services's primary txt record!
Poco::FIFOEvent < std::string > EDomainChanged;
Thrown whenever the domain name changes. Will be thrown for a successful registration (change from empty name to new name)
Poco::FIFOEvent < Poco::Int32 > ERegistrationFailed;
Returns the error code. When this Event is thrown the whole object was reset to empty default values, including name and domain.
Poco::FIFOEvent < std::string > EServiceRenamed;
Thrown whenever the service name changes. Will be thrown for a successful registration (change from empty name to new name)