interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

/home/tetron/hack/vos/libs/vos/vos/remotesite.hh

Go to the documentation of this file.
00001 // XXX needs LGPL
00002 
00003 #ifndef _REMOTESITE_HH_
00004 #define _REMOTESITE_HH_
00005 
00006 #include <vos/vos/siteextension.hh>
00007 #include <vos/vos/remotevobject.hh>
00008 
00009 namespace VOS {
00010 
00011 /** @class RemoteSiteExtension remotesite.hh vos/vos/remotesite.hh
00012     @ingroup libvos
00013 
00014     Used to extend a remote site so that createVobject(),
00015     setPeerIdentity() and renameVobject() send network requests to the
00016     actual site.
00017  */
00018 class VOS_API RemoteSiteExtension : public SiteExtension
00019 {
00020 private:
00021     VobjectBase* base;
00022     std::string antispoofid;
00023 
00024 protected:
00025     bool clientMode;
00026     std::string localURL;
00027     std::string clientModeHP;
00028 
00029 public:
00030     RemoteSiteExtension();
00031 
00032     virtual void siteExtensionAttachedTo(Site* st);
00033 
00034     virtual VUtil::vRef<VobjectBase> pre_createVobject(VobjectState& state, Vobject* requester,
00035                                                 const char* name,
00036                                                 const std::deque<std::string>& typelist);
00037     virtual void post_setPeerIdentity(VUtil::vRef<Identity> peerIdentity);
00038 
00039     virtual bool pre_renameVobject(VobjectState& state, Vobject* requester,
00040                                    const std::string& oldname,
00041                                    const std::string& newname);
00042 
00043     void currentIdentityUpdateHandler(Message* m);
00044     void renameObjectUpdateHandler(Message* m);
00045 
00046     virtual VUtil::vRef<VobjectBase> getBase() { return VUtil::vRef<VobjectBase>(base, true); }
00047 
00048 
00049     /** @param s the anti-spoof ID that was received from this
00050         remote site during handshaking
00051     */
00052     void setAntiSpoofID(const std::string& s) { antispoofid = s; }
00053 
00054     /** @return the anti-spoof ID was received from this remote site. */
00055     const std::string& getAntiSpoofID() { return antispoofid; }
00056 
00057     void setClientOnlyMode(const std::string& localURL,
00058                            const std::string& clientModeHP);
00059 
00060     /** Reads and parses any messages pending on the socket.
00061         @return a list of messages/message blocks
00062     */
00063     virtual std::list< VUtil::vRef<MessageBlock> > readQueuedMessages(bool block) = 0;
00064 
00065     virtual bool isConnected() = 0;
00066 };
00067 
00068 }
00069 
00070 #endif