using new notification system for connection attempts

This commit is contained in:
csoler 2019-12-02 20:53:51 +01:00
parent d8569d813c
commit 65fa54c206
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
13 changed files with 127 additions and 131 deletions

View file

@ -59,7 +59,7 @@ enum class RsEventType : uint32_t
AUTHSSL_CONNECTION_AUTENTICATION = 3,
/// @see pqissl
REMOTE_PEER_REFUSED_CONNECTION = 4,
PEER_CONNECTION = 4,
/// @see RsGxsChanges
GXS_CHANGES = 5,
@ -173,7 +173,7 @@ public:
};
//===================================================================================================//
// Connexion events //
// Connexion and security events //
//===================================================================================================//
/**
@ -182,10 +182,10 @@ public:
*/
struct RsAuthSslConnectionAutenticationEvent : RsEvent
{
RsAuthSslConnectionAutenticationEvent();
RsAuthSslConnectionAutenticationEvent() : RsEvent(RsEventType::AUTHSSL_CONNECTION_AUTENTICATION) {}
enum ConnextionErrorCode: uint8_t {
UNKNOWN_ERROR = 0x00,
enum ConnectionErrorCode: uint8_t {
NO_ERROR = 0x00,
MISSING_AUTHENTICATION_INFO = 0x01,
PGP_SIGNATURE_VALIDATION_FAILED = 0x02,
MISMATCHED_PGP_ID = 0x03,
@ -193,23 +193,21 @@ struct RsAuthSslConnectionAutenticationEvent : RsEvent
NOT_A_FRIEND = 0x05,
MISSING_CERTIFICATE = 0x06,
IP_IS_BLACKLISTED = 0x07,
NO_ERROR = 0x08,
UNKNOWN_ERROR = 0x08,
};
bool mSuccess;
RsPeerId mSslId;
std::string mSslCn;
RsPgpId mPgpId;
RsUrl mLocator;
std::string mErrorMsg;
ConnextionErrorCode mErrorCode;
ConnectionErrorCode mErrorCode;
///* @see RsEvent @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx) override
{
RsEvent::serial_process(j, ctx);
RS_SERIAL_PROCESS(mSuccess);
RS_SERIAL_PROCESS(mSslId);
RS_SERIAL_PROCESS(mSslCn);
RS_SERIAL_PROCESS(mPgpId);
@ -219,3 +217,28 @@ struct RsAuthSslConnectionAutenticationEvent : RsEvent
}
};
struct RsConnectionEvent : RsEvent
{
RsConnectionEvent()
: RsEvent(RsEventType::PEER_CONNECTION),
mType(UNKNOWN) {}
enum ConnectionType: uint8_t {
UNKNOWN = 0x00,
PEER_CONNECTED = 0x01,
PEER_DISCONNECTED = 0x02,
PEER_REFUSED_CONNECTION = 0x03,
};
ConnectionType mType;
RsPeerId mSslId;
///* @see RsEvent @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
{
RsEvent::serial_process(j, ctx);
RS_SERIAL_PROCESS(mType);
RS_SERIAL_PROCESS(mSslId);
}
};

View file

@ -212,8 +212,6 @@ public:
NotifyClient() {}
virtual ~NotifyClient() {}
virtual void notifyPeerConnected (const std::string& /* peer_id */) {}
virtual void notifyPeerDisconnected (const std::string& /* peer_id */) {}
virtual void notifyListPreChange (int /* list */, int /* type */) {}
virtual void notifyListChange (int /* list */, int /* type */) {}
virtual void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) {}