Open Lighting Architecture  0.9.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
29 namespace ola {
30 
35  public:
36  virtual ~DiscoveryAgentInterface() {}
37 
41  virtual bool Init() = 0;
42 
48  struct RegisterOptions {
53  typedef std::map<std::string, std::string> TxtData;
54 
58  static const int ALL_INTERFACES = 0;
59 
60  int if_index;
65  std::string domain;
70  domain("") {
71  }
72 
73  RegisterOptions(const RegisterOptions &options)
74  : if_index(options.if_index),
75  domain(options.domain),
76  txt_data(options.txt_data) {
77  }
78  };
79 
80  // Think about what sort of error handling we want here
88  virtual void RegisterService(const std::string &service_name,
89  const std::string &type,
90  uint16_t port,
91  const RegisterOptions &options) = 0;
92 };
93 
100  public:
102 
109 
110  private:
111  DISALLOW_COPY_AND_ASSIGN(DiscoveryAgentFactory);
112 };
113 } // namespace ola
114 #endif // OLAD_DISCOVERYAGENT_H_