Free Electron
BeaconClientI.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __BeaconClientI_h__
8 #define __BeaconClientI_h__
9 
10 namespace beacon
11 {
12 
13 struct BeaconConfig
14 {
15  char ipAddress[16]; /// Beacon IP address (xxx.xxx.xxx.xxx\0)
16  uint16_t requestPort; /// Beacon request port
17  uint16_t gdRequestPort; /// Global dictionary request port
18 };
19 
20 /**************************************************************************//**
21  @brief Client Node interface to Beacon
22 
23  @ingroup beacon
24 *//***************************************************************************/
25 class FE_DL_EXPORT BeaconClientI:
26  virtual public fe::Component,
27  public fe::CastableAs<BeaconClientI>
28 {
29 public:
30  /// @brief Registers node with the Beacon
31  virtual bool registerWithBeacon(const BeaconConfig &config,
32  bool timeSync) = 0;
33 
34  /// @brief Shutdowns the thread monitoring the Beacon and
35  /// sending keep alive messages
36  virtual void shutdown() = 0;
37 
38  /// @brief Returns the unique ID of this client instance
39  virtual uint8_t getID() = 0;
40 
41  /// @brief Returns the time offset between the clock on the Beacon
42  /// and the local processor
43  virtual int64_t getTimeOffset() = 0;
44 
45  /// @brief Returns the current time plus the offset to give you
46  /// the Beacon time
47  virtual int64_t getBeaconTime() = 0;
48 
49  /// @brief Returns the estimated latency between the server and the client
50  virtual int64_t getLatency() = 0;
51 
52  /// @brief Returns true if the list has of nodes has changed
53  virtual bool isListUpdated() = 0;
54 
55  /// @brief Fills in the list of nodes registered with the Beacon
56  virtual void getList(std::list<Node> &registeredNode) = 0;
57 
58  /// @brief Returns true if the Beacon is alive
59  /// (received a response from the Beacon within the timeout period)
60  virtual bool isBeaconAlive() = 0;
61 
62  /// Global Dictionary access functions.
63  /// The Global Dictionary is a name/values strings list
64 
65  /// @brief Gets the value from the Global Dictionary given a list of names
66  virtual bool dictionaryGet(
67  std::vector<std::pair<fe::String,fe::String>> &list) = 0;
68 
69  /// @brief Sets name/values in the Global Dictionary
70  virtual bool dictionarySet(
71  const std::vector<std::pair<fe::String,fe::String>> &list) = 0;
72 
73  /// @brief Unsets name/value pairs in the Global Dictionary
74  /// given a list of names
75  virtual bool dictionaryUnset(
76  const std::vector<std::pair<fe::String,fe::String>> &list) = 0;
77 
78  /// @brief Clears the Global Dictionary
79  virtual bool dictionaryClear() = 0;
80 
81  /// @brief Gets the all matching pairs in the Global Dictionary
82  /// using the regex search string
83  virtual bool dictionaryGetRegex(const fe::String searchString,
84  std::vector<std::pair<fe::String,fe::String>> &list) = 0;
85 
86  /// @brief Get the last update counter received for the Global Dictionary
87  virtual uint64_t dictionaryGetUpdateCounter() = 0;
88 };
89 
90 } // namespace beacon
91 
92 #endif // __BeaconClientI_h__
Client Node interface to Beacon.
Definition: BeaconClientI.h:25
Automatically reference-counted string container.
Definition: String.h:128
Base for all interfacable components.
Definition: Component.h:20
Definition: BeaconClient.cc:16
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192