mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-28 16:17:28 -04:00
changed enum to enum class and made names globally more consistent for RsEvents
This commit is contained in:
parent
d7504c59b5
commit
3d7ae59df7
21 changed files with 155 additions and 151 deletions
|
@ -206,6 +206,85 @@ std::string RsPeerTrustString(uint32_t trustLvl);
|
|||
std::string RsPeerNetModeString(uint32_t netModel);
|
||||
std::string RsPeerLastConnectString(uint32_t lastConnect);
|
||||
|
||||
//===================================================================================================//
|
||||
// Connexion and security events //
|
||||
//===================================================================================================//
|
||||
|
||||
/**
|
||||
* Event triggered by AuthSSL when authentication of a connection attempt either
|
||||
* fail or success
|
||||
*/
|
||||
struct RsAuthSslConnectionAutenticationEvent : RsEvent
|
||||
{
|
||||
RsAuthSslConnectionAutenticationEvent() : RsEvent(RsEventType::AUTHSSL_CONNECTION_AUTENTICATION) {}
|
||||
|
||||
enum class AuthenticationCode: uint8_t {
|
||||
NO_CONNECTION_ERROR = 0x00,
|
||||
MISSING_AUTHENTICATION_INFO = 0x01,
|
||||
PGP_SIGNATURE_VALIDATION_FAILED = 0x02,
|
||||
MISMATCHED_PGP_ID = 0x03,
|
||||
NO_CERTIFICATE_SUPPLIED = 0x04,
|
||||
NOT_A_FRIEND = 0x05,
|
||||
MISSING_CERTIFICATE = 0x06,
|
||||
IP_IS_BLACKLISTED = 0x07,
|
||||
PEER_REFUSED_CONNECTION = 0x08,
|
||||
UNKNOWN_ERROR = 0x09,
|
||||
};
|
||||
|
||||
RsPeerId mSslId;
|
||||
std::string mSslCn;
|
||||
RsPgpId mPgpId;
|
||||
RsUrl mLocator;
|
||||
std::string mErrorMsg;
|
||||
AuthenticationCode mErrorCode;
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
RS_SERIAL_PROCESS(mSslId);
|
||||
RS_SERIAL_PROCESS(mSslCn);
|
||||
RS_SERIAL_PROCESS(mPgpId);
|
||||
RS_SERIAL_PROCESS(mLocator);
|
||||
RS_SERIAL_PROCESS(mErrorMsg);
|
||||
RS_SERIAL_PROCESS(mErrorCode);
|
||||
}
|
||||
};
|
||||
|
||||
struct RsConnectionEvent : RsEvent
|
||||
{
|
||||
RsConnectionEvent()
|
||||
: RsEvent(RsEventType::PEER_CONNECTION),
|
||||
mConnectionInfoCode(ConnectionEventCode::UNKNOWN) {}
|
||||
|
||||
enum class ConnectionEventCode: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
PEER_CONNECTED = 0x01,
|
||||
PEER_DISCONNECTED = 0x02,
|
||||
PEER_TIME_SHIFT = 0x03, // mStrInfo1 = time shift in seconds
|
||||
PEER_REPORTS_WRONG_IP = 0x04, // mStrInfo1 = address reported, mStrInfo2 = own address
|
||||
};
|
||||
|
||||
ConnectionEventCode mConnectionInfoCode;
|
||||
RsPeerId mSslId;
|
||||
std::string mStrInfo1;
|
||||
std::string mStrInfo2;
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
RS_SERIAL_PROCESS(mConnectionInfoCode);
|
||||
RS_SERIAL_PROCESS(mSslId);
|
||||
RS_SERIAL_PROCESS(mStrInfo1);
|
||||
RS_SERIAL_PROCESS(mStrInfo2);
|
||||
}
|
||||
};
|
||||
|
||||
//===================================================================================================//
|
||||
// Peer Details //
|
||||
//===================================================================================================//
|
||||
|
||||
/* We should definitely split this into 2 sub-structures:
|
||||
* PGP info (or profile info) with all info related to PGP keys
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue