/home/tetron/hack/vos/libs/vos/vos/sitepeering.hh
Go to the documentation of this file.00001 #ifndef _SITEPEERING_HH_
00002 #define _SITEPEERING_HH_
00003
00004 #include <stdexcept>
00005 #include <set>
00006
00007 #include <vos/vos/siteextension.hh>
00008 #include <vos/vos/remotesocketsite.hh>
00009 #include <vos/vos/localsite.hh>
00010 #include <vos/vos/iterator.hh>
00011
00012 namespace VOS {
00013
00014
00015
00016
00017 class VOS_API PortBindingError : public std::runtime_error
00018 {
00019 public:
00020 PortBindingError(const std::string& s) : std::runtime_error(s) { };
00021 };
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 class VOS_API SitePeeringThread
00033 {
00034 private:
00035 void sendHello(const std::string& gotAntiSpoof = "");
00036 bool verifyAlias(VUtil::URL& url, std::string& checkid);
00037 void handleHello(Message* hello);
00038
00039 protected:
00040 RemoteSiteExtension* rsse;
00041 LocalSiteExtension* lsse;
00042 bool isClient;
00043
00044 public:
00045 SitePeeringThread(LocalSiteExtension* l, bool isCl);
00046
00047
00048
00049
00050 SitePeeringThread(const SitePeeringThread& spt);
00051
00052 virtual ~SitePeeringThread() { };
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 void operator()();
00069
00070
00071 VUtil::vRef<Site> remotesite;
00072
00073 static std::string getProtoVersion();
00074 static bool checkProtoVersion(const std::string& s);
00075 static bool checkProtoVersion(Message* m);
00076
00077 virtual void init() = 0;
00078 virtual void done() = 0;
00079 };
00080 }
00081
00082 #endif