Telnet++
A C++ library for interacting with Telnet streams
session.hpp
1 #pragma once
2 
3 #include "telnetpp/client_option.hpp"
4 #include "telnetpp/server_option.hpp"
5 #include "telnetpp/detail/routing_visitor.hpp"
6 #include <functional>
7 
8 namespace telnetpp {
9 
10 //* =========================================================================
89 //* =========================================================================
90 class TELNETPP_EXPORT session
91 {
92 public :
93  //* =====================================================================
96  //* =====================================================================
97  session(
98  std::function<std::vector<token> (std::string const&)> on_text);
99 
100  //* =====================================================================
102  //* =====================================================================
103  void install(
104  command const &cmd,
105  std::function<std::vector<token> (command const &)> const &on_command);
106 
107  //* =====================================================================
109  //* =====================================================================
110  void install(client_option &option);
111 
112  //* =====================================================================
114  //* =====================================================================
115  void install(server_option &option);
116 
117  //* =====================================================================
121  //* =====================================================================
122  std::vector<token> receive(u8stream const &stream);
123 
124  //* =====================================================================
129  //* =====================================================================
130  std::vector<stream_token> send(std::vector<token> const &tokens);
131 
132 private :
133  u8stream unparsed_buffer_;
134  telnetpp::detail::command_router command_router_;
135  telnetpp::detail::negotiation_router negotiation_router_;
136  telnetpp::detail::subnegotiation_router subnegotiation_router_;
137  telnetpp::detail::routing_visitor visitor_;
138 
139 };
140 
141 }
A class that represents a Telnet option&#39;s client side.
Definition: client_option.hpp:34
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 class that encapsulates the value of a Telnet command.
Definition: command.hpp:11
Definition: byte_converter.hpp:4
An abstraction for a Telnet session.
Definition: session.hpp:90