mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-27 11:00:37 -05: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
|
|
@ -184,79 +184,3 @@ public:
|
|||
virtual ~RsEvents();
|
||||
};
|
||||
|
||||
//===================================================================================================//
|
||||
// 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 ConnectionErrorCode: 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;
|
||||
ConnectionErrorCode 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(UNKNOWN) {}
|
||||
|
||||
enum ConnectionType: 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
|
||||
};
|
||||
|
||||
ConnectionType 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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -105,12 +105,12 @@ struct RsGxsChannelPost : RsSerializable
|
|||
struct RsGxsChannelEvent: RsEvent
|
||||
{
|
||||
RsGxsChannelEvent()
|
||||
: RsEvent(RsEventType::GXS_CHANNELS), mChannelEventCode(UNKNOWN) {}
|
||||
: RsEvent(RsEventType::GXS_CHANNELS), mChannelEventCode(ChannelEventCode::UNKNOWN) {}
|
||||
|
||||
enum ChannelEventCode: uint8_t {
|
||||
enum class ChannelEventCode: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
NEW_CHANNEL = 0x01, // emitted when new channel is received
|
||||
UPDATED_CHANNEL = 0x02, // emitted when existing channel is updated
|
||||
UPDATED_CHANNEL = 0x02, // emitted when existing channel is updated
|
||||
NEW_MESSAGE = 0x03, // new message reeived in a particular channel (group and msg id)
|
||||
UPDATED_MESSAGE = 0x04, // existing message has been updated in a particular channel (group and msg id)
|
||||
RECEIVED_PUBLISH_KEY = 0x05, // publish key for this channel has been received.
|
||||
|
|
|
|||
|
|
@ -165,9 +165,9 @@ struct RsGxsCircleDetails : RsSerializable
|
|||
struct RsGxsCircleEvent: RsEvent
|
||||
{
|
||||
RsGxsCircleEvent()
|
||||
: RsEvent(RsEventType::GXS_CIRCLES), mCircleEventType(UNKNOWN) {}
|
||||
: RsEvent(RsEventType::GXS_CIRCLES), mCircleEventType(CircleEventCode::UNKNOWN) {}
|
||||
|
||||
enum CircleEventType: uint8_t {
|
||||
enum class CircleEventCode: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
CIRCLE_MEMBERSHIP_REQUEST = 0x01, // mCircleId contains the circle id and mGxsId is the id requesting membership
|
||||
CIRCLE_MEMBERSHIP_INVITE = 0x02, // mCircleId is the circle that invites me, and mGxsId is my own Id that is invited
|
||||
|
|
@ -176,7 +176,7 @@ struct RsGxsCircleEvent: RsEvent
|
|||
CIRCLE_MEMBERSHIP_REVOQUED= 0x05, // mCircleId contains the circle id and mGxsId is the id that was revoqued by admin
|
||||
};
|
||||
|
||||
CircleEventType mCircleEventType;
|
||||
CircleEventCode mCircleEventType;
|
||||
RsGxsCircleId mCircleId;
|
||||
RsGxsId mGxsId;
|
||||
|
||||
|
|
|
|||
|
|
@ -107,9 +107,9 @@ struct RsGxsForumMsg : RsSerializable
|
|||
struct RsGxsForumEvent: RsEvent
|
||||
{
|
||||
RsGxsForumEvent()
|
||||
: RsEvent(RsEventType::GXS_FORUMS), mForumEventCode(UNKNOWN) {}
|
||||
: RsEvent(RsEventType::GXS_FORUMS), mForumEventCode(ForumEventCode::UNKNOWN) {}
|
||||
|
||||
enum ForumEventCode: uint8_t {
|
||||
enum class ForumEventCode: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
NEW_FORUM = 0x01, // emitted when new forum is received
|
||||
UPDATED_FORUM = 0x02, // emitted when existing forum is updated
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
|||
struct RsGxsPostedEvent: RsEvent
|
||||
{
|
||||
RsGxsPostedEvent()
|
||||
: RsEvent(RsEventType::GXS_POSTED), mPostedEventCode(UNKNOWN) {}
|
||||
: RsEvent(RsEventType::GXS_POSTED), mPostedEventCode(PostedEventCode::UNKNOWN) {}
|
||||
|
||||
enum PostedEventCode: uint8_t {
|
||||
enum class PostedEventCode: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
NEW_POSTED_GROUP = 0x01,
|
||||
NEW_MESSAGE = 0x02
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue