Telnet++  3.1.0.2
A C++ library for interacting with Telnet streams
registration.hpp
1 #pragma once
2 
3 #include "telnetpp/client_option.hpp"
4 #include "telnetpp/detail/negotiation_router.hpp"
5 #include "telnetpp/detail/subnegotiation_router.hpp"
6 #include "telnetpp/element.hpp"
7 #include "telnetpp/server_option.hpp"
8 
9 namespace telnetpp::detail {
10 
11 //* =========================================================================
13 //* =========================================================================
14 void register_client_option(
16  negotiation_router &neg_router,
17  subnegotiation_router &sub_router);
18 
19 //* =========================================================================
21 //* =========================================================================
22 void register_server_option(
24  negotiation_router &neg_router,
25  subnegotiation_router &sub_router);
26 
31 template <class NegotiableOption>
32 void register_route_from_negotiation_to_option(
33  negotiation_router &route,
34  negotiation_type request,
35  NegotiableOption &option)
36 {
37  route.register_route(
38  negotiation{request, option.option_code()},
39  [&option, request](telnetpp::negotiation const &) {
40  return option.negotiate(request);
41  });
42 }
43 
44 //* =========================================================================
46 //* =========================================================================
47 template <class SubnegotiableOption>
48 void register_route_from_subnegotiation_to_option(
49  subnegotiation_router &route, SubnegotiableOption &option)
50 {
51  route.register_route(
52  option.option_code(), [&option](telnetpp::subnegotiation const &sub) {
53  return option.subnegotiate(sub.content());
54  });
55 }
56 
57 } // namespace telnetpp::detail
A class that represents a Telnet option's client side. That is, the side that receives WILL and WONT ...
Definition: client_option.hpp:35
A class that encapsulates a Telnet negotiation.
Definition: negotiation.hpp:15
A class that represents a Telnet option's server side. That is, the side that receives DO and DONT ne...
Definition: server_option.hpp:35
A class that encapsulates a Telnet subnegotiation.
Definition: subnegotiation.hpp:14