Diffstat (limited to 'include/opkele/association.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | include/opkele/association.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/opkele/association.h b/include/opkele/association.h index a8f3915..72eff5b 100644 --- a/include/opkele/association.h +++ b/include/opkele/association.h | |||
@@ -1,68 +1,70 @@ | |||
1 | #ifndef __OPKELE_ASSOCIATION_H | 1 | #ifndef __OPKELE_ASSOCIATION_H |
2 | #define __OPKELE_ASSOCIATION_H | 2 | #define __OPKELE_ASSOCIATION_H |
3 | 3 | ||
4 | #include <time.h> | 4 | #include <time.h> |
5 | #include <opkele/types.h> | 5 | #include <opkele/types.h> |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * @file | 8 | * @file |
9 | * @brief reference implementation of association_t | 9 | * @brief reference implementation of association_t |
10 | */ | 10 | */ |
11 | 11 | ||
12 | namespace opkele { | 12 | namespace opkele { |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * reference implementation of association_t class. | 15 | * reference implementation of association_t class. |
16 | */ | 16 | */ |
17 | class association : public association_t { | 17 | class association : public association_t { |
18 | public: | 18 | public: |
19 | /** | 19 | /** |
20 | * OpenID server name | 20 | * OpenID server name |
21 | */ | 21 | */ |
22 | string _server; | 22 | string _server; |
23 | /** | 23 | /** |
24 | * association handle | 24 | * association handle |
25 | */ | 25 | */ |
26 | string _handle; | 26 | string _handle; |
27 | /** | 27 | /** |
28 | * association type | 28 | * association type |
29 | */ | 29 | */ |
30 | string _assoc_type; | 30 | string _assoc_type; |
31 | /** | 31 | /** |
32 | * the secret | 32 | * the secret |
33 | */ | 33 | */ |
34 | secret_t _secret; | 34 | secret_t _secret; |
35 | /** | 35 | /** |
36 | * expiration time | 36 | * expiration time |
37 | */ | 37 | */ |
38 | time_t _expires; | 38 | time_t _expires; |
39 | /** | 39 | /** |
40 | * statelessness of the assoc_handle | 40 | * statelessness of the assoc_handle |
41 | */ | 41 | */ |
42 | bool _stateless; | 42 | bool _stateless; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * @param __server the server name | 45 | * @param __server the server name |
46 | * @param __handle association handle | 46 | * @param __handle association handle |
47 | * @param __assoc_type association type | 47 | * @param __assoc_type association type |
48 | * @param __secret the secret | 48 | * @param __secret the secret |
49 | * @param __expires expiration time | 49 | * @param __expires expiration time |
50 | * @param __stateless statelessness of the assoc_handle | 50 | * @param __stateless statelessness of the assoc_handle |
51 | */ | 51 | */ |
52 | association(const string& __server, const string& __handle, | 52 | association(const string& __server, const string& __handle, |
53 | const string& __assoc_type, const secret_t& __secret, | 53 | const string& __assoc_type, const secret_t& __secret, |
54 | time_t __expires, bool __stateless) | 54 | time_t __expires, bool __stateless) |
55 | : _server(__server), _handle(__handle), _assoc_type(__assoc_type), | 55 | : _server(__server), _handle(__handle), _assoc_type(__assoc_type), |
56 | _secret(__secret), _expires(__expires), _stateless(__stateless) { } | 56 | _secret(__secret), _expires(__expires), _stateless(__stateless) { } |
57 | 57 | ||
58 | virtual string server() const { return _server; } | 58 | virtual string server() const { return _server; } |
59 | virtual string handle() const { return _handle; } | 59 | virtual string handle() const { return _handle; } |
60 | virtual string assoc_type() const { return _assoc_type; } | 60 | virtual string assoc_type() const { return _assoc_type; } |
61 | virtual secret_t secret() const { return _secret; } | 61 | virtual secret_t secret() const { return _secret; } |
62 | virtual int expires_in() const { return _expires-time(0); } | 62 | virtual int expires_in() const { return _expires-time(0); } |
63 | virtual bool stateless() const { return _stateless; } | 63 | virtual bool stateless() const { return _stateless; } |
64 | |||
65 | virtual bool is_expired() const { return _expires<time(0); } | ||
64 | }; | 66 | }; |
65 | 67 | ||
66 | } | 68 | } |
67 | 69 | ||
68 | #endif /* __OPKELE_ASSOCIATION_H */ | 70 | #endif /* __OPKELE_ASSOCIATION_H */ |