1 #ifndef SERVERCONTEXTIMPL_H
2 #define SERVERCONTEXTIMPL_H
4 #ifdef epicsExportSharedSymbols
5 # define serverContextImplEpicsExportSharedSymbols
6 # undef epicsExportSharedSymbols
11 #ifdef serverContextImplEpicsExportSharedSymbols
12 # define epicsExportSharedSymbols
13 # undef serverContextImplEpicsExportSharedSymbols
16 #include <pv/blockingUDP.h>
17 #include <pv/blockingTCP.h>
18 #include <pv/beaconEmitter.h>
20 #include "serverContext.h"
25 class ServerContextImpl :
28 public std::tr1::enable_shared_from_this<ServerContextImpl>
30 friend class ServerContext;
32 typedef std::tr1::shared_ptr<ServerContextImpl> shared_pointer;
33 typedef std::tr1::shared_ptr<const ServerContextImpl> const_shared_pointer;
35 static size_t num_instances;
38 virtual ~ServerContextImpl();
41 const ServerGUID& getGUID() OVERRIDE FINAL;
42 const Version& getVersion() OVERRIDE FINAL;
44 void run(epics::pvData::uint32
seconds) OVERRIDE FINAL;
45 void shutdown() OVERRIDE FINAL;
46 void printInfo(std::
ostream& str,
int lvl) OVERRIDE FINAL;
47 void setBeaconServerStatusProvider(BeaconServerStatusProvider::shared_pointer const & beaconServerStatusProvider) OVERRIDE FINAL;
49 epics::pvData::Timer::shared_pointer getTimer() OVERRIDE FINAL;
50 Channel::shared_pointer getChannel(pvAccessID
id) OVERRIDE FINAL;
51 Transport::shared_pointer getSearchTransport() OVERRIDE FINAL;
52 Configuration::const_shared_pointer getConfiguration() OVERRIDE FINAL;
53 TransportRegistry* getTransportRegistry() OVERRIDE FINAL;
55 virtual
void newServerDetected() OVERRIDE FINAL;
58 epicsTimeStamp& getStartTime() OVERRIDE FINAL;
60 virtual Configuration::shared_pointer getCurrentConfig() OVERRIDE FINAL;
65 static const Version VERSION;
71 float getBeaconPeriod();
77 epics::pvData::int32 getReceiveBufferSize();
83 epics::pvData::int32 getServerPort() OVERRIDE FINAL;
89 epics::pvData::int32 getBroadcastPort() OVERRIDE FINAL;
95 BeaconServerStatusProvider::shared_pointer getBeaconServerStatusProvider();
101 const osiSockAddr *getServerInetAddress();
107 const BlockingUDPTransport::shared_pointer& getBroadcastTransport();
113 virtual const std::vector<ChannelProvider::shared_pointer>& getChannelProviders() OVERRIDE FINAL;
119 bool isChannelProviderNamePreconfigured();
122 typedef std::map<std::
string, std::tr1::weak_ptr<ChannelProvider> > s_channelNameToProvider_t;
123 s_channelNameToProvider_t s_channelNameToProvider;
135 std::
string _beaconAddressList;
140 IfaceNodeVector _ifaceList;
142 osiSockAddr _ifaceAddr;
148 std::
string _ignoreAddressList;
153 bool _autoBeaconAddressList;
163 epics::pvData::int32 _broadcastPort;
168 epics::pvData::int32 _serverPort;
173 epics::pvData::int32 _receiveBufferSize;
175 epics::pvData::Timer::shared_pointer _timer;
180 BlockingUDPTransportVector _udpTransports;
185 BlockingUDPTransport::shared_pointer _broadcastTransport;
187 BeaconEmitter::shared_pointer _beaconEmitter;
192 BlockingTCPAcceptor::shared_pointer _acceptor;
198 TransportRegistry _transportRegistry;
200 ResponseHandler::shared_pointer _responseHandler;
203 std::vector<ChannelProvider::shared_pointer> _channelProviders;
206 epics::pvData::Mutex _mutex;
209 epics::pvData::Event _runEvent;
214 BeaconServerStatusProvider::shared_pointer _beaconServerStatusProvider;
218 void loadConfiguration();
220 Configuration::const_shared_pointer configuration;
222 epicsTimeStamp _startTime;
228 #endif // SERVERCONTEXTIMPL_H
duration< int64_t > seconds