summaryrefslogtreecommitdiffabout
path: root/include/opkele
authorMichael Krelin <hacker@klever.net>2008-02-08 22:16:15 (UTC)
committer Michael Krelin <hacker@klever.net>2008-02-08 22:16:15 (UTC)
commit16667a21c3052c89218d3e56098f0fc29dca2f1a (patch) (unidiff)
tree7154633a771b96da02cc4c980167b7ad92b6d27e /include/opkele
parentf2ba7be73a62d115f293f5d690efabcafd5fcf4f (diff)
downloadlibopkele-16667a21c3052c89218d3e56098f0fc29dca2f1a.zip
libopkele-16667a21c3052c89218d3e56098f0fc29dca2f1a.tar.gz
libopkele-16667a21c3052c89218d3e56098f0fc29dca2f1a.tar.bz2
minor fixes and making compiler a bit happier
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'include/opkele') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/basic_op.h2
-rw-r--r--include/opkele/expat.h16
-rw-r--r--include/opkele/iterator.h19
-rw-r--r--include/opkele/types.h1
4 files changed, 20 insertions, 18 deletions
diff --git a/include/opkele/basic_op.h b/include/opkele/basic_op.h
index 0326508..12306dd 100644
--- a/include/opkele/basic_op.h
+++ b/include/opkele/basic_op.h
@@ -1,250 +1,252 @@
1#ifndef __OPKELE_BASIC_OP_H 1#ifndef __OPKELE_BASIC_OP_H
2#define __OPKELE_BASIC_OP_H 2#define __OPKELE_BASIC_OP_H
3 3
4#include <string> 4#include <string>
5#include <opkele/types.h> 5#include <opkele/types.h>
6#include <opkele/extension.h> 6#include <opkele/extension.h>
7 7
8namespace opkele { 8namespace opkele {
9 using std::string; 9 using std::string;
10 10
11 /** 11 /**
12 * Implementation of basic OP functionality 12 * Implementation of basic OP functionality
13 */ 13 */
14 class basic_OP { 14 class basic_OP {
15 public: 15 public:
16 /** 16 /**
17 * The request mode for the request being processed 17 * The request mode for the request being processed
18 */ 18 */
19 mode_t mode; 19 mode_t mode;
20 /** 20 /**
21 * association used in transaction. reset in case of dumb operation 21 * association used in transaction. reset in case of dumb operation
22 */ 22 */
23 assoc_t assoc; 23 assoc_t assoc;
24 /** 24 /**
25 * true if the request is openid2 request 25 * true if the request is openid2 request
26 */ 26 */
27 bool openid2; 27 bool openid2;
28 /** 28 /**
29 * The return_to RP endpoint 29 * The return_to RP endpoint
30 */ 30 */
31 string return_to; 31 string return_to;
32 /** 32 /**
33 * The realm we authenticate for 33 * The realm we authenticate for
34 */ 34 */
35 string realm; 35 string realm;
36 /** 36 /**
37 * Claimed identifier 37 * Claimed identifier
38 */ 38 */
39 string claimed_id; 39 string claimed_id;
40 /** 40 /**
41 * The OP-Local identifier 41 * The OP-Local identifier
42 */ 42 */
43 string identity; 43 string identity;
44 /** 44 /**
45 * The invalidate handle for the reply request 45 * The invalidate handle for the reply request
46 */ 46 */
47 string invalidate_handle; 47 string invalidate_handle;
48 48
49 virtual ~basic_OP() { }
50
49 void reset_vars(); 51 void reset_vars();
50 52
51 /** 53 /**
52 * @name Request information access 54 * @name Request information access
53 * Setting and retrieval of the information pertaining to the request being processed 55 * Setting and retrieval of the information pertaining to the request being processed
54 * @{ 56 * @{
55 */ 57 */
56 /** 58 /**
57 * Check if the RP expects us to get back to them. 59 * Check if the RP expects us to get back to them.
58 * @return true if RP supplied return_to URL 60 * @return true if RP supplied return_to URL
59 */ 61 */
60 bool has_return_to() const; 62 bool has_return_to() const;
61 /** 63 /**
62 * Find out where the RP is waiting for us. 64 * Find out where the RP is waiting for us.
63 * @return the return_to URL supplied 65 * @return the return_to URL supplied
64 * @throw no_return_to if no return_to is supplied with the request 66 * @throw no_return_to if no return_to is supplied with the request
65 */ 67 */
66 const string& get_return_to() const; 68 const string& get_return_to() const;
67 69
68 /** 70 /**
69 * Find out what realm we are authenticating user for 71 * Find out what realm we are authenticating user for
70 * @return the realm 72 * @return the realm
71 */ 73 */
72 const string& get_realm() const; 74 const string& get_realm() const;
73 75
74 /** 76 /**
75 * Check if request is about identity 77 * Check if request is about identity
76 * @return true if so 78 * @return true if so
77 */ 79 */
78 bool has_identity() const; 80 bool has_identity() const;
79 /** 81 /**
80 * Get claimed identifier supplied with the request 82 * Get claimed identifier supplied with the request
81 * @return claimed identifier 83 * @return claimed identifier
82 * @throw non_identity if request is not about identity 84 * @throw non_identity if request is not about identity
83 */ 85 */
84 const string& get_claimed_id() const; 86 const string& get_claimed_id() const;
85 /** 87 /**
86 * Get the identity (OP-Local identifier) being confirmed 88 * Get the identity (OP-Local identifier) being confirmed
87 * @return identity 89 * @return identity
88 * @throw non_identity if request is not about identity 90 * @throw non_identity if request is not about identity
89 */ 91 */
90 const string& get_identity() const; 92 const string& get_identity() const;
91 93
92 /** 94 /**
93 * Is identifier supposed to be selected on our side? 95 * Is identifier supposed to be selected on our side?
94 * @return true if identity is a special identifier select URI 96 * @return true if identity is a special identifier select URI
95 */ 97 */
96 bool is_id_select() const; 98 bool is_id_select() const;
97 99
98 /** 100 /**
99 * Select the identity for identifier select request 101 * Select the identity for identifier select request
100 * @param cid claimed identifier 102 * @param cid claimed identifier
101 * @param lid local identifier 103 * @param lid local identifier
102 */ 104 */
103 void select_identity(const string& cid,const string& lid); 105 void select_identity(const string& cid,const string& lid);
104 /** 106 /**
105 * Set claimed identifier (for instance if it's supposed to have 107 * Set claimed identifier (for instance if it's supposed to have
106 * fragment part) 108 * fragment part)
107 * @param cid claimed identifier 109 * @param cid claimed identifier
108 */ 110 */
109 void set_claimed_id(const string& cid); 111 void set_claimed_id(const string& cid);
110 /** 112 /**
111 * @} 113 * @}
112 */ 114 */
113 115
114 /** @name OpenID operations 116 /** @name OpenID operations
115 * @{ 117 * @{
116 */ 118 */
117 /** 119 /**
118 * Establish association with RP 120 * Establish association with RP
119 * @param oum reply message 121 * @param oum reply message
120 * @param inm request message 122 * @param inm request message
121 */ 123 */
122 basic_openid_message& associate( 124 basic_openid_message& associate(
123 basic_openid_message& oum, 125 basic_openid_message& oum,
124 const basic_openid_message& inm); 126 const basic_openid_message& inm);
125 127
126 /** 128 /**
127 * Parse the checkid_* request. The function parses input message, 129 * Parse the checkid_* request. The function parses input message,
128 * retrieves the information needed for further processing, 130 * retrieves the information needed for further processing,
129 * verifies what can be verified at this stage. 131 * verifies what can be verified at this stage.
130 * @param inm incoming OpenID message 132 * @param inm incoming OpenID message
131 * @param ext extension/chain of extensions supported 133 * @param ext extension/chain of extensions supported
132 */ 134 */
133 void checkid_(const basic_openid_message& inm,extension_t *ext=0); 135 void checkid_(const basic_openid_message& inm,extension_t *ext=0);
134 /** 136 /**
135 * Build and sign a positive assertion message 137 * Build and sign a positive assertion message
136 * @param om outpu OpenID message 138 * @param om outpu OpenID message
137 * @param ext extension/chain of extensions supported 139 * @param ext extension/chain of extensions supported
138 * @return reference to om 140 * @return reference to om
139 */ 141 */
140 basic_openid_message& id_res(basic_openid_message& om, 142 basic_openid_message& id_res(basic_openid_message& om,
141 extension_t *ext=0); 143 extension_t *ext=0);
142 /** 144 /**
143 * Build a 'cancel' negative assertion 145 * Build a 'cancel' negative assertion
144 * @param om output OpenID message 146 * @param om output OpenID message
145 * @return reference to om 147 * @return reference to om
146 */ 148 */
147 basic_openid_message& cancel(basic_openid_message& om); 149 basic_openid_message& cancel(basic_openid_message& om);
148 /** 150 /**
149 * Build an 'error' reply 151 * Build an 'error' reply
150 * @param om output OpenID message 152 * @param om output OpenID message
151 * @param error a human-readable message indicating the cause 153 * @param error a human-readable message indicating the cause
152 * @param contact contact address for the server administrator (can be empty) 154 * @param contact contact address for the server administrator (can be empty)
153 * @param reference a reference token (can be empty) 155 * @param reference a reference token (can be empty)
154 * @return reference to om 156 * @return reference to om
155 */ 157 */
156 basic_openid_message& error(basic_openid_message& om, 158 basic_openid_message& error(basic_openid_message& om,
157 const string& error,const string& contact, 159 const string& error,const string& contact,
158 const string& reference ); 160 const string& reference );
159 /** 161 /**
160 * Build a setup_needed reply to checkid_immediate request 162 * Build a setup_needed reply to checkid_immediate request
161 * @param oum output OpenID message 163 * @param oum output OpenID message
162 * @param inm incoming OpenID request being processed 164 * @param inm incoming OpenID request being processed
163 * @return reference to oum 165 * @return reference to oum
164 */ 166 */
165 basic_openid_message& setup_needed( 167 basic_openid_message& setup_needed(
166 basic_openid_message& oum,const basic_openid_message& inm); 168 basic_openid_message& oum,const basic_openid_message& inm);
167 169
168 /** 170 /**
169 * Process check_authentication request 171 * Process check_authentication request
170 * @param oum output OpenID message 172 * @param oum output OpenID message
171 * @param inm incoming request 173 * @param inm incoming request
172 * @return reference to oum 174 * @return reference to oum
173 */ 175 */
174 basic_openid_message& check_authentication( 176 basic_openid_message& check_authentication(
175 basic_openid_message& oum,const basic_openid_message& inm); 177 basic_openid_message& oum,const basic_openid_message& inm);
176 /** 178 /**
177 * @} 179 * @}
178 */ 180 */
179 181
180 /** 182 /**
181 * Verify return_to url. The default implementation checks whether 183 * Verify return_to url. The default implementation checks whether
182 * return_to URI matches the realm 184 * return_to URI matches the realm
183 * @throw bad_realm in case of invalid realm 185 * @throw bad_realm in case of invalid realm
184 * @throw bad_return_to if return_to doesn't match the realm 186 * @throw bad_return_to if return_to doesn't match the realm
185 * @see verify_OP::verify_return_to() 187 * @see verify_OP::verify_return_to()
186 */ 188 */
187 virtual void verify_return_to(); 189 virtual void verify_return_to();
188 190
189 /** 191 /**
190 * @name Global persistent store API 192 * @name Global persistent store API
191 * These functions are related to the associations with RPs storage 193 * These functions are related to the associations with RPs storage
192 * and retrieval and nonce management. 194 * and retrieval and nonce management.
193 * @{ 195 * @{
194 */ 196 */
195 /** 197 /**
196 * Allocate association. 198 * Allocate association.
197 * @param type association type 199 * @param type association type
198 * @param kl association key length 200 * @param kl association key length
199 * @param sl true if the association is stateless 201 * @param sl true if the association is stateless
200 * @return association object 202 * @return association object
201 */ 203 */
202 virtual assoc_t alloc_assoc(const string& type,size_t kl,bool sl) = 0; 204 virtual assoc_t alloc_assoc(const string& type,size_t kl,bool sl) = 0;
203 /** 205 /**
204 * Retrieve valid unexpired association 206 * Retrieve valid unexpired association
205 * @param handle association handle 207 * @param handle association handle
206 * @return association object 208 * @return association object
207 */ 209 */
208 virtual assoc_t retrieve_assoc(const string& handle) = 0; 210 virtual assoc_t retrieve_assoc(const string& handle) = 0;
209 /** 211 /**
210 * Allocate nonce. 212 * Allocate nonce.
211 * @param nonce input-output parameter containing timestamp part of 213 * @param nonce input-output parameter containing timestamp part of
212 * the nonce on input 214 * the nonce on input
213 * @param sl true if the nonce is 215 * @param sl true if the nonce is
214 * @return reference to nonce 216 * @return reference to nonce
215 * @throw failed_lookup if no such valid unexpired association 217 * @throw failed_lookup if no such valid unexpired association
216 * could be retrieved 218 * could be retrieved
217 */ 219 */
218 virtual string& alloc_nonce(string& nonce) = 0; 220 virtual string& alloc_nonce(string& nonce) = 0;
219 /** 221 /**
220 * Check nonce validity 222 * Check nonce validity
221 * @param nonce nonce to check 223 * @param nonce nonce to check
222 * @return true if nonce found and isn't yet invalidated 224 * @return true if nonce found and isn't yet invalidated
223 */ 225 */
224 virtual bool check_nonce(const string& nonce) = 0; 226 virtual bool check_nonce(const string& nonce) = 0;
225 /** 227 /**
226 * Invalidate nonce 228 * Invalidate nonce
227 * @param nonce nonce to check 229 * @param nonce nonce to check
228 */ 230 */
229 virtual void invalidate_nonce(const string& nonce) = 0; 231 virtual void invalidate_nonce(const string& nonce) = 0;
230 /** 232 /**
231 * @} 233 * @}
232 */ 234 */
233 235
234 /** 236 /**
235 * @name Site particulars API 237 * @name Site particulars API
236 * @{ 238 * @{
237 */ 239 */
238 /** 240 /**
239 * Query the absolute URL of the op endpoint 241 * Query the absolute URL of the op endpoint
240 * @return fully qualified url of the OP endpoint 242 * @return fully qualified url of the OP endpoint
241 */ 243 */
242 virtual const string get_op_endpoint() const = 0; 244 virtual const string get_op_endpoint() const = 0;
243 /** 245 /**
244 * @} 246 * @}
245 */ 247 */
246 248
247 }; 249 };
248} 250}
249 251
250#endif /* __OPKELE_BASIC_OP_H */ 252#endif /* __OPKELE_BASIC_OP_H */
diff --git a/include/opkele/expat.h b/include/opkele/expat.h
index 60c41ac..3ab1630 100644
--- a/include/opkele/expat.h
+++ b/include/opkele/expat.h
@@ -1,91 +1,91 @@
1#ifndef __OPKELE_EXPAT_H 1#ifndef __OPKELE_EXPAT_H
2#define __OPKELE_EXPAT_H 2#define __OPKELE_EXPAT_H
3 3
4#include <cassert> 4#include <cassert>
5#include <expat.h> 5#include <expat.h>
6 6
7namespace opkele { 7namespace opkele {
8 8
9 namespace util { 9 namespace util {
10 10
11 class expat_t { 11 class expat_t {
12 public: 12 public:
13 XML_Parser _x; 13 XML_Parser _x;
14 14
15 expat_t() : _x(0) { } 15 expat_t() : _x(0) { }
16 expat_t(XML_Parser x) : _x(x) { } 16 expat_t(XML_Parser x) : _x(x) { }
17 virtual ~expat_t() throw(); 17 virtual ~expat_t() throw();
18 18
19 expat_t& operator=(XML_Parser x); 19 expat_t& operator=(XML_Parser x);
20 20
21 operator const XML_Parser(void) const { return _x; } 21 operator const XML_Parser(void) const { return _x; }
22 operator XML_Parser(void) { return _x; } 22 operator XML_Parser(void) { return _x; }
23 23
24 inline bool parse(const char *s,int len,bool final=false) { 24 inline bool parse(const char *s,int len,bool final=false) {
25 assert(_x); 25 assert(_x);
26 return XML_Parse(_x,s,len,final); 26 return XML_Parse(_x,s,len,final);
27 } 27 }
28 28
29 virtual void start_element(const XML_Char *n,const XML_Char **a) { } 29 virtual void start_element(const XML_Char * /* n */,const XML_Char ** /* a */) { }
30 virtual void end_element(const XML_Char *n) { } 30 virtual void end_element(const XML_Char * /* n */) { }
31 void set_element_handler(); 31 void set_element_handler();
32 32
33 virtual void character_data(const XML_Char *s,int l) { } 33 virtual void character_data(const XML_Char * /* s */,int /* l */) { }
34 void set_character_data_handler(); 34 void set_character_data_handler();
35 35
36 virtual void processing_instruction(const XML_Char *t,const XML_Char *d) { } 36 virtual void processing_instruction(const XML_Char * /* t */,const XML_Char * /* d */) { }
37 void set_processing_instruction_handler(); 37 void set_processing_instruction_handler();
38 38
39 virtual void comment(const XML_Char *d) { } 39 virtual void comment(const XML_Char * /* d */) { }
40 void set_comment_handler(); 40 void set_comment_handler();
41 41
42 virtual void start_cdata_section() { } 42 virtual void start_cdata_section() { }
43 virtual void end_cdata_section() { } 43 virtual void end_cdata_section() { }
44 void set_cdata_section_handler(); 44 void set_cdata_section_handler();
45 45
46 virtual void default_handler(const XML_Char *s,int l) { } 46 virtual void default_handler(const XML_Char * /* s */,int /* l */) { }
47 void set_default_handler(); 47 void set_default_handler();
48 void set_default_handler_expand(); 48 void set_default_handler_expand();
49 49
50 virtual void start_namespace_decl(const XML_Char *p,const XML_Char *u) { } 50 virtual void start_namespace_decl(const XML_Char * /* p */,const XML_Char * /* u */) { }
51 virtual void end_namespace_decl(const XML_Char *p) { } 51 virtual void end_namespace_decl(const XML_Char * /* p */) { }
52 void set_namespace_decl_handler(); 52 void set_namespace_decl_handler();
53 53
54 inline enum XML_Error get_error_code() { 54 inline enum XML_Error get_error_code() {
55 assert(_x); return XML_GetErrorCode(_x); } 55 assert(_x); return XML_GetErrorCode(_x); }
56 static inline const XML_LChar *error_string(XML_Error c) { 56 static inline const XML_LChar *error_string(XML_Error c) {
57 return XML_ErrorString(c); } 57 return XML_ErrorString(c); }
58 58
59 inline long get_current_byte_index() { 59 inline long get_current_byte_index() {
60 assert(_x); return XML_GetCurrentByteIndex(_x); } 60 assert(_x); return XML_GetCurrentByteIndex(_x); }
61 inline int get_current_line_number() { 61 inline int get_current_line_number() {
62 assert(_x); return XML_GetCurrentLineNumber(_x); } 62 assert(_x); return XML_GetCurrentLineNumber(_x); }
63 inline int get_current_column_number() { 63 inline int get_current_column_number() {
64 assert(_x); return XML_GetCurrentColumnNumber(_x); } 64 assert(_x); return XML_GetCurrentColumnNumber(_x); }
65 65
66 inline void set_user_data() { 66 inline void set_user_data() {
67 assert(_x); XML_SetUserData(_x,this); } 67 assert(_x); XML_SetUserData(_x,this); }
68 68
69 inline bool set_base(const XML_Char *b) { 69 inline bool set_base(const XML_Char *b) {
70 assert(_x); return XML_SetBase(_x,b); } 70 assert(_x); return XML_SetBase(_x,b); }
71 inline const XML_Char *get_base() { 71 inline const XML_Char *get_base() {
72 assert(_x); return XML_GetBase(_x); } 72 assert(_x); return XML_GetBase(_x); }
73 73
74 inline int get_specified_attribute_count() { 74 inline int get_specified_attribute_count() {
75 assert(_x); return XML_GetSpecifiedAttributeCount(_x); } 75 assert(_x); return XML_GetSpecifiedAttributeCount(_x); }
76 76
77 inline bool set_param_entity_parsing(enum XML_ParamEntityParsing c) { 77 inline bool set_param_entity_parsing(enum XML_ParamEntityParsing c) {
78 assert(_x); return XML_SetParamEntityParsing(_x,c); } 78 assert(_x); return XML_SetParamEntityParsing(_x,c); }
79 79
80 inline static XML_Parser parser_create(const XML_Char *e=0) { 80 inline static XML_Parser parser_create(const XML_Char *e=0) {
81 return XML_ParserCreate(e); } 81 return XML_ParserCreate(e); }
82 inline static XML_Parser parser_create_ns(const XML_Char *e=0,XML_Char s='\t') { 82 inline static XML_Parser parser_create_ns(const XML_Char *e=0,XML_Char s='\t') {
83 return XML_ParserCreateNS(e,s); } 83 return XML_ParserCreateNS(e,s); }
84 84
85 }; 85 };
86 86
87 } 87 }
88 88
89} 89}
90 90
91#endif /* __OPKELE_EXPAT_H */ 91#endif /* __OPKELE_EXPAT_H */
diff --git a/include/opkele/iterator.h b/include/opkele/iterator.h
index 812a786..28c1c83 100644
--- a/include/opkele/iterator.h
+++ b/include/opkele/iterator.h
@@ -1,217 +1,216 @@
1#ifndef __OPKELE_ITERATOR_H 1#ifndef __OPKELE_ITERATOR_H
2#define __OPKELE_ITERATOR_H 2#define __OPKELE_ITERATOR_H
3 3
4#include <cassert> 4#include <cassert>
5#include <iterator> 5#include <iterator>
6 6
7namespace opkele { 7namespace opkele {
8 namespace util { 8 namespace util {
9 using std::iterator; 9 using std::iterator;
10 using std::forward_iterator_tag; 10 using std::forward_iterator_tag;
11 using std::output_iterator_tag; 11 using std::output_iterator_tag;
12 12
13 template <typename T> 13 template <typename T>
14 class basic_output_iterator_proxy_impl : public iterator<output_iterator_tag,T,void,T*,T&> { 14 class basic_output_iterator_proxy_impl : public iterator<output_iterator_tag,T,void,T*,T&> {
15 public: 15 public:
16 virtual ~basic_output_iterator_proxy_impl() { } 16 virtual ~basic_output_iterator_proxy_impl() { }
17 17
18 virtual basic_output_iterator_proxy_impl<T>* dup() const = 0; 18 virtual basic_output_iterator_proxy_impl<T>* dup() const = 0;
19 basic_output_iterator_proxy_impl<T>& operator*() { return *this; }; 19 basic_output_iterator_proxy_impl<T>& operator*() { return *this; };
20 virtual basic_output_iterator_proxy_impl<T>& operator=(const T& x) = 0; 20 virtual basic_output_iterator_proxy_impl<T>& operator=(const T& x) = 0;
21 21
22 }; 22 };
23 23
24 template<typename IT,typename T=typename IT::value_type> 24 template<typename IT,typename T=typename IT::value_type>
25 class output_iterator_proxy_impl : public basic_output_iterator_proxy_impl<T> { 25 class output_iterator_proxy_impl : public basic_output_iterator_proxy_impl<T> {
26 public: 26 public:
27 IT i; 27 IT i;
28 28
29 output_iterator_proxy_impl(const IT& i) : i(i) { } 29 output_iterator_proxy_impl(const IT& _i) : i(_i) { }
30 basic_output_iterator_proxy_impl<T>* dup() const { 30 basic_output_iterator_proxy_impl<T>* dup() const {
31 return new output_iterator_proxy_impl<IT,T>(i); } 31 return new output_iterator_proxy_impl<IT,T>(i); }
32 basic_output_iterator_proxy_impl<T>& operator=(const T& x) { 32 basic_output_iterator_proxy_impl<T>& operator=(const T& x) {
33 (*i) = x; 33 (*i) = x; return *this; }
34 }
35 }; 34 };
36 35
37 template<typename T> 36 template<typename T>
38 class output_iterator_proxy : public iterator<output_iterator_tag,T,void,T*,T&> { 37 class output_iterator_proxy : public iterator<output_iterator_tag,T,void,T*,T&> {
39 public: 38 public:
40 basic_output_iterator_proxy_impl<T> *I; 39 basic_output_iterator_proxy_impl<T> *I;
41 40
42 template<typename IT> 41 template<typename IT>
43 output_iterator_proxy(const IT& i) 42 output_iterator_proxy(const IT& i)
44 : I(new output_iterator_proxy_impl<IT,T>(i)) { } 43 : I(new output_iterator_proxy_impl<IT,T>(i)) { }
45 output_iterator_proxy(const output_iterator_proxy<T>& x) 44 output_iterator_proxy(const output_iterator_proxy<T>& x)
46 : I(x.I->dup()) { } 45 : I(x.I->dup()) { }
47 ~output_iterator_proxy() { delete I; } 46 ~output_iterator_proxy() { delete I; }
48 47
49 output_iterator_proxy& operator=(const output_iterator_proxy<T>& x) { 48 output_iterator_proxy& operator=(const output_iterator_proxy<T>& x) {
50 delete I; I = x.I->dup(); } 49 delete I; I = x.I->dup(); }
51 50
52 output_iterator_proxy& operator*() { return *this; } 51 output_iterator_proxy& operator*() { return *this; }
53 output_iterator_proxy& operator=(const T& x) { 52 output_iterator_proxy& operator=(const T& x) {
54 (**I) = x; } 53 (**I) = x; return *this; }
55 54
56 output_iterator_proxy& operator++() { return *this; } 55 output_iterator_proxy& operator++() { return *this; }
57 output_iterator_proxy& operator++(int) { return *this; } 56 output_iterator_proxy& operator++(int) { return *this; }
58 }; 57 };
59 58
60 template <typename T,typename TR=T&,typename TP=T*> 59 template <typename T,typename TR=T&,typename TP=T*>
61 class basic_forward_iterator_proxy_impl : public iterator<forward_iterator_tag,T,void,TP,TR> { 60 class basic_forward_iterator_proxy_impl : public iterator<forward_iterator_tag,T,void,TP,TR> {
62 public: 61 public:
63 virtual ~basic_forward_iterator_proxy_impl() { } 62 virtual ~basic_forward_iterator_proxy_impl() { }
64 63
65 virtual basic_forward_iterator_proxy_impl<T,TR,TP>* dup() const = 0; 64 virtual basic_forward_iterator_proxy_impl<T,TR,TP>* dup() const = 0;
66 65
67 virtual bool operator==(const basic_forward_iterator_proxy_impl<T,TR,TP>& x) const = 0; 66 virtual bool operator==(const basic_forward_iterator_proxy_impl<T,TR,TP>& x) const = 0;
68 virtual bool operator!=(const basic_forward_iterator_proxy_impl<T,TR,TP>& x) const { 67 virtual bool operator!=(const basic_forward_iterator_proxy_impl<T,TR,TP>& x) const {
69 return !((*this)==x); } 68 return !((*this)==x); }
70 virtual TR operator*() const = 0; 69 virtual TR operator*() const = 0;
71 virtual TP operator->() const = 0; 70 virtual TP operator->() const = 0;
72 virtual void advance() = 0; 71 virtual void advance() = 0;
73 }; 72 };
74 73
75 template <typename IT> 74 template <typename IT>
76 class forward_iterator_proxy_impl : public basic_forward_iterator_proxy_impl<typename IT::value_type,typename IT::reference,typename IT::pointer> { 75 class forward_iterator_proxy_impl : public basic_forward_iterator_proxy_impl<typename IT::value_type,typename IT::reference,typename IT::pointer> {
77 public: 76 public:
78 IT i; 77 IT i;
79 78
80 forward_iterator_proxy_impl(const IT& i) : i(i) { } 79 forward_iterator_proxy_impl(const IT& _i) : i(_i) { }
81 80
82 virtual basic_forward_iterator_proxy_impl<typename IT::value_type,typename IT::reference,typename IT::pointer>* dup() const { 81 virtual basic_forward_iterator_proxy_impl<typename IT::value_type,typename IT::reference,typename IT::pointer>* dup() const {
83 return new forward_iterator_proxy_impl<IT>(i); } 82 return new forward_iterator_proxy_impl<IT>(i); }
84 83
85 virtual bool operator==(const basic_forward_iterator_proxy_impl<typename IT::value_type,typename IT::reference,typename IT::pointer>& x) const { 84 virtual bool operator==(const basic_forward_iterator_proxy_impl<typename IT::value_type,typename IT::reference,typename IT::pointer>& x) const {
86 return i==static_cast<const forward_iterator_proxy_impl<IT>*>(&x)->i; } 85 return i==static_cast<const forward_iterator_proxy_impl<IT>*>(&x)->i; }
87 virtual bool operator!=(const basic_forward_iterator_proxy_impl<typename IT::value_type,typename IT::reference,typename IT::pointer>& x) const { 86 virtual bool operator!=(const basic_forward_iterator_proxy_impl<typename IT::value_type,typename IT::reference,typename IT::pointer>& x) const {
88 return i!=static_cast<const forward_iterator_proxy_impl<IT>*>(&x)->i; } 87 return i!=static_cast<const forward_iterator_proxy_impl<IT>*>(&x)->i; }
89 virtual typename IT::reference operator*() const { return *i; } 88 virtual typename IT::reference operator*() const { return *i; }
90 virtual typename IT::pointer operator->() const { return i.operator->(); } 89 virtual typename IT::pointer operator->() const { return i.operator->(); }
91 virtual void advance() { ++i; } 90 virtual void advance() { ++i; }
92 }; 91 };
93 92
94 template<typename T,typename TR=T&,typename TP=T*> 93 template<typename T,typename TR=T&,typename TP=T*>
95 class forward_iterator_proxy : public iterator<forward_iterator_tag,T,void,TP,TR> { 94 class forward_iterator_proxy : public iterator<forward_iterator_tag,T,void,TP,TR> {
96 public: 95 public:
97 basic_forward_iterator_proxy_impl<T,TR,TP> *I; 96 basic_forward_iterator_proxy_impl<T,TR,TP> *I;
98 97
99 template<typename IT> 98 template<typename IT>
100 forward_iterator_proxy(const IT& i) 99 forward_iterator_proxy(const IT& i)
101 : I(new forward_iterator_proxy_impl<IT>(i)) { } 100 : I(new forward_iterator_proxy_impl<IT>(i)) { }
102 forward_iterator_proxy(const forward_iterator_proxy<T,TR,TP>& x) 101 forward_iterator_proxy(const forward_iterator_proxy<T,TR,TP>& x)
103 : I(x.I->dup()) { } 102 : I(x.I->dup()) { }
104 ~forward_iterator_proxy() { delete I; } 103 ~forward_iterator_proxy() { delete I; }
105 104
106 forward_iterator_proxy& operator=(const forward_iterator_proxy<T,TR,TP>& x) { 105 forward_iterator_proxy& operator=(const forward_iterator_proxy<T,TR,TP>& x) {
107 delete I; I = x.I->dup(); } 106 delete I; I = x.I->dup(); }
108 107
109 bool operator==(const forward_iterator_proxy<T,TR,TP>& x) const { 108 bool operator==(const forward_iterator_proxy<T,TR,TP>& x) const {
110 return (*I)==(*(x.I)); } 109 return (*I)==(*(x.I)); }
111 bool operator!=(const forward_iterator_proxy<T,TR,TP>& x) const { 110 bool operator!=(const forward_iterator_proxy<T,TR,TP>& x) const {
112 return (*I)!=(*(x.I)); } 111 return (*I)!=(*(x.I)); }
113 112
114 TR operator*() const { 113 TR operator*() const {
115 return **I; } 114 return **I; }
116 TP operator->() const { 115 TP operator->() const {
117 return I->operator->(); } 116 return I->operator->(); }
118 117
119 forward_iterator_proxy<T,TR,TP>& operator++() { 118 forward_iterator_proxy<T,TR,TP>& operator++() {
120 I->advance(); return *this; } 119 I->advance(); return *this; }
121 forward_iterator_proxy<T,TR,TP>& operator++(int) { 120 forward_iterator_proxy<T,TR,TP>& operator++(int) {
122 forward_iterator_proxy<T,TR,TP> rv(*this); 121 forward_iterator_proxy<T,TR,TP> rv(*this);
123 I->advance(); return rv; } 122 I->advance(); return rv; }
124 }; 123 };
125 124
126 template<typename IT> 125 template<typename IT>
127 class basic_filterator : public iterator< 126 class basic_filterator : public iterator<
128 typename IT::iterator_category, 127 typename IT::iterator_category,
129 typename IT::value_type, 128 typename IT::value_type,
130 typename IT::difference_type, 129 typename IT::difference_type,
131 typename IT::pointer, 130 typename IT::pointer,
132 typename IT::reference> { 131 typename IT::reference> {
133 public: 132 public:
134 IT it; 133 IT it;
135 IT ei; 134 IT ei;
136 bool empty; 135 bool empty;
137 136
138 basic_filterator() : empty(true) { } 137 basic_filterator() : empty(true) { }
139 basic_filterator(const IT& bi,const IT& ei) 138 basic_filterator(const IT& _bi,const IT& _ei)
140 : it(bi), ei(ei) { empty = (bi==ei); } 139 : it(_bi), ei(_ei) { empty = (it==ei); }
141 basic_filterator(const basic_filterator<IT>& x) 140 basic_filterator(const basic_filterator<IT>& x)
142 : it(x.it), ei(x.ei), empty(x.empty) { } 141 : it(x.it), ei(x.ei), empty(x.empty) { }
143 virtual ~basic_filterator() { } 142 virtual ~basic_filterator() { }
144 143
145 bool operator==(const basic_filterator<IT>& x) const { 144 bool operator==(const basic_filterator<IT>& x) const {
146 return empty?x.empty:(it==x.it); } 145 return empty?x.empty:(it==x.it); }
147 bool operator!=(const basic_filterator<IT>& x) const { 146 bool operator!=(const basic_filterator<IT>& x) const {
148 return empty!=x.empty || it!=x.it; } 147 return empty!=x.empty || it!=x.it; }
149 148
150 typename IT::reference operator*() const { 149 typename IT::reference operator*() const {
151 assert(!empty); 150 assert(!empty);
152 return *it; } 151 return *it; }
153 typename IT::pointer operator->() const { 152 typename IT::pointer operator->() const {
154 assert(!empty); 153 assert(!empty);
155 return it.operator->(); } 154 return it.operator->(); }
156 155
157 basic_filterator<IT>& operator++() { 156 basic_filterator<IT>& operator++() {
158 bool found = false; 157 bool found = false;
159 for(++it;!(it==ei || (found=is_interesting()));++it); 158 for(++it;!(it==ei || (found=is_interesting()));++it);
160 if(!found) empty=true; 159 if(!found) empty=true;
161 return *this; 160 return *this;
162 } 161 }
163 basic_filterator<IT> operator++(int) { 162 basic_filterator<IT> operator++(int) {
164 basic_filterator<IT> rv(*this); 163 basic_filterator<IT> rv(*this);
165 ++(*this); 164 ++(*this);
166 return rv; 165 return rv;
167 } 166 }
168 167
169 void prepare() { 168 void prepare() {
170 bool found = false; 169 bool found = false;
171 for(;!(it==ei || (found=is_interesting()));++it); 170 for(;!(it==ei || (found=is_interesting()));++it);
172 if(!found) empty = true; 171 if(!found) empty = true;
173 } 172 }
174 virtual bool is_interesting() const = 0; 173 virtual bool is_interesting() const = 0;
175 }; 174 };
176 175
177 template<typename IT,typename T=typename IT::value_type::first_type,typename TR=T&,typename TP=T*> 176 template<typename IT,typename T=typename IT::value_type::first_type,typename TR=T&,typename TP=T*>
178 class map_keys_iterator : public iterator< 177 class map_keys_iterator : public iterator<
179 typename IT::iterator_category, 178 typename IT::iterator_category,
180 T,void,TP,TR> { 179 T,void,TP,TR> {
181 public: 180 public:
182 typedef map_keys_iterator<IT,T,TR,TP> self_type; 181 typedef map_keys_iterator<IT,T,TR,TP> self_type;
183 IT it; 182 IT it;
184 IT ei; 183 IT ei;
185 bool empty; 184 bool empty;
186 185
187 map_keys_iterator() : empty(true) { } 186 map_keys_iterator() : empty(true) { }
188 map_keys_iterator(const IT& bi, 187 map_keys_iterator(const IT& _bi,
189 const IT& ei) 188 const IT& _ei)
190 : it(bi), ei(ei) { empty = (bi==ei); } 189 : it(_bi), ei(_ei) { empty = (it==ei); }
191 map_keys_iterator(const self_type& x) 190 map_keys_iterator(const self_type& x)
192 : it(x.it), ei(x.ei), empty(x.empty) { } 191 : it(x.it), ei(x.ei), empty(x.empty) { }
193 192
194 bool operator==(const self_type& x) const { 193 bool operator==(const self_type& x) const {
195 return empty?x.empty:(it==x.it); } 194 return empty?x.empty:(it==x.it); }
196 bool operator!=(const self_type& x) const { 195 bool operator!=(const self_type& x) const {
197 return empty!=x.empty || it!=x.it; } 196 return empty!=x.empty || it!=x.it; }
198 197
199 TR operator*() const { 198 TR operator*() const {
200 assert(!empty); 199 assert(!empty);
201 return it->first; } 200 return it->first; }
202 TP operator->() const { 201 TP operator->() const {
203 assert(!empty); 202 assert(!empty);
204 return &(it->first); } 203 return &(it->first); }
205 204
206 self_type& operator++() { 205 self_type& operator++() {
207 assert(!empty); 206 assert(!empty);
208 empty=((++it)==ei); return *this; } 207 empty=((++it)==ei); return *this; }
209 self_type operator++(int) { 208 self_type operator++(int) {
210 self_type rv(*this); 209 self_type rv(*this);
211 ++(*this); return rv; } 210 ++(*this); return rv; }
212 }; 211 };
213 212
214 } 213 }
215} 214}
216 215
217#endif /* __OPKELE_ITERATOR_H */ 216#endif /* __OPKELE_ITERATOR_H */
diff --git a/include/opkele/types.h b/include/opkele/types.h
index 6ab51ef..a3b657d 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -1,229 +1,230 @@
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 <cstring> 9#include <cstring>
10#include <ostream> 10#include <ostream>
11#include <vector> 11#include <vector>
12#include <string> 12#include <string>
13#include <map> 13#include <map>
14#include <set> 14#include <set>
15#include <list> 15#include <list>
16#include <opkele/iterator.h> 16#include <opkele/iterator.h>
17#include <opkele/tr1-mem.h> 17#include <opkele/tr1-mem.h>
18 18
19namespace opkele { 19namespace opkele {
20 using std::vector; 20 using std::vector;
21 using std::string; 21 using std::string;
22 using std::map; 22 using std::map;
23 using std::ostream; 23 using std::ostream;
24 using std::multimap; 24 using std::multimap;
25 using std::set; 25 using std::set;
26 using std::list; 26 using std::list;
27 using std::iterator; 27 using std::iterator;
28 using std::forward_iterator_tag; 28 using std::forward_iterator_tag;
29 29
30 /** 30 /**
31 * the OpenID operation mode 31 * the OpenID operation mode
32 */ 32 */
33 typedef enum _mode_t { 33 typedef enum _mode_t {
34 mode_unknown = 0, 34 mode_unknown = 0,
35 mode_associate, 35 mode_associate,
36 mode_checkid_immediate, 36 mode_checkid_immediate,
37 mode_checkid_setup, 37 mode_checkid_setup,
38 mode_check_association 38 mode_check_association
39 } mode_t; 39 } mode_t;
40 40
41 /** 41 /**
42 * the association secret container 42 * the association secret container
43 */ 43 */
44 class secret_t : public vector<unsigned char> { 44 class secret_t : public vector<unsigned char> {
45 public: 45 public:
46 46
47 /** 47 /**
48 * xor the secret and hmac together and encode, using base64 48 * xor the secret and hmac together and encode, using base64
49 * @param key_d pointer to the message digest 49 * @param key_d pointer to the message digest
50 * @param rv reference to the return value 50 * @param rv reference to the return value
51 */ 51 */
52 void enxor_to_base64(const unsigned char *key_d,string& rv) const; 52 void enxor_to_base64(const unsigned char *key_d,string& rv) const;
53 /** 53 /**
54 * decode base64-encoded secret and xor it with the message digest 54 * decode base64-encoded secret and xor it with the message digest
55 * @param key_d pointer to the message digest 55 * @param key_d pointer to the message digest
56 * @param b64 base64-encoded secret value 56 * @param b64 base64-encoded secret value
57 */ 57 */
58 void enxor_from_base64(const unsigned char *key_d,const string& b64); 58 void enxor_from_base64(const unsigned char *key_d,const string& b64);
59 /** 59 /**
60 * plainly encode to base64 representation 60 * plainly encode to base64 representation
61 * @param rv reference to the return value 61 * @param rv reference to the return value
62 */ 62 */
63 void to_base64(string& rv) const; 63 void to_base64(string& rv) const;
64 /** 64 /**
65 * decode cleartext secret from base64 65 * decode cleartext secret from base64
66 * @param b64 base64-encoded representation of the secret value 66 * @param b64 base64-encoded representation of the secret value
67 */ 67 */
68 void from_base64(const string& b64); 68 void from_base64(const string& b64);
69 }; 69 };
70 70
71 /** 71 /**
72 * Interface to the association. 72 * Interface to the association.
73 */ 73 */
74 class association_t { 74 class association_t {
75 public: 75 public:
76 76
77 virtual ~association_t() { } 77 virtual ~association_t() { }
78 78
79 /** 79 /**
80 * retrieve the server with which association was established. 80 * retrieve the server with which association was established.
81 * @return server name 81 * @return server name
82 */ 82 */
83 virtual string server() const = 0; 83 virtual string server() const = 0;
84 /** 84 /**
85 * retrieve the association handle. 85 * retrieve the association handle.
86 * @return handle 86 * @return handle
87 */ 87 */
88 virtual string handle() const = 0; 88 virtual string handle() const = 0;
89 /** 89 /**
90 * retrieve the association type. 90 * retrieve the association type.
91 * @return association type 91 * @return association type
92 */ 92 */
93 virtual string assoc_type() const = 0; 93 virtual string assoc_type() const = 0;
94 /** 94 /**
95 * retrieve the association secret. 95 * retrieve the association secret.
96 * @return association secret 96 * @return association secret
97 */ 97 */
98 virtual secret_t secret() const = 0; 98 virtual secret_t secret() const = 0;
99 /** 99 /**
100 * retrieve the number of seconds the association expires in. 100 * retrieve the number of seconds the association expires in.
101 * @return seconds till expiration 101 * @return seconds till expiration
102 */ 102 */
103 virtual int expires_in() const = 0; 103 virtual int expires_in() const = 0;
104 /** 104 /**
105 * check whether the association is stateless. 105 * check whether the association is stateless.
106 * @return true if stateless 106 * @return true if stateless
107 */ 107 */
108 virtual bool stateless() const = 0; 108 virtual bool stateless() const = 0;
109 /** 109 /**
110 * check whether the association is expired. 110 * check whether the association is expired.
111 * @return true if expired 111 * @return true if expired
112 */ 112 */
113 virtual bool is_expired() const = 0; 113 virtual bool is_expired() const = 0;
114 }; 114 };
115 115
116 /** 116 /**
117 * the shared_ptr<> for association_t object type 117 * the shared_ptr<> for association_t object type
118 */ 118 */
119 typedef tr1mem::shared_ptr<association_t> assoc_t; 119 typedef tr1mem::shared_ptr<association_t> assoc_t;
120 120
121 class basic_openid_message { 121 class basic_openid_message {
122 public: 122 public:
123 typedef list<string> fields_t; 123 typedef list<string> fields_t;
124 typedef util::forward_iterator_proxy< 124 typedef util::forward_iterator_proxy<
125 string,const string&,const string* 125 string,const string&,const string*
126 > fields_iterator; 126 > fields_iterator;
127 127
128 basic_openid_message() { } 128 basic_openid_message() { }
129 virtual ~basic_openid_message() { }
129 basic_openid_message(const basic_openid_message& x); 130 basic_openid_message(const basic_openid_message& x);
130 void copy_to(basic_openid_message& x) const; 131 void copy_to(basic_openid_message& x) const;
131 132
132 virtual bool has_field(const string& n) const = 0; 133 virtual bool has_field(const string& n) const = 0;
133 virtual const string& get_field(const string& n) const = 0; 134 virtual const string& get_field(const string& n) const = 0;
134 135
135 virtual bool has_ns(const string& uri) const; 136 virtual bool has_ns(const string& uri) const;
136 virtual string get_ns(const string& uri) const; 137 virtual string get_ns(const string& uri) const;
137 138
138 virtual fields_iterator fields_begin() const = 0; 139 virtual fields_iterator fields_begin() const = 0;
139 virtual fields_iterator fields_end() const = 0; 140 virtual fields_iterator fields_end() const = 0;
140 141
141 virtual string append_query(const string& url) const; 142 virtual string append_query(const string& url) const;
142 virtual string query_string() const; 143 virtual string query_string() const;
143 144
144 145
145 virtual void reset_fields(); 146 virtual void reset_fields();
146 virtual void set_field(const string& n,const string& v); 147 virtual void set_field(const string& n,const string& v);
147 virtual void reset_field(const string& n); 148 virtual void reset_field(const string& n);
148 149
149 virtual void from_keyvalues(const string& kv); 150 virtual void from_keyvalues(const string& kv);
150 virtual void to_keyvalues(ostream& o) const; 151 virtual void to_keyvalues(ostream& o) const;
151 152
152 virtual void to_htmlhiddens(ostream& o) const; 153 virtual void to_htmlhiddens(ostream& o) const;
153 154
154 void add_to_signed(const string& fields); 155 void add_to_signed(const string& fields);
155 string find_ns(const string& uri,const char *pfx) const; 156 string find_ns(const string& uri,const char *pfx) const;
156 string allocate_ns(const string& uri,const char *pfx); 157 string allocate_ns(const string& uri,const char *pfx);
157 }; 158 };
158 159
159 class openid_message_t : public basic_openid_message, public map<string,string> { 160 class openid_message_t : public basic_openid_message, public map<string,string> {
160 public: 161 public:
161 openid_message_t() { } 162 openid_message_t() { }
162 openid_message_t(const basic_openid_message& x) 163 openid_message_t(const basic_openid_message& x)
163 : basic_openid_message(x) { } 164 : basic_openid_message(x) { }
164 165
165 void copy_to(basic_openid_message& x) const; 166 void copy_to(basic_openid_message& x) const;
166 167
167 bool has_field(const string& n) const; 168 bool has_field(const string& n) const;
168 const string& get_field(const string& n) const; 169 const string& get_field(const string& n) const;
169 virtual fields_iterator fields_begin() const; 170 virtual fields_iterator fields_begin() const;
170 virtual fields_iterator fields_end() const; 171 virtual fields_iterator fields_end() const;
171 172
172 void reset_fields(); 173 void reset_fields();
173 void set_field(const string& n,const string& v); 174 void set_field(const string& n,const string& v);
174 void reset_field(const string& n); 175 void reset_field(const string& n);
175 }; 176 };
176 177
177 /** 178 /**
178 * request/response parameters map 179 * request/response parameters map
179 */ 180 */
180 class params_t : public openid_message_t { 181 class params_t : public openid_message_t {
181 public: 182 public:
182 183
183 /** 184 /**
184 * check whether the parameter is present. 185 * check whether the parameter is present.
185 * @param n the parameter name 186 * @param n the parameter name
186 * @return true if yes 187 * @return true if yes
187 */ 188 */
188 bool has_param(const string& n) const { 189 bool has_param(const string& n) const {
189 return has_field(n); } 190 return has_field(n); }
190 /** 191 /**
191 * retrieve the parameter (const version) 192 * retrieve the parameter (const version)
192 * @param n the parameter name 193 * @param n the parameter name
193 * @return the parameter value 194 * @return the parameter value
194 * @throw failed_lookup if there is no such parameter 195 * @throw failed_lookup if there is no such parameter
195 */ 196 */
196 const string& get_param(const string& n) const { 197 const string& get_param(const string& n) const {
197 return get_field(n); } 198 return get_field(n); }
198 199
199 /** 200 /**
200 * parse the OpenID key/value data. 201 * parse the OpenID key/value data.
201 * @param kv the OpenID key/value data 202 * @param kv the OpenID key/value data
202 */ 203 */
203 void parse_keyvalues(const string& kv) { 204 void parse_keyvalues(const string& kv) {
204 from_keyvalues(kv); } 205 from_keyvalues(kv); }
205 206
206 string append_query(const string& url,const char *prefix="openid.") const; 207 string append_query(const string& url,const char *prefix="openid.") const;
207 208
208 }; 209 };
209 210
210 struct openid_endpoint_t { 211 struct openid_endpoint_t {
211 string uri; 212 string uri;
212 string claimed_id; 213 string claimed_id;
213 string local_id; 214 string local_id;
214 215
215 openid_endpoint_t() { } 216 openid_endpoint_t() { }
216 openid_endpoint_t(const string& u,const string& cid,const string& lid) 217 openid_endpoint_t(const string& u,const string& cid,const string& lid)
217 : uri(u), claimed_id(cid), local_id(lid) { } 218 : uri(u), claimed_id(cid), local_id(lid) { }
218 219
219 bool operator==(const openid_endpoint_t& x) const { 220 bool operator==(const openid_endpoint_t& x) const {
220 return uri==x.uri && local_id==x.local_id; } 221 return uri==x.uri && local_id==x.local_id; }
221 bool operator<(const openid_endpoint_t& x) const { 222 bool operator<(const openid_endpoint_t& x) const {
222 int c; 223 int c;
223 return (c=strcmp(uri.c_str(),x.uri.c_str())) 224 return (c=strcmp(uri.c_str(),x.uri.c_str()))
224 ? (c<0) : (strcmp(local_id.c_str(),x.local_id.c_str())<0); } 225 ? (c<0) : (strcmp(local_id.c_str(),x.local_id.c_str())<0); }
225 }; 226 };
226 227
227} 228}
228 229
229#endif /* __OPKELE_TYPES_H */ 230#endif /* __OPKELE_TYPES_H */