otsdaq  3.09.00
GatewaySupervisor.h
1 #ifndef _ots_GatewaySupervisor_h
2 #define _ots_GatewaySupervisor_h
3 #include <atomic>
4 #include <condition_variable>
5 #include <mutex>
6 
7 #include "otsdaq/CoreSupervisors/ConfigurationSupervisorBase.h"
8 #include "otsdaq/CoreSupervisors/CorePropertySupervisorBase.h"
9 #include "otsdaq/FiniteStateMachine/RunControlStateMachine.h"
10 #include "otsdaq/GatewaySupervisor/Iterator.h"
11 #include "otsdaq/SOAPUtilities/SOAPMessenger.h"
12 #include "otsdaq/SupervisorInfo/AllSupervisorInfo.h"
13 #include "otsdaq/WebUsersUtilities/WebUsers.h"
14 #include "otsdaq/WorkLoopManager/WorkLoopManager.h"
15 
16 #include "otsdaq/CodeEditor/CodeEditor.h"
17 #include "otsdaq/TablePlugins/DesktopIconTable.h"
18 
19 #include "otsdaq/NetworkUtilities/TransceiverSocket.h" // for UDP state changer
20 
21 #pragma GCC diagnostic push
22 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
23 #include <xdaq/Application.h>
24 #pragma GCC diagnostic pop
25 #include "otsdaq/Macros/XDAQApplicationMacros.h"
26 
27 #include <toolbox/task/WorkLoop.h>
28 #include <xdata/String.h>
29 #include <xgi/Method.h>
30 #include "otsdaq/GatewaySupervisor/PixelHistoPicGen.h"
31 
32 #include <pthread.h> // for pthread_setcancelstate in broadcastMessageThread
33 #include <set>
34 #include <sstream>
35 #include <string>
36 
37 // clang-format off
38 
40 // #define FSM_LAST_CONFIGURED_GROUP_ALIAS_FILE std::string("FSMLastConfiguredGroupAlias.hist")
41 // #define FSM_LAST_STARTED_GROUP_ALIAS_FILE std::string("FSMLastStartedGroupAlias.hist")
42 
43 // #define FSM_CONFIGURED_GROUP_ALIASES_FILE std::string("FSMConfiguredGroupAliases.hist")
44 // #define FSM_STARTED_GROUP_ALIASES_FILE std::string("FSMStartedGroupAlias.hist")
45 
46 // #define FSM_CONFIGURED_OR_STARTED_GROUP_ALIASES_FILE std::string("FSMConfiguredOrStartedGroupAlias.hist")
47 
48 // #define FSM_CONFIGURED_CONTEXTS_FILE std::string("FSMConfiguredContexts.hist")
49 // #define FSM_STARTED_CONTEXTS_FILE std::string("FSMStartedContexts.hist")
50 // #define FSM_CONFIGURED_OR_STARTED_CONTEXTS_FILE std::string("FSMConfiguredOrStartedContexts.hist")
51 
52 // #define FSM_CONFIGURED_BACKBONES_FILE std::string("FSMConfiguredBackbones.hist")
53 // #define FSM_STARTED_BACKBONES_FILE std::string("FSMStartedBackbones.hist")
54 // #define FSM_CONFIGURED_OR_STARTED_BACKBONES_FILE std::string("FSMConfiguredOrStartedBackbones.hist")
55 
56 // #define FSM_CONFIGURED_ITERATORS_FILE std::string("FSMConfiguredIterators.hist")
57 // #define FSM_STARTED_ITERATORS_FILE std::string("FSMStartedIterators.hist")
58 // #define FSM_CONFIGURED_OR_STARTED_ITERATORS_FILE std::string("FSMConfiguredOrStartedIterators.hist")
59 
60 
61 namespace ots
62 {
63 class ConfigurationManager;
64 class TableGroupKey;
65 class WorkLoopManager;
66 
67 
72  class GatewaySupervisor : public xdaq::Application,
73  public SOAPMessenger,
77  {
78  friend class WizardSupervisor;
79  friend class Iterator;
80 
81  static const std::string COMMAND_PARAM_LOG_ENTRY_PREAMBLE;
82  static const std::string COMMAND_PARAM_SUBSYSTEM_COMMON_PREAMBLE;
83  static const std::string COMMAND_PARAM_SUBSYSTEM_COMMON_OVERRIDE_PREAMBLE;
84  static const std::string COMMAND_PARAM_SUBSYSTEM_COMMON_CONTEXT_PREAMBLE;
85  static const std::string COMMAND_PARAM_SUBSYSTEM_COMMON_CONTEXT_OVERRIDE_PREAMBLE;
86  static const std::string COMMAND_PARAM_ITERATION_INDEX_PREAMBLE;
87 
88  public:
89  XDAQ_INSTANTIATOR();
90 
91  GatewaySupervisor (xdaq::ApplicationStub* s);
92  virtual ~GatewaySupervisor (void);
93 
94  void init (void);
95 
96  void Default (xgi::Input* in, xgi::Output* out);
97 
98  void loginRequest (xgi::Input* in, xgi::Output* out);
99  void request (xgi::Input* in, xgi::Output* out);
100  void tooltipRequest (xgi::Input* in, xgi::Output* out);
101  void XGI_Turtle (xgi::Input* in, xgi::Output* out);
102 
103  void addStateMachineStatusToXML (HttpXmlDocument& xmlOut, const std::string& fsmName, bool getRunNumber = true);
104  void addFilteredConfigAliasesToXML (HttpXmlDocument& xmlOut, const std::string& fsmName);
105  void addRequiredFsmLogInputToXML (HttpXmlDocument& xmlOut, const std::string& fsmName);
106  static std::string getGlobalFieldsString (ConfigurationManager* cfgMgr, const std::map<std::string, TableVersion>& memberMap = {});
107 
108  // State Machine requests handlers
109  void stateMachineXgiHandler(xgi::Input* in, xgi::Output* out);
110  void stateMachineIterationBreakpoint(xgi::Input* in, xgi::Output* out);
111 
112  static std::string getIconHeaderString(void);
113  static bool handleAddDesktopIconRequest(const std::string& author, cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut, std::vector<DesktopIconTable::DesktopIcon>* newIcons = nullptr);
114  static void handleGetApplicationIdRequest(AllSupervisorInfo* applicationInfo, cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut, std::map<std::string /* requestOrigin */, std::map<std::string /* requestUrlHostPort */, std::string /* translatedHostPort */>>* portTranslationMap = nullptr);
115 
116  xoap::MessageReference stateMachineXoapHandler(xoap::MessageReference msg);
117 
118  bool stateMachineThread(toolbox::task::WorkLoop* workLoop);
119 
120  // Status requests handlers
121  void statusRequest(xgi::Input* in, xgi::Output* out);
122  void infoRequestResultHandler(xgi::Input* in, xgi::Output* out);
123  bool infoRequestThread(toolbox::task::WorkLoop* workLoop);
124 
125  // External GatewaySupervisor XOAP handlers
126  xoap::MessageReference supervisorCookieCheck(xoap::MessageReference msg);
127  xoap::MessageReference supervisorGetActiveUsers(xoap::MessageReference msg);
128  xoap::MessageReference supervisorSystemMessage(xoap::MessageReference msg);
129  xoap::MessageReference supervisorGetUserInfo(xoap::MessageReference msg);
130  xoap::MessageReference supervisorSystemLogbookEntry(xoap::MessageReference msg);
131  xoap::MessageReference supervisorLastTableGroupRequest(xoap::MessageReference msg);
132 
133  // Finite State Machine States
134  void stateInitial(toolbox::fsm::FiniteStateMachine& fsm) override;
135  void statePaused(toolbox::fsm::FiniteStateMachine& fsm) override;
136  void stateRunning(toolbox::fsm::FiniteStateMachine& fsm) override;
137  void stateHalted(toolbox::fsm::FiniteStateMachine& fsm) override;
138  void stateConfigured(toolbox::fsm::FiniteStateMachine& fsm) override;
139  void inError(toolbox::fsm::FiniteStateMachine& fsm) override;
140 
141  void transitionConfiguring(toolbox::Event::Reference e) override;
142  void transitionHalting(toolbox::Event::Reference e) override;
143  void transitionInitializing(toolbox::Event::Reference e) override;
144  void transitionPausing(toolbox::Event::Reference e) override;
145  void transitionResuming(toolbox::Event::Reference e) override;
146  void transitionStarting(toolbox::Event::Reference e) override;
147  void transitionStopping(toolbox::Event::Reference e) override;
148  void transitionShuttingDown(toolbox::Event::Reference e) override;
149  void transitionStartingUp(toolbox::Event::Reference e) override;
150  void enteringError(toolbox::Event::Reference e) override;
151 
152  void makeSystemLogEntry(const std::string& entryText, const std::string& subjectText = "");
153  static void addSystemMessage(std::string toUserCSV, std::string message);
154 
155  void checkForAsyncError(void);
156 
157  // CorePropertySupervisorBase override functions
158  virtual void setSupervisorPropertyDefaults (void) override;
159  virtual void forceSupervisorPropertyValues (void) override;
160 
161 
162  private:
163  unsigned int getNextRunNumber (const std::string& fsmName = "");
164  void setNextRunNumber (unsigned int runNumber, const std::string& fsmName = "");
165  std::string getLastLogEntry (const std::string& logType, const std::string& fsmName = "");
166  void setLastLogEntry (const std::string& logType, const std::string& logEntry, const std::string& fsmName = "");
167 
168 
169  static xoap::MessageReference lastTableGroupRequestHandler (const SOAPParameters& parameters);
170  static void launchStartOTSCommand (const std::string& command, ConfigurationManager* cfgMgr);
171  static void launchStartOneServerCommand (const std::string& command, ConfigurationManager* cfgMgr, const std::string& contextName);
172 
173  static void indicateOtsAlive (const CorePropertySupervisorBase* properties = 0);
174  xoap::MessageReference TRACESupervisorRequest (xoap::MessageReference message);
175 
176  static void StateChangerWorkLoop (GatewaySupervisor* supervisorPtr);
177  static void AppStatusWorkLoop (GatewaySupervisor* supervisorPtr, const bool doDisconnected = false);
178 
179  std::string attemptStateMachineTransition (HttpXmlDocument* xmldoc,
180  std::ostringstream* out,
181  const std::string& command,
182  const std::string& fsmName,
183  const std::string& fsmWindowName,
184  const std::string& username,
185  const std::vector<std::string>& parameters,
186  std::string logEntry = "");
187  void broadcastMessage (xoap::MessageReference msg);
188  void broadcastMessageToRemoteGateways (const xoap::MessageReference msg, unsigned int iteration = 0);
189  void broadcastMessageToRemoteGatewaysComplete (const xoap::MessageReference msg, unsigned int iterationIndex = 0);
190  void signalAndWaitForBroadcastThreads (unsigned int numberOfThreads);
191 
192  struct BroadcastMessageIterationsDoneStruct
193  {
194  // Creating std::vector<std::vector<bool>>
195  // because of problems with the standard library
196  // not allowing passing by reference of bool types.
197  // Broadcast thread implementation requires passing by reference.
198  ~BroadcastMessageIterationsDoneStruct()
199  {
200  for (auto& arr : iterationsDone_)
201  delete[] arr;
202  iterationsDone_.clear();
203  arraySizes_.clear();
204  } // end destructor
205 
206  void push(const unsigned int& size)
207  {
208  iterationsDone_.push_back(new bool[size]);
209  arraySizes_.push_back(size);
210 
211  // initialize to false
212  for (unsigned int i = 0; i < size; ++i)
213  iterationsDone_[iterationsDone_.size() - 1][i] = false;
214  } // end push()
215 
216  bool* operator[](unsigned int i) { return iterationsDone_[i]; }
217  const bool* operator[](unsigned int i) const { return iterationsDone_[i]; }
218  unsigned int size(unsigned int i = -1)
219  {
220  if (i == (unsigned int)-1)
221  return iterationsDone_.size();
222  return arraySizes_[i];
223  }
224 
225  private:
226  std::vector<bool*> iterationsDone_;
227  std::vector<unsigned int> arraySizes_;
228  }; // end BroadcastMessageIterationsDoneStruct definition
229 
230  struct BroadcastThreadStruct
231  {
232  //===================
233  BroadcastThreadStruct()
234  : threadIndex_(-1)
235  , exitThread_(false)
236  , working_(true)
237  , workToDo_(false)
238  , error_(false)
239  {
240  } // end BroadcastThreadStruct constructor()
241 
242  //===================
243  BroadcastThreadStruct(BroadcastThreadStruct &&b)
244  : threadIndex_(b.threadIndex_)
245  , exitThread_(b.exitThread_.load())
246  , working_(b.working_.load())
247  , workToDo_(b.workToDo_.load())
248  , error_(b.error_.load())
249  {
250  } // end BroadcastThreadStruct move constructor()
251 
252 
254  {
255  //===================
256  BroadcastMessageStruct(const SupervisorInfo& appInfo,
257  xoap::MessageReference message,
258  const std::string& command,
259  const unsigned int& iteration,
260  bool& iterationsDone,
261  std::shared_ptr<BroadcastMessageIterationsDoneStruct> iterationsDoneOwner)
262  : appInfo_(appInfo)
263  , message_(message)
264  , command_(command)
265  , iteration_(iteration)
266  , iterationsDone_(iterationsDone)
267  , iterationsDoneOwner_(iterationsDoneOwner)
268  {
269  }
270 
271  const SupervisorInfo& appInfo_;
272  xoap::MessageReference message_;
273  const std::string command_;
274  const unsigned int iteration_;
275  bool& iterationsDone_;
276  // Keep the BroadcastMessageIterationsDoneStruct alive while this message
277  // is in use by a thread, preventing UAF even if broadcastMessage() returns
278  // early (e.g. on timeout or exception) before the thread finishes.
279  std::shared_ptr<BroadcastMessageIterationsDoneStruct> iterationsDoneOwner_;
280 
281  std::string reply_;
282  }; // end BroadcastMessageStruct definition
283 
284  //===================
285  void setMessage(const SupervisorInfo& appInfo,
286  xoap::MessageReference message,
287  const std::string& command,
288  const unsigned int& iteration,
289  bool& iterationsDone,
290  std::shared_ptr<BroadcastMessageIterationsDoneStruct> iterationsDoneOwner)
291  {
292  messages_.clear();
294  appInfo, message, command, iteration, iterationsDone, iterationsDoneOwner));
295  workToDo_ = true;
296  } // end setMessage()
297 
298  const SupervisorInfo& getAppInfo() { return messages_[0].appInfo_; }
299  xoap::MessageReference getMessage() { return messages_[0].message_; }
300  const std::string& getCommand() { return messages_[0].command_; }
301  const unsigned int& getIteration() { return messages_[0].iteration_; }
302  std::string& getReply() { return messages_[0].reply_; }
303  bool& getIterationsDone() { return messages_[0].iterationsDone_; }
304 
305  // each thread accesses these members
306  std::mutex threadMutex_;
307  unsigned int threadIndex_;
308  std::atomic<bool> exitThread_, working_, workToDo_, error_;
309  // always just 1 message (for now)
310  std::vector<BroadcastThreadStruct::BroadcastMessageStruct> messages_;
311 
312  }; // end BroadcastThreadStruct declaration
313  static void broadcastMessageThread(
314  GatewaySupervisor* supervisorPtr,
315  std::shared_ptr<GatewaySupervisor::BroadcastThreadStruct> threadStruct);
316  bool handleBroadcastMessageTarget(const SupervisorInfo& appInfo,
317  xoap::MessageReference message,
318  const std::string& command,
319  const unsigned int& iteration,
320  std::string& reply,
321  unsigned int threadIndex = 0,
322  const std::atomic<bool>* exitFlag = nullptr);
323 
324 
325  // Member Variables -----------------------
326 
327  bool supervisorGuiHasBeenLoaded_;
328  static WebUsers theWebUsers_;
329  std::map<std::string /* requestOrigin */, std::map<std::string /* requestUrlHostPort */,
330  std::string /* translatedHostPort */>>
331  portTranslationMap_;
332 
333  WorkLoopManager stateMachineWorkLoopManager_;
334  toolbox::BSem stateMachineSemaphore_;
335 
336  std::string activeStateMachineName_;
337  std::string activeStateMachineWindowName_;
338  std::string activeStateMachineDumpFormatOnRun_, activeStateMachineDumpFormatOnConfigure_;
339  std::string activeStateMachineSystemDumpOnRun_, activeStateMachineSystemDumpOnConfigure_;
340  bool activeStateMachineSystemDumpOnRunEnable_, activeStateMachineSystemDumpOnConfigureEnable_;
341  std::string activeStateMachineSystemDumpOnRunFilename_, activeStateMachineSystemDumpOnConfigureFilename_;
342  bool activeStateMachineRequireUserLogOnRun_, activeStateMachineRequireUserLogOnConfigure_;
343  std::string activeStateMachineRunInfoPluginType_;
344  std::map<std::string /* fsmName */, std::string /* logEntry */>
345  stateMachineConfigureLogEntry_, stateMachineStartLogEntry_, stateMachineStopLogEntry_;
346  std::string activeStateMachineRunNumber_, activeStateMachineRunAlias_, activeStateMachineConfigurationAlias_;
347  bool activeStateMachineRollOverLogOnConfigure_, activeStateMachineRollOverLogOnStart_;
348  std::chrono::steady_clock::time_point
349  activeStateMachineRunStartTime;
350  int activeStateMachineRunDuration_ms;
351  unsigned int activeStateMachineConfigureConditionID_, activeStateMachineRunConditionID_;
352  std::string activeStateMachineSubsystemCommonList_, activeStateMachineSubsystemCommonOverrideList_;
353  std::string activeSubsystemCommonContextList_, activeSubsystemCommonContextOverrideList_;
354  std::string appliedContextCommonList_, appliedContextCommonOverrideList_;
355  std::mutex contextCommonMutex_;
356 
357  std::string cachedSubsystemCommonBackboneKey_;
358  std::string cachedSubsystemCommonList_, cachedSubsystemCommonOverrideList_;
359  std::string cachedSubsystemCommonContextList_, cachedSubsystemCommonContextOverrideList_;
360 
361  std::mutex systemStatusMutex_;
362  std::string lastLogbookEntry_;
363  time_t lastLogbookEntryTime_ = 0;
364 
365  std::string lastConsoleErr_, lastConsoleWarn_, lastConsoleInfo_, lastConsoleErrTime_, lastConsoleWarnTime_, lastConsoleInfoTime_;
366  std::string firstConsoleErr_, firstConsoleWarn_, firstConsoleInfo_, firstConsoleErrTime_, firstConsoleWarnTime_, firstConsoleInfoTime_;
367  size_t systemConsoleErrCount_ = 0, systemConsoleWarnCount_ = 0, systemConsoleInfoCount_ = 0;
368 
369  std::pair<std::string /*group name*/, TableGroupKey>
370  theConfigurationTableGroup_;
371  std::string stateMachineTransitionUsername_;
372 
373  Iterator theIterator_;
374  std::mutex stateMachineAccessMutex_;
376  std::string stateMachineLastCommandInput_;
377  enum
378  {
379  VERBOSE_MUTEX = 0
380  };
381 
382  CodeEditor codeEditor_;
383 
384  std::mutex broadcastCommandMessageIndexMutex_;
385  unsigned int broadcastCommandMessageIndex_;
386  std::atomic<bool> broadcastIterationsDone_{true};
387  std::mutex broadcastIterationBreakpointMutex_;
388  unsigned int broadcastIterationBreakpoint_;
390  std::mutex broadcastCommandStatusUpdateMutex_;
391  std::string broadcastCommandStatus_;
392 
393  std::mutex remoteIterationMutex_;
394  std::condition_variable remoteIterationCV_;
395  unsigned int remoteIterationIndex_ = 0;
396  std::atomic<bool> isRemoteSubsystemIteration_{false};
397 
398  static std::vector<std::shared_ptr<GatewaySupervisor::BroadcastThreadStruct>> broadcastThreadStructs_;
399 
400  std::string securityType_;
401  PixelHistoPicGen picGen_;
402 
403  //Variable used by the RunInfo plugin
404  unsigned int conditionID_;
405 
406 public: //used by remote subsystem control and status
407 
410 
411  enum class ConfigDumpTypes
412  {
413  Text,
414  JSON_all,
415  Unknown
416  };
417 
418  std::string command, fsmName;
419  private: //make error private to connect to set timestamp
420  std::string error;
421  time_t errorTimestamp = 0;
422  public:
423  void setError(const std::string& err) { error = err; errorTimestamp = time(0); }
424  void clearError() { error = ""; errorTimestamp = 0; }
425  void copyError(const RemoteGatewayInfo& r) { error = r.error; errorTimestamp = r.errorTimestamp; }
426  const std::string& getError() const { return error; }
427  const std::string getErrorTimestamp() const { return StringMacros::getTimestampString(errorTimestamp); }
428 
429  std::string config_dump;
430  ConfigDumpTypes config_dump_type = ConfigDumpTypes::Unknown;
431 
432  size_t ignoreStatusCount = 0;
433 
434  size_t consoleErrCount = 0, consoleWarnCount = 0;
435 
436  std::string fullName;
437  std::string user_data_path_record;
438  std::string setupType, instancePath, instanceHost, instanceUser;
439 
440  std::string selected_config_alias;
441  std::set<std::string> config_aliases;
442  std::string iconString, parentIconFolderPath, landingPage, permissionThresholdString;
443 
444  std::string usernameWithLock;
445 
446  enum class FSM_ModeTypes
447  {
448  Follow_FSM,
449  DoNotHalt,
450  OnlyConfigure,
451  };
452  FSM_ModeTypes fsm_mode = FSM_ModeTypes::Follow_FSM;
453  bool fsm_included = true;
454 
455  std::string getFsmMode() const {
456  switch(fsm_mode)
457  {
458  case FSM_ModeTypes::Follow_FSM: return "Follow FSM";
459  case FSM_ModeTypes::DoNotHalt: return "Do Not Halt";
460  case FSM_ModeTypes::OnlyConfigure: return "Only Configure";
461  default: return "Impossible";
462  }
463  } //end getFsmMode()
464 
465  std::string getConfigDumpType() const {
466  switch(config_dump_type)
467  {
468  case ConfigDumpTypes::Text: return "Text";
469  case ConfigDumpTypes::JSON_all: return "JSON all";
470  default: return "Unknown";
471  }
472  } //end getFsmMode()
473 
474  std::map<std::string, SupervisorInfo::SubappInfo> subapps;
475  bool iterationsDone = false;
476  }; //end GatewaySupervisor::RemoteGatewayInfo struct
477 
478  std::vector<GatewaySupervisor::RemoteGatewayInfo> remoteGatewayApps_;
479  std::mutex remoteGatewayAppsMutex_;
480  std::map<std::string /* appName */,
481  bool /* lastStatusGood */> appLastStatusGood_;
482  std::mutex dualStatusThreadMutex_;
483 
486 
487  std::map<unsigned int /* lid */, SupervisorInfo> localAllSupervisorInfo_;
488 
489 
490  std::mutex latestGatewayIconsMutex_;
491  std::vector<DesktopIconTable::DesktopIcon> latestGatewayIcons_;
492  std::pair<std::string /* latestIconContext group */, TableGroupKey>
494 
496  std::pair<std::string /* latestIconContext group */, TableGroupKey>
498 
499  std::string cachedGlobalFieldsString_;
500  std::pair<std::string, TableGroupKey> cachedGlobalFieldsGroup_;
501 
502  static void CheckRemoteGatewayStatus (GatewaySupervisor::RemoteGatewayInfo& remoteGatewayApp, const std::unique_ptr<TransceiverSocket>& remoteGatewaySocket, const std::string& ipForReverseLoginOverUDP, int portForReverseLoginOverUDP, const std::string& contextCommonList = "", const std::string& contextCommonOverrideList = "");
503  static void SendRemoteGatewayCommand (GatewaySupervisor::RemoteGatewayInfo& remoteGatewayApp, const std::unique_ptr<TransceiverSocket>& remoteGatewaySocket);
504  static void applyContextCommonTables (GatewaySupervisor* supervisor, const std::string& contextCommonList, const std::string& contextCommonOverrideList);
505  static void GetRemoteGatewayIcons (GatewaySupervisor::RemoteGatewayInfo& remoteGatewayApp, const std::unique_ptr<TransceiverSocket>& remoteGatewaySocket);
506  void loadRemoteGatewaySettings (std::vector<GatewaySupervisor::RemoteGatewayInfo>& remoteGateways, bool onlyNotFound = false) const;
507  void saveRemoteGatewaySettings (void) const;
508  static std::string translateURLForRequestOrigin (const std::string& url, const std::string& requestOrigin, std::map<std::string /* requestOrigin */, std::map<std::string /* requestUrlHostPort */, std::string /* translatedHostPort */>>& portTranslationMap);
509  static std::string translateRemoteIconStringForRequestOrigin (const std::string& iconString, const std::string& requestOrigin, std::map<std::string /* requestOrigin */, std::map<std::string /* requestUrlHostPort */, std::string /* translatedHostPort */>>& portTranslationMap);
510 
511  };
512 // clang-format on
513 
514 } // namespace ots
515 
516 #endif
friend class GatewaySupervisor
for access to indicateOtsAlive()
std::string latestGatewayRemoteIconsString_
cached string of remote gateway icons for quick access
virtual void setSupervisorPropertyDefaults(void) override
override to control supervisor specific defaults
void stateHalted(toolbox::fsm::FiniteStateMachine &fsm) override
virtual void forceSupervisorPropertyValues(void) override
override to force supervisor property values (and ignore user settings)
std::vector< DesktopIconTable::DesktopIcon > latestGatewayIcons_
used to track the latest desktop icons (which are defined by the active context but allowed to change...
void statePaused(toolbox::fsm::FiniteStateMachine &fsm) override
std::string ipAddressForStateChangesOverUDP_
IP used for UDP reverse-login propagation to remote gateways.
void stateRunning(toolbox::fsm::FiniteStateMachine &fsm) override
int portForReverseLoginOverUDP_
UDP port for reverse-login; 0 = disabled.
std::map< unsigned int, SupervisorInfo > localAllSupervisorInfo_
only use in main thread, stable copy of app status
std::pair< std::string, TableGroupKey > latestGatewayIconsContextGroup_
used to track the table group key for the latest desktop icons
void stateConfigured(toolbox::fsm::FiniteStateMachine &fsm) override
void stateInitial(toolbox::fsm::FiniteStateMachine &fsm) override
std::pair< std::string, TableGroupKey > latestGatewayRemoteIconsContextGroup_
used to track the table group key for the latest remote desktop icons
defines used also by OtsConfigurationWizardSupervisor
ConfigDumpTypes
<FSM Modes: 'Follow FSM,' 'Do not Halt' (artdaq), or 'Only Configure' (DCS/DQM)
FSM_ModeTypes
<FSM Modes: 'Follow FSM,' 'Do not Halt' (artdaq), or 'Only Configure' (DCS/DQM)
std::string permissionThresholdString
used for desktop icons
std::set< std::string > config_aliases
used for remote gateway subapp control
std::string selected_config_alias
used for remote gateway subapp control
FSM_ModeTypes fsm_mode
used for remote gateway subapp control
std::string fsmName
when not "", need to send
bool iterationsDone
tracks per-gateway iteration completion during FSM transitions
std::map< std::string, SupervisorInfo::SubappInfo > subapps
remote gateways can have subapps
size_t ignoreStatusCount
if non-zero, do not ask for status
std::string instanceUser
used for remote ots instance ssh launch
std::string user_data_path_record
used for remote gateway subapp control
static std::string getTimestampString(const std::string &linuxTimeInSeconds)