pubsub.h
/*
Copyright (c) 2007-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef PUBSUB_H__
#define PUBSUB_H__
#include <map>
#include <string>
#include "gloox.h"
#include "jid.h"
namespace gloox
{
namespace PubSub
{
class Item;
enum NodeType
{
NodeLeaf,
NodeCollection,
NodeInvalid
};
enum AffiliationType
{
AffiliationNone,
AffiliationPublisher,
AffiliationOwner,
AffiliationOutcast,
AffiliationInvalid
};
enum SubscriptionType
{
SubscriptionNone,
SubscriptionSubscribed,
SubscriptionPending,
SubscriptionUnconfigured,
SubscriptionInvalid
};
enum EventType
{
EventCollection,
EventConfigure,
EventDelete,
EventItems,
EventItemsRetract,
EventPurge,
EventSubscription,
EventUnknown
};
enum SubscriptionObject
{
SubscriptionNodes,
SubscriptionItems
};
enum AccessModel
{
AccessOpen,
AccessPresence,
AccessRoster,
AccessAuthorize,
AccessWhitelist,
AccessDefault
};
enum PubSubFeature
{
FeatureCollections = 1,
FeatureConfigNode = 1<<1,
FeatureCreateAndConfig = 1<<2,
FeatureCreateNodes = 1<<3,
FeatureDeleteAny = 1<<4,
FeatureDeleteNodes = 1<<5,
FeatureGetPending = 1<<6,
FeatureInstantNodes = 1<<7,
FeatureItemIDs = 1<<8,
FeatureLeasedSubscription = 1<<9,
FeatureManageSubscriptions = 1<<10,
FeatureMetaData = 1<<11,
FeatureModifyAffiliations = 1<<12,
FeatureMultiCollection = 1<<13,
FeatureMultiSubscribe = 1<<14,
FeaturePutcastAffiliation = 1<<15,
FeaturePersistentItems = 1<<16,
FeaturePresenceNotifications = 1<<17,
FeaturePublish = 1<<18,
FeaturePublisherAffiliation = 1<<19,
FeaturePurgeNodes = 1<<20,
FeatureRetractItems = 1<<21,
FeatureRetrieveAffiliations = 1<<22,
FeatureRetrieveDefault = 1<<23,
FeatureRetrieveItems = 1<<24,
FeatureRetrieveSubscriptions = 1<<25,
FeatureSubscribe = 1<<26,
FeatureSubscriptionOptions = 1<<27,
FeatureSubscriptionNotifs = 1<<28,
FeatureUnknown = 1<<29
};
// [Persistent - Notification]
/* Publisher MUST include an &lt;item/&gt; element, which MAY be empty or contain a payload; if item ID is not provided by publisher, it MUST be generated by pubsub service */
// [Persistent - Payload]
/* Publisher MUST include an &lt;item/&gt; element that contains the payload; if item ID is not provided by publisher, it MUST be generated by pubsub service */
// [Transient - Notification]
/* Publisher MUST NOT include an &lt;item/&gt; element (therefore item ID is neither provided nor generated) but the notification will include an empty &lt;items/&gt; element */
// [Transient - Payload]
/* Publisher MUST include an &lt;item/&gt; element that contains the payload, but the item ID is OPTIONAL */
struct Subscriber
{
Subscriber( const JID& _jid,
SubscriptionType _type,
const std::string& _subid = EmptyString)
: jid( _jid ), type( _type ), subid( _subid ) {}
JID jid;
SubscriptionType type;
std::string subid;
};
struct Affiliate
{
Affiliate( const JID& _jid, AffiliationType _type )
: jid( _jid ), type( _type ) {}
JID jid;
AffiliationType type;
};
typedef std::list<Subscriber> SubscriberList;
typedef std::list<Affiliate> AffiliateList;
struct TrackedInfo
{
JID service;
std::string node;
std::string item;
std::string sid;
};
struct SubscriptionInfo
{
SubscriptionType type;
JID jid;
std::string subid;
};
typedef std::list<SubscriptionInfo> SubscriptionList;
typedef std::map<std::string, SubscriptionList> SubscriptionMap;
typedef std::map<std::string, AffiliationType> AffiliationMap;
typedef std::list<Item*> ItemList;
}
}
#endif // PUBSUB_H__
gloox::JID
An abstraction of a JID.
Definition jid.h:31
gloox::PubSub::Item
Abstracts a PubSub Item (XEP-0060).
Definition pubsubitem.h:38
gloox::PubSub
Namespace holding all the Pubsub-related structures and definitions.
Definition pubsub.h:28
gloox::PubSub::SubscriptionObject
SubscriptionObject
Definition pubsub.h:97
gloox::PubSub::SubscriptionItems
@ SubscriptionItems
Definition pubsub.h:99
gloox::PubSub::SubscriptionNodes
@ SubscriptionNodes
Definition pubsub.h:98
gloox::PubSub::EventType
EventType
Definition pubsub.h:82
gloox::PubSub::EventItems
@ EventItems
Definition pubsub.h:86
gloox::PubSub::EventCollection
@ EventCollection
Definition pubsub.h:83
gloox::PubSub::EventPurge
@ EventPurge
Definition pubsub.h:88
gloox::PubSub::EventDelete
@ EventDelete
Definition pubsub.h:85
gloox::PubSub::EventItemsRetract
@ EventItemsRetract
Definition pubsub.h:87
gloox::PubSub::EventUnknown
@ EventUnknown
Definition pubsub.h:90
gloox::PubSub::EventSubscription
@ EventSubscription
Definition pubsub.h:89
gloox::PubSub::EventConfigure
@ EventConfigure
Definition pubsub.h:84
gloox::PubSub::AccessModel
AccessModel
Definition pubsub.h:106
gloox::PubSub::AccessOpen
@ AccessOpen
Definition pubsub.h:107
gloox::PubSub::AccessPresence
@ AccessPresence
Definition pubsub.h:111
gloox::PubSub::AccessDefault
@ AccessDefault
Definition pubsub.h:126
gloox::PubSub::AccessRoster
@ AccessRoster
Definition pubsub.h:114
gloox::PubSub::AccessWhitelist
@ AccessWhitelist
Definition pubsub.h:119
gloox::PubSub::AccessAuthorize
@ AccessAuthorize
Definition pubsub.h:117
gloox::PubSub::SubscriptionType
SubscriptionType
Definition pubsub.h:61
gloox::PubSub::SubscriptionPending
@ SubscriptionPending
Definition pubsub.h:67
gloox::PubSub::SubscriptionInvalid
@ SubscriptionInvalid
Definition pubsub.h:75
gloox::PubSub::SubscriptionNone
@ SubscriptionNone
Definition pubsub.h:62
gloox::PubSub::SubscriptionSubscribed
@ SubscriptionSubscribed
Definition pubsub.h:64
gloox::PubSub::SubscriptionUnconfigured
@ SubscriptionUnconfigured
Definition pubsub.h:71
gloox::PubSub::AffiliationType
AffiliationType
Definition pubsub.h:49
gloox::PubSub::AffiliationInvalid
@ AffiliationInvalid
Definition pubsub.h:54
gloox::PubSub::AffiliationOwner
@ AffiliationOwner
Definition pubsub.h:52
gloox::PubSub::AffiliationPublisher
@ AffiliationPublisher
Definition pubsub.h:51
gloox::PubSub::AffiliationNone
@ AffiliationNone
Definition pubsub.h:50
gloox::PubSub::AffiliationOutcast
@ AffiliationOutcast
Definition pubsub.h:53
gloox::PubSub::NodeType
NodeType
Definition pubsub.h:36
gloox::PubSub::NodeInvalid
@ NodeInvalid
Definition pubsub.h:42
gloox::PubSub::NodeLeaf
@ NodeLeaf
Definition pubsub.h:37
gloox::PubSub::NodeCollection
@ NodeCollection
Definition pubsub.h:39
gloox::PubSub::PubSubFeature
PubSubFeature
Definition pubsub.h:134
gloox::PubSub::FeatureRetrieveAffiliations
@ FeatureRetrieveAffiliations
Definition pubsub.h:164
gloox::PubSub::FeatureModifyAffiliations
@ FeatureModifyAffiliations
Definition pubsub.h:150
gloox::PubSub::FeaturePublisherAffiliation
@ FeaturePublisherAffiliation
Definition pubsub.h:161
gloox::PubSub::FeatureGetPending
@ FeatureGetPending
Definition pubsub.h:143
gloox::PubSub::FeatureConfigNode
@ FeatureConfigNode
Definition pubsub.h:136
gloox::PubSub::FeatureMultiSubscribe
@ FeatureMultiSubscribe
Definition pubsub.h:153
gloox::PubSub::FeatureRetrieveDefault
@ FeatureRetrieveDefault
Definition pubsub.h:166
gloox::PubSub::FeatureUnknown
@ FeatureUnknown
Definition pubsub.h:175
gloox::PubSub::FeatureCreateAndConfig
@ FeatureCreateAndConfig
Definition pubsub.h:137
gloox::PubSub::FeatureMultiCollection
@ FeatureMultiCollection
Definition pubsub.h:151
gloox::PubSub::FeatureCollections
@ FeatureCollections
Definition pubsub.h:135
gloox::PubSub::FeatureItemIDs
@ FeatureItemIDs
Definition pubsub.h:146
gloox::PubSub::FeatureSubscriptionOptions
@ FeatureSubscriptionOptions
Definition pubsub.h:172
gloox::PubSub::FeatureRetrieveSubscriptions
@ FeatureRetrieveSubscriptions
Definition pubsub.h:169
gloox::PubSub::FeaturePresenceNotifications
@ FeaturePresenceNotifications
Definition pubsub.h:157
gloox::PubSub::FeaturePublish
@ FeaturePublish
Definition pubsub.h:159
gloox::PubSub::FeatureLeasedSubscription
@ FeatureLeasedSubscription
Definition pubsub.h:147
gloox::PubSub::FeatureDeleteNodes
@ FeatureDeleteNodes
Definition pubsub.h:142
gloox::PubSub::FeaturePersistentItems
@ FeaturePersistentItems
Definition pubsub.h:156
gloox::PubSub::FeatureManageSubscriptions
@ FeatureManageSubscriptions
Definition pubsub.h:148
gloox::PubSub::FeatureCreateNodes
@ FeatureCreateNodes
Definition pubsub.h:139
gloox::PubSub::FeaturePurgeNodes
@ FeaturePurgeNodes
Definition pubsub.h:162
gloox::PubSub::FeatureSubscriptionNotifs
@ FeatureSubscriptionNotifs
Definition pubsub.h:174
gloox::PubSub::FeatureMetaData
@ FeatureMetaData
Definition pubsub.h:149
gloox::PubSub::FeaturePutcastAffiliation
@ FeaturePutcastAffiliation
Definition pubsub.h:155
gloox::PubSub::FeatureRetrieveItems
@ FeatureRetrieveItems
Definition pubsub.h:168
gloox::PubSub::FeatureDeleteAny
@ FeatureDeleteAny
Definition pubsub.h:140
gloox::PubSub::FeatureSubscribe
@ FeatureSubscribe
Definition pubsub.h:171
gloox::PubSub::FeatureInstantNodes
@ FeatureInstantNodes
Definition pubsub.h:145
gloox::PubSub::FeatureRetractItems
@ FeatureRetractItems
Definition pubsub.h:163
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::EmptyString
const std::string EmptyString
Definition gloox.cpp:124
gloox::PubSub::SubscriptionInfo
Definition pubsub.h:234
gloox::PubSub::TrackedInfo
Definition pubsub.h:223