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

@ -61,7 +61,7 @@ enum class RsEventType : uint32_t
/// @see pqissl
PEER_CONNECTION = 4,
/// @see RsGxsChanges // this one should probably be removed because it's not used anywhere
/// @see RsGxsChanges
GXS_CHANGES = 5,
/// Emitted when a peer state changes, @see RsPeers

View file

@ -102,23 +102,36 @@ struct RsGxsChannelPost : RsSerializable
~RsGxsChannelPost() override;
};
enum class RsChannelEventCode: uint8_t
{
UNKNOWN = 0x00,
NEW_CHANNEL = 0x01, /// emitted when new channel is received
/// emitted when existing channel is updated
UPDATED_CHANNEL = 0x02,
/// new message reeived in a particular channel (group and msg id)
NEW_MESSAGE = 0x03,
/// existing message has been updated in a particular channel
UPDATED_MESSAGE = 0x04,
/// publish key for this channel has been received
RECEIVED_PUBLISH_KEY = 0x05,
/// subscription for channel mChannelGroupId changed.
SUBSCRIBE_STATUS_CHANGED = 0x06,
};
struct RsGxsChannelEvent: RsEvent
{
RsGxsChannelEvent()
: RsEvent(RsEventType::GXS_CHANNELS), mChannelEventCode(ChannelEventCode::UNKNOWN) {}
RsGxsChannelEvent():
RsEvent(RsEventType::GXS_CHANNELS),
mChannelEventCode(RsChannelEventCode::UNKNOWN) {}
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
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.
SUBSCRIBE_STATUS_CHANGED = 0x06, // subscription for channel mChannelGroupId changed.
};
ChannelEventCode mChannelEventCode;
RsGxsGroupId mChannelGroupId;
RsChannelEventCode mChannelEventCode;
RsGxsGroupId mChannelGroupId;
RsGxsMessageId mChannelMsgId;
///* @see RsEvent @see RsSerializable

View file

@ -162,32 +162,54 @@ struct RsGxsCircleDetails : RsSerializable
}
};
enum class RsGxsCircleEventCode: uint8_t
{
UNKNOWN = 0x00,
/** mCircleId contains the circle id and mGxsId is the id requesting
* membership */
CIRCLE_MEMBERSHIP_REQUEST = 0x01,
/** mCircleId is the circle that invites me, and mGxsId is my own Id that is
* invited */
CIRCLE_MEMBERSHIP_INVITE = 0x02,
/** mCircleId contains the circle id and mGxsId is the id dropping
* membership */
CIRCLE_MEMBERSHIP_LEAVE = 0x03,
/// mCircleId contains the circle id and mGxsId is the id of the new member
CIRCLE_MEMBERSHIP_JOIN = 0x04,
/** mCircleId contains the circle id and mGxsId is the id that was revoqued
* by admin */
CIRCLE_MEMBERSHIP_REVOQUED= 0x05,
};
struct RsGxsCircleEvent: RsEvent
{
RsGxsCircleEvent()
: RsEvent(RsEventType::GXS_CIRCLES), mCircleEventType(CircleEventCode::UNKNOWN) {}
: RsEvent(RsEventType::GXS_CIRCLES),
mCircleEventType(RsGxsCircleEventCode::UNKNOWN) {}
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
CIRCLE_MEMBERSHIP_LEAVE = 0x03, // mCircleId contains the circle id and mGxsId is the id dropping membership
CIRCLE_MEMBERSHIP_JOIN = 0x04, // mCircleId contains the circle id and mGxsId is the id of the new member
CIRCLE_MEMBERSHIP_REVOQUED= 0x05, // mCircleId contains the circle id and mGxsId is the id that was revoqued by admin
};
CircleEventCode mCircleEventType;
RsGxsCircleId mCircleId;
RsGxsId mGxsId;
RsGxsCircleEventCode mCircleEventType;
RsGxsCircleId mCircleId;
RsGxsId mGxsId;
///* @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(mCircleEventType);
RS_SERIAL_PROCESS(mCircleId);
RS_SERIAL_PROCESS(mGxsId);
}
~RsGxsCircleEvent() override;
};
class RsGxsCircles: public RsGxsIfaceHelper

View file

@ -104,33 +104,45 @@ struct RsGxsForumMsg : RsSerializable
~RsGxsForumMsg() override;
};
enum class RsForumEventCode: uint8_t
{
UNKNOWN = 0x00,
NEW_FORUM = 0x01, /// emitted when new forum is received
UPDATED_FORUM = 0x02, /// emitted when existing forum is updated
/// new message reeived in a particular forum
NEW_MESSAGE = 0x03,
/// existing message has been updated in a particular forum
UPDATED_MESSAGE = 0x04,
/// forum was subscribed or unsubscribed
SUBSCRIBE_STATUS_CHANGED = 0x05,
};
struct RsGxsForumEvent: RsEvent
{
RsGxsForumEvent()
: RsEvent(RsEventType::GXS_FORUMS), mForumEventCode(ForumEventCode::UNKNOWN) {}
RsGxsForumEvent()
: RsEvent(RsEventType::GXS_FORUMS),
mForumEventCode(RsForumEventCode::UNKNOWN) {}
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
NEW_MESSAGE = 0x03, // new message reeived in a particular forum (group and msg id)
UPDATED_MESSAGE = 0x04, // existing message has been updated in a particular forum (group and msg id)
SUBSCRIBE_STATUS_CHANGED = 0x05, // forum was subscribed or unsubscribed
};
ForumEventCode mForumEventCode;
RsGxsGroupId mForumGroupId;
RsForumEventCode mForumEventCode;
RsGxsGroupId mForumGroupId;
RsGxsMessageId mForumMsgId;
///* @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(mForumEventCode);
RS_SERIAL_PROCESS(mForumGroupId);
RS_SERIAL_PROCESS(mForumMsgId);
}
}
~RsGxsForumEvent() override;
};
class RsGxsForums: public RsGxsIfaceHelper

View file

@ -296,19 +296,25 @@ struct MsgTagType : RsSerializable
} //namespace Rs
} //namespace Msgs
enum class RsMailStatusEventCode: uint8_t
{
NEW_MESSAGE = 0x00,
MESSAGE_REMOVED = 0x01,
MESSAGE_SENT = 0x02,
/// means the peer received the message
MESSAGE_RECEIVED_ACK = 0x03,
/// An error occurred attempting to sign the message
SIGNATURE_FAILED = 0x04,
};
struct RsMailStatusEvent : RsEvent
{
RsMailStatusEvent() : RsEvent(RsEventType::MAIL_STATUS_CHANGE) {}
enum MailStatusEventCode: uint8_t {
NEW_MESSAGE = 0x00,
MESSAGE_REMOVED = 0x01,
MESSAGE_SENT = 0x02,
MESSAGE_RECEIVED_ACK = 0x03, // means the peer received the message
FAILED_SIGNATURE = 0x04, // means the signature of the message cannot be verified
};
MailStatusEventCode mMailStatusEventCode;
RsMailStatusEventCode mMailStatusEventCode;
std::set<RsMailMessageId> mChangedMsgIds;
/// @see RsEvent

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;
};
//===================================================================================================//

View file

@ -68,18 +68,21 @@ class RsPostedGroup
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
enum class RsPostedEventCode: uint8_t
{
UNKNOWN = 0x00,
NEW_POSTED_GROUP = 0x01,
NEW_MESSAGE = 0x02
};
struct RsGxsPostedEvent: RsEvent
{
RsGxsPostedEvent()
: RsEvent(RsEventType::GXS_POSTED), mPostedEventCode(PostedEventCode::UNKNOWN) {}
RsGxsPostedEvent():
RsEvent(RsEventType::GXS_POSTED),
mPostedEventCode(RsPostedEventCode::UNKNOWN) {}
enum class PostedEventCode: uint8_t {
UNKNOWN = 0x00,
NEW_POSTED_GROUP = 0x01,
NEW_MESSAGE = 0x02
};
PostedEventCode mPostedEventCode;
RsPostedEventCode mPostedEventCode;
RsGxsGroupId mPostedGroupId;
RsGxsMessageId mPostedMsgId;