Back to index

nordugrid-arc-nox  1.1.0~rc6
SecAttr.h
Go to the documentation of this file.
00001 #ifndef __ARC_SECATTR__
00002 #define __ARC_SECATTR__
00003 
00004 #include <string>
00005 #include <list>
00006 #include <cstring>
00007 
00008 #include <arc/XMLNode.h>
00009 
00010 namespace Arc {
00012 
00014   class SecAttrFormat {
00015    private:
00016     const char* format_;
00017    public:
00018     inline SecAttrFormat(const SecAttrFormat& format):format_(format.format_) {};
00019     inline SecAttrFormat(const char* format = ""):format_(format) {};
00020     inline SecAttrFormat operator=(SecAttrFormat format) { format_=format.format_; return *this; };
00021     inline SecAttrFormat operator=(const char* format) { format_=format; return *this; };
00022     inline bool operator==(SecAttrFormat format) { return (strcmp(format_,format.format_) == 0); };
00023     inline bool operator==(const char* format) { return (strcmp(format_,format) == 0); };
00024     inline bool operator!=(SecAttrFormat format) { return (strcmp(format_,format.format_) != 0); };
00025     inline bool operator!=(const char* format) { return (strcmp(format_,format) != 0); };
00026   };
00028 
00037   class SecAttr {
00038    public:
00039     static SecAttrFormat UNDEFINED; 
00040     static SecAttrFormat ARCAuth;   
00041     static SecAttrFormat XACML;     
00042     static SecAttrFormat SAML;      
00043     static SecAttrFormat GACL;      
00044     SecAttr() {};
00045     virtual ~SecAttr() {};
00051     bool operator==(const SecAttr &b) const { return equal(b); };
00054     bool operator!=(const SecAttr &b) const { return !equal(b); };
00055 
00059     virtual operator bool() const;
00060 
00064     virtual bool Export(SecAttrFormat format,std::string &val) const;
00069     virtual bool Export(SecAttrFormat format,XMLNode &val) const;
00070 
00076     virtual bool Import(SecAttrFormat format,const std::string &val);
00077     virtual bool Import(SecAttrFormat format,XMLNode val);
00078 
00079    protected:
00080     virtual bool equal(const SecAttr &b) const;
00081   };
00082 
00084 
00090   class MultiSecAttr: public SecAttr {
00091    public:
00092     MultiSecAttr() {};
00093     virtual ~MultiSecAttr() {};
00094     virtual operator bool() const;
00095     virtual bool Export(SecAttrFormat format,XMLNode &val) const;
00096     virtual bool Import(SecAttrFormat format,XMLNode val);
00097    protected:
00098     std::list<SecAttr*> attrs_;
00099     virtual bool equal(const SecAttr &b) const;
00100     virtual bool Add(SecAttrFormat format,XMLNode &val);
00101   };
00102 
00103   
00104 
00105 }
00106 
00107 #endif
00108