| 1 | // \file UGear_telnet.hxx |
| 2 | // telnet server class. |
| 3 | // |
| 4 | // Adapted from FlightGear props.hxx/cxx code |
| 5 | // Written by Curtis Olson, started September 2000. |
| 6 | // Modified by Bernie Bright, May 2002. |
| 7 | // |
| 8 | // Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt |
| 9 | // |
| 10 | // This program is free software; you can redistribute it and/or |
| 11 | // modify it under the terms of the GNU General Public License as |
| 12 | // published by the Free Software Foundation; either version 2 of the |
| 13 | // License, or (at your option) any later version. |
| 14 | // |
| 15 | // This program is distributed in the hope that it will be useful, but |
| 16 | // WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | // General Public License for more details. |
| 19 | // |
| 20 | // You should have received a copy of the GNU General Public License |
| 21 | // along with this program; if not, write to the Free Software |
| 22 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 23 | // |
| 24 | // $Id$ |
| 25 | |
| 26 | #pragma once |
| 27 | |
| 28 | #include <string> |
| 29 | #include <vector> |
| 30 | |
| 31 | |
| 32 | #include <simgear/io/sg_netChannel.hxx> |
| 33 | |
| 34 | |
| 35 | /** |
| 36 | * Telent server class. |
| 37 | * This class provides a telnet-like server for remote access to |
| 38 | * FlightGear properties. |
| 39 | */ |
| 40 | class UGTelnet: simgear::NetChannel |
| 41 | { |
| 42 | |
| 43 | private: |
| 44 | |
| 45 | /** |
| 46 | * Server port to listen on. |
| 47 | */ |
| 48 | int port; |
| 49 | bool enabled; |
| 50 | simgear::NetChannelPoller poller; |
| 51 | public: |
| 52 | |
| 53 | /** |
| 54 | * Create a new TCP server. |
| 55 | * |
| 56 | * @param tokens Tokenized configuration parameters |
| 57 | */ |
| 58 | UGTelnet( const int port_num ); |
| 59 | |
| 60 | /** |
| 61 | * Destructor. |
| 62 | */ |
| 63 | ~UGTelnet(); |
| 64 | |
| 65 | /** |
| 66 | * Start the telnet server. |
| 67 | */ |
| 68 | bool open(); |
| 69 | |
| 70 | /** |
| 71 | * Process network activity. |
| 72 | */ |
| 73 | bool process(); |
| 74 | |
| 75 | /** |
| 76 | * |
| 77 | */ |
| 78 | bool close(); |
| 79 | |
| 80 | /** |
| 81 | * Accept a new client connection. |
| 82 | */ |
| 83 | void handleAccept(); |
| 84 | |
| 85 | }; |