Back to index

nordugrid-arc-nox  1.1.0~rc6
isis.h
Go to the documentation of this file.
00001 #ifndef __ARC_ISIS_H__
00002 #define __ARC_ISIS_H__
00003 
00004 #include <string>
00005 #include <fstream>
00006 
00007 #include <arc/Logger.h>
00008 #include <arc/XMLNode.h>
00009 #include <arc/infosys/RegisteredService.h>
00010 #include <arc/infosys/InformationInterface.h>
00011 #include <arc/dbxml/XmlDatabase.h>
00012 
00013 namespace ISIS {
00014     class Neighbor_Container {
00015         private:
00016             bool locked;
00017             std::vector<std::string> content;
00018         public:
00019             Neighbor_Container():locked(false) {}
00020             std::vector<std::string>::iterator find_element(const std::string);
00021             bool contains(const std::string);
00022             void push(const std::string);
00023             void remove(std::string);
00024             int count();
00025     };
00026 
00027     class ISIService: public Arc::RegisteredService {
00028         private:
00029             // Configuration parameters
00030             Arc::Logger logger_;
00031             std::string endpoint_;
00032             Arc::Period valid;
00033             Arc::Period remove;
00034             int retry;
00035             int sparsity;
00036             std::string my_key;
00037             std::string my_cert;
00038             std::string my_proxy;
00039             std::string my_cadir;
00040             std::string my_cafile;
00041 
00042             bool KillThread;
00043             int ThreadsCount;
00044             // Garbage collector for memory leak killing
00045             std::vector<Arc::XMLNode*> garbage_collector;
00046 
00047             Arc::XmlDatabase *db_;
00048             Arc::NS ns_;
00049             Arc::MCC_Status make_soap_fault(Arc::Message &outmsg, const std::string& reason = "");
00050             void make_soap_fault(Arc::XMLNode &response, const std::string& reason = "");
00051             // List of known InfoProviderISIS's endpoint URL, key, cert, proxy and cadir in string
00052             std::vector<Arc::ISIS_description> infoproviders_;
00053             std::string bootstrapISIS;
00054             std::string my_hash;
00055             std::multimap<std::string,Arc::ISIS_description> hash_table;
00056             void BootStrap(int retry_count);
00057             bool neighbors_update_needed;
00058             bool available_provider;
00059             bool connection_lock;    // It is need for the connection ignoring  to the InfoProvider because it is circular dependency.
00060 
00061             // List of known neighbor's endpoint URL, key, cert, proxy and cadir in string
00062             int neighbors_count;
00063             bool neighbors_lock;
00064             std::vector<Arc::ISIS_description> neighbors_;
00065             Neighbor_Container not_availables_neighbors_;
00066             void Neighbors_Calculate(std::multimap<std::string,Arc::ISIS_description>::const_iterator it, int count);
00067             void Neighbors_Update();
00068 
00069             // Informations from the RegEntry
00070             std::string PeerID(Arc::XMLNode& regentry);
00071             std::string Cert(Arc::XMLNode& regentry);
00072             std::string Key(Arc::XMLNode& regentry);
00073             std::string Proxy(Arc::XMLNode& regentry);
00074             std::string CaDir(Arc::XMLNode& regentry);
00075 
00076             bool CheckAuth(const std::string& action, Arc::Message &inmsg, Arc::XMLNode &response);
00077             bool CheckAuth(const std::string& action, Arc::Message &inmsg, Arc::Message &outmsg);
00078             // InformationContainer providing information via the LIDI interface
00079             Arc::InformationContainer infodoc_;
00080 
00081             // Functions for the service specific interface
00082             Arc::MCC_Status Query(Arc::XMLNode &request, Arc::XMLNode &response);
00083             Arc::MCC_Status Register(Arc::XMLNode &request, Arc::XMLNode &response);
00084             Arc::MCC_Status RemoveRegistrations(Arc::XMLNode &request, Arc::XMLNode &response);
00085             Arc::MCC_Status GetISISList(Arc::XMLNode &request, Arc::XMLNode &response);
00086 
00087             Arc::MCC_Status Connect(Arc::XMLNode &request, Arc::XMLNode &response);
00088 
00089         public:
00090             ISIService(Arc::Config *cfg);
00091             virtual ~ISIService(void);
00092             virtual Arc::MCC_Status process(Arc::Message &in, Arc::Message &out);
00093             virtual bool RegistrationCollector(Arc::XMLNode &doc);
00094     };
00095 } // namespace
00096 #endif
00097