Debian Codegraph @

src/Network/propsProtocol.hxx

raw symbols SCIP
1 /*
2 * SPDX-FileName: propsProtocol.hxx
3 * SPDX-FileComment: Property server class. Used for telnet server.
4 * SPDX-FileCopyrightText: Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
5 * SPDX-FileContributor: Modified by Bernie Bright, May 2002
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9 #pragma once
10
11 #include <simgear/compiler.h>
12 #include <string>
13 #include <vector>
14
15 #include <simgear/io/sg_netChannel.hxx>
16
17 #include "protocol.hxx"
18
19 /**
20 * Property server class.
21 * This class provides a telnet-like server for remote access to
22 * FlightGear properties.
23 */
24 class FGProps : public FGProtocol,
25 public simgear::NetChannel,
26 public SGPropertyChangeListener // for subscriptions
27 {
28 private:
29 class PropsChannel;
30
31 /**
32 * Server port to listen on.
33 */
34 int port = 5501;
35 simgear::NetChannelPoller poller;
36
37 std::vector<PropsChannel*> _activeChannels;
38
39 public:
40 /**
41 * Create a new TCP server.
42 *
43 * @param tokens Tokenized configuration parameters
44 */
45 FGProps(const std::vector<std::string>& tokens);
46
47 /**
48 * Destructor.
49 */
50 ~FGProps();
51
52 /**
53 * Start the telnet server.
54 */
55 bool open() override;
56
57 /**
58 * Process network activity.
59 */
60 bool process() override;
61
62 /**
63 *
64 */
65 bool close() override;
66
67 /**
68 * Accept a new client connection.
69 */
70 void handleAccept() override;
71
72 void removeChannel(PropsChannel* channel);
73 };