178a55978358043109af7393ddc2d6475ceba35c
[senf.git] / Utils / Console / Telnet.cci
1 // $Id$
2 //
3 // Copyright (C) 2008 
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief Telnet inline non-template implementation */
25
26 //#include "Telnet.ih"
27
28 // Custom includes
29
30 #define prefix_ inline
31 ///////////////////////////////cci.p///////////////////////////////////////
32
33 ///////////////////////////////////////////////////////////////////////////
34 // senf::console::detail::BaseTelnetProtocol::OptInfo
35
36 prefix_ senf::console::detail::BaseTelnetProtocol::OptInfo::OptInfo()
37     : local (false), option (0u), wantState (DISABLED), optionState (NONE), enabled (false)
38 {}
39
40 prefix_ senf::console::detail::BaseTelnetProtocol::OptInfo::OptInfo(bool l, option_type o)
41     : local (l), option (o), wantState (DISABLED), optionState (NONE), enabled (false)
42 {}
43
44 ///////////////////////////////////////////////////////////////////////////
45 // senf::console::detail::BaseTelnetProtocol::TelnetHandler
46
47 prefix_ senf::console::detail::BaseTelnetProtocol::TelnetHandler::~TelnetHandler()
48 {}
49
50 ///////////////////////////////////////////////////////////////////////////
51 // senf::console::detail::BaseTelnetProtocol
52
53 prefix_ senf::console::detail::BaseTelnetProtocol::~BaseTelnetProtocol()
54 {}
55
56 prefix_ void senf::console::detail::BaseTelnetProtocol::sendNOP()
57 {
58     transmit(CMD_IAC);
59     transmit(CMD_NOP);
60 }
61
62 prefix_ void senf::console::detail::BaseTelnetProtocol::sendBRK()
63 {
64     transmit(CMD_IAC);
65     transmit(CMD_BRK);
66 }
67
68 prefix_ void senf::console::detail::BaseTelnetProtocol::sendIP()
69 {
70     transmit(CMD_IAC);
71     transmit(CMD_IP);
72 }
73
74 prefix_ void senf::console::detail::BaseTelnetProtocol::sendAO()
75 {
76     transmit(CMD_IAC);
77     transmit(CMD_AO);
78 }
79
80 prefix_ void senf::console::detail::BaseTelnetProtocol::sendAYT()
81 {
82     transmit(CMD_IAC);
83     transmit(CMD_AYT);
84 }
85
86 prefix_ void senf::console::detail::BaseTelnetProtocol::sendEC()
87 {
88     transmit(CMD_IAC);
89     transmit(CMD_EC);
90 }
91
92 prefix_ void senf::console::detail::BaseTelnetProtocol::sendEL()
93 {
94     transmit(CMD_IAC);
95     transmit(CMD_EL);
96 }
97
98 prefix_ void senf::console::detail::BaseTelnetProtocol::sendGA()
99 {
100     transmit(CMD_IAC);
101     transmit(CMD_GA);
102 }
103
104 prefix_ void senf::console::detail::BaseTelnetProtocol::requestLocalOption(option_type option,
105                                                                            bool enabled)
106 {
107     request(getOption(true, option), enabled);
108 }
109
110 prefix_ void senf::console::detail::BaseTelnetProtocol::acceptLocalOption(option_type option,
111                                                                           bool enabled)
112 {
113     getOption(true, option).wantState = OptInfo::ACCEPTED;
114 }
115
116 prefix_ void senf::console::detail::BaseTelnetProtocol::requestPeerOption(option_type option,
117                                                                           bool enabled)
118 {
119     request(getOption(false, option), enabled);
120 }
121
122 prefix_ void senf::console::detail::BaseTelnetProtocol::acceptPeerOption(option_type option,
123                                                                          bool enabled)
124 {
125     getOption(false, option).wantState = OptInfo::ACCEPTED;
126 }
127
128 prefix_ void senf::console::detail::BaseTelnetProtocol::emit(char c)
129 {
130     v_charReceived(c);
131 }
132
133 ///////////////////////////////cci.e///////////////////////////////////////
134 #undef prefix_
135
136 \f
137 // Local Variables:
138 // mode: c++
139 // fill-column: 100
140 // comment-column: 40
141 // c-file-style: "senf"
142 // indent-tabs-mode: nil
143 // ispell-local-dictionary: "american"
144 // compile-command: "scons -u test"
145 // End: