gloox.h

00001 /*
00002   Copyright (c) 2005-2007 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00329 #ifndef GLOOX_H__
00330 #define GLOOX_H__
00331 
00332 #include "macros.h"
00333 
00334 #include <string>
00335 #include <list>
00336 #include <map>
00337 
00344 namespace gloox
00345 {
00347   GLOOX_API extern const std::string XMLNS_CLIENT;
00348 
00350   GLOOX_API extern const std::string XMLNS_COMPONENT_ACCEPT;
00351 
00353   GLOOX_API extern const std::string XMLNS_COMPONENT_CONNECT;
00354 
00356   GLOOX_API extern const std::string XMLNS_DISCO_INFO;
00357 
00359   GLOOX_API extern const std::string XMLNS_DISCO_ITEMS;
00360 
00362   GLOOX_API extern const std::string XMLNS_ADHOC_COMMANDS;
00363 
00365   GLOOX_API extern const std::string XMLNS_COMPRESSION;
00366 
00368   GLOOX_API extern const std::string XMLNS_OFFLINE;
00369 
00371   GLOOX_API extern const std::string XMLNS_CHAT_STATES;
00372 
00374   GLOOX_API extern const std::string XMLNS_AMP;
00375 
00377   GLOOX_API extern const std::string XMLNS_IBB;
00378 
00380   GLOOX_API extern const std::string XMLNS_FEATURE_NEG;
00381 
00383   GLOOX_API extern const std::string XMLNS_CHATNEG;
00384 
00386   GLOOX_API extern const std::string XMLNS_XHTML_IM;
00387 
00389   GLOOX_API extern const std::string XMLNS_DELAY;
00390 
00392   GLOOX_API extern const std::string XMLNS_ROSTER;
00393 
00395   GLOOX_API extern const std::string XMLNS_VERSION;
00396 
00398   GLOOX_API extern const std::string XMLNS_REGISTER;
00399 
00401   GLOOX_API extern const std::string XMLNS_PRIVACY;
00402 
00404   GLOOX_API extern const std::string XMLNS_AUTH;
00405 
00407   GLOOX_API extern const std::string XMLNS_PRIVATE_XML;
00408 
00410   GLOOX_API extern const std::string XMLNS_LAST;
00411 
00413   GLOOX_API extern const std::string XMLNS_SEARCH;
00414 
00416   GLOOX_API extern const std::string XMLNS_IQ_OOB;
00417 
00419   GLOOX_API extern const std::string XMLNS_X_DATA;
00420 
00422   GLOOX_API extern const std::string XMLNS_X_EVENT;
00423 
00425   GLOOX_API extern const std::string XMLNS_X_OOB;
00426 
00428   GLOOX_API extern const std::string XMLNS_X_DELAY;
00429 
00431   GLOOX_API extern const std::string XMLNS_X_GPGSIGNED;
00432 
00434   GLOOX_API extern const std::string XMLNS_X_GPGENCRYPTED;
00435 
00437   GLOOX_API extern const std::string XMLNS_VCARD_TEMP;
00438 
00440   GLOOX_API extern const std::string XMLNS_X_VCARD_UPDATE;
00441 
00443   GLOOX_API extern const std::string XMLNS_BOOKMARKS;
00444 
00446   GLOOX_API extern const std::string XMLNS_ANNOTATIONS;
00447 
00449   GLOOX_API extern const std::string XMLNS_ROSTER_DELIMITER;
00450 
00452   GLOOX_API extern const std::string XMLNS_XMPP_PING;
00453 
00455   GLOOX_API extern const std::string XMLNS_SI;
00456 
00458   GLOOX_API extern const std::string XMLNS_SI_FT;
00459 
00461   GLOOX_API extern const std::string XMLNS_BYTESTREAMS;
00462 
00464   GLOOX_API extern const std::string XMLNS_MUC;
00465 
00467   GLOOX_API extern const std::string XMLNS_MUC_USER;
00468 
00470   GLOOX_API extern const std::string XMLNS_MUC_ADMIN;
00471 
00473   GLOOX_API extern const std::string XMLNS_MUC_UNIQUE;
00474 
00476   GLOOX_API extern const std::string XMLNS_MUC_OWNER;
00477 
00479   GLOOX_API extern const std::string XMLNS_MUC_ROOMINFO;
00480 
00482   GLOOX_API extern const std::string XMLNS_MUC_ROOMS;
00483 
00485   GLOOX_API extern const std::string XMLNS_MUC_REQUEST;
00486 
00488   GLOOX_API extern const std::string XMLNS_XMPP_STREAM;
00489 
00491   GLOOX_API extern const std::string XMLNS_XMPP_STANZAS;
00492 
00494   GLOOX_API extern const std::string XMLNS_STREAM_TLS;
00495 
00497   GLOOX_API extern const std::string XMLNS_STREAM_SASL;
00498 
00500   GLOOX_API extern const std::string XMLNS_STREAM_BIND;
00501 
00503   GLOOX_API extern const std::string XMLNS_STREAM_SESSION;
00504 
00506   GLOOX_API extern const std::string XMLNS_STREAM_IQAUTH;
00507 
00509   GLOOX_API extern const std::string XMLNS_STREAM_IQREGISTER;
00510 
00512   GLOOX_API extern const std::string XMLNS_STREAM_COMPRESS;
00513 
00515   GLOOX_API extern const std::string XMPP_STREAM_VERSION_MAJOR;
00516 
00518   GLOOX_API extern const std::string XMPP_STREAM_VERSION_MINOR;
00519 
00521   GLOOX_API extern const std::string GLOOX_VERSION;
00522 
00526   enum ConnectionState
00527   {
00528     StateDisconnected,              
00529     StateConnecting,                
00530     StateConnected                  
00532   };
00533 
00538   enum StreamEvent
00539   {
00540     StreamEventConnecting,          
00541     StreamEventEncryption,          
00542     StreamEventCompression,         
00543     StreamEventAuthentication,      
00544     StreamEventSessionInit,         
00545     StreamEventResourceBinding,     
00546     StreamEventSessionCreation,     
00548     StreamEventRoster,              
00549     StreamEventFinished             
00550   };
00551 
00555   enum ConnectionError
00556   {
00557     ConnNoError,                    
00558     ConnStreamError,                
00560     ConnStreamVersionError,         
00561     ConnStreamClosed,               
00562     ConnProxyAuthRequired,          
00564     ConnProxyAuthFailed,            
00566     ConnProxyNoSupportedAuth,       
00568     ConnIoError,                    
00569     ConnParseError,                 
00570     ConnConnectionRefused,          
00572     ConnDnsError,                   
00574     ConnOutOfMemory,                
00575     ConnNoSupportedAuth,            
00577     ConnTlsFailed,                  
00579     ConnTlsNotAvailable,            
00582     ConnCompressionFailed,          
00584     ConnAuthenticationFailed,       
00586     ConnUserDisconnected,           
00587     ConnNotConnected                
00588   };
00589 
00593   enum TLSPolicy
00594   {
00595     TLSDisabled,                    
00596     TLSOptional,                    
00597     TLSRequired                     
00600   };
00601 
00605   enum StreamFeature
00606   {
00607     StreamFeatureBind             =    1, 
00608     StreamFeatureSession          =    2, 
00609     StreamFeatureStartTls         =    8, 
00610     StreamFeatureIqRegister       =   16, 
00612     StreamFeatureIqAuth           =   32, 
00614     StreamFeatureCompressZlib     =   64, 
00616     StreamFeatureCompressDclz     =  128  
00618     // SASLMechanism below must be adjusted accordingly.
00619   };
00620 
00624   // must be adjusted with changes to StreamFeature enum above
00625   enum SaslMechanism
00626   {
00627     SaslMechNone           =     0, 
00628     SaslMechDigestMd5      =   256, 
00629     SaslMechPlain          =   512, 
00630     SaslMechAnonymous      =  1024, 
00632     SaslMechExternal       =  2048, 
00633     SaslMechGssapi         =  4096, 
00634     SaslMechAll            = 65535  
00635   };
00636 
00640   enum StreamError
00641   {
00642     StreamErrorUndefined,           
00645     StreamErrorBadFormat,           
00651     StreamErrorBadNamespacePrefix,  
00654     StreamErrorConflict,            
00657     StreamErrorConnectionTimeout,   
00659     StreamErrorHostGone,            
00662     StreamErrorHostUnknown,         
00665     StreamErrorImproperAddressing,  
00667     StreamErrorInternalServerError, 
00670     StreamErrorInvalidFrom,         
00674     StreamErrorInvalidId,           
00676     StreamErrorInvalidNamespace,    
00680     StreamErrorInvalidXml,          
00682     StreamErrorNotAuthorized,       
00686     StreamErrorPolicyViolation,     
00689     StreamErrorRemoteConnectionFailed,
00691     StreamErrorResourceConstraint,  
00693     StreamErrorRestrictedXml,       
00696     StreamErrorSeeOtherHost,        
00701     StreamErrorSystemShutdown,      
00703     StreamErrorUndefinedCondition,  
00706     StreamErrorUnsupportedEncoding, 
00709     StreamErrorUnsupportedStanzaType,
00711     StreamErrorUnsupportedVersion,  
00715     StreamErrorXmlNotWellFormed     
00717   };
00718 
00722   enum StanzaType
00723   {
00724     StanzaUndefined,                
00725     StanzaIq,                       
00726     StanzaMessage,                  
00727     StanzaS10n,                     
00728     StanzaPresence                  
00729   };
00730 
00734   enum StanzaSubType
00735   {
00736     StanzaSubUndefined        =  0, 
00737     StanzaIqGet               =  1, 
00738     StanzaIqSet               =  2, 
00742     StanzaIqResult            =  4, 
00743     StanzaIqError             =  8, 
00748     StanzaPresenceUnavailable = 16,      
00752     StanzaPresenceAvailable =   32, 
00756     StanzaPresenceProbe    =    64, 
00760     StanzaPresenceError    =   128, 
00764     StanzaS10nSubscribe    =   256, 
00768     StanzaS10nSubscribed   =   512, 
00772     StanzaS10nUnsubscribe  =  1024, 
00776     StanzaS10nUnsubscribed =  2048, 
00780     StanzaMessageChat      =  4096, 
00786     StanzaMessageError     =  8192, 
00792     StanzaMessageGroupchat = 16384, 
00799     StanzaMessageHeadline  = 32768, 
00808     StanzaMessageNormal    = 65536  
00815   };
00816 
00820   enum StanzaErrorType
00821   {
00822     StanzaErrorTypeUndefined,       
00823     StanzaErrorTypeCancel,          
00824     StanzaErrorTypeContinue,        
00825     StanzaErrorTypeModify,          
00826     StanzaErrorTypeAuth,            
00827     StanzaErrorTypeWait             
00828   };
00829 
00834   enum StanzaError
00835   {
00836     StanzaErrorUndefined = 0,       
00837     StanzaErrorBadRequest,          
00841     StanzaErrorConflict,            
00844     StanzaErrorFeatureNotImplemented,
00847     StanzaErrorForbidden,           
00849     StanzaErrorGone,                
00853     StanzaErrorInternalServerError, 
00856     StanzaErrorItemNotFound,        
00858     StanzaErrorJidMalformed,        
00863     StanzaErrorNotAcceptable,       
00867     StanzaErrorNotAllowed,          
00869     StanzaErrorNotAuthorized,       
00872     StanzaErrorPaymentRequired,     
00875     StanzaErrorRecipientUnavailable,
00880     StanzaErrorRedirect,            
00885     StanzaErrorRegistrationRequired,
00888     StanzaErrorRemoteServerNotFound,
00891     StanzaErrorRemoteServerTimeout, 
00895     StanzaErrorResourceConstraint,  
00897     StanzaErrorServiceUnavailable,  
00899     StanzaErrorSubscribtionRequired,
00902     StanzaErrorUndefinedCondition,  
00906     StanzaErrorUnexpectedRequest    
00909   };
00910 
00914   enum Presence
00915   {
00916     PresenceUnknown,                
00917     PresenceAvailable,              
00918     PresenceChat,                   
00919     PresenceAway,                   
00920     PresenceDnd,                    
00921     PresenceXa,                     
00923     PresenceUnavailable             
00924   };
00925 
00929   enum CertStatus
00930   {
00931     CertOk               =  0,      
00932     CertInvalid          =  1,      
00933     CertSignerUnknown    =  2,      
00934     CertRevoked          =  4,      
00935     CertExpired          =  8,      
00936     CertNotActive        = 16,      
00937     CertWrongPeer        = 32,      
00939     CertSignerNotCa      = 64       
00940   };
00941 
00945   struct CertInfo
00946   {
00947     int status;                     
00948     bool chain;                     
00949     std::string issuer;             
00950     std::string server;             
00951     int date_from;                  
00953     int date_to;                    
00955     std::string protocol;           
00956     std::string cipher;             
00957     std::string mac;                
00958     std::string compression;        
00959   };
00960 
00964   enum AuthenticationError
00965   {
00966     AuthErrorUndefined,             
00967     SaslAborted,                    
00970     SaslIncorrectEncoding,          
00975     SaslInvalidAuthzid,             
00980     SaslInvalidMechanism,           
00983     SaslMechanismTooWeak,           
00987     SaslNotAuthorized,              
00991     SaslTemporaryAuthFailure,       
00994     NonSaslConflict,                
00995     NonSaslNotAcceptable,           
00996     NonSaslNotAuthorized            
00997   };
00998 
01002   enum LogArea
01003   {
01004     LogAreaClassParser                = 0x00001, 
01005     LogAreaClassConnectionTCPBase     = 0x00002, 
01006     LogAreaClassClient                = 0x00004, 
01007     LogAreaClassClientbase            = 0x00008, 
01008     LogAreaClassComponent             = 0x00010, 
01009     LogAreaClassDns                   = 0x00020, 
01010     LogAreaClassConnectionHTTPProxy   = 0x00040, 
01011     LogAreaClassConnectionSOCKS5Proxy = 0x00080, 
01012     LogAreaClassConnectionTCPClient   = 0x00100, 
01013     LogAreaClassConnectionTCPServer   = 0x00200, 
01014     LogAreaClassS5BManager            = 0x00400, 
01015     LogAreaAllClasses                 = 0x01FFF, 
01016     LogAreaXmlIncoming                = 0x02000, 
01017     LogAreaXmlOutgoing                = 0x04000, 
01018     LogAreaUser                       = 0x80000, 
01019     LogAreaAll                        = 0xFFFFF  
01020   };
01021 
01025   enum LogLevel
01026   {
01027     LogLevelDebug,                  
01028     LogLevelWarning,                
01029     LogLevelError                   
01030   };
01031 
01035   enum MessageEventType
01036   {
01037     MessageEventCancel    = 0,      
01038     MessageEventOffline   = 1,      
01040     MessageEventDelivered = 2,      
01042     MessageEventDisplayed = 4,      
01043     MessageEventComposing = 8       
01044   };
01045 
01049   enum ChatStateType
01050   {
01051     ChatStateActive       =  1,     
01052     ChatStateComposing    =  2,     
01053     ChatStatePaused       =  4,     
01054     ChatStateInactive     =  8,     
01055     ChatStateGone         = 16      
01057   };
01058 
01062   enum ResourceBindError
01063   {
01064     RbErrorUnknownError,            
01065     RbErrorBadRequest,              
01066     RbErrorNotAllowed,              
01067     RbErrorConflict                 
01068   };
01069 
01073   enum SessionCreateError
01074   {
01075     ScErrorUnknownError,            
01076     ScErrorInternalServerError,     
01077     ScErrorForbidden,               
01078     ScErrorConflict                 
01080   };
01081 
01085   enum MessageSessionFilter
01086   {
01087     FilterMessageEvents    = 1,     
01088     FilterChatStates       = 2      
01089   };
01090 
01094   enum MUCRoomAffiliation
01095   {
01096     AffiliationNone,                
01097     AffiliationOutcast,             
01098     AffiliationMember,              
01099     AffiliationOwner,               
01100     AffiliationAdmin                
01101   };
01102 
01106   enum MUCRoomRole
01107   {
01108     RoleNone,                       
01109     RoleVisitor,                    
01110     RoleParticipant,                
01111     RoleModerator                   
01112   };
01113 
01117   enum MUCRoomFlag
01118   {
01119     FlagPasswordProtected  =    1,  
01120     FlagPublicLogging      =    2,  
01121     FlagHidden             =    4,  
01122     FlagMembersOnly        =    8,  
01123     FlagModerated          =   16,  
01124     FlagNonAnonymous       =   32,  
01125     FlagOpen               =   64,  
01126     FlagPersistent         =  128,  
01127     FlagPublic             =  256,  
01128     FlagSemiAnonymous      =  512,  
01129     FlagTemporary          = 1024,  
01130     FlagUnmoderated        = 2048,  
01131     FlagUnsecured          = 4096,  
01132     FlagFullyAnonymous     = 8192   
01133   };
01134 
01138   enum MUCUserFlag
01139   {
01140     UserSelf               =   1,   
01141     UserNickChanged        =   2,   
01142     UserKicked             =   4,   
01143     UserBanned             =   8,   
01144     UserAffiliationChanged =  16,   
01145     UserRoomDestroyed      =  32    
01146   };
01147 
01151   typedef std::list<std::string> StringList;
01152 
01156   typedef std::map<std::string, std::string> StringMap;
01157 
01158 }
01159 
01160 extern "C"
01161 {
01162   GLOOX_API const char* gloox_version();
01163 }
01164 
01165 #endif // GLOOX_H__

Generated on Sat Nov 10 08:50:27 2007 for gloox by  doxygen 1.5.3-20071008