CARMA C++
NetTermHandler.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_NETTERMHANDLER_H
2 #define SZA_UTIL_NETTERMHANDLER_H
3 
11 #include <string>
13 
14 namespace sza {
15  namespace util {
16 
21  class NetTermHandler : public NetHandler {
22  public:
23 
24  enum MsgType {
25  NONE, // An initializer
26  LINE, // A line of text has been sent
27  SHUTDOWN, // A message from the server that it is shutting
28  // down
29  DISCONNECT, // A message from a client that it is
30  // disconnecting
31  };
32 
37 
41  NetTermHandler(int fd);
42 
46  virtual ~NetTermHandler();
47 
51  MsgType getLastMsgType();
52 
56  std::string getLastLine();
57 
61  void sendLine(std::string& line);
62 
63  private:
64 
65  static const unsigned LINE_LEN;
66  static const unsigned BUF_SIZE;
67 
68  MsgType lastMsgType_;
69 
70  std::string lastLine_;
71 
75  static NET_READ_HANDLER(readMsg);
76 
77  }; // End class NetTermHandler
78 
79  } // End namespace util
80 } // End namespace sza
81 
82 
83 
84 #endif // End #ifndef SZA_UTIL_NETTERMHANDLER_H
Tagged: Sun Apr 4 22:36:40 UTC 2004.
MsgType getLastMsgType()
Return the last message type read into the network buffer.
std::string getLastLine()
Return a copy of the last line read into the network buffer.
A handler for network messages between terminal servers and clients.
virtual ~NetTermHandler()
Destructor.
NetTermHandler()
Constructor.
void sendLine(std::string &line)
Pack a line.