2018-05-28 16:28:51 -04:00
/*******************************************************************************
* libretroshare / src / retroshare : rsgxsflags . h *
* *
* libretroshare : retroshare core library *
* *
2018-11-11 14:42:48 -05:00
* Copyright 2012 - 2018 by Retroshare Team < retroshare . project @ gmail . com > *
2018-05-28 16:28:51 -04:00
* *
* This program is free software : you can redistribute it and / or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation , either version 3 of the *
* License , or ( at your option ) any later version . *
* *
* This program is distributed in the hope that it will be useful , *
* but WITHOUT ANY WARRANTY ; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the *
* GNU Lesser General Public License for more details . *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program . If not , see < https : //www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2012-05-21 18:07:43 -04:00
# ifndef RSGXSFLAGS_H
# define RSGXSFLAGS_H
# include "inttypes.h"
2012-10-21 15:45:35 -04:00
/**
* The GXS_SERV namespace serves a single point of reference for definining grp and msg flags
* Declared and defined here are :
* - privacy flags which define the level of privacy that can be given \ n
* to a group
* - authentication types which defined types of authentication needed for a given message to
* confirm its authenticity
* - subscription flags : This used only locally by the peer to subscription status to a \ n
* a group
* -
*/
2012-05-21 18:07:43 -04:00
namespace GXS_SERV {
2012-10-21 15:45:35 -04:00
/** START privacy **/
2012-05-21 18:07:43 -04:00
2015-10-23 22:53:00 -04:00
static const uint32_t FLAG_PRIVACY_MASK = 0x0000000f ;
2016-12-31 08:23:37 -05:00
static const uint32_t FLAG_PRIVACY_PRIVATE = 0x00000001 ; // pub key encrypted. No-one can read unless he has the key to decrypt the publish key.
static const uint32_t FLAG_PRIVACY_RESTRICTED = 0x00000002 ; // publish private key needed to publish. Typical usage: channels.
static const uint32_t FLAG_PRIVACY_PUBLIC = 0x00000004 ; // anyone can publish, publish key pair not needed. Typical usage: forums.
2012-05-21 18:07:43 -04:00
2012-10-21 15:45:35 -04:00
/** END privacy **/
2012-05-21 18:07:43 -04:00
2012-10-21 15:45:35 -04:00
/** END authentication **/
2015-10-23 22:53:00 -04:00
/** START author authentication flags **/
2015-10-25 18:27:15 -04:00
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_MASK = 0x0000ff00 ;
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_NONE = 0x00000000 ;
2016-12-31 08:23:37 -05:00
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_GPG = 0x00000100 ; // Anti-spam feature. Allows to ask higher reputation to anonymous IDs
2019-08-01 05:33:00 -04:00
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_REQUIRED = 0x00000200 ;
2019-03-30 17:53:14 -04:00
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN = 0x00000400 ; // ???
2016-07-25 14:56:55 -04:00
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES = 0x00000800 ; // not used anymore
2016-12-31 08:23:37 -05:00
static const uint32_t FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN = 0x00001000 ; // Anti-spam feature. Allows to ask higher reputation to unknown IDs and anonymous IDs
2015-10-23 22:53:00 -04:00
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_MASK = 0x000000ff ;
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED = 0x00000001 ;
2019-03-30 17:53:14 -04:00
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED = 0x00000002 ; // unused
2015-10-23 22:53:00 -04:00
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_THREADHEAD = 0x00000004 ;
static const uint32_t FLAG_GROUP_SIGN_PUBLISH_NONEREQ = 0x00000008 ;
2012-11-10 18:42:38 -05:00
/** START msg authentication flags **/
2015-10-23 22:53:00 -04:00
static const uint8_t MSG_AUTHEN_MASK = 0x0f ;
2017-01-01 11:50:09 -05:00
static const uint8_t MSG_AUTHEN_ROOT_PUBLISH_SIGN = 0x01 ; // means: new threads need to be signed by the publish signature of the group. Typical use: posts in channels.
static const uint8_t MSG_AUTHEN_CHILD_PUBLISH_SIGN = 0x02 ; // means: all messages need to be signed by the publish signature of the group. Typical use: channels were comments are restricted to the publisher.
static const uint8_t MSG_AUTHEN_ROOT_AUTHOR_SIGN = 0x04 ; // means: new threads need to be signed by the author of the message. Typical use: forums, since posts are signed.
static const uint8_t MSG_AUTHEN_CHILD_AUTHOR_SIGN = 0x08 ; // means: all messages need to be signed by the author of the message. Typical use: forums since response to posts are signed, and signed comments in channels.
2012-11-10 18:42:38 -05:00
/** END msg authentication flags **/
/** START group options flag **/
2017-01-01 11:50:09 -05:00
static const uint8_t GRP_OPTION_AUTHEN_AUTHOR_SIGN = 0x01 ; // means: the group options (serialised grp data) needs to be signed by a specific author stored in GroupMeta.mAuthorId
// note that it is always signed by the *admin* (means the creator) of the group. This author signature is just an option here.
2012-11-10 18:42:38 -05:00
/** END group options flag **/
2012-09-04 18:32:52 -04:00
2012-10-21 15:45:35 -04:00
/** START Subscription Flags. (LOCAL) **/
2012-09-04 18:32:52 -04:00
2017-01-01 11:50:09 -05:00
static const uint32_t GROUP_SUBSCRIBE_ADMIN = 0x01 ; // means: you have the admin key for this group
static const uint32_t GROUP_SUBSCRIBE_PUBLISH = 0x02 ; // means: you have the publish key for thiss group. Typical use: publish key in channels are shared with specific friends.
static const uint32_t GROUP_SUBSCRIBE_SUBSCRIBED = 0x04 ; // means: you are subscribed to a group, which makes you a source for this group to your friend nodes.
2012-11-10 18:42:38 -05:00
static const uint32_t GROUP_SUBSCRIBE_NOT_SUBSCRIBED = 0x08 ;
2012-10-01 16:57:56 -04:00
2013-03-16 12:44:33 -04:00
/*!
* Simply defines the range of bits that deriving services
* should not use
*/
2012-09-13 18:58:42 -04:00
static const uint32_t GROUP_SUBSCRIBE_MASK = 0x0000000f ;
2012-09-04 18:32:52 -04:00
2012-10-21 15:45:35 -04:00
/** END Subscription Flags. (LOCAL) **/
/** START GXS Msg status flags **/
2013-06-04 17:00:43 -04:00
/*!
* Two lower bytes are reserved for Generic STATUS Flags listed here .
* Services are free to use the two upper bytes . ( 16 flags ) .
*
* NOTE : RsGxsCommentService uses 0x000f0000 .
*/
2015-10-23 22:53:00 -04:00
static const uint32_t GXS_MSG_STATUS_GEN_MASK = 0x0000ffff ;
2017-01-01 11:50:09 -05:00
static const uint32_t GXS_MSG_STATUS_UNPROCESSED = 0x00000001 ; // Flags to store the read/process status of group messages.
static const uint32_t GXS_MSG_STATUS_GUI_UNREAD = 0x00000002 ; // The actual meaning may depend on the type of service.
static const uint32_t GXS_MSG_STATUS_GUI_NEW = 0x00000004 ; //
2020-11-22 15:45:21 -05:00
static const uint32_t GXS_MSG_STATUS_KEEP_FOREVER = 0x00000008 ; // Do not delete message even if older then group maximum storage time
2017-01-01 11:50:09 -05:00
static const uint32_t GXS_MSG_STATUS_DELETE = 0x00000020 ; //
2012-12-08 16:50:13 -05:00
2012-10-21 15:45:35 -04:00
/** END GXS Msg status flags **/
2012-11-17 09:35:21 -05:00
/** START GXS Grp status flags **/
static const uint32_t GXS_GRP_STATUS_UNPROCESSED = 0x000000100 ;
2018-09-02 11:07:40 -04:00
static const uint32_t GXS_GRP_STATUS_UNREAD = 0x000000200 ;
2012-11-17 09:35:21 -05:00
/** END GXS Grp status flags **/
2012-05-21 18:07:43 -04:00
}
2013-02-26 18:34:42 -05:00
// GENERIC GXS MACROS
2014-10-12 11:53:23 -04:00
# define IS_MSG_NEW(status) (status & GXS_SERV::GXS_MSG_STATUS_GUI_NEW)
2014-10-12 13:11:37 -04:00
# define IS_MSG_UNREAD(status) (status & GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD)
2016-06-16 22:23:27 -04:00
# define IS_MSG_UNPROCESSED(status) (status & GXS_SERV::GXS_MSG_STATUS_UNPROCESSED)
2013-03-16 08:31:31 -04:00
2015-10-24 00:22:55 -04:00
# define IS_GROUP_PGP_AUTHED(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
2016-06-30 14:16:45 -04:00
# define IS_GROUP_PGP_KNOWN_AUTHED(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN)
2015-10-26 23:38:10 -04:00
# define IS_GROUP_MESSAGE_TRACKING(signFlags) (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES)
2015-10-24 00:22:55 -04:00
2013-02-26 18:34:42 -05:00
# define IS_GROUP_ADMIN(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
2015-10-23 22:53:00 -04:00
# define IS_GROUP_PUBLISHER(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
2013-03-24 11:56:21 -04:00
# define IS_GROUP_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
2015-10-23 22:53:00 -04:00
# define IS_GROUP_NOT_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED)
2013-03-16 08:31:31 -04:00
2012-05-21 18:07:43 -04:00
# endif // RSGXSFLAGS_H