- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

gsecretsfile.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2013 Graeme Walker <graeme_walker@users.sourceforge.net>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
20
21 #ifndef G_AUTH_SECRETS_FILE_H
22 #define G_AUTH_SECRETS_FILE_H
23
24 #include "gdef.h"
25 #include "gauth.h"
26 #include "gpath.h"
27 #include "gdatetime.h"
28 #include <string>
29 #include <map>
30 #include <set>
31 #include <iostream>
32
34 namespace GAuth
35 {
36 class SecretsFile ;
37 }
38
42 class GAuth::SecretsFile
43 {
44 public:
45 SecretsFile( const G::Path & path , bool auto_ , const std::string & name , const std::string & type ) ;
46 ~SecretsFile() ;
47 bool valid() const ;
48 std::string id( const std::string & mechanism ) const ;
49 std::string secret( const std::string & mechanism ) const ;
50 std::string secret( const std::string & mechanism , const std::string & id ) const ;
51 std::string path() const ;
52 bool contains( const std::string & mechanism ) const ;
53
54 private:
55 bool process( std::string side , std::string mechanism , std::string id , std::string secret ) ;
56 void read( const G::Path & ) ;
57 unsigned int read( std::istream & ) ;
58 void reread() const ;
59 void reread(int) ;
60 static G::DateTime::EpochTime readFileTime( const G::Path & ) ;
61
62 private:
63 typedef std::map<std::string,std::string> Map ;
64 typedef std::set<std::string> Set ;
65 G::Path m_path ;
66 bool m_auto ;
67 std::string m_debug_name ;
68 std::string m_server_type ;
69 bool m_valid ;
70 Map m_map ;
71 Set m_set ;
72 G::DateTime::EpochTime m_file_time ;
73 G::DateTime::EpochTime m_check_time ;
74 } ;
75
76 #endif
G::DateTime::EpochTime
std::time_t EpochTime
Definition: gdatetime.h:41
GAuth::SecretsFile::valid
bool valid() const
Definition: gsecretsfile.cpp:56
GAuth::SecretsFile::~SecretsFile
~SecretsFile()
Definition: gsecretsfile.cpp:182
GAuth::SecretsFile::secret
std::string secret(const std::string &mechanism) const
Definition: gsecretsfile.cpp:197
GAuth::SecretsFile::id
std::string id(const std::string &mechanism) const
Definition: gsecretsfile.cpp:186
GAuth::SecretsFile::contains
bool contains(const std::string &mechanism) const
Definition: gsecretsfile.cpp:222
GAuth::SecretsFile
A implementation class used by GAuth::Secrets.
Definition: gsecretsfile.h:42
GAuth::SecretsFile::SecretsFile
SecretsFile(const G::Path &path, bool auto_, const std::string &name, const std::string &type)
Definition: gsecretsfile.cpp:40
gauth.h
GAuth::SecretsFile::path
std::string path() const
Definition: gsecretsfile.cpp:217
gdatetime.h
gpath.h
GAuth
SASL authentication classes.
G::Path
A Path object represents a file system path.
Definition: gpath.h:44