Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
DiscoveryAgent.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * DiscoveryAgent.h
17 * The Interface for DNS-SD Registration & Discovery
18 * Copyright (C) 2013 Simon Newton
19 */
20
21#ifndef OLAD_DISCOVERYAGENT_H_
22#define OLAD_DISCOVERYAGENT_H_
23
24#include <stdint.h>
25#include <ola/base/Macro.h>
26#include <string>
27#include <map>
28
29namespace ola {
30
35 public:
36 virtual ~DiscoveryAgentInterface() {}
37
41 virtual bool Init() = 0;
42
54 typedef std::map<std::string, std::string> TxtData;
55
59 static const int ALL_INTERFACES = 0;
60
67 std::string domain;
72 domain("") {
73 }
74
75 RegisterOptions(const RegisterOptions &options)
76 : if_index(options.if_index),
77 domain(options.domain),
78 txt_data(options.txt_data) {
79 }
80 };
81
89 // TODO(simon): Think about what sort of error handling we want here
90 virtual void RegisterService(const std::string &service_name,
91 const std::string &type,
92 uint16_t port,
93 const RegisterOptions &options) = 0;
94};
95
103 public:
105
113
114 private:
116 const DiscoveryAgentFactory &operator=(const DiscoveryAgentFactory &) = delete;
117};
118} // namespace ola
119#endif // OLAD_DISCOVERYAGENT_H_
Helper macros.
A Factory which produces implementations of DiscoveryAgentInterface.
Definition DiscoveryAgent.h:102
DiscoveryAgentInterface * New()
Create a new DiscoveryAgent.
Definition DiscoveryAgent.cpp:36
The interface to DNS-SD operations like register, browse etc.
Definition DiscoveryAgent.h:34
virtual bool Init()=0
Initialize the DiscoveryAgent.
virtual void RegisterService(const std::string &service_name, const std::string &type, uint16_t port, const RegisterOptions &options)=0
Register a service.
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
Options for the RegisterService method.
Definition DiscoveryAgent.h:49
std::string domain
The domain to use.
Definition DiscoveryAgent.h:67
TxtData txt_data
Definition DiscoveryAgent.h:68
std::map< std::string, std::string > TxtData
Definition DiscoveryAgent.h:54
static const int ALL_INTERFACES
A constant which represents all Interfaces.
Definition DiscoveryAgent.h:59
int if_index
Definition DiscoveryAgent.h:61