pvAccessCPP  7.1.6
beaconHandler.h
1 /**
2  * Copyright - See the COPYRIGHT that is included with this distribution.
3  * pvAccessCPP is distributed subject to a Software License Agreement found
4  * in file LICENSE that is included with this distribution.
5  */
6 
7 #ifndef BEACONHANDLER_H
8 #define BEACONHANDLER_H
9 
10 #ifdef epicsExportSharedSymbols
11 # define beaconHandlerEpicsExportSharedSymbols
12 # undef epicsExportSharedSymbols
13 #endif
14 
15 #include <osiSock.h>
16 
17 #include <pv/timeStamp.h>
18 #include <pv/lock.h>
19 
20 #ifdef beaconHandlerEpicsExportSharedSymbols
21 # define epicsExportSharedSymbols
22 # undef beaconHandlerEpicsExportSharedSymbols
23 #endif
24 
25 #include <pv/pvaDefs.h>
26 #include <pv/remote.h>
27 #include <pv/pvAccess.h>
28 
29 namespace epics {
30 namespace pvAccess {
31 
32 /**
33  * BeaconHandler
34  */
35 class BeaconHandler
36 {
37 public:
38  POINTER_DEFINITIONS(BeaconHandler);
39 
40  /**
41  * Constructor.
42  */
44  const osiSockAddr* responseFrom);
45 
46  virtual ~BeaconHandler();
47 
48  /**
49  * Update beacon period and do analitical checks (server restared, routing problems, etc.)
50  * @param from who is notifying.
51  * @param remoteTransportRevision encoded (major, minor) revision.
52  * @param guid server GUID.
53  * @param sequentalID sequential ID.
54  * @param changeCount change count.
55  * @param data server status data, can be <code>NULL</code>.
56  */
57  void beaconNotify(osiSockAddr* from,
58  epics::pvData::int8 remoteTransportRevision,
59  epics::pvData::TimeStamp* timestamp,
60  ServerGUID const &guid,
63  const epics::pvData::PVFieldPtr& data);
64 private:
65  /**
66  * Context instance.
67  */
68  Context::weak_pointer _context;
69  /**
70  * Remote address.
71  */
72  /**
73  * Mutex
74  */
75  epics::pvData::Mutex _mutex;
76  /**
77  * Server GUID.
78  */
79  ServerGUID _serverGUID;
80  /**
81  * Server startup timestamp.
82  */
83  epics::pvData::int16 _serverChangeCount;
84  /**
85  * First beacon flag.
86  */
87  bool _first;
88 
89  /**
90  * Update beacon.
91  * @param remoteTransportRevision encoded (major, minor) revision.
92  * @param timestamp time when beacon was received.
93  * @param guid server GUID.
94  * @param sequentalID sequential ID.
95  * @param changeCount change count.
96  * @return network change (server restarted) detected.
97  */
98  bool updateBeacon(epics::pvData::int8 remoteTransportRevision,
99  epics::pvData::TimeStamp* timestamp,
100  ServerGUID const &guid,
101  epics::pvData::int16 sequentalID,
102  epics::pvData::int16 changeCount);
103 };
104 
105 }
106 }
107 
108 #endif /* INTROSPECTIONREGISTRY_H */
BeaconHandler(Context::shared_pointer const &context, const osiSockAddr *responseFrom)
Constructor.
virtual void authNZMessage(epics::pvData::PVStructure::shared_pointer const &data)=0
Pass data to the active security plug-in session.
void beaconNotify(osiSockAddr *from, epics::pvData::int8 remoteTransportRevision, epics::pvData::TimeStamp *timestamp, ServerGUID const &guid, epics::pvData::int16 sequentalID, epics::pvData::int16 changeCount, const epics::pvData::PVFieldPtr &data)
Update beacon period and do analitical checks (server restared, routing problems, etc...