1 /* 2 Copyright (c) 2005-2019 by Jakob Schröter <js@camaya.net> 3 This file is part of the gloox library. http://camaya.net/gloox 4 5 This software is distributed under a license. The full license 6 agreement can be found in the file LICENSE in this distribution. 7 This software may not be copied, modified, sold or distributed 8 other than expressed in the named license agreement. 9 10 This software is distributed without any warranty. 11 */ 12 13 /*! @mainpage gloox API Documentation 14 * 15 * @section contents Contents 16 * @ref intro_sec <br> 17 * @ref handlers_sec <br> 18 * @ref comp_sec <br> 19 * @ref client_sec <br> 20 * @ref block_conn_sec <br> 21 * @ref roster_sec <br> 22 * @ref privacy_sec <br> 23 * @ref auth_sec <br> 24 * @ref msg_sec <br> 25 * @ref xeps_sec <br> 26 * @ref filetransfer_sec <br> 27 * @ref proxy_sec <br> 28 * @ref upgrading_sec <br> 29 * <br> 30 * 31 * @section intro_sec Introduction 32 * 33 * The design of gloox follows the so-called observer pattern, which basically means that everything is 34 * event-driven. There are two ways you can connect to the Jabber/XMPP network using gloox, either as 35 * client or as component. For a C++ XMPP server library see <http://camaya.net/glooxd>. 36 * 37 * @note Section 11.5 of the XMPP specification (RFC 3290) requires that only UTF-8 is used as encoding 38 * for any traffic sent over the wire. Since gloox cannot know which encoding is used in any given input, 39 * it is a requirement that any input to gloox is valid UTF-8. 40 * 41 * @section handlers_sec Event Handlers 42 * 43 * The most important tools of gloox are the event handlers. Currently, there exist 4 handlers for 44 * the basic protocol as defined in the RFCs, as well as numerous handlers for events generated by 45 * the included XEP-implementations and for additional functionality. Additionally, a log handler, 46 * a generic tag handler and a handler for connection events are available. 47 * 48 * Basically these handlers are virtual interfaces from which you derive a class and implement a few 49 * virtual functions. Then you register such an object with the respective protocol implementation. A 50 * short example: 51 * @code 52 * class MyClass : public PresenceHandler 53 * { 54 * public: 55 * // reimplemented from PresenceHandler 56 * virtual void handlePresence( const Presence& presence ); 57 * 58 * [...] 59 * }; 60 * 61 * void MyClass::handlePresence( const Presence& presence ) 62 * { 63 * // extract further information from the Presence object 64 * } 65 * @endcode 66 * 67 * Somewhere else you do something like this: 68 * @code 69 * OtherClass::doSomething() 70 * { 71 * Client* client = new Client( ... ); 72 * [...] 73 * MyClass* handler = new MyClass( ... ); 74 * client->registerPresenceHandler( handler ); 75 * } 76 * @endcode 77 * 78 * Now, every time a presence stanza (not subscription stanza) is received, handlePresence() is called 79 * with the current stanza as argument. You can then use the extensive getters of the Stanza class to 80 * extract stanza data. 81 * 82 * This works similar for all the other event handlers. 83 * Another example, this time using the connection event handler (class @link gloox::ConnectionListener 84 * ConnectionListener @endlink): 85 * @code 86 * class MyClass : public ConnectionListener 87 * { 88 * public: 89 * virtual void onConnect(); 90 * 91 * virtual bool onTLSConnect( ... ); 92 * }; 93 * 94 * void MyClass::onConnect() 95 * { 96 * // do something when the connection is established 97 * } 98 * 99 * bool MyClass::onTLSConnect( const CertInfo& info ) 100 * { 101 * // decide whether you trust the certificate, examine the CertInfo structure 102 * return true; // if you trust it, otherwise return false 103 * } 104 * @endcode 105 * 106 * @note The ConnectionListener interface is a peculiarity. You MUST re-implement 107 * @link gloox::ConnectionListener::onTLSConnect() ConnectionListener::onTLSConnect() @endlink if 108 * you want to be able to connect successfully to TLS/SSL enabled servers. Even though gloox tries 109 * to verify the server's certificate it does not automatically trust a server. The client's programmer 110 * and/or user have to decide whether to trust a server or not. This trust is expressed by the return 111 * value of onTLSConnect(). @b False means you don't trust the server/certificate and as a consequence 112 * the connection is dropped immediately. 113 * 114 * @section comp_sec Components 115 * 116 * A component in the Jabber/XMPP network is an add-on to a server which runs externally 117 * to the actual server software, but can have similar privileges. Components use a protocol described in 118 * @xep{0114} to connect and authenticate to a server. 119 * 120 * The @link gloox::Component Component @endlink class supports this protocol and can be used to create 121 * a new Jabber component. It's as simple as: 122 * @code 123 * Component* comp = new Component( ... ); 124 * comp->connect(); 125 * @endcode 126 * 127 * @section client_sec Clients 128 * 129 * A client can be an end-user's chat client, a bot, or a similar entity not tied to a particular 130 * server. The @link gloox::Client Client @endlink class implements the necessary functionality to 131 * connect to an XMPP server. Usage is, again, pretty simple: 132 * @code 133 * class MyClass : public ConnectionListener, PresenceHandler 134 * { 135 * public: 136 * void doSomething(); 137 * 138 * virtual void handlePresence( ... ); 139 * 140 * virtual void onConnect(); 141 * 142 * virtual bool onTLSConnect( const CertInfo& info ); 143 * }; 144 * 145 * void MyClass::doSomething() 146 * { 147 * JID jid( "jid@server/resource" ); 148 * Client* client = new Client( jid, "password" ); 149 * client->registerConnectionListener( this ); 150 * client->registerPresenceHandler( this ); 151 * client->connect(); 152 * } 153 * 154 * void MyClass::onConnect() 155 * { 156 * // connection established, auth done (see API docs for exceptions) 157 * } 158 * 159 * bool MyClass::onTLSConnect( const CertInfo& info ) 160 * { 161 * // examine certificate info 162 * } 163 * 164 * void MyClass::handlePresence( Presence* presence ) 165 * { 166 * // presence info 167 * } 168 * @endcode 169 * 170 * @note gloox does not officially support the style of connection which is usually used on port 171 * 5223, i.e. SSL encryption before any XML is sent, because it's a legacy method and not standard XMPP. 172 * However, gloox includes a ConnectionTLS class that, as a side-effect, allows you to establish such 173 * connections. 174 * 175 * @note @link gloox::Client::connect() Client::connect() @endlink by default blocks until the 176 * connection ends (either @link gloox::Client::disconnect() Client::disconnect() @endlink is called 177 * or the server closes the connection). 178 * 179 * @section block_conn_sec Blocking vs. Non-blocking Connections 180 * 181 * For some kind of bots a blocking connection (the default behaviour) is ideal. All the bot does is 182 * react to events coming from the server. However, for end user clients or anything with a GUI this 183 * is far from perfect. 184 * 185 * In these cases non-blocking connections can be used. If 186 * @link gloox::ClientBase::connect() ClientBase::connect( false ) @endlink is 187 * called, the function returnes immediately after the connection has been established. It is then 188 * the resposibility of the programmer to initiate receiving of data from the socket. 189 * 190 * The easiest way is to call @link gloox::ClientBase::recv() ClientBase::recv() @endlink 191 * periodically with the desired timeout (in microseconds) as parameter. The default value of -1 192 * means the call blocks until any data was received, which is then parsed automatically. 193 * 194 * As an alternative to periodic polling you can get a hold of the raw file descriptor used for the 195 * connection. You can then use select() on it and use 196 * @link gloox::ClientBase::recv() ClientBase::recv() @endlink when select indicates that data is 197 * available. You should @b not recv() any data from the file descriptor directly as there is no 198 * way to feed that back into the parser. 199 * 200 * To get the file descriptor you'll need to set a connection class (e.g. an instance of 201 * @link gloox::ConnectionTCPClient ConnectionTCPClient @endlink) manually, like so: 202 * 203 * @code 204 * Client* client = new Client( ... ); 205 * ConnectionTCPClient* conn = new ConnectionTCPClient( client, client->logInstance(), server, port ); 206 * client->setConnectionImpl( conn ); 207 * 208 * client->connect( false ); 209 * int sock = conn->socket(); 210 * 211 * [...] 212 * @endcode 213 * 214 * It would also be possible to fetch the fd like this: 215 * 216 * @code 217 * Client* client = new Client( ... ); 218 * client->connect( false ); 219 * int sock = static_cast<ConnectionTCPClient*>( client->connectionImpl() )->socket(); 220 * 221 * [...] 222 * @endcode 223 * Obviously this will only work as long as you haven't set a different type of connection using setConnectionImpl(). 224 * 225 * @note This has changed in 0.9. ClientBase::fileDescriptor() is no longer available. 226 * 227 * @section roster_sec Roster Management 228 * 229 * Among others, RFC 3921 defines the protocol to manage one's contact list (roster). In gloox, the 230 * @link gloox::RosterManager RosterManager @endlink class implements this functionality. A few 231 * easy-to-use functions are available to subscribe to or unsubscribe from the presence of remote 232 * entities. It is also possible to add a contact to a roster without actually subscribing to the 233 * contacts presence. Additionally, the interface @link gloox::RosterListener RosterListener @endlink 234 * offers many callbacks for various roster-related events. 235 * 236 * If you create a Client object as shown above, you also get a RosterManager for free. 237 * @link gloox::Client::rosterManager() Client::rosterManager() @endlink returns a pointer to the 238 * object. 239 * 240 * @section privacy_sec Privacy Lists 241 * 242 * Also defined in RFC 3921: Privacy Lists. A Privacy List can be used to explicitely block or allow 243 * sending of stanzas from and to contacts, respectively. You can define rules based on JID, stanza type, 244 * etc. The @link gloox::PrivacyManager PrivacyManager @endlink class and the 245 * @link gloox::PrivacyListHandler PrivacyListHandler @endlink virtual interface allow for full 246 * flexibility in Privacy List handling. 247 * 248 * @code 249 * PrivacyManager* p = new PrivacyManager( ... ); 250 * [...] 251 * PrivacyListHandler::PrivacyList list; 252 * PrivacyItem item( PrivacyItem::TypeJid, PrivacyItem::ActionDeny, 253 * PrivacyItem::PacketMessage, "me@there.com" ); 254 * list.push_back( item ); 255 * 256 * PrivacyItem item2( PrivacyItem::TypeJid, PrivacyItem::ActionAllow, 257 * PrivacyItem::PacketIq, "me@example.org" ); 258 * list.push_back( item2 ); 259 * 260 * p->store( "myList", list ); 261 * @endcode 262 * 263 * @section auth_sec Authentication 264 * 265 * gloox supports old-style IQ-based authentication defined in @xep{0078} as well as several SASL mechanisms. 266 * See the documentation of the @link gloox::Client Client @endlink class for more information. 267 * 268 * @section msg_sec Sending and Receiving of Chat Messages 269 * 270 * For Messaging it is recommended to use the MessageSession interface. It handles sending and receiving 271 * of messages as well as message events and chat states (such as typing notifications, etc.). See 272 * @link gloox::MessageSession MessageSession @endlink for more details. 273 * 274 * @section xeps_sec Protocol Extensions (XEPs) 275 * 276 * The XMPP Standards Foundation has published a number of extensions to the core protocols, called 277 * XMPP Extension Protocols (XEPs). A couple of these XEPs are implemented in gloox: 278 * 279 * @li @xep{0004} @link gloox::DataForm Data Forms @endlink 280 * @li @xep{0012} @link gloox::LastActivity Last Activity @endlink 281 * @li @xep{0013} @link gloox::FlexibleOffline Flexible Offline Message Retrieval @endlink 282 * @li @xep{0022} Message Events (see @link gloox::MessageSession MessageSession @endlink for examples) 283 * @li @xep{0027} Current Jabber OpenPGP Usage (see @link gloox::GPGSigned GPGSigned @endlink 284 * and @link gloox::GPGEncrypted GPGEncrypted @endlink) 285 * @li @xep{0030} @link gloox::Disco Service Discovery @endlink 286 * @li @xep{0045} @link gloox::MUCRoom Multi-User Chat @endlink 287 * @li @xep{0047} In-Band Bytestreams, used with @ref filetransfer_sec 288 * @li @xep{0048} @link gloox::BookmarkStorage Bookmark Storage @endlink 289 * @li @xep{0049} @link gloox::PrivateXML Private XML Storage @endlink 290 * @li @xep{0050} @link gloox::Adhoc Ad-hoc Commands @endlink 291 * @li @xep{0054} @link gloox::VCardManager vcard-temp @endlink 292 * @li @xep{0060} @link gloox::PubSub::Manager Publish-Subscribe @endlink 293 * @li @xep{0065} @link gloox::SOCKS5BytestreamManager SOCKS5 Bytestreams @endlink, used with 294 * @ref filetransfer_sec and @ref proxy_sec 295 * @li @xep{0066} @link gloox::OOB Out of Band Data @endlink, also used with @ref filetransfer_sec 296 * @li @xep{0077} @link gloox::Registration In-Band Registration @endlink 297 * @li @xep{0078} Non-SASL Authentication (automatically used if the server does not support SASL) 298 * @li @xep{0079} @link gloox::AMP Advanced Message Processing @endlink 299 * @li @xep{0083} Nested Roster Groups (automatically used if supported by the server, see 300 * @link gloox::RosterManager::delimiter() RosterManager @endlink) 301 * @li @xep{0085} Chat State Notifications (see @link gloox::MessageSession MessageSession @endlink for 302 * examples) 303 * @li @xep{0091} @link gloox::DelayedDelivery Delayed Delivery @endlink (old spec) 304 * @li @xep{0092} Software Version (integrated into @link gloox::Disco Service Discovery @endlink) 305 * @li @xep{0095} @link gloox::SIManager Stream Initiation @endlink, used with @ref filetransfer_sec 306 * @li @xep{0096} @ref filetransfer_sec 307 * @li @xep{0106} @link gloox::JID::escapeNode() JID Escaping @endlink 308 * @li @xep{0114} @link gloox::Component Jabber Component Protocol @endlink 309 * @li @xep{0115} @link gloox::Capabilities Entity Capabilities @endlink (used automatically internally) 310 * @li @xep{0124} @link gloox::ConnectionBOSH Bidirectional-streams Over Synchronous HTTP (BOSH) @endlink 311 * @li @xep{0131} @link gloox::SHIM Stanza Headers and Internet Metadata @endlink 312 * @li @xep{0138} Stream Compression (used automatically if gloox is compiled with zlib and if the server 313 * supports it) 314 * @li @xep{0145} @link gloox::Annotations Annotations @endlink 315 * @li @xep{0153} @link gloox::VCardUpdate vCard-based Avatars @endlink 316 * @li @xep{0166} @link gloox::Jingle::SessionManager Jingle @endlink 317 * @li @xep{0172} @link gloox::Nickname User Nickname @endlink 318 * @li @xep{0174} @link gloox::LinkLocal::Manager Link-local Messaging @endlink 319 * @li @xep{0176} @link gloox::Jingle::ICEUDP Jingle ICE-UDP Transport Method @endlink 320 * @li @xep{0184} @link gloox::Receipt Message Receipts @endlink 321 * @li @xep{0198} Stream Management (integrated into @link gloox::Client @endlink) 322 * @li @xep{0199} @link gloox::ClientBase::xmppPing() XMPP Ping @endlink 323 * @li @xep{0203} @link gloox::DelayedDelivery Delayed Delivery @endlink (new spec) 324 * @li @xep{0206} XMPP Over BOSH, see @link gloox::ConnectionBOSH BOSH @endlink 325 * @li @xep{0224} @link gloox::Attention Attention @endlink 326 * @li @xep{0234} @link gloox::Jingle::FileTransfer Jingle File Transfer @endlink 327 * @li @xep{0256} @link gloox::LastActivity::Query Last Activity in Presence @endlink 328 * @li @xep{0280} @link gloox::Carbons Message Carbons @endlink 329 * @li @xep{0297} @link gloox::Forward Stanza Forwarding @endlink 330 * @li @xep{0352} @link gloox::Client::hasClientStateIndication() Client State Indication @endlink 331 * 332 * Further extensions can easily be implemented using 333 * @link gloox::StanzaExtension StanzaExtensions @endlink. 334 * 335 * @section filetransfer_sec File Transfer 336 * 337 * For file transfer, gloox implements @xep{0095} (Stream Initiation) as well @xep{0096} (File Transfer) 338 * for the signalling, and @xep{0065} (SOCKS5 Bytestreams) as well as @xep{0047} (In-Band Bytestreams) 339 * for the transport. See @link gloox::SIProfileFT SIProfileFT @endlink. 340 * 341 * @section proxy_sec HTTP and SOCKS5 Proxy support 342 * 343 * gloox is capable of traversing HTTP as well as SOCKS5 proxies, even chained. See 344 * @link gloox::ConnectionHTTPProxy ConnectionHTTPProxy @endlink and 345 * @link gloox::ConnectionSOCKS5Proxy ConnectionSOCKS5Proxy @endlink. 346 * 347 * @section upgrading_sec Upgrading from earlier versions 348 * 349 * See <a href='upgrading.html'>Upgrading</a>. 350 * 351 */ 352 353 #ifndef GLOOX_H__ 354 #define GLOOX_H__ 355 356 #include "macros.h" 357 358 #include <string> 359 #include <list> 360 #include <map> 361 362 /** 363 * @brief The namespace for the gloox library. 364 * 365 * @author Jakob Schröter <js@camaya.net> 366 * @since 0.3 367 */ 368 namespace gloox 369 { 370 /** Client namespace (RFC 3920)*/ 371 GLOOX_API extern const std::string XMLNS_CLIENT; 372 373 /** Component Accept namespace (@xep{0114}) */ 374 GLOOX_API extern const std::string XMLNS_COMPONENT_ACCEPT; 375 376 /** Component Connect namespace (@xep{0114}) */ 377 GLOOX_API extern const std::string XMLNS_COMPONENT_CONNECT; 378 379 /** Service Discovery Info namespace (@xep{0030}) */ 380 GLOOX_API extern const std::string XMLNS_DISCO_INFO; 381 382 /** Service Discovery Items namespace (@xep{0030}) */ 383 GLOOX_API extern const std::string XMLNS_DISCO_ITEMS; 384 385 /** Service Discovery Publish namespace (@xep{0030}) */ 386 GLOOX_API extern const std::string XMLNS_DISCO_PUBLISH; 387 388 /** Adhoc Commands namespace (@xep{0050}) */ 389 GLOOX_API extern const std::string XMLNS_ADHOC_COMMANDS; 390 391 /** Stream Compression namespace (@xep{0138}) */ 392 GLOOX_API extern const std::string XMLNS_COMPRESSION; 393 394 /** Flexible Offline Message Retrieval (@xep{0013}) */ 395 GLOOX_API extern const std::string XMLNS_OFFLINE; 396 397 /** Chat State Notifications namespace (@xep{0085}) */ 398 GLOOX_API extern const std::string XMLNS_CHAT_STATES; 399 400 /** Advanced Message Processing (@xep{0079}) */ 401 GLOOX_API extern const std::string XMLNS_AMP; 402 403 /** In-Band Bytestreams namespace (@xep{0047}) */ 404 GLOOX_API extern const std::string XMLNS_IBB; 405 406 /** Feature Negotiation namespace (@xep{0020}) */ 407 GLOOX_API extern const std::string XMLNS_FEATURE_NEG; 408 409 /** Chat Session Negotiation namespace (@xep{0155}) */ 410 GLOOX_API extern const std::string XMLNS_CHATNEG; 411 412 /** XHTML-IM namespace (@xep{0071}) */ 413 GLOOX_API extern const std::string XMLNS_XHTML_IM; 414 415 /** Delayed Delivery namespace (@xep{0203}) */ 416 GLOOX_API extern const std::string XMLNS_DELAY; 417 418 /** Roster namespace (RFC 3921) */ 419 GLOOX_API extern const std::string XMLNS_ROSTER; 420 421 /** Software Version namespace (@xep{0092}) */ 422 GLOOX_API extern const std::string XMLNS_VERSION; 423 424 /** In-Band Registration namespace (@xep{0077}) */ 425 GLOOX_API extern const std::string XMLNS_REGISTER; 426 427 /** Privacy lists namespace (RFC 3921) */ 428 GLOOX_API extern const std::string XMLNS_PRIVACY; 429 430 /** Non-SASL Authentication namespace (@xep{0078}) */ 431 GLOOX_API extern const std::string XMLNS_AUTH; 432 433 /** Private XML Storage namespace (@xep{0049}) */ 434 GLOOX_API extern const std::string XMLNS_PRIVATE_XML; 435 436 /** Last Activity namespace (@xep{0012}) */ 437 GLOOX_API extern const std::string XMLNS_LAST; 438 439 /** Jabber Search namespace (@xep{0055}) */ 440 GLOOX_API extern const std::string XMLNS_SEARCH; 441 442 /** Out of Band Data (IQ) namespace (@xep{0066}) */ 443 GLOOX_API extern const std::string XMLNS_IQ_OOB; 444 445 /** Data Forms namespace (@xep{0004}) */ 446 GLOOX_API extern const std::string XMLNS_X_DATA; 447 448 /** Message Events (@xep{0022}) */ 449 GLOOX_API extern const std::string XMLNS_X_EVENT; 450 451 /** Out of Band Data (X) namespace (@xep{0066}) */ 452 GLOOX_API extern const std::string XMLNS_X_OOB; 453 454 /** Delayed Delivery namespace (@xep{0091}) */ 455 GLOOX_API extern const std::string XMLNS_X_DELAY; 456 457 /** Current Jabber OpenPGP Usage (Sign.) (@xep{0027}) */ 458 GLOOX_API extern const std::string XMLNS_X_GPGSIGNED; 459 460 /** Current Jabber OpenPGP Usage (Enc.) (@xep{0027}) */ 461 GLOOX_API extern const std::string XMLNS_X_GPGENCRYPTED; 462 463 /** vcard-temp namespace (@xep{0054}) */ 464 GLOOX_API extern const std::string XMLNS_VCARD_TEMP; 465 466 /** vCard-Based Avatars namespace (@xep{0153}) */ 467 GLOOX_API extern const std::string XMLNS_X_VCARD_UPDATE; 468 469 /** Bookmark Storage namespace (@xep{0048}) */ 470 GLOOX_API extern const std::string XMLNS_BOOKMARKS; 471 472 /** Annotations namespace (@xep{0145}) */ 473 GLOOX_API extern const std::string XMLNS_ANNOTATIONS; 474 475 /** Nested Roster Groups namespace (@xep{0083}) */ 476 GLOOX_API extern const std::string XMLNS_ROSTER_DELIMITER; 477 478 /** XMPP Ping namespace (@xep{0199}) */ 479 GLOOX_API extern const std::string XMLNS_XMPP_PING; 480 481 /** Stream Initiation namespace (@xep{0095}) */ 482 GLOOX_API extern const std::string XMLNS_SI; 483 484 /** File transfer profile of Stream Initiation (@xep{0096}) */ 485 GLOOX_API extern const std::string XMLNS_SI_FT; 486 487 /** SOCKS5 Bytestreams namespace (@xep{0065}) */ 488 GLOOX_API extern const std::string XMLNS_BYTESTREAMS; 489 490 /** Multi-User Chat namespace (@xep{0045}) */ 491 GLOOX_API extern const std::string XMLNS_MUC; 492 493 /** Multi-User Chat namespace (user) (@xep{0045}) */ 494 GLOOX_API extern const std::string XMLNS_MUC_USER; 495 496 /** Multi-User Chat namespace (admin) (@xep{0045}) */ 497 GLOOX_API extern const std::string XMLNS_MUC_ADMIN; 498 499 /** Multi-User Chat namespace (unique) (@xep{0045}) */ 500 GLOOX_API extern const std::string XMLNS_MUC_UNIQUE; 501 502 /** Multi-User Chat namespace (owner) (@xep{0045}) */ 503 GLOOX_API extern const std::string XMLNS_MUC_OWNER; 504 505 /** Multi-User Chat namespace (roominfo) (@xep{0045}) */ 506 GLOOX_API extern const std::string XMLNS_MUC_ROOMINFO; 507 508 /** Multi-User Chat namespace (rooms) (@xep{0045}) */ 509 GLOOX_API extern const std::string XMLNS_MUC_ROOMS; 510 511 /** Multi-User Chat namespace (request) (@xep{0045}) */ 512 GLOOX_API extern const std::string XMLNS_MUC_REQUEST; 513 514 /** PubSub namespace (@xep{0060}) */ 515 GLOOX_API extern const std::string XMLNS_PUBSUB; 516 517 /** PubSub namespace (errors) (@xep{0060}) */ 518 GLOOX_API extern const std::string XMLNS_PUBSUB_ERRORS; 519 520 /** PubSub namespace (event) (@xep{0060}) */ 521 GLOOX_API extern const std::string XMLNS_PUBSUB_EVENT; 522 523 /** PubSub namespace (owner) (@xep{0060}) */ 524 GLOOX_API extern const std::string XMLNS_PUBSUB_OWNER; 525 526 /** Entity Capabilities namespace (@xep{0115}) */ 527 GLOOX_API extern const std::string XMLNS_CAPS; 528 529 /** SOCKS5 Fast Mode namespace */ 530 GLOOX_API extern const std::string XMLNS_FT_FASTMODE; 531 532 /** XMPP stream namespace (RFC 3920) */ 533 GLOOX_API extern const std::string XMLNS_STREAM; 534 535 /** XMPP stream namespace (RFC 3920) */ 536 GLOOX_API extern const std::string XMLNS_XMPP_STREAM; 537 538 /** XMPP stanzas namespace (RFC 3920) */ 539 GLOOX_API extern const std::string XMLNS_XMPP_STANZAS; 540 541 /** TLS Stream Feature namespace (RFC 3920) */ 542 GLOOX_API extern const std::string XMLNS_STREAM_TLS; 543 544 /** SASL Stream Feature namespace (RFC 3920) */ 545 GLOOX_API extern const std::string XMLNS_STREAM_SASL; 546 547 /** Resource Bind Stream Feature (RFC 3921) */ 548 GLOOX_API extern const std::string XMLNS_STREAM_BIND; 549 550 /** Session Create Stream Feature (RFC 3921) */ 551 GLOOX_API extern const std::string XMLNS_STREAM_SESSION; 552 553 /** Non-SASL Auth. Stream Feature (@xep{0078}) */ 554 GLOOX_API extern const std::string XMLNS_STREAM_IQAUTH; 555 556 /** In-Band Registration namespace (@xep{0077}) */ 557 GLOOX_API extern const std::string XMLNS_STREAM_IQREGISTER; 558 559 /** Stream Compression Feature namespace (@xep{0138}) */ 560 GLOOX_API extern const std::string XMLNS_STREAM_COMPRESS; 561 562 /** General HTTP binding (BOSH) namespace (@xep{0124}) */ 563 GLOOX_API extern const std::string XMLNS_HTTPBIND; 564 565 /** XMPP-over-BOSH extensions (@xep{0206}) */ 566 GLOOX_API extern const std::string XMLNS_XMPP_BOSH; 567 568 /** Message Receipt namespace (@xep{0184}) */ 569 GLOOX_API extern const std::string XMLNS_RECEIPTS; 570 571 /** Message Receipt namespace (@xep{0172}) */ 572 GLOOX_API extern const std::string XMLNS_NICKNAME; 573 574 /** Jabber RPC namespace (@xep{0009}) */ 575 GLOOX_API extern const std::string XMLNS_JABBER_RPC; 576 577 /** Jingle namespace (@xep{0166}) */ 578 GLOOX_API extern const std::string XMLNS_JINGLE; 579 580 /** Jingle error namespace (@xep{0166}) */ 581 GLOOX_API extern const std::string XMLNS_JINGLE_ERRORS; 582 583 /** Jingle ICE-UDP Transport namespace (@xep{0176}) */ 584 GLOOX_API extern const std::string XMLNS_JINGLE_ICE_UDP; 585 586 /** Jingle File Transfer namespace (@xep{0234}) */ 587 GLOOX_API extern const std::string XMLNS_JINGLE_FILE_TRANSFER; 588 589 /** Jingle File Transfer namespace (multiple files) (@xep{0234}) */ 590 GLOOX_API extern const std::string XMLNS_JINGLE_FILE_TRANSFER_MULTI; 591 592 /** Stanza Headers and Internet Metadata (SHIM) namespace (@xep{0131}) */ 593 GLOOX_API extern const std::string XMLNS_SHIM; 594 595 /** Attention namespace (@xep{0224}) */ 596 GLOOX_API extern const std::string XMLNS_ATTENTION; 597 598 /** Stream Management namespace (@xep{0198}) */ 599 GLOOX_API extern const std::string XMLNS_STREAM_MANAGEMENT; 600 601 /** Stanza Forwarding namespace (@xep{0297}) */ 602 GLOOX_API extern const std::string XMLNS_STANZA_FORWARDING; 603 604 /** Message Carbons namespace (@xep{0280}) */ 605 GLOOX_API extern const std::string XMLNS_MESSAGE_CARBONS; 606 607 /** Client State Indication namespace (@xep{0352}) */ 608 GLOOX_API extern const std::string XMLNS_CLIENT_STATE_INDICATION; 609 610 /** Use of Cryptographic Hash Functions in XMPP namespace (@xep{0300}) */ 611 GLOOX_API extern const std::string XMLNS_HASHES; 612 613 /** IO Data (@xep{0244}) */ 614 GLOOX_API extern const std::string XMLNS_IODATA; 615 616 /** Supported stream version (major). */ 617 GLOOX_API extern const std::string XMPP_STREAM_VERSION_MAJOR; 618 619 /** Supported stream version (minor). */ 620 GLOOX_API extern const std::string XMPP_STREAM_VERSION_MINOR; 621 622 /** gloox version */ 623 GLOOX_API extern const std::string GLOOX_VERSION; 624 625 /** gloox caps node */ 626 GLOOX_API extern const std::string GLOOX_CAPS_NODE; 627 628 /** A string containing "xmlns". */ 629 GLOOX_API extern const std::string XMLNS; 630 631 /** A string containing "type". */ 632 GLOOX_API extern const std::string TYPE; 633 634 /** An empty string. */ 635 GLOOX_API extern const std::string EmptyString; 636 637 /** 638 * This describes the possible states of a stream. 639 */ 640 enum ConnectionState 641 { 642 StateDisconnected, /**< The client is in disconnected state. */ 643 StateConnecting, /**< The client is currently trying to establish a connection. */ 644 StateConnected /**< The client is connected to the server but authentication is not 645 * (yet) done. */ 646 }; 647 648 /** 649 * Describes stream events that get emitted by means of ConnectionListener::onStreamEvent(). 650 * @since 0.9 651 */ 652 enum StreamEvent 653 { 654 StreamEventConnecting, /**< The Client is about to initaite the connection. */ 655 StreamEventEncryption, /**< The Client is about to negotiate encryption. */ 656 StreamEventCompression, /**< The Client is about to negotiate compression. */ 657 StreamEventAuthentication, /**< The Client is about to authenticate. */ 658 StreamEventSessionInit, /**< The Client is about to create a session. */ 659 StreamEventResourceBinding, /**< The Client is about to bind a resource to the stream. */ 660 StreamEventSMEnable, /**< The Client is about to request Stream Management (@xep{0198}). 661 * @since 1.0.4 */ 662 StreamEventSMResume, /**< The Client is about to request resumption by means of Stream Management 663 * (@xep{0198}). 664 * @since 1.0.4 */ 665 StreamEventSMResumed, /**< The stream has successfully been resumed by means of Stream Management 666 * (@xep{0198}). 667 * @since 1.0.4 */ 668 StreamEventSMEnableFailed, /**< The attempt to enable Stream Management 669 * (@xep{0198}) failed. This is not critical. 670 * @since 1.0.4 */ 671 StreamEventSMResumeFailed, /**< The attempt to resume an aborted session by means of Stream Management 672 * (@xep{0198}) failed. This is not critical. 673 * @since 1.0.4 */ 674 StreamEventSessionCreation, /**< The Client is about to create a session. 675 * @since 0.9.1 */ 676 StreamEventRoster, /**< The Client is about to request the roster. */ 677 StreamEventFinished /**< The log-in phase is completed. */ 678 }; 679 680 /** 681 * This describes connection error conditions. 682 */ 683 enum ConnectionError 684 { 685 ConnNoError, /**< Not really an error. Everything went just fine. */ 686 ConnStreamError, /**< A stream error occured. The stream has been closed. 687 * Use ClientBase::streamError() to find the reason. */ 688 ConnStreamVersionError, /**< The incoming stream's version is not supported */ 689 ConnStreamClosed, /**< The stream has been closed (by the server). */ 690 ConnProxyAuthRequired, /**< The HTTP/SOCKS5 proxy requires authentication. 691 * @since 0.9 */ 692 ConnProxyAuthFailed, /**< HTTP/SOCKS5 proxy authentication failed. 693 * @since 0.9 */ 694 ConnProxyNoSupportedAuth, /**< The HTTP/SOCKS5 proxy requires an unsupported auth mechanism. 695 * @since 0.9 */ 696 ConnIoError, /**< An I/O error occured. */ 697 ConnParseError, /**< An XML parse error occurred. */ 698 ConnConnectionRefused, /**< The connection was refused by the server (on the socket level). 699 * @since 0.9 */ 700 ConnDnsError, /**< Resolving the server's hostname failed. 701 * @since 0.9 */ 702 ConnOutOfMemory, /**< Out of memory. Uhoh. */ 703 ConnNoSupportedAuth, /**< The auth mechanisms the server offers are not supported 704 * or the server offered no auth mechanisms at all. */ 705 ConnTlsFailed, /**< The server's certificate could not be verified or the TLS 706 * handshake did not complete successfully. */ 707 ConnTlsNotAvailable, /**< The server didn't offer TLS while it was set to be required, 708 * or TLS was not compiled in. 709 * @since 0.9.4 */ 710 ConnCompressionFailed, /**< Negotiating/initializing compression failed. 711 * @since 0.9 */ 712 ConnAuthenticationFailed, /**< Authentication failed. Username/password wrong or account does 713 * not exist. Use ClientBase::authError() to find the reason. */ 714 ConnUserDisconnected, /**< The user (or higher-level protocol) requested a disconnect. */ 715 ConnNotConnected /**< There is no active connection. */ 716 }; 717 718 /** 719 * ClientBase's policy regarding TLS usage. Use with ClientBase::setTls(). 720 */ 721 enum TLSPolicy 722 { 723 TLSDisabled, /**< Don't use TLS. */ 724 TLSOptional, /**< Use TLS if compiled in and offered by the server. */ 725 TLSRequired /**< Don't attempt to log in if the server didn't offer TLS 726 * or if TLS was not compiled in. Disconnect error will be 727 * ConnTlsNotAvailable. */ 728 }; 729 730 /** 731 * Supported Stream Features. 732 */ 733 enum StreamFeature 734 { 735 StreamFeatureBind = 1, /**< The server supports resource binding. */ 736 StreamFeatureUnbind = 2, /**< The server supports binding multiple resources. */ 737 StreamFeatureSession = 4, /**< The server supports sessions. */ 738 StreamFeatureStartTls = 8, /**< The server supports <starttls>. */ 739 StreamFeatureIqRegister = 16, /**< The server supports @xep{0077} (In-Band 740 * Registration). */ 741 StreamFeatureIqAuth = 32, /**< The server supports @xep{0078} (Non-SASL 742 * Authentication). */ 743 StreamFeatureCompressZlib = 64, /**< The server supports @xep{0138} (Stream 744 * Compression) (Zlib). */ 745 StreamFeatureCompressDclz = 128, /**< The server supports @xep{0138} (Stream 746 * Compression) (LZW/DCLZ). */ 747 StreamFeatureStreamManagement = 256, /**< The server supports @xep{0198} (Stream Management). */ 748 StreamFeatureClientStateIndication = 512 /**< The server supports @xep{0352} (Client State Indication). */ 749 // SaslMechanism below must be adjusted accordingly. 750 }; 751 752 /** 753 * Supported SASL mechanisms. 754 */ 755 // must be adjusted with changes to StreamFeature enum above 756 enum SaslMechanism 757 { 758 SaslMechNone = 0, /**< Invalid SASL Mechanism. */ 759 SaslMechScramSha1 = 1024, /**< SASL SCRAM-SHA-1 accroding to RFC 5801 */ 760 SaslMechScramSha1Plus = 2048, /**< SASL SCRAM-SHA-1-PLUS accroding to RFC 5801 */ 761 SaslMechDigestMd5 = 4096, /**< SASL Digest-MD5 according to RFC 2831. */ 762 SaslMechPlain = 8192, /**< SASL PLAIN according to RFC 2595 Section 6. */ 763 SaslMechAnonymous = 16384, /**< SASL ANONYMOUS according to draft-ietf-sasl-anon-05.txt/ 764 * RFC 2245 Section 6. */ 765 SaslMechExternal = 32768, /**< SASL EXTERNAL according to RFC 2222 Section 7.4. */ 766 SaslMechGssapi = 65536, /**< SASL GSSAPI (Win32 only). */ 767 SaslMechNTLM = 131072, /**< SASL NTLM (Win32 only). */ 768 SaslMechAll = 262143 /**< Includes all supported SASL mechanisms. */ 769 }; 770 771 /** 772 * This describes stream error conditions as defined in RFC 3920 Sec. 4.7.3. 773 */ 774 enum StreamError 775 { 776 StreamErrorBadFormat, /**< The entity has sent XML that cannot be processed; 777 * this error MAY be used instead of the more specific XML-related 778 * errors, such as <bad-namespace-prefix/>, <invalid-xml/>, 779 * <restricted-xml/>, <unsupported-encoding/>, and 780 * <not-well-formed/>, although the more specific errors are 781 * preferred. */ 782 StreamErrorBadNamespacePrefix, /**< The entity has sent a namespace prefix that is unsupported, or has 783 * sent no namespace prefix on an element that requires such a prefix 784 * (see XML Namespace Names and Prefixes (Section 11.2)). */ 785 StreamErrorConflict, /**< The server is closing the active stream for this entity because a 786 * new stream has been initiated that conflicts with the existing 787 * stream. */ 788 StreamErrorConnectionTimeout, /**< The entity has not generated any traffic over the stream for some 789 * period of time (configurable according to a local service policy).*/ 790 StreamErrorHostGone, /**< the value of the 'to' attribute provided by the initiating entity 791 * in the stream header corresponds to a hostname that is no longer 792 * hosted by the server.*/ 793 StreamErrorHostUnknown, /**< The value of the 'to' attribute provided by the initiating entity 794 * in the stream header does not correspond to a hostname that is hosted 795 * by the server. */ 796 StreamErrorImproperAddressing, /**< A stanza sent between two servers lacks a 'to' or 'from' attribute 797 * (or the attribute has no value). */ 798 StreamErrorInternalServerError, /**< the server has experienced a misconfiguration or an 799 * otherwise-undefined internal error that prevents it from servicing the 800 * stream. */ 801 StreamErrorInvalidFrom, /**< The JID or hostname provided in a 'from' address does not match an 802 * authorized JID or validated domain negotiated between servers via SASL 803 * or dialback, or between a client and a server via authentication and 804 * resource binding.*/ 805 StreamErrorInvalidId, /**< The stream ID or dialback ID is invalid or does not match an ID 806 * previously provided. */ 807 StreamErrorInvalidNamespace, /**< The streams namespace name is something other than 808 * "http://etherx.jabber.org/streams" or the dialback namespace name is 809 * something other than "jabber:server:dialback" (see XML Namespace Names 810 * and Prefixes (Section 11.2)). */ 811 StreamErrorInvalidXml, /**< The entity has sent invalid XML over the stream to a server that 812 * performs validation (see Validation (Section 11.3)). */ 813 StreamErrorNotAuthorized, /**< The entity has attempted to send data before the stream has been 814 * authenticated, or otherwise is not authorized to perform an action 815 * related to stream negotiation; the receiving entity MUST NOT process 816 * the offending stanza before sending the stream error. */ 817 StreamErrorPolicyViolation, /**< The entity has violated some local service policy; the server MAY 818 * choose to specify the policy in the <text/> element or an 819 * application-specific condition element. */ 820 StreamErrorRemoteConnectionFailed,/**< The server is unable to properly connect to a remote entity that 821 * is required for authentication or authorization. */ 822 StreamErrorResourceConstraint, /**< the server lacks the system resources necessary to service the 823 * stream. */ 824 StreamErrorRestrictedXml, /**< The entity has attempted to send restricted XML features such as a 825 * comment, processing instruction, DTD, entity reference, or unescaped 826 * character (see Restrictions (Section 11.1)). */ 827 StreamErrorSeeOtherHost, /**< The server will not provide service to the initiating entity but is 828 * redirecting traffic to another host; the server SHOULD specify the 829 * alternate hostname or IP address (which MUST be a valid domain 830 * identifier) as the XML character data of the <see-other-host/> 831 * element. */ 832 StreamErrorSystemShutdown, /**< The server is being shut down and all active streams are being 833 * closed. */ 834 StreamErrorUndefinedCondition, /**< The error condition is not one of those defined by the other 835 * conditions in this list; this error condition SHOULD be used only in 836 * conjunction with an application-specific condition. */ 837 StreamErrorUnsupportedEncoding, /**< The initiating entity has encoded the stream in an encoding that is 838 * not supported by the server (see Character Encoding (Section 11.5)). 839 */ 840 StreamErrorUnsupportedStanzaType,/**< The initiating entity has sent a first-level child of the stream 841 * that is not supported by the server. */ 842 StreamErrorUnsupportedVersion, /**< The value of the 'version' attribute provided by the initiating 843 * entity in the stream header specifies a version of XMPP that is not 844 * supported by the server; the server MAY specify the version(s) it 845 * supports in the <text/> element. */ 846 StreamErrorXmlNotWellFormed, /**< The initiating entity has sent XML that is not well-formed as 847 * defined by [XML]. */ 848 StreamErrorUndefined /**< An undefined/unknown error occured. Also used if a diconnect was 849 * user-initiated. Also set before and during a established connection 850 * (where obviously no error occured). */ 851 }; 852 853 /** 854 * Describes types of stanza errors. 855 */ 856 enum StanzaErrorType 857 { 858 StanzaErrorTypeAuth, /**< Retry after providing credentials. */ 859 StanzaErrorTypeCancel, /**< Do not retry (the error is unrecoverable). */ 860 StanzaErrorTypeContinue, /**< Proceed (the condition was only a warning). */ 861 StanzaErrorTypeModify, /**< Retry after changing the data sent. */ 862 863 StanzaErrorTypeWait, /**< Retry after waiting (the error is temporary). */ 864 StanzaErrorTypeUndefined /**< No error. */ 865 }; 866 867 /** 868 * Describes the defined stanza error conditions of RFC 3920. 869 * Used by, eg., Stanza::error(). 870 */ 871 enum StanzaError 872 { 873 874 StanzaErrorBadRequest, /**< The sender has sent XML that is malformed or that cannot be 875 * processed (e.g., an IQ stanza that includes an unrecognized value 876 * of the 'type' attribute); the associated error type SHOULD be 877 * "modify". */ 878 StanzaErrorConflict, /**< Access cannot be granted because an existing resource or session 879 * exists with the same name or address; the associated error type 880 * SHOULD be "cancel". */ 881 StanzaErrorFeatureNotImplemented,/**< The feature requested is not implemented by the recipient or 882 * server and therefore cannot be processed; the associated error 883 * type SHOULD be "cancel". */ 884 StanzaErrorForbidden, /**< The requesting entity does not possess the required permissions to 885 * perform the action; the associated error type SHOULD be "auth". */ 886 StanzaErrorGone, /**< The recipient or server can no longer be contacted at this address 887 * (the error stanza MAY contain a new address in the XML character data 888 * of the <gone/> element); the associated error type SHOULD be 889 * "modify". */ 890 StanzaErrorInternalServerError, /**< The server could not process the stanza because of a 891 * misconfiguration or an otherwise-undefined internal server error; the 892 * associated error type SHOULD be "wait". */ 893 StanzaErrorItemNotFound, /**< The addressed JID or item requested cannot be found; the associated 894 * error type SHOULD be "cancel". */ 895 StanzaErrorJidMalformed, /**< The sending entity has provided or communicated an XMPP address 896 * (e.g., a value of the 'to' attribute) or aspect thereof (e.g., a 897 * resource identifier) that does not adhere to the syntax defined in 898 * Addressing Scheme (Section 3); the associated error type SHOULD be 899 * "modify". */ 900 StanzaErrorNotAcceptable, /**< The recipient or server understands the request but is refusing to 901 * process it because it does not meet criteria defined by the recipient 902 * or server (e.g., a local policy regarding acceptable words in 903 * messages); the associated error type SHOULD be "modify". */ 904 StanzaErrorNotAllowed, /**< The recipient or server does not allow any entity to perform the 905 * action; the associated error type SHOULD be "cancel". */ 906 StanzaErrorNotAuthorized, /**< The sender must provide proper credentials before being allowed to 907 * perform the action, or has provided impreoper credentials; the 908 * associated error type should be "auth". */ 909 StanzaErrorNotModified, /**< The item requested has not changed since it was last requested; 910 * the associated error type SHOULD be "continue". */ 911 StanzaErrorPaymentRequired, /**< The requesting entity is not authorized to access the requested 912 * service because payment is required; the associated error type SHOULD 913 * be "auth". */ 914 StanzaErrorRecipientUnavailable,/**< The intended recipient is temporarily unavailable; the associated 915 * error type SHOULD be "wait" (note: an application MUST NOT return 916 * this error if doing so would provide information about the intended 917 * recipient's network availability to an entity that is not authorized 918 * to know such information). */ 919 StanzaErrorRedirect, /**< The recipient or server is redirecting requests for this 920 * information to another entity, usually temporarily (the error 921 * stanza SHOULD contain the alternate address, which MUST be a valid 922 * JID, in the XML character data of the <redirect/> element); 923 * the associated error type SHOULD be "modify". */ 924 StanzaErrorRegistrationRequired,/**< The requesting entity is not authorized to access the requested 925 * service because registration is required; the associated error type 926 * SHOULD be "auth". */ 927 StanzaErrorRemoteServerNotFound,/**< A remote server or service specified as part or all of the JID of 928 * the intended recipient does not exist; the associated error type 929 * SHOULD be "cancel". */ 930 StanzaErrorRemoteServerTimeout, /**< A remote server or service specified as part or all of the JID of 931 * the intended recipient (or required to fulfill a request) could not 932 * be contacted within a reasonable amount of time; the associated error 933 * type SHOULD be "wait". */ 934 StanzaErrorResourceConstraint, /**< The server or recipient lacks the system resources necessary to 935 * service the request; the associated error type SHOULD be "wait". */ 936 StanzaErrorServiceUnavailable, /**< The server or recipient does not currently provide the requested 937 * service; the associated error type SHOULD be "cancel". */ 938 StanzaErrorSubscribtionRequired,/**< The requesting entity is not authorized to access the requested 939 * service because a subscription is required; the associated error type 940 * SHOULD be "auth". */ 941 StanzaErrorUndefinedCondition, /**< The error condition is not one of those defined by the other 942 * conditions in this list; any error type may be associated with this 943 * condition, and it SHOULD be used only in conjunction with an 944 * application-specific condition. */ 945 StanzaErrorUnexpectedRequest, /**< The recipient or server understood the request but was not 946 * expecting it at this time (e.g., the request was out of order); 947 * the associated error type SHOULD be "wait". */ 948 StanzaErrorUnknownSender, /**< The stanza 'from' address specified by a connected client is not 949 * valid for the stream (e.g., the stanza does not include a 'from' 950 * address when multiple resources are bound to the stream); the 951 * associated error type SHOULD be "modify".*/ 952 StanzaErrorUndefined /**< No stanza error occured. */ 953 }; 954 955 /** 956 * Describes the possible 'available presence' types. 957 */ 958 // enum Presence 959 // { 960 // PresenceUnknown, /**< Unknown status. */ 961 // PresenceAvailable, /**< The entity or resource is online and available. */ 962 // PresenceChat, /**< The entity or resource is actively interested in chatting. */ 963 // PresenceAway, /**< The entity or resource is temporarily away. */ 964 // PresenceDnd, /**< The entity or resource is busy (dnd = "Do Not Disturb"). */ 965 // PresenceXa, /**< The entity or resource is away for an extended period (xa = 966 // * "eXtended Away"). */ 967 // PresenceUnavailable /**< The entity or resource is offline. */ 968 // }; 969 970 /** 971 * Describes the verification results of a certificate. 972 */ 973 enum CertStatus 974 { 975 CertOk = 0, /**< The certificate is valid and trusted. */ 976 CertInvalid = 1, /**< The certificate is not trusted. */ 977 CertSignerUnknown = 2, /**< The certificate hasn't got a known issuer. */ 978 CertRevoked = 4, /**< The certificate has been revoked. */ 979 CertExpired = 8, /**< The certificate has expired. */ 980 CertNotActive = 16, /**< The certifiacte is not yet active. */ 981 CertWrongPeer = 32, /**< The certificate has not been issued for the 982 * peer we're connected to. */ 983 CertSignerNotCa = 64 /**< The signer is not a CA. */ 984 }; 985 986 /** 987 * Describes the certificate presented by the peer. 988 */ 989 struct CertInfo 990 { 991 int status; /**< Bitwise or'ed CertStatus or CertOK. */ 992 bool chain; /**< Determines whether the cert chain verified ok. */ 993 std::string issuer; /**< The name of the issuing entity.*/ 994 std::string server; /**< The server the certificate has been issued for. */ 995 int date_from; /**< The date from which onwards the certificate is valid 996 * (UNIX timestamp; UTC). 997 * @todo Change type to time_t or long? */ 998 int date_to; /**< The date up to which the certificate is valid 999 * (UNIX timestamp; UTC). 1000 * @todo Change type to time_t or long? */ 1001 std::string protocol; /**< The encryption protocol used for the connection. */ 1002 std::string cipher; /**< The cipher used for the connection. */ 1003 std::string mac; /**< The MAC used for the connection. */ 1004 std::string compression; /**< The compression used for the connection. */ 1005 }; 1006 1007 /** 1008 * Describes the defined SASL (and non-SASL) error conditions. 1009 */ 1010 enum AuthenticationError 1011 { 1012 AuthErrorUndefined, /**< No error occurred, or error condition is unknown. */ 1013 SaslAborted, /**< The receiving entity acknowledges an <abort/> element sent 1014 * by the initiating entity; sent in reply to the <abort/> 1015 * element. */ 1016 SaslIncorrectEncoding, /**< The data provided by the initiating entity could not be processed 1017 * because the [BASE64] encoding is incorrect (e.g., because the encoding 1018 * does not adhere to the definition in Section 3 of [BASE64]); sent in 1019 * reply to a <response/> element or an <auth/> element with 1020 * initial response data. */ 1021 SaslInvalidAuthzid, /**< The authzid provided by the initiating entity is invalid, either 1022 * because it is incorrectly formatted or because the initiating entity 1023 * does not have permissions to authorize that ID; sent in reply to a 1024 * <response/> element or an <auth/> element with initial 1025 * response data.*/ 1026 SaslInvalidMechanism, /**< The initiating entity did not provide a mechanism or requested a 1027 * mechanism that is not supported by the receiving entity; sent in reply 1028 * to an <auth/> element. */ 1029 SaslMalformedRequest, /**< The request is malformed (e.g., the <auth/> element includes 1030 * an initial response but the mechanism does not allow that); sent in 1031 * reply to an <abort/>, <auth/>, <challenge/>, or 1032 * <response/> element. */ 1033 SaslMechanismTooWeak, /**< The mechanism requested by the initiating entity is weaker than 1034 * server policy permits for that initiating entity; sent in reply to a 1035 * <response/> element or an <auth/> element with initial 1036 * response data. */ 1037 SaslNotAuthorized, /**< The authentication failed because the initiating entity did not 1038 * provide valid credentials (this includes but is not limited to the 1039 * case of an unknown username); sent in reply to a <response/> 1040 * element or an <auth/> element with initial response data. */ 1041 SaslTemporaryAuthFailure, /**< The authentication failed because of a temporary error condition 1042 * within the receiving entity; sent in reply to an <auth/> element 1043 * or <response/> element. */ 1044 NonSaslConflict, /**< @xep{0078}: Resource Conflict */ 1045 NonSaslNotAcceptable, /**< @xep{0078}: Required Information Not Provided */ 1046 NonSaslNotAuthorized /**< @xep{0078}: Incorrect Credentials */ 1047 }; 1048 1049 /** 1050 * Identifies log sources. 1051 */ 1052 enum LogArea 1053 { 1054 LogAreaClassParser = 0x000001, /**< Log messages from Parser. */ 1055 LogAreaClassConnectionTCPBase = 0x000002, /**< Log messages from ConnectionTCPBase. */ 1056 LogAreaClassClient = 0x000004, /**< Log messages from Client. */ 1057 LogAreaClassClientbase = 0x000008, /**< Log messages from ClientBase. */ 1058 LogAreaClassComponent = 0x000010, /**< Log messages from Component. */ 1059 LogAreaClassDns = 0x000020, /**< Log messages from DNS. */ 1060 LogAreaClassConnectionHTTPProxy = 0x000040, /**< Log messages from ConnectionHTTPProxy */ 1061 LogAreaClassConnectionSOCKS5Proxy = 0x000080, /**< Log messages from ConnectionSOCKS5Proxy */ 1062 LogAreaClassConnectionTCPClient = 0x000100, /**< Log messages from ConnectionTCPClient. */ 1063 LogAreaClassConnectionTCPServer = 0x000200, /**< Log messages from ConnectionTCPServer. */ 1064 LogAreaClassS5BManager = 0x000400, /**< Log messages from SOCKS5BytestreamManager. */ 1065 LogAreaClassSOCKS5Bytestream = 0x000800, /**< Log messages from SOCKS5Bytestream. */ 1066 LogAreaClassConnectionBOSH = 0x001000, /**< Log messages from ConnectionBOSH */ 1067 LogAreaClassConnectionTLS = 0x002000, /**< Log messages from ConnectionTLS */ 1068 LogAreaLinkLocalManager = 0x004000, /**< Log messages from LinkLocalManager */ 1069 LogAreaAllClasses = 0x01FFFF, /**< All log messages from all the classes. */ 1070 LogAreaXmlIncoming = 0x020000, /**< Incoming XML. */ 1071 LogAreaXmlOutgoing = 0x040000, /**< Outgoing XML. */ 1072 LogAreaUser = 0x800000, /**< User-defined sources. */ 1073 LogAreaAll = 0xFFFFFF /**< All log sources. */ 1074 }; 1075 1076 /** 1077 * Describes a log message's severity. 1078 */ 1079 enum LogLevel 1080 { 1081 LogLevelDebug, /**< Debug messages. */ 1082 LogLevelWarning, /**< Non-crititcal warning messages. */ 1083 LogLevelError /**< Critical, unrecoverable errors. */ 1084 }; 1085 1086 /** 1087 * The possible Message Events according to @xep{0022}. 1088 */ 1089 enum MessageEventType 1090 { 1091 MessageEventOffline = 1, /**< Indicates that the message has been stored offline by the 1092 * intended recipient's server. */ 1093 MessageEventDelivered = 2, /**< Indicates that the message has been delivered to the 1094 * recipient. */ 1095 MessageEventDisplayed = 4, /**< Indicates that the message has been displayed */ 1096 MessageEventComposing = 8, /**< Indicates that a reply is being composed. */ 1097 MessageEventInvalid = 16, /**< Invalid type. */ 1098 MessageEventCancel = 32 /**< Cancels the 'Composing' event. */ 1099 }; 1100 1101 /** 1102 * The possible Chat States according to @xep{0085}. 1103 */ 1104 enum ChatStateType 1105 { 1106 ChatStateActive = 1, /**< User is actively participating in the chat session. */ 1107 ChatStateComposing = 2, /**< User is composing a message. */ 1108 ChatStatePaused = 4, /**< User had been composing but now has stopped. */ 1109 ChatStateInactive = 8, /**< User has not been actively participating in the chat session. */ 1110 ChatStateGone = 16, /**< User has effectively ended their participation in the chat 1111 * session. */ 1112 ChatStateInvalid = 32 /**< Invalid type. */ 1113 }; 1114 1115 /** 1116 * Describes the possible error conditions for resource binding. 1117 */ 1118 enum ResourceBindError 1119 { 1120 RbErrorUnknownError, /**< An unknown error occured. */ 1121 RbErrorBadRequest, /**< Resource identifier cannot be processed. */ 1122 RbErrorNotAllowed, /**< Client is not allowed to bind a resource. */ 1123 RbErrorConflict /**< Resource identifier is in use. */ 1124 }; 1125 1126 /** 1127 * Describes the possible error conditions for session establishemnt. 1128 */ 1129 enum SessionCreateError 1130 { 1131 ScErrorUnknownError, /**< An unknown error occured. */ 1132 ScErrorInternalServerError, /**< Internal server error. */ 1133 ScErrorForbidden, /**< Username or resource not allowed to create session. */ 1134 ScErrorConflict /**< Server informs newly-requested session of resource 1135 * conflict. */ 1136 }; 1137 1138 /** 1139 * Currently implemented message session filters. 1140 */ 1141 enum MessageSessionFilter 1142 { 1143 FilterMessageEvents = 1, /**< Message Events (@xep{0022}) */ 1144 FilterChatStates = 2 /**< Chat State Notifications (@xep{0085}) */ 1145 }; 1146 1147 /** 1148 * Defined MUC room affiliations. See @xep{0045} for default privileges. 1149 */ 1150 enum MUCRoomAffiliation 1151 { 1152 AffiliationNone, /**< No affiliation with the room. */ 1153 AffiliationOutcast, /**< The user has been banned from the room. */ 1154 AffiliationMember, /**< The user is a member of the room. */ 1155 AffiliationOwner, /**< The user is a room owner. */ 1156 AffiliationAdmin, /**< The user is a room admin. */ 1157 AffiliationInvalid /**< Invalid affiliation. */ 1158 }; 1159 1160 /** 1161 * Defined MUC room roles. See @xep{0045} for default privileges. 1162 */ 1163 enum MUCRoomRole 1164 { 1165 RoleNone, /**< Not present in room. */ 1166 RoleVisitor, /**< The user visits a room. */ 1167 RoleParticipant, /**< The user has voice in a moderatd room. */ 1168 RoleModerator, /**< The user is a room moderator. */ 1169 RoleInvalid /**< Invalid role. */ 1170 }; 1171 1172 /** 1173 * Configuration flags for a room. 1174 */ 1175 enum MUCRoomFlag 1176 { 1177 FlagPasswordProtected = 1<< 1, /**< Password-protected room. */ 1178 FlagPublicLogging = 1<< 2, /**< Room conversation is logged. Code: 170 */ 1179 FlagPublicLoggingOff = 1<< 3, /**< Room conversation is not logged. Code: 171 */ 1180 FlagHidden = 1<< 4, /**< Hidden room. */ 1181 FlagMembersOnly = 1<< 5, /**< Members-only room. */ 1182 FlagModerated = 1<< 6, /**< Moderated room. */ 1183 FlagNonAnonymous = 1<< 7, /**< Non-anonymous room. Code: 100, 172 */ 1184 FlagOpen = 1<< 8, /**< Open room. */ 1185 FlagPersistent = 1<< 9, /**< Persistent room .*/ 1186 FlagPublic = 1<<10, /**< Public room. */ 1187 FlagSemiAnonymous = 1<<11, /**< Semi-anonymous room. Code: 173 */ 1188 FlagTemporary = 1<<12, /**< Temporary room. */ 1189 FlagUnmoderated = 1<<13, /**< Unmoderated room. */ 1190 FlagUnsecured = 1<<14, /**< Unsecured room. */ 1191 FlagFullyAnonymous = 1<<15 /**< Fully anonymous room. Code: 174 */ 1192 // keep in sync with MUCUserFlag below 1193 }; 1194 1195 /** 1196 * Configuration flags for a user. 1197 */ 1198 // keep in sync with MUCRoomFlag above 1199 enum MUCUserFlag 1200 { 1201 UserSelf = 1<<16, /**< Other flags relate to the current user him/herself. Code: 110 */ 1202 UserNickChanged = 1<<17, /**< The user changed his/her nickname. Code: 303 */ 1203 UserKicked = 1<<18, /**< The user has been kicked. Code: 307 */ 1204 UserBanned = 1<<19, /**< The user has been banned. Code: 301 */ 1205 UserAffiliationChanged = 1<<20, /**< The user's affiliation with the room changed and as a result 1206 * he/she has been removed from the room. Code: 321 */ 1207 UserRoomDestroyed = 1<<21, /**< The room has been destroyed. */ 1208 UserNickAssigned = 1<<22, /**< Service has assigned or modified occupant's roomnick. 1209 * Code: 210*/ 1210 UserNewRoom = 1<<23, /**< The room has been newly created. Code: 201*/ 1211 UserMembershipRequired = 1<<24, /**< User is being removed from the room because the room has 1212 * been changed to members-only and the user is not a member. 1213 * Code: 322 */ 1214 UserRoomShutdown = 1<<25, /**< User is being removed from the room because of a system 1215 * shutdown. Code: 332 */ 1216 UserAffiliationChangedWNR = 1<<26 /**< The user's affiliation changed While Not in the Room. 1217 * Code: 101 */ 1218 }; 1219 1220 /** 1221 * Describes possible subscription types according to RFC 3921, Section 9. 1222 */ 1223 enum SubscriptionType 1224 { 1225 S10nNone, /**< Contact and user are not subscribed to each other, and 1226 * neither has requested a subscription from the other. */ 1227 S10nNoneOut, /**< Contact and user are not subscribed to each other, and 1228 * user has sent contact a subscription request but contact 1229 * has not replied yet. */ 1230 S10nNoneIn, /**< Contact and user are not subscribed to each other, and 1231 * contact has sent user a subscription request but user has 1232 * not replied yet (note: contact's server SHOULD NOT push or 1233 * deliver roster items in this state, but instead SHOULD wait 1234 * until contact has approved subscription request from user). */ 1235 S10nNoneOutIn, /**< Contact and user are not subscribed to each other, contact 1236 * has sent user a subscription request but user has not replied 1237 * yet, and user has sent contact a subscription request but 1238 * contact has not replied yet. */ 1239 S10nTo, /**< User is subscribed to contact (one-way). */ 1240 S10nToIn, /**< User is subscribed to contact, and contact has sent user a 1241 * subscription request but user has not replied yet. */ 1242 S10nFrom, /**< Contact is subscribed to user (one-way). */ 1243 S10nFromOut, /**< Contact is subscribed to user, and user has sent contact a 1244 * subscription request but contact has not replied yet. */ 1245 S10nBoth /**< User and contact are subscribed to each other (two-way). */ 1246 }; 1247 1248 /** 1249 * A list of strings. 1250 */ 1251 typedef std::list<std::string> StringList; 1252 1253 /** 1254 * A list of pointers to strings. 1255 */ 1256 typedef std::list<std::string*> StringPList; 1257 1258 /** 1259 * A map of strings. 1260 */ 1261 typedef std::map<std::string, std::string> StringMap; 1262 1263 /** 1264 * A multimap of strings. 1265 */ 1266 typedef std::multimap<std::string, std::string> StringMultiMap; 1267 1268 class StanzaExtension; 1269 /** 1270 * A list of StanzaExtensions. 1271 */ 1272 typedef std::list<const StanzaExtension*> StanzaExtensionList; 1273 } 1274 1275 extern "C" 1276 { 1277 GLOOX_API const char* gloox_version(); 1278 } 1279 1280 #endif // GLOOX_H__ 1281