35 #ifndef INCLUDE_OLA_E133_SLPTHREAD_H_
36 #define INCLUDE_OLA_E133_SLPTHREAD_H_
40 #include <ola/io/SelectServer.h>
42 #include <ola/network/Socket.h>
44 #include <ola/slp/SLPClient.h>
45 #include <ola/slp/URLEntry.h>
46 #include <ola/thread/ExecutorInterface.h>
47 #include <ola/thread/Thread.h>
59 using ola::slp::URLEntries;
68 : ServerInfo(server_info),
69 backend_type(server_info.backend_type) {
73 : ServerInfo(server_info) {
91 unsigned int discovery_interval = DEFAULT_DISCOVERY_INTERVAL_SECONDS);
117 void RunDeviceDiscoveryNow();
121 bool Join(
void *ptr = NULL);
122 virtual void Cleanup() = 0;
124 static const unsigned int DEFAULT_DISCOVERY_INTERVAL_SECONDS;
138 const string &service) = 0;
141 uint16_t lifetime) = 0;
143 const string& url) = 0;
148 virtual void ThreadStopping() {}
152 virtual uint16_t MinRefreshTime() {
return 0; }
154 void ReRegisterAllServices();
156 static const char RDNMET_SCOPE[];
162 } URLRegistrationState;
163 typedef std::map<string, URLRegistrationState> URLStateMap;
169 typedef std::map<string, DiscoveryState> DiscoveryStateMap;
171 URLStateMap m_url_map;
172 DiscoveryStateMap m_discovery_callbacks;
174 unsigned int m_discovery_interval;
178 void StartDiscoveryProcess();
179 void RemoveDiscoveryTimeout(DiscoveryState *state);
180 void RunDiscoveryForService(
const string service);
181 void ForceDiscovery(
const string service);
182 void DiscoveryComplete(
const string service,
bool result,
183 const URLEntries &urls);
185 const URLEntries *urls);
186 void DiscoveryTriggered(
const string service);
194 void ReRegisterService(
string url);
206 static string GetDeviceURL(
const IPV4Address& address,
const UID &uid);
207 static string GetControllerURL(
const IPV4Address& address);
208 static uint16_t ClampLifetime(
const string &url, uint16_t lifetime);
210 static const uint16_t MIN_SLP_LIFETIME;
211 static const uint16_t SA_REREGISTRATION_TIME;
212 static const char E133_DEVICE_SLP_SERVICE_NAME[];
213 static const char E133_CONTROLLER_SLP_SERVICE_NAME[];
226 unsigned int discovery_interval =
227 BaseSLPThread::DEFAULT_DISCOVERY_INTERVAL_SECONDS);
234 #endif // INCLUDE_OLA_E133_SLPTHREAD_H_