21 #ifndef OLAD_OLASERVER_H_
22 #define OLAD_OLASERVER_H_
26 #endif // HAVE_CONFIG_H
31 #include <ola/io/SelectServer.h>
32 #include <ola/network/InterfacePicker.h>
33 #include <ola/network/Socket.h>
34 #include <ola/network/TCPSocketFactory.h>
35 #include <ola/plugin_id.h>
38 #include <ola/rpc/RpcSessionHandler.h>
52 #ifdef HAVE_LIBMICROHTTPD
53 typedef class OladHTTPServer OladHTTPServer_t;
55 typedef int OladHTTPServer_t;
56 #endif // HAVE_LIBMICROHTTPD
73 std::string network_interface;
74 std::string pid_data_dir;
89 OlaServer(
const std::vector<class PluginLoader*> &plugin_loaders,
150 return m_instance_name;
158 return m_preferences_factory;
161 static const unsigned int DEFAULT_HTTP_PORT = 9090;
168 class OlaClientService *client_service;
171 typedef std::map<ola::io::DescriptorHandle, ClientEntry> ClientMap;
174 const Options m_options;
175 std::vector<class PluginLoader*> m_plugin_loaders;
176 class PreferencesFactory *m_preferences_factory;
179 class ExportMap *m_export_map;
181 std::auto_ptr<class ExportMap> m_our_export_map;
185 std::auto_ptr<class DeviceManager> m_device_manager;
186 std::auto_ptr<class PluginManager> m_plugin_manager;
187 std::auto_ptr<class PluginAdaptor> m_plugin_adaptor;
188 std::auto_ptr<class UniverseStore> m_universe_store;
189 std::auto_ptr<class PortManager> m_port_manager;
190 std::auto_ptr<class OlaServerServiceImpl> m_service_impl;
191 std::auto_ptr<class ClientBroker> m_broker;
192 std::auto_ptr<class PortBroker> m_port_broker;
193 std::auto_ptr<const ola::rdm::RootPidStore> m_pid_store;
194 std::auto_ptr<class DiscoveryAgentInterface> m_discovery_agent;
195 std::auto_ptr<ola::rpc::RpcServer> m_rpc_server;
196 class Preferences *m_server_preferences;
197 class Preferences *m_universe_preferences;
198 std::string m_instance_name;
201 std::auto_ptr<OladHTTPServer_t> m_httpd;
203 bool RunHousekeeping();
205 #ifdef HAVE_LIBMICROHTTPD
208 #endif // HAVE_LIBMICROHTTPD
215 void ReloadPluginsInternal();
221 static const char INSTANCE_NAME_KEY[];
222 static const char K_INSTANCE_NAME_VAR[];
223 static const char K_DISCOVERY_SERVICE_TYPE[];
224 static const char K_UID_VAR[];
225 static const char SERVER_PREFERENCES[];
226 static const char UNIVERSE_PREFERENCES[];
227 static const unsigned int K_HOUSEKEEPING_TIMEOUT_MS;
232 #endif // OLAD_OLASERVER_H_
void NewConnection(ola::io::ConnectedDescriptor *descriptor)
Add a new ConnectedDescriptor to this Server.
Definition: OlaServer.cpp:342
Represents the RPC session between a client and server.
Definition: RpcSession.h:45
Used to receive notifications of RPC client session activity.
Definition: RpcSessionHandler.h:36
const PreferencesFactory * GetPreferencesFactory()
Get the preferences factory.
Definition: OlaServer.h:157
Definition: Preferences.h:343
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
A container for the exported variables.
Definition: ExportMap.h:324
A BidirectionalFileDescriptor that also generates notifications when closed.
Definition: Descriptor.h:282
std::string http_data_dir
Port to run the HTTP server on.
Definition: OlaServer.h:72
Holds information about RDM PIDs.
void Terminate()
Exit from the Run() loop.
Definition: SelectServer.cpp:116
A RDM unique identifier (UID).
Export variables on the http server.
bool http_enable_quit
Restrict access to localhost only.
Definition: OlaServer.h:69
Constants used throughout OLA.
Options for the OlaServer.
Definition: OlaServer.h:66
static const int OLA_DEFAULT_PORT
The default port which olad listens on for incoming RPC connections.
Definition: Constants.h:68
void * timeout_id
A timeout handle which can later be used to cancel a timeout.
Definition: SchedulerInterface.h:34
const std::string InstanceName()
Get the instance name.
Definition: OlaServer.h:149
The main OlaServer class.
Definition: OlaServer.h:61
void ReloadPidStore()
Reload the pid store.
Definition: OlaServer.cpp:330
Definition: Interface.h:35
OlaServer(const std::vector< class PluginLoader * > &plugin_loaders, class PreferencesFactory *preferences_factory, ola::io::SelectServer *ss, const Options &ola_options, ola::network::TCPAcceptingSocket *socket=NULL, ExportMap *export_map=NULL)
Create a new instance of the OlaServer.
Definition: OlaServer.cpp:91
void ReloadPlugins()
Reload all plugins.
Definition: OlaServer.cpp:326
A single threaded I/O event management system.
Definition: SelectServer.h:63
An RPC server.
Definition: RpcServer.h:48
bool http_localhost_only
Run the HTTP server.
Definition: OlaServer.h:68
ola::network::GenericSocketAddress LocalRPCAddress() const
Return the socket address the RPC server is listening on.
Definition: OlaServer.cpp:349
void StopServer()
Stop the OLA Server.
Definition: OlaServer.h:126
Represents a RDM UID.
Definition: UID.h:57
Definition: TCPSocket.h:73
void NewClient(ola::rpc::RpcSession *session)
Called by the RpcServer when a client connects.
Definition: OlaServer.cpp:357
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
The root of the RDM parameter descriptor store.
Definition: PidStore.h:68
~OlaServer()
Shutdown the server.
Definition: OlaServer.cpp:113
void ClientRemoved(ola::rpc::RpcSession *session)
Called by the RpcServer when a client disconnects.
Definition: OlaServer.cpp:364
bool Init()
Initialize the OlaServer.
Definition: OlaServer.cpp:156
unsigned int http_port
Enable /quit URL.
Definition: OlaServer.h:70
a Generic Socket Address
Definition: SocketAddress.h:165