35 #ifndef INCLUDE_OLA_E133_SLPTHREAD_H_
36 #define INCLUDE_OLA_E133_SLPTHREAD_H_
39 #include <ola/thread/Thread.h>
40 #include <ola/io/SelectServer.h>
41 #include <ola/network/Socket.h>
42 #include <ola/network/IPV4Address.h>
44 #include <ola/thread/ExecutorInterface.h>
45 #include <ola/slp/SLPClient.h>
46 #include <ola/slp/URLEntry.h>
58 using ola::slp::URLEntries;
67 : ServerInfo(server_info),
68 backend_type(server_info.backend_type) {
72 : ServerInfo(server_info) {
90 unsigned int discovery_interval = DEFAULT_DISCOVERY_INTERVAL_SECONDS);
116 void RunDeviceDiscoveryNow();
120 bool Join(
void *ptr = NULL);
121 virtual void Cleanup() = 0;
123 static const unsigned int DEFAULT_DISCOVERY_INTERVAL_SECONDS;
137 const string &service) = 0;
140 uint16_t lifetime) = 0;
142 const string& url) = 0;
147 virtual void ThreadStopping() {}
151 virtual uint16_t MinRefreshTime() {
return 0; }
153 void ReRegisterAllServices();
155 static const char RDNMET_SCOPE[];
160 ola::thread::timeout_id timeout;
161 } URLRegistrationState;
162 typedef std::map<string, URLRegistrationState> URLStateMap;
166 ola::thread::timeout_id timeout;
168 typedef std::map<string, DiscoveryState> DiscoveryStateMap;
170 URLStateMap m_url_map;
171 DiscoveryStateMap m_discovery_callbacks;
173 unsigned int m_discovery_interval;
177 void StartDiscoveryProcess();
178 void RemoveDiscoveryTimeout(DiscoveryState *state);
179 void RunDiscoveryForService(
const string service);
180 void ForceDiscovery(
const string service);
181 void DiscoveryComplete(
const string service,
bool result,
182 const URLEntries &urls);
184 const URLEntries *urls);
185 void DiscoveryTriggered(
const string service);
193 void ReRegisterService(
string url);
205 static string GetDeviceURL(
const IPV4Address& address,
const UID &uid);
206 static string GetControllerURL(
const IPV4Address& address);
207 static uint16_t ClampLifetime(
const string &url, uint16_t lifetime);
209 static const uint16_t MIN_SLP_LIFETIME;
210 static const uint16_t SA_REREGISTRATION_TIME;
211 static const char E133_DEVICE_SLP_SERVICE_NAME[];
212 static const char E133_CONTROLLER_SLP_SERVICE_NAME[];
223 unsigned int discovery_interval =
224 BaseSLPThread::DEFAULT_DISCOVERY_INTERVAL_SECONDS);
232 #endif // INCLUDE_OLA_E133_SLPTHREAD_H_