Telnet++
A C++ library for interacting with Telnet streams
server_option.hpp
1 #pragma once
2 
3 #include "telnetpp/element.hpp"
4 #include <boost/signals2.hpp>
5 #include <vector>
6 
7 namespace telnetpp {
8 
9 //* =========================================================================
33 //* =========================================================================
34 class TELNETPP_EXPORT server_option {
35 public :
36  //* =====================================================================
39  //* =====================================================================
40  enum class state
41  {
42  inactive,
43  activating,
44  active,
45  deactivating,
46  };
47 
48  //* =====================================================================
50  //* =====================================================================
51  telnetpp::u8 option() const;
52 
53  //* =====================================================================
60  //* =====================================================================
61  void set_activatable();
62 
63  //* =====================================================================
65  //* =====================================================================
66  std::vector<telnetpp::token> activate();
67 
68  //* =====================================================================
70  //* =====================================================================
71  std::vector<telnetpp::token> deactivate();
72 
73  //* =====================================================================
75  //* =====================================================================
76  bool is_active() const;
77 
78  //* =====================================================================
81  //* =====================================================================
82  std::vector<telnetpp::token> negotiate(telnetpp::u8 request);
83 
84  //* =====================================================================
87  //* =====================================================================
88  std::vector<telnetpp::token> subnegotiate(
89  telnetpp::u8stream const &content);
90 
91  //* =====================================================================
107  //* =====================================================================
108  boost::signals2::signal<
109  std::vector<telnetpp::token> (state new_state),
111  > on_state_changed;
112 
113 protected :
114  //* =====================================================================
117  //* =====================================================================
118  explicit server_option(telnetpp::u8 option);
119 
120 private :
121  //* =====================================================================
124  //* =====================================================================
125  virtual std::vector<telnetpp::token> handle_subnegotiation(
126  telnetpp::u8stream const &content) = 0;
127 
128  state state_ = state::inactive;
129  bool activatable_ = false;
130  u8 option_;
131 };
132 
133 }
state
An enumeration of the different states in which this option can be.
Definition: server_option.hpp:40
A collection of bytes that models the Standard Library&#39;s Container concept.
A class that represents a Telnet option&#39;s server side.
Definition: server_option.hpp:34
A combiner for tokens.
Definition: element.hpp:47
Definition: byte_converter.hpp:4