Open Lighting Architecture  0.9.6
 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 
49  struct RegisterOptions {
54  typedef std::map<std::string, std::string> TxtData;
55 
59  static const int ALL_INTERFACES = 0;
60 
61  int if_index;
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:
115  DISALLOW_COPY_AND_ASSIGN(DiscoveryAgentFactory);
116 };
117 } // namespace ola
118 #endif // OLAD_DISCOVERYAGENT_H_