Clean up the namespace.
[fides] / lib / fides.h
index fb54b12..4ca088f 100644 (file)
 #include "privatekey.h"
 #include "utility.h"
 
-namespace fides {
-       class fides {
+namespace Fides {
+       class exception: public std::runtime_error {
+               public:
+               exception(const std::string reason): runtime_error(reason) {}
+       };
+
+       class Manager {
                std::string homedir;
                std::string certdir;
                std::string obsoletedir;
@@ -38,26 +43,17 @@ namespace fides {
                bool firstrun;
                struct timeval latest;
 
-               public:
-               // Utility functions
-
-               class exception: public std::runtime_error {
-                       public:
-                       exception(const std::string reason): runtime_error(reason) {}
-               };
-               // Fides class itself
-
                private:
-               privatekey mykey;
-               std::map<std::string, publickey *> keys;
-               std::map<std::string, certificate *> certs;
+               PrivateKey mykey;
+               std::map<std::string, PublicKey *> keys;
+               std::map<std::string, Certificate *> certs;
 
-               void merge(certificate *cert);
-               void merge(publickey *key);
+               void merge(Certificate *cert);
+               void merge(PublicKey *key);
 
                public:
-               fides(const std::string &homedir = "");
-               ~fides();
+               Manager(const std::string &homedir = "");
+               ~Manager();
 
                bool is_firstrun() const;
                bool fsck() const;
@@ -65,37 +61,37 @@ namespace fides {
 
                void sign(const std::string &statement);
 
-               void allow(const std::string &statement, const publickey *key = 0);
-               void dontcare(const std::string &statement, const publickey *key = 0);
-               void deny(const std::string &statement, const publickey *key = 0);
-               bool is_allowed(const std::string &statement, const publickey *key = 0) const;
-               bool is_denied(const std::string &statement, const publickey *key = 0) const;
+               void allow(const std::string &statement, const PublicKey *key = 0);
+               void dontcare(const std::string &statement, const PublicKey *key = 0);
+               void deny(const std::string &statement, const PublicKey *key = 0);
+               bool is_allowed(const std::string &statement, const PublicKey *key = 0) const;
+               bool is_denied(const std::string &statement, const PublicKey *key = 0) const;
 
                void auth_stats(const std::string &statement, int &self, int &trusted, int &all) const;
-               void trust(const publickey *key);
-               void dctrust(const publickey *key);
-               void distrust(const publickey *key);
-               bool is_trusted(const publickey *key) const;
-               bool is_distrusted(const publickey *key) const;
-               publickey *find_key(const std::string &fingerprint) const;
+               void trust(const PublicKey *key);
+               void dctrust(const PublicKey *key);
+               void distrust(const PublicKey *key);
+               bool is_trusted(const PublicKey *key) const;
+               bool is_distrusted(const PublicKey *key) const;
+               PublicKey *find_key(const std::string &fingerprint) const;
                void update_trust();
 
-               std::vector<const certificate *> find_certificates(const publickey *key, const std::string &statement) const;
-               std::vector<const certificate *> find_certificates(const std::string &statement) const;
-               std::vector<const certificate *> find_certificates(const publickey *key) const;
+               std::vector<const Certificate *> find_certificates(const PublicKey *key, const std::string &statement) const;
+               std::vector<const Certificate *> find_certificates(const std::string &statement) const;
+               std::vector<const Certificate *> find_certificates(const PublicKey *key) const;
 
-               const certificate *import_certificate(const std::string &certificate);
-               std::string export_certificate(const certificate *) const;
+               const Certificate *import_certificate(const std::string &Certificate);
+               std::string export_certificate(const Certificate *) const;
 
-               const publickey *import_key(const std::string &key);
-               std::string export_key(const publickey *key) const;
+               const PublicKey *import_key(const std::string &key);
+               std::string export_key(const PublicKey *key) const;
 
                void import_all(std::istream &in);
                void export_all(std::ostream &out) const;
 
-               certificate *certificate_from_string(const std::string &certificate);
-               certificate *certificate_load(const std::string &filename);
-               void certificate_save(const certificate *cert, const std::string &filename) const;
+               Certificate *certificate_from_string(const std::string &Certificate);
+               Certificate *certificate_load(const std::string &filename);
+               void certificate_save(const Certificate *cert, const std::string &filename) const;
 
        };
 }