18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
19 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
20 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
20 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
21 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
21 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
22 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
22 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
23 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
23 EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, |
24 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
24 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
25 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
25 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING |
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ |
29 */ |
30 |
30 |
31 #pragma once |
31 #pragma once |
93 { |
93 { |
94 public: |
94 public: |
95 RCONSession(); |
95 RCONSession(); |
96 ~RCONSession(); |
96 ~RCONSession(); |
97 |
97 |
98 const IPAddress& address() const; |
98 const IPAddress& address() const; |
99 void connect (IPAddress address); |
99 void bumpLastPing(); |
100 void disconnect(); |
100 void connect(IPAddress address); |
101 void handle_packet (Datagram& datagram); |
101 void disconnect(); |
102 void process_server_updates (Bytestream& packet); |
102 int getAdminCount() const; |
103 int num_admins() const; |
103 const String& getLevel() const; |
104 void send (const Bytestream& packet); |
104 UDPSocket* getSocket(); |
105 void send_hello(); |
105 RCONSessionState getState() const; |
106 void send_password(); |
106 void handlePacket(Datagram& datagram); |
107 void set_password (const String& password); |
107 bool isActive() const; |
108 UDPSocket* socket(); |
108 void processServerUpdates(Bytestream& packet); |
109 void tick(); |
109 void requestTabCompletion(const String& part); |
110 void bump_last_ping(); |
110 void send(const Bytestream& packet); |
111 bool send_command (const String& message); |
111 bool sendCommand(const String& message); |
112 RCONSessionState state() const; |
112 void sendHello(); |
113 const String& level() const; |
113 void sendPassword(); |
114 bool is_active() const; |
114 void setInterface(class Interface* interface); |
115 void request_tab_complete (const String& part); |
115 void setPassword(const String& password); |
116 void set_interface (class Interface* iface); |
116 void tick(); |
117 |
117 |
118 private: |
118 private: |
119 RCONSessionState m_state; |
119 RCONSessionState m_state; |
120 IPAddress m_address; |
120 IPAddress m_address; |
121 UDPSocket m_socket; |
121 UDPSocket m_socket; |
122 time_t m_lastPing; |
122 time_t m_lastPing; |
123 String m_password; |
123 String m_password; |
124 String m_salt; |
124 String m_salt; |
125 int m_serverProtocol; |
125 int m_serverProtocol; |
126 String m_hostname; |
126 String m_hostname; |
127 int m_numAdmins; |
127 int m_adminCount; |
128 String m_level; |
128 String m_level; |
129 String m_lastTabComplete; |
129 String m_lastTabComplete; |
130 class Interface* m_interface; |
130 class Interface* m_interface; |
131 }; |
131 }; |
132 |
132 |