Fix few glitches in Cyril PR

This commit is contained in:
Gioacchino Mazzurco 2020-01-07 00:54:49 +01:00
parent c96223a2a8
commit 37b5d8f307
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
25 changed files with 430 additions and 424 deletions

View file

@ -210,33 +210,35 @@ std::string RsPeerLastConnectString(uint32_t lastConnect);
// Connexion and security events //
//===================================================================================================//
enum class RsAuthSslError: uint8_t
{
NO_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,
};
/**
* 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,
};
RsAuthSslConnectionAutenticationEvent() :
RsEvent(RsEventType::AUTHSSL_CONNECTION_AUTENTICATION) {}
RsPeerId mSslId;
std::string mSslCn;
RsPgpId mPgpId;
RsUrl mLocator;
RsUrl mLocator;
std::string mErrorMsg;
AuthenticationCode mErrorCode;
RsAuthSslError mErrorCode;
///* @see RsEvent @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,
@ -250,36 +252,49 @@ struct RsAuthSslConnectionAutenticationEvent : RsEvent
RS_SERIAL_PROCESS(mErrorMsg);
RS_SERIAL_PROCESS(mErrorCode);
}
~RsAuthSslConnectionAutenticationEvent() override;
};
enum class RsConnectionEventCode: uint8_t
{
UNKNOWN = 0x00,
PEER_CONNECTED = 0x01,
PEER_DISCONNECTED = 0x02,
PEER_TIME_SHIFT = 0x03, // mTimeShift = time shift in seconds
PEER_REPORTS_WRONG_IP = 0x04, // mPeerLocator = address reported, mOwnLocator = own address
};
struct RsConnectionEvent : RsEvent
{
RsConnectionEvent()
: RsEvent(RsEventType::PEER_CONNECTION),
mConnectionInfoCode(ConnectionEventCode::UNKNOWN) {}
mConnectionInfoCode(RsConnectionEventCode::UNKNOWN), mTimeShift(0) {}
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;
RsConnectionEventCode mConnectionInfoCode;
RsPeerId mSslId;
std::string mStrInfo1;
std::string mStrInfo2;
RsUrl mOwnLocator;
RsUrl mReportedLocator;
/** If there is a time shift with the peer aka
* mConnectionInfoCode == PEER_TIME_SHIFT contains the time shift value in
* seconds */
rstime_t mTimeShift;
///* @see RsEvent @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
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);
RS_SERIAL_PROCESS(mOwnLocator);
RS_SERIAL_PROCESS(mReportedLocator);
RS_SERIAL_PROCESS(mTimeShift);
}
~RsConnectionEvent() override;
};
//===================================================================================================//