-rw-r--r-- | include/opkele/types.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h index ca07df5..d959021 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h | |||
@@ -1,45 +1,44 @@ | |||
1 | #ifndef __OPKELE_TYPES_H | 1 | #ifndef __OPKELE_TYPES_H |
2 | #define __OPKELE_TYPES_H | 2 | #define __OPKELE_TYPES_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * @file | 5 | * @file |
6 | * @brief various types declarations | 6 | * @brief various types declarations |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <ostream> | 9 | #include <ostream> |
10 | #include <vector> | 10 | #include <vector> |
11 | #include <string> | 11 | #include <string> |
12 | #include <map> | 12 | #include <map> |
13 | #include <memory> | ||
14 | #include <set> | 13 | #include <set> |
14 | #include <opkele/tr1-mem.h> | ||
15 | 15 | ||
16 | namespace opkele { | 16 | namespace opkele { |
17 | using std::vector; | 17 | using std::vector; |
18 | using std::string; | 18 | using std::string; |
19 | using std::map; | 19 | using std::map; |
20 | using std::ostream; | 20 | using std::ostream; |
21 | using std::auto_ptr; | ||
22 | using std::multimap; | 21 | using std::multimap; |
23 | using std::set; | 22 | using std::set; |
24 | 23 | ||
25 | /** | 24 | /** |
26 | * the OpenID operation mode | 25 | * the OpenID operation mode |
27 | */ | 26 | */ |
28 | typedef enum _mode_t { | 27 | typedef enum _mode_t { |
29 | mode_associate, | 28 | mode_associate, |
30 | mode_checkid_immediate, | 29 | mode_checkid_immediate, |
31 | mode_checkid_setup, | 30 | mode_checkid_setup, |
32 | mode_check_association | 31 | mode_check_association |
33 | } mode_t; | 32 | } mode_t; |
34 | 33 | ||
35 | /** | 34 | /** |
36 | * the association secret container | 35 | * the association secret container |
37 | */ | 36 | */ |
38 | class secret_t : public vector<unsigned char> { | 37 | class secret_t : public vector<unsigned char> { |
39 | public: | 38 | public: |
40 | 39 | ||
41 | /** | 40 | /** |
42 | * xor the secret and hmac together and encode, using base64 | 41 | * xor the secret and hmac together and encode, using base64 |
43 | * @param key_d pointer to the message digest | 42 | * @param key_d pointer to the message digest |
44 | * @param rv reference to the return value | 43 | * @param rv reference to the return value |
45 | */ | 44 | */ |
@@ -87,51 +86,51 @@ namespace opkele { | |||
87 | virtual string assoc_type() const = 0; | 86 | virtual string assoc_type() const = 0; |
88 | /** | 87 | /** |
89 | * retrieve the association secret. | 88 | * retrieve the association secret. |
90 | * @return association secret | 89 | * @return association secret |
91 | */ | 90 | */ |
92 | virtual secret_t secret() const = 0; | 91 | virtual secret_t secret() const = 0; |
93 | /** | 92 | /** |
94 | * retrieve the number of seconds the association expires in. | 93 | * retrieve the number of seconds the association expires in. |
95 | * @return seconds till expiration | 94 | * @return seconds till expiration |
96 | */ | 95 | */ |
97 | virtual int expires_in() const = 0; | 96 | virtual int expires_in() const = 0; |
98 | /** | 97 | /** |
99 | * check whether the association is stateless. | 98 | * check whether the association is stateless. |
100 | * @return true if stateless | 99 | * @return true if stateless |
101 | */ | 100 | */ |
102 | virtual bool stateless() const = 0; | 101 | virtual bool stateless() const = 0; |
103 | /** | 102 | /** |
104 | * check whether the association is expired. | 103 | * check whether the association is expired. |
105 | * @return true if expired | 104 | * @return true if expired |
106 | */ | 105 | */ |
107 | virtual bool is_expired() const = 0; | 106 | virtual bool is_expired() const = 0; |
108 | }; | 107 | }; |
109 | 108 | ||
110 | /** | 109 | /** |
111 | * the auto_ptr<> for association_t object type | 110 | * the shared_ptr<> for association_t object type |
112 | */ | 111 | */ |
113 | typedef auto_ptr<association_t> assoc_t; | 112 | typedef tr1mem::shared_ptr<association_t> assoc_t; |
114 | 113 | ||
115 | /** | 114 | /** |
116 | * request/response parameters map | 115 | * request/response parameters map |
117 | */ | 116 | */ |
118 | class params_t : public map<string,string> { | 117 | class params_t : public map<string,string> { |
119 | public: | 118 | public: |
120 | 119 | ||
121 | /** | 120 | /** |
122 | * check whether the parameter is present. | 121 | * check whether the parameter is present. |
123 | * @param n the parameter name | 122 | * @param n the parameter name |
124 | * @return true if yes | 123 | * @return true if yes |
125 | */ | 124 | */ |
126 | bool has_param(const string& n) const; | 125 | bool has_param(const string& n) const; |
127 | /** | 126 | /** |
128 | * retrieve the parameter (const version) | 127 | * retrieve the parameter (const version) |
129 | * @param n the parameter name | 128 | * @param n the parameter name |
130 | * @return the parameter value | 129 | * @return the parameter value |
131 | * @throw failed_lookup if there is no such parameter | 130 | * @throw failed_lookup if there is no such parameter |
132 | */ | 131 | */ |
133 | const string& get_param(const string& n) const; | 132 | const string& get_param(const string& n) const; |
134 | /** | 133 | /** |
135 | * retrieve the parameter. | 134 | * retrieve the parameter. |
136 | * @param n the parameter name | 135 | * @param n the parameter name |
137 | * @return the parameter value | 136 | * @return the parameter value |