| 85 // ------------------------------------------------------------------------------------------------- |
85 // ------------------------------------------------------------------------------------------------- |
| 86 // |
86 // |
| 87 METHOD |
87 METHOD |
| 88 RCONSession::handle_packet (Bytestream& packet, const IPAddress& from) -> void |
88 RCONSession::handle_packet (Bytestream& packet, const IPAddress& from) -> void |
| 89 { |
89 { |
| 90 print ("Handling packet of %1 bytes\n", packet.written_length()); |
90 print ("Processing packet of %1 bytes\n", packet.written_length()); |
| 91 bool ok = true; |
91 bool ok = true; |
| 92 |
92 |
| 93 while (packet.bytes_left() > 0) |
93 while (packet.bytes_left() > 0) |
| 94 { |
94 { |
| 95 print ("%1/%2 bytes left\n", packet.bytes_left(), packet.written_length()); |
|
| 96 int header = packet.read_byte (&ok); |
95 int header = packet.read_byte (&ok); |
| 97 print ("recieved HEADER with %1\n", header); |
|
| 98 |
96 |
| 99 switch (ServerResponse (header)) |
97 switch (ServerResponse (header)) |
| 100 { |
98 { |
| 101 case SVRC_OLDPROTOCOL: |
99 case SVRC_OLDPROTOCOL: |
| 102 fprintf (stderr, "wrong version\n"); |
100 fprintf (stderr, "wrong version\n"); |
| 193 RCONSession::send_password() -> void |
191 RCONSession::send_password() -> void |
| 194 { |
192 { |
| 195 print ("sending password...\n"); |
193 print ("sending password...\n"); |
| 196 Bytestream packet; |
194 Bytestream packet; |
| 197 packet.write_byte (CLRC_PASSWORD); |
195 packet.write_byte (CLRC_PASSWORD); |
| |
196 print ("password: %1\nsalt: %2\nhashed password: %3\n", m_password, m_salt, (m_salt + m_password).md5()); |
| 198 packet.write_string ((m_salt + m_password).md5()); |
197 packet.write_string ((m_salt + m_password).md5()); |
| 199 send (packet); |
198 send (packet); |
| 200 bump_last_ping(); |
199 bump_last_ping(); |
| 201 } |
200 } |
| 202 |
201 |