Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Differ the creation of the RemoteProcessMemory to when we have enough information
[simgrid.git] / src / mc / remote / CheckerSide.hpp
index fced9be1e747bde3c98a1b3d848ba45480ef0f32..d3e571ba650e5027166c95e4ea2529a1eeee2326 100644 (file)
 
 namespace simgrid::mc {
 
+/* CheckerSide: All what the checker needs to interact with a given application process */
+
 class CheckerSide {
   std::unique_ptr<event_base, decltype(&event_base_free)> base_{nullptr, &event_base_free};
   std::unique_ptr<event, decltype(&event_free)> socket_event_{nullptr, &event_free};
   std::unique_ptr<event, decltype(&event_free)> signal_event_{nullptr, &event_free};
-
+  std::unique_ptr<RemoteProcessMemory> remote_memory_;
   Channel channel_;
 
+  bool running_ = false;
+  pid_t pid_;
+
 public:
-  explicit CheckerSide(int sockfd, ModelChecker* mc);
+  explicit CheckerSide(int sockfd, pid_t pid);
 
   // No copy:
   CheckerSide(CheckerSide const&) = delete;
   CheckerSide& operator=(CheckerSide const&) = delete;
   CheckerSide& operator=(CheckerSide&&) = delete;
 
+  /* Communicating with the application */
   Channel const& get_channel() const { return channel_; }
   Channel& get_channel() { return channel_; }
 
-  void dispatch() const;
+  bool handle_message(const char* buffer, ssize_t size);
+  void dispatch_events() const;
   void break_loop() const;
+
+  /* Interacting with the application process */
+  pid_t get_pid() const { return pid_; }
+  bool running() const { return running_; }
+  void terminate() { running_ = false; }
+  void handle_waitpid();
+  RemoteProcessMemory& get_remote_memory() { return *remote_memory_.get(); }
+  void clear_memory_cache();
 };
 
 } // namespace simgrid::mc