• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

AbiCollab_Packet.h

Go to the documentation of this file.
00001 /*
00002  * AbiCollab - Code to enable the modification of remote documents.
00003  * Copyright (C) 2006 by Marc Maurer <uwog@uwog.net>
00004  * Copyright (C) 2007 One Laptop Per Child
00005  * Copyright (C) 2008 AbiSource Corporation B.V.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020  * 02110-1301 USA.
00021  */
00022 
00023 #ifndef ABICOLLAB_PACKET_H
00024 #define ABICOLLAB_PACKET_H
00025 
00026 #include <boost/format.hpp>
00027 
00028 #include "ut_types.h"
00029 #include "ut_string_class.h"
00030 #include "px_ChangeRecord.h"
00031 #include "ut_stack.h"
00032 #include "Serialization.h"
00033 
00034 #include <string>
00035 #include <vector>
00036 
00037 class Buddy;
00038 
00039 enum PacketType
00040 {
00041     PT_Session = 0,
00042     PT_Event,
00043     PT_Handler
00044 };
00045 
00046 enum PacketEventType
00047 {
00048     PTE_AccountAddBuddyRequest,
00049     PTE_StartSession,
00050     PTE_JoinSession,
00051     PTE_DisjoinSession,
00052     PTE_CloseSession
00053 };
00054 
00055 enum PClassType // send over the net to identify classes
00056 {
00057     // NOTE: do not reshuffle these values: it will make the protocol incompatible with previous versions
00058 
00059     //
00060     // base
00061     //
00062     PCT_Packet = 0,
00063     PCT_EventPacket,
00064     PCT_Event,
00065     PCT_ProtocolErrorPacket,
00066 
00067     //
00068     // session packets
00069     //
00070     /* misc. session packets */
00071     PCT_SignalSessionPacket = 0x10,             // update _PCT_FirstSessionPacket if you move this
00072     PCT_RevertSessionPacket,
00073     PCT_RevertAckSessionPacket,
00074     PCT_GlobSessionPacket,
00075     /* changerecord session packets */
00076     PCT_ChangeRecordSessionPacket,              // update _PCT_FirstChangeRecord if you move this
00077     PCT_Props_ChangeRecordSessionPacket,
00078     PCT_InsertSpan_ChangeRecordSessionPacket,
00079     PCT_ChangeStrux_ChangeRecordSessionPacket,
00080     PCT_DeleteStrux_ChangeRecordSessionPacket,
00081     PCT_Object_ChangeRecordSessionPacket,
00082     PCT_Data_ChangeRecordSessionPacket,
00083     PCT_Glob_ChangeRecordSessionPacket,
00084     PCT_RDF_ChangeRecordSessionPacket,          // update _PCT_LastChangeRecord if you move this
00085     /* session takeover packets */
00086     PCT_SessionTakeoverRequestPacket = 0x40,    // update _PCT_FirstSessionTakeoverPacket if you move this
00087     PCT_SessionTakeoverAckPacket,
00088     PCT_SessionFlushedPacket,
00089     PCT_SessionReconnectRequestPacket,
00090     PCT_SessionReconnectAckPacket,              // update _PCT_LastSessionTakeoverPacket and _PCT_LastSessionPacket if you move this
00091 
00092     //
00093     // events
00094     //
00095     PCT_AccountNewEvent = 0x80,
00096     PCT_AccountOnlineEvent,
00097     PCT_AccountOfflineEvent,
00098     PCT_AccountAddBuddyEvent,
00099     PCT_AccountDeleteBuddyEvent,
00100     PCT_AccountBuddyOnlineEvent,
00101     PCT_AccountBuddyOfflineEvent,
00102     PCT_AccountAddBuddyRequestEvent,
00103     PCT_AccountBuddyAddDocumentEvent,
00104     PCT_StartSessionEvent,
00105     PCT_JoinSessionEvent,
00106     PCT_JoinSessionRequestEvent,
00107     PCT_JoinSessionRequestResponseEvent,
00108     PCT_DisjoinSessionEvent,
00109     PCT_CloseSessionEvent,
00110     PCT_GetSessionsEvent,
00111     PCT_GetSessionsResponseEvent,
00112 
00113     //
00114     // meta values (KEEP THESE UPDATED WHEN ADDING NEW PACKET TYPES!!)
00115     //
00116     _PCT_FirstSessionPacket = PCT_SignalSessionPacket,
00117     _PCT_LastSessionPacket = PCT_SessionReconnectAckPacket,
00118 
00119     _PCT_FirstChangeRecord = PCT_ChangeRecordSessionPacket,
00120     _PCT_LastChangeRecord = PCT_RDF_ChangeRecordSessionPacket,
00121 
00122     _PCT_FirstSessionTakeoverPacket = PCT_SessionTakeoverRequestPacket,
00123     _PCT_LastSessionTakeoverPacket = PCT_SessionReconnectAckPacket,
00124 
00125     _PCT_FirstEvent = PCT_AccountNewEvent,
00126     _PCT_LastEvent = PCT_GetSessionsResponseEvent
00127 };
00128 
00129 class PX_ChangeRecord;
00130 class SessionPacket;
00131 class AbiCollab;
00132 class AccountHandler;
00133 
00134 /*************************************************************
00135  * Packets                                                   *
00136  *************************************************************/
00137 
00138 #define DECLARE_ABSTRACT_PACKET(Class)                                  \
00139     virtual PClassType getClassType() const { return PCT_##Class; }
00140 
00141 #define DECLARE_SERIALIZABLE_PACKET                                     \
00142     virtual void serialize(Archive & ar);
00143 
00144 #define DECLARE_PACKET(Class)                                           \
00145     DECLARE_ABSTRACT_PACKET(Class)                                      \
00146     DECLARE_SERIALIZABLE_PACKET                                         \
00147     virtual Packet* clone() const { return new Class( *this ); }        \
00148     static Packet* create() { return new Class(); }
00149 
00150 #define REGISTER_PACKET(Class)                                          \
00151     struct PacketRegister##Class {                                      \
00152         PacketRegister##Class() {                                       \
00153             Packet::registerPacketClass( PCT_##Class, Class::create,    \
00154                 #Class );                                               \
00155         }                                                               \
00156     };                                                                  \
00157     static PacketRegister##Class _PacketRegister##Class;
00158 
00159 class Packet
00160 {
00161 public:
00162     DECLARE_ABSTRACT_PACKET(Packet);
00163 
00164     Packet();
00165     Packet( AbiCollab* session );
00166     virtual ~Packet() {}
00167     virtual Packet* clone() const = 0;
00168 
00169     const AbiCollab* getSession() const             { return m_pSession; }
00170     AbiCollab* getSession()                         { return m_pSession; }
00171     virtual UT_sint32 getProtocolVersion() const;
00172 
00173     virtual void serialize(Archive & ar);                                       // overridden automatically throught DECLARE_PACKET
00174     void setParent( Packet* pParent )       { m_pParent = pParent; }
00175     Packet* getParent()                     { return m_pParent; }
00176 
00177     virtual std::string toStr() const;
00178 
00179 protected:
00180     AbiCollab*          m_pSession;
00181     Packet*             m_pParent;
00182 
00184 public:
00185     typedef Packet*(*PacketCreateFuncType)();
00186     static Packet* createPacket( PClassType eType );
00187     static const char* getPacketClassname( PClassType eType );
00188     static void registerPacketClass( PClassType eType, PacketCreateFuncType createFunc, const char* szClassName );
00189 private:
00190     struct ClassData {
00191         PacketCreateFuncType    StaticConstructor;
00192         const char*             ClassName;
00193         ClassData() : StaticConstructor( NULL ), ClassName( NULL ) {}
00194     };
00195     typedef std::map<PClassType,ClassData> ClassMap;
00196     static ClassMap& GetClassMap();
00197 };
00198 
00199 /*************************************************************
00200  * SessionPackets                                            *
00201  *************************************************************/
00202 
00203 class SessionPacket : public Packet
00204 {
00205 public:
00206     DECLARE_SERIALIZABLE_PACKET
00207 
00208     static bool isInstanceOf(const Packet& packet);
00209 
00210 protected:
00211     SessionPacket() : m_sSessionId(""), m_sDocUUID("")  {}
00212     SessionPacket(const std::string& sSessionId, const std::string& sDocUUID);
00213 
00214 public:
00215     virtual const std::string& getSessionId() const
00216         { return m_sSessionId; }
00217 
00218     void setSessionId(const std::string& sSessionId)
00219         { m_sSessionId = sSessionId; }
00220 
00221     virtual const std::string & getDocUUID() const
00222         { return m_sDocUUID; }
00223 
00224     void setDocUUID(const std::string& sDocUUID)
00225         { m_sDocUUID = sDocUUID; }
00226 
00227     virtual std::string toStr() const;
00228 
00229 private:
00230     std::string         m_sSessionId;
00231     std::string         m_sDocUUID;
00232 };
00233 
00234 class AbstractChangeRecordSessionPacket : public SessionPacket
00235 {
00236 public:
00237     AbstractChangeRecordSessionPacket()
00238         : SessionPacket("", "")
00239         {}
00240 
00241     AbstractChangeRecordSessionPacket(const std::string& sSessionId, const std::string& sDocUUID)
00242         : SessionPacket(sSessionId, sDocUUID)
00243         {}
00244 
00245     static bool isInstanceOf(const SessionPacket& packet);
00246 
00247     virtual PT_DocPosition getPos() const = 0;
00248     virtual UT_sint32 getLength() const = 0;
00249     virtual UT_sint32 getAdjust() const = 0;
00250     virtual UT_sint32 getRev() const = 0;
00251     virtual UT_sint32 getRemoteRev(void) const = 0;
00252 };
00253 
00254 class ChangeRecordSessionPacket : public AbstractChangeRecordSessionPacket
00255 {
00256 public:
00257     DECLARE_PACKET(ChangeRecordSessionPacket);
00258     ChangeRecordSessionPacket()
00259             : m_cType(PX_ChangeRecord::PXType(0)),
00260             m_iLength(0),
00261             m_iAdjust(0),
00262             m_iPos(0),
00263             m_iRev(0),
00264             m_iRemoteRev(0) {}
00265     ChangeRecordSessionPacket(
00266             const std::string& sSessionId,
00267             PX_ChangeRecord::PXType cType,
00268             const std::string& sDocUUID,
00269             PT_DocPosition iPos,
00270             int iRev,
00271             int iRemoteRev);
00272 
00273     PX_ChangeRecord::PXType getPXType() const           { return m_cType; }
00274 
00275     virtual PT_DocPosition getPos() const               { return m_iPos; }
00276     virtual UT_sint32 getLength() const                 { return m_iLength; }
00277     virtual UT_sint32 getAdjust() const                 { return m_iAdjust; }
00278     virtual UT_sint32 getRev() const                    { return m_iRev; }
00279     virtual UT_sint32 getRemoteRev(void) const          { return m_iRemoteRev; }
00280 
00281     void setPos( UT_sint32 iPos )                       { m_iPos = iPos; }
00282     void setLength( UT_sint32 iLength )                 { m_iLength = iLength; }
00283     void setAdjust(UT_sint32 iAdjust)                   { m_iAdjust = iAdjust; }
00284     void setRev( UT_sint32 iRev )                       { m_iRev = iRev; }
00285     void setRemoteRev( UT_sint32 iRemoteRev )           { m_iRemoteRev = iRemoteRev; }
00286 
00287     virtual std::string toStr() const;
00288 
00289 private:
00290     PX_ChangeRecord::PXType     m_cType;
00291 
00292     UT_sint32                   m_iLength;
00293     UT_sint32                   m_iAdjust;
00294 
00295     PT_DocPosition              m_iPos;
00296     UT_sint32                   m_iRev;
00297     UT_sint32                   m_iRemoteRev;
00298 };
00299 
00300 class Props_ChangeRecordSessionPacket : public ChangeRecordSessionPacket {
00301 public:
00302     DECLARE_PACKET(Props_ChangeRecordSessionPacket);
00303     Props_ChangeRecordSessionPacket() : m_szAtts(NULL), m_szProps(NULL) {}
00304     Props_ChangeRecordSessionPacket( const Props_ChangeRecordSessionPacket& );
00305     Props_ChangeRecordSessionPacket(
00306             const std::string& sSessionId,
00307             PX_ChangeRecord::PXType cType,
00308             const std::string& sDocUUID,
00309             PT_DocPosition iPos,
00310             int iRev,
00311             int iRemoteRev)
00312     : ChangeRecordSessionPacket( sSessionId, cType, sDocUUID, iPos, iRev, iRemoteRev )
00313     , m_szAtts( NULL )
00314     , m_szProps( NULL )
00315     {}
00316     ~Props_ChangeRecordSessionPacket()
00317     {
00318         _freeProps();
00319         _freeAtts();
00320     }
00321 
00322     gchar** getProps() const                                        { return m_szProps; }
00323     const std::map<UT_UTF8String,UT_UTF8String>& getPropMap() const { return m_sProps; }
00324     std::map<UT_UTF8String,UT_UTF8String>& getPropMap()             { return m_sProps; }
00325 
00326     gchar** getAtts() const                                         { return m_szAtts; }
00327     const std::map<UT_UTF8String,UT_UTF8String>& getAttMap() const  { return m_sAtts; }
00328     std::map<UT_UTF8String,UT_UTF8String>& getAttMap()              { return m_sAtts; }
00329     gchar* getAttribute( const gchar* attr ) const;
00330 
00331     virtual std::string toStr() const;
00332 
00333 protected:
00334     gchar**                                 m_szAtts;
00335     gchar**                                 m_szProps;
00336     std::map<UT_UTF8String,UT_UTF8String>   m_sAtts;
00337     std::map<UT_UTF8String,UT_UTF8String>   m_sProps;
00338 
00339     void _freeProps();
00340     void _freeAtts();
00341     void _fillProps();      // uses m_sProps to make m_szProps
00342     void _fillAtts();       // uses m_sAtts to make m_szAtts
00343 };
00344 
00345 class InsertSpan_ChangeRecordSessionPacket : public Props_ChangeRecordSessionPacket {
00346 public:
00347     DECLARE_PACKET(InsertSpan_ChangeRecordSessionPacket);
00348     InsertSpan_ChangeRecordSessionPacket() : m_sText("") {}
00349     InsertSpan_ChangeRecordSessionPacket(
00350             const std::string& sSessionId,
00351             PX_ChangeRecord::PXType cType,
00352             const std::string& sDocUUID,
00353             PT_DocPosition iPos,
00354             int iRev,
00355             int iRemoteRev)
00356     : Props_ChangeRecordSessionPacket( sSessionId, cType, sDocUUID, iPos, iRev, iRemoteRev )
00357     , m_sText("")
00358     {}
00359 
00360     virtual std::string toStr() const;
00361 
00362     // XXX: make proper setters/getters when done!
00363     UT_UTF8String               m_sText;
00364 };
00365 
00366 class ChangeStrux_ChangeRecordSessionPacket : public Props_ChangeRecordSessionPacket {
00367 public:
00368     DECLARE_PACKET(ChangeStrux_ChangeRecordSessionPacket);
00369     ChangeStrux_ChangeRecordSessionPacket() : m_eStruxType(PTStruxType(0)) {} // FIXME: 0 is not a good initializer
00370     ChangeStrux_ChangeRecordSessionPacket(
00371             const std::string& sSessionId,
00372             PX_ChangeRecord::PXType cType,
00373             const std::string& sDocUUID,
00374             PT_DocPosition iPos,
00375             int iRev,
00376             int iRemoteRev)
00377     : Props_ChangeRecordSessionPacket( sSessionId, cType, sDocUUID, iPos, iRev, iRemoteRev )
00378     , m_eStruxType(PTStruxType(0)) // FIXME: 0 is not a good initializer
00379     {}
00380 
00381     virtual std::string toStr() const;
00382 
00383     // XXX: make proper setters/getters when done!
00384     PTStruxType                 m_eStruxType;
00385 };
00386 
00387 class DeleteStrux_ChangeRecordSessionPacket : public ChangeRecordSessionPacket {
00388 public:
00389     DECLARE_PACKET(DeleteStrux_ChangeRecordSessionPacket);
00390     DeleteStrux_ChangeRecordSessionPacket(): m_eStruxType(PTStruxType(0)) // FIXME: 0 is not a good initializer
00391     {}
00392     DeleteStrux_ChangeRecordSessionPacket(
00393             const std::string& sSessionId,
00394             PX_ChangeRecord::PXType cType,
00395             const std::string& sDocUUID,
00396             PT_DocPosition iPos,
00397             int iRev,
00398             int iRemoteRev)
00399     : ChangeRecordSessionPacket( sSessionId, cType, sDocUUID, iPos, iRev, iRemoteRev )
00400     , m_eStruxType(PTStruxType(0)) // FIXME: 0 is not a good initializer
00401     {}
00402 
00403     virtual std::string toStr() const;
00404 
00405     // XXX: make proper setters/getters when done!
00406     PTStruxType                 m_eStruxType;
00407 };
00408 
00409 class Object_ChangeRecordSessionPacket : public Props_ChangeRecordSessionPacket {
00410 public:
00411     DECLARE_PACKET(Object_ChangeRecordSessionPacket);
00412     Object_ChangeRecordSessionPacket() : m_eObjectType(PTObjectType(0)) {} // FIXME: 0 is not a good initializer
00413     Object_ChangeRecordSessionPacket(
00414             const std::string& sSessionId,
00415             PX_ChangeRecord::PXType cType,
00416             const std::string& sDocUUID,
00417             PT_DocPosition iPos,
00418             int iRev,
00419             int iRemoteRev)
00420     : Props_ChangeRecordSessionPacket( sSessionId, cType, sDocUUID, iPos, iRev, iRemoteRev )
00421     , m_eObjectType(PTObjectType(0)) // FIXME: 0 is not a good initializer
00422     {}
00423 
00424     virtual std::string toStr() const;
00425 
00426     PTObjectType getObjectType() const
00427     { return m_eObjectType; }
00428 
00429     void setObjectType(PTObjectType eObjectType)
00430     { m_eObjectType = eObjectType; }
00431 
00432 private:
00433     PTObjectType                m_eObjectType;
00434 };
00435 
00436 class RDF_ChangeRecordSessionPacket : public Props_ChangeRecordSessionPacket {
00437 public:
00438     DECLARE_PACKET(RDF_ChangeRecordSessionPacket);
00439     RDF_ChangeRecordSessionPacket() {} // FIXME: 0 is not a good initializer
00440     RDF_ChangeRecordSessionPacket(
00441             const std::string& sSessionId,
00442             PX_ChangeRecord::PXType cType,
00443             const std::string& sDocUUID,
00444             PT_DocPosition iPos,
00445             int iRev,
00446             int iRemoteRev)
00447     : Props_ChangeRecordSessionPacket( sSessionId, cType, sDocUUID, iPos, iRev, iRemoteRev )
00448     {}
00449 
00450     virtual std::string toStr() const;
00451 
00452 private:
00453 };
00454 
00455 class Data_ChangeRecordSessionPacket : public Props_ChangeRecordSessionPacket {
00456 public:
00457     DECLARE_PACKET(Data_ChangeRecordSessionPacket);
00458     Data_ChangeRecordSessionPacket() : m_bTokenSet(false) {}
00459     Data_ChangeRecordSessionPacket(
00460             const std::string& sSessionId,
00461             PX_ChangeRecord::PXType cType,
00462             const std::string& sDocUUID,
00463             PT_DocPosition iPos,
00464             int iRev,
00465             int iRemoteRev)
00466     : Props_ChangeRecordSessionPacket( sSessionId, cType, sDocUUID, iPos, iRev, iRemoteRev )
00467     , m_bTokenSet(false)
00468     {}
00469 
00470     virtual std::string toStr() const;
00471 
00472     // XXX: make proper setters/getters when done!
00473     std::vector<char>           m_vecData;
00474     bool                        m_bTokenSet;
00475     std::string                 m_sToken;
00476 };
00477 
00478 class Glob_ChangeRecordSessionPacket : public ChangeRecordSessionPacket
00479 {
00480 public:
00481     DECLARE_PACKET(Glob_ChangeRecordSessionPacket);
00482     Glob_ChangeRecordSessionPacket() {}
00483     Glob_ChangeRecordSessionPacket(
00484             const std::string& sSessionId,
00485             PX_ChangeRecord::PXType cType,
00486             const std::string& sDocUUID,
00487             PT_DocPosition iPos,
00488             int iRev,
00489             int iRemoteRev)
00490     : ChangeRecordSessionPacket( sSessionId, cType, sDocUUID, iPos, iRev, iRemoteRev )
00491     {}
00492 
00493     virtual std::string toStr() const;
00494 
00495     // XXX: make proper setters/getters when done!
00496     UT_Byte                         m_iGLOBType;
00497 };
00498 
00499 class GlobSessionPacket : public AbstractChangeRecordSessionPacket
00500 {
00501 public:
00502     DECLARE_PACKET(GlobSessionPacket);
00503     GlobSessionPacket() {}
00504     GlobSessionPacket( const GlobSessionPacket& Other );
00505     GlobSessionPacket( const std::string& sSessionId, const std::string& sDocUUID )
00506         : AbstractChangeRecordSessionPacket(sSessionId, sDocUUID)
00507         {}
00508     ~GlobSessionPacket();
00509 
00510     const std::vector<SessionPacket*>& getPackets() const   { return m_pPackets; }
00511 
00512     void addPacket(SessionPacket* pPacket);
00513 
00514     virtual PT_DocPosition getPos() const;
00515     virtual UT_sint32 getLength() const;
00516     virtual UT_sint32 getAdjust() const;
00517     virtual UT_sint32 getRev() const;
00518     virtual UT_sint32 getRemoteRev(void) const;
00519 
00520     virtual std::string toStr() const;
00521 
00522 private:
00523     std::vector<SessionPacket*>     m_pPackets;
00524 };
00525 
00526 class SignalSessionPacket : public SessionPacket
00527 {
00528 public:
00529     DECLARE_PACKET(SignalSessionPacket);
00530     SignalSessionPacket() {}
00531     SignalSessionPacket(const std::string& sSessionId, const std::string& sDocUUID, UT_uint32 iSignal);
00532 
00533     UT_uint32 getSignalType() const
00534         { return m_iSignal; }
00535 
00536     virtual std::string toStr() const;
00537 
00538 private:
00539     UT_uint32   m_iSignal;
00540 };
00541 
00542 class RevertSessionPacket : public SessionPacket
00543 {
00544 public:
00545     DECLARE_PACKET(RevertSessionPacket);
00546     RevertSessionPacket() {}
00547     RevertSessionPacket(const std::string& sSessionId, const std::string& sDocUUID, UT_sint32 iRev);
00548 
00549     UT_sint32           getRev() const
00550         { return m_iRev; }
00551 
00552     virtual std::string toStr() const;
00553 
00554 private:
00555     UT_sint32           m_iRev;
00556 };
00557 
00558 class RevertAckSessionPacket : public SessionPacket
00559 {
00560 public:
00561     DECLARE_PACKET(RevertAckSessionPacket);
00562     RevertAckSessionPacket() {}
00563     RevertAckSessionPacket(const std::string& sSessionId, const std::string& sDocUUID, UT_sint32 iRev);
00564 
00565     UT_sint32           getRev() const
00566         { return m_iRev; }
00567 
00568     virtual std::string toStr() const;
00569 
00570 private:
00571     UT_sint32           m_iRev;
00572 };
00573 
00574 
00575 /*************************************************************
00576  * Session Takeover Packets                                  *
00577  *************************************************************/
00578 
00579 class AbstractSessionTakeoverPacket : public SessionPacket
00580 {
00581 public:
00582     AbstractSessionTakeoverPacket() {}
00583 
00584     AbstractSessionTakeoverPacket(const std::string& sSessionId, const std::string& sDocUUID)
00585         : SessionPacket(sSessionId, sDocUUID)
00586         {}
00587 
00588     static bool isInstanceOf(const SessionPacket& packet);
00589 };
00590 
00591 class SessionTakeoverRequestPacket : public AbstractSessionTakeoverPacket
00592 {
00593 public:
00594     DECLARE_PACKET(SessionTakeoverRequestPacket);
00595     SessionTakeoverRequestPacket() {}
00596     SessionTakeoverRequestPacket(
00597         const std::string& sSessionId, const std::string& sDocUUID,
00598         bool bPromote, const std::vector<std::string>& vBuddyIdentifiers
00599     );
00600 
00601     bool promote() const
00602         { return m_bPromote; }
00603 
00604     const std::vector<std::string>& getBuddyIdentifiers() const
00605         { return m_vBuddyIdentifiers; }
00606 
00607     virtual std::string toStr() const;
00608 
00609 private:
00610     bool                        m_bPromote;
00611     std::vector<std::string>    m_vBuddyIdentifiers;
00612 };
00613 
00614 class SessionTakeoverAckPacket : public AbstractSessionTakeoverPacket
00615 {
00616 public:
00617     DECLARE_PACKET(SessionTakeoverAckPacket);
00618     SessionTakeoverAckPacket() {}
00619     SessionTakeoverAckPacket(const std::string& sSessionId, const std::string& sDocUUID)
00620         : AbstractSessionTakeoverPacket(sSessionId, sDocUUID) { }
00621 
00622     virtual std::string toStr() const;
00623 };
00624 
00625 class SessionFlushedPacket : public AbstractSessionTakeoverPacket
00626 {
00627 public:
00628     DECLARE_PACKET(SessionFlushedPacket);
00629     SessionFlushedPacket() {}
00630     SessionFlushedPacket(const std::string& sSessionId, const std::string& sDocUUID)
00631         : AbstractSessionTakeoverPacket(sSessionId, sDocUUID) { }
00632 
00633     virtual std::string toStr() const;
00634 };
00635 
00636 class SessionReconnectRequestPacket : public AbstractSessionTakeoverPacket
00637 {
00638 public:
00639     DECLARE_PACKET(SessionReconnectRequestPacket);
00640     SessionReconnectRequestPacket() {}
00641     SessionReconnectRequestPacket(const std::string& sSessionId, const std::string& sDocUUID)
00642         : AbstractSessionTakeoverPacket(sSessionId, sDocUUID) { }
00643 
00644     virtual std::string toStr() const;
00645 };
00646 
00647 class SessionReconnectAckPacket : public AbstractSessionTakeoverPacket
00648 {
00649 public:
00650     DECLARE_PACKET(SessionReconnectAckPacket);
00651     SessionReconnectAckPacket() {}
00652     SessionReconnectAckPacket(const std::string& sSessionId, const std::string& sDocUUID,
00653         UT_sint32 iRev);
00654 
00655     UT_sint32                   getRev() const
00656         { return m_iRev; }
00657 
00658     virtual std::string toStr() const;
00659 
00660 private:
00661     UT_sint32                   m_iRev;
00662 };
00663 
00664 #endif /* ABICOLLAB_PACKET_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1