My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
Control.h
1 #ifndef GCP_UTIL_CONTROL_H
2 #define GCP_UTIL_CONTROL_H
3 
11 #include "gcp/util/common/FdSet.h"
12 #include "gcp/util/common/NetStr.h"
13 #include "gcp/util/common/SignalTask.h"
14 #include "gcp/util/common/Ports.h"
15 #include "gcp/util/common/TcpClient.h"
16 #include "gcp/util/common/XtermManip.h"
17 
18 namespace gcp {
19  namespace util {
20 
21  class Control {
22  public:
23 
27  Control(std::string host, bool log);
28 
32  void processCommands();
33  void processCommands2();
34  void processAll();
35  void processMessages();
36  void readMessage();
37  void readStdin();
38 
42  virtual ~Control();
43 
44  private:
45 
46  XtermManip xterm_;
47  bool doEsc_;
48  std::ostringstream os_, esc_;
49 
50  // A static pointer to ourselves for use in handlers
51 
52  static Control* control_;
53 
54  // An object for handling signals
55 
56  SignalTask signalTask_;
57 
58  // A client object for managing our connection to the control program
59 
60  TcpClient client_;
61 
62  // A network buffer for communication with the control program
63 
64  NetStr netStr_;
65 
66  // A set of file descriptors
67 
68  FdSet fdSet_;
69 
70  // True when we should exit.
71 
72  bool stop_;
73 
74  // Thread management objects
75 
76  Thread* readThread_;
77 
78  static THREAD_START(startRead);
79 
80  Thread* sendThread_;
81 
82  static THREAD_START(startSend);
83 
87  void readCommand();
88 
92  void sendCommand();
93 
97  static SIGNALTASK_HANDLER_FN(exitHandler);
98 
102  static NET_SEND_HANDLER(sendHandler);
103 
107  static NET_READ_HANDLER(readHandler);
108 
113  static NET_SEND_HANDLER(errorHandler);
114 
115  void setRawMode(int fd);
116 
117  }; // End class Control
118 
119  } // End namespace util
120 } // End namespace gcp
121 
122 
123 
124 
125 #endif // End #ifndef GCP_UTIL_CONTROL_H
void processCommands()
Definition: Control.cc:96
Definition: NetStr.h:21
Definition: XtermManip.h:23
void processMessages()
Definition: Control.cc:448
Control(std::string host, bool log)
Definition: SignalTask.h:53
Definition: Control.h:21
Definition: FdSet.h:16
Definition: TcpClient.h:18
Definition: Thread.h:57
void processAll()
Definition: Control.cc:288
virtual ~Control()
Definition: Control.cc:81
void processCommands2()
Definition: Control.cc:157