2022-02-06 16:48:52 +01:00
|
|
|
//===========================================================================//
|
|
|
|
//
|
|
|
|
// Purpose: Enumerations for writing out the requests.
|
|
|
|
//
|
|
|
|
//===========================================================================//
|
|
|
|
#pragma once
|
|
|
|
|
2022-02-08 16:32:00 +01:00
|
|
|
typedef int SocketHandle_t;
|
|
|
|
|
2022-02-06 16:48:52 +01:00
|
|
|
enum class ServerDataRequestType_t : int
|
|
|
|
{
|
2022-02-11 00:38:50 +01:00
|
|
|
SERVERDATA_REQUEST_VALUE = 0,
|
|
|
|
SERVERDATA_REQUEST_SETVALUE,
|
|
|
|
SERVERDATA_REQUEST_EXECCOMMAND,
|
|
|
|
SERVERDATA_REQUEST_AUTH,
|
|
|
|
SERVERDATA_REQUEST_SEND_CONSOLE_LOG,
|
|
|
|
SERVERDATA_REQUEST_SEND_REMOTEBUG,
|
2022-02-06 16:48:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class ServerDataResponseType_t : int
|
|
|
|
{
|
|
|
|
SERVERDATA_RESPONSE_VALUE = 0,
|
2022-02-11 00:38:50 +01:00
|
|
|
SERVERDATA_RESPONSE_UPDATE,
|
|
|
|
SERVERDATA_RESPONSE_AUTH,
|
|
|
|
SERVERDATA_RESPONSE_CONSOLE_LOG,
|
2022-02-06 16:48:52 +01:00
|
|
|
SERVERDATA_RESPONSE_STRING,
|
|
|
|
SERVERDATA_RESPONSE_REMOTEBUG,
|
|
|
|
};
|
|
|
|
|
2022-02-08 16:32:00 +01:00
|
|
|
class CConnectedNetConsoleData
|
|
|
|
{
|
|
|
|
public:
|
2022-08-02 23:58:43 +02:00
|
|
|
SocketHandle_t m_hSocket;
|
2022-11-14 21:00:41 +01:00
|
|
|
u_long m_nPayloadLen; // Num bytes for this message.
|
|
|
|
u_long m_nPayloadRead; // Num read bytes from input buffer.
|
2022-08-02 23:58:43 +02:00
|
|
|
int m_nFailedAttempts; // Num failed authentication attempts.
|
|
|
|
int m_nIgnoredMessage; // Count how many times client ignored the no-auth message.
|
|
|
|
bool m_bValidated; // Revalidates netconsole if false.
|
2022-09-09 19:47:31 +02:00
|
|
|
bool m_bAuthorized; // Set to true after successful netconsole auth.
|
2022-08-02 23:58:43 +02:00
|
|
|
bool m_bInputOnly; // If set, don't send spew to this net console.
|
2022-11-14 21:00:41 +01:00
|
|
|
vector<uint8_t> m_RecvBuffer;
|
2022-02-08 16:32:00 +01:00
|
|
|
|
|
|
|
CConnectedNetConsoleData(SocketHandle_t hSocket = -1)
|
|
|
|
{
|
2022-08-02 23:58:43 +02:00
|
|
|
m_hSocket = hSocket;
|
|
|
|
m_nPayloadLen = 0;
|
|
|
|
m_nPayloadRead = 0;
|
|
|
|
m_nFailedAttempts = 0;
|
|
|
|
m_nIgnoredMessage = 0;
|
|
|
|
m_bValidated = false;
|
|
|
|
m_bAuthorized = false;
|
|
|
|
m_bInputOnly = false;
|
2022-11-14 21:00:41 +01:00
|
|
|
m_RecvBuffer.resize(sizeof(u_long)); // Reserve enough for length-prefix.
|
2022-02-08 16:32:00 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-02-06 16:48:52 +01:00
|
|
|
/* PACKET FORMAT **********************************
|
|
|
|
|
|
|
|
REQUEST:
|
|
|
|
int requestID;
|
|
|
|
int ServerDataRequestType_t;
|
|
|
|
NullTerminatedString (variable or command)
|
|
|
|
NullTerminatedString (value)
|
|
|
|
|
|
|
|
RESPONSE:
|
|
|
|
int requestID;
|
|
|
|
int ServerDataResponseType_t;
|
|
|
|
NullTerminatedString (variable)
|
|
|
|
NullTerminatedString (value)
|
|
|
|
|
|
|
|
***************************************************/
|