summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2008-02-03 15:28:30 (UTC)
committer Michael Krelin <hacker@klever.net>2008-02-03 15:28:30 (UTC)
commitd1c45af16b3bd31f65d03eec0fcd1c61b4d69fb0 (patch) (unidiff)
tree34fc1389a138a2c33ccfceb595379a16a0139768
parent5f742d37f78d626e0140632b28b072f892fd98c3 (diff)
downloadlibopkele-d1c45af16b3bd31f65d03eec0fcd1c61b4d69fb0.zip
libopkele-d1c45af16b3bd31f65d03eec0fcd1c61b4d69fb0.tar.gz
libopkele-d1c45af16b3bd31f65d03eec0fcd1c61b4d69fb0.tar.bz2
moved openid_endpoint_t to types.h
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/basic_rp.h18
-rw-r--r--include/opkele/types.h18
2 files changed, 18 insertions, 18 deletions
diff --git a/include/opkele/basic_rp.h b/include/opkele/basic_rp.h
index 3f17fd9..d5356aa 100644
--- a/include/opkele/basic_rp.h
+++ b/include/opkele/basic_rp.h
@@ -1,52 +1,34 @@
1#ifndef __OPKELE_BASIC_RP_H 1#ifndef __OPKELE_BASIC_RP_H
2#define __OPKELE_BASIC_RP_H 2#define __OPKELE_BASIC_RP_H
3 3
4#include <cstring>
5#include <string> 4#include <string>
6#include <opkele/types.h> 5#include <opkele/types.h>
7#include <opkele/extension.h> 6#include <opkele/extension.h>
8 7
9namespace opkele { 8namespace opkele {
10 using std::string; 9 using std::string;
11 10
12 struct openid_endpoint_t {
13 string uri;
14 string claimed_id;
15 string local_id;
16
17 openid_endpoint_t() { }
18 openid_endpoint_t(const string& u,const string& cid,const string& lid)
19 : uri(u), claimed_id(cid), local_id(lid) { }
20
21 bool operator==(const openid_endpoint_t& x) const {
22 return uri==x.uri && local_id==x.local_id; }
23 bool operator<(const openid_endpoint_t& x) const {
24 int c;
25 return (c=strcmp(uri.c_str(),x.uri.c_str()))
26 ? (c<0) : (strcmp(local_id.c_str(),x.local_id.c_str())<0); }
27 };
28
29 class basic_RP { 11 class basic_RP {
30 public: 12 public:
31 13
32 virtual ~basic_RP() { } 14 virtual ~basic_RP() { }
33 15
34 /** 16 /**
35 * @name Global persistent store API 17 * @name Global persistent store API
36 * These are functions related to the associations with OP storage 18 * These are functions related to the associations with OP storage
37 * and retrieval and nonce records. They provide an interface to 19 * and retrieval and nonce records. They provide an interface to
38 * the persistent storage which is shared by all sessions. If the 20 * the persistent storage which is shared by all sessions. If the
39 * implementor prefers the dumb mode instead, the function should 21 * implementor prefers the dumb mode instead, the function should
40 * throw dumb_RP exception instead. 22 * throw dumb_RP exception instead.
41 * @see opkele::dumb_RP 23 * @see opkele::dumb_RP
42 * @{ 24 * @{
43 */ 25 */
44 /** 26 /**
45 * Store association and return allocated association object. 27 * Store association and return allocated association object.
46 * @param OP OP endpoint 28 * @param OP OP endpoint
47 * @param handle association handle 29 * @param handle association handle
48 * @param type association type 30 * @param type association type
49 * @param secret association secret 31 * @param secret association secret
50 * @params expires_in the number of seconds association expires in 32 * @params expires_in the number of seconds association expires in
51 * @return the association object 33 * @return the association object
52 * @throw dumb_RP for dumb RP 34 * @throw dumb_RP for dumb RP
diff --git a/include/opkele/types.h b/include/opkele/types.h
index 5d39a5c..6ab51ef 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -1,32 +1,33 @@
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 <ostream> 10#include <ostream>
10#include <vector> 11#include <vector>
11#include <string> 12#include <string>
12#include <map> 13#include <map>
13#include <set> 14#include <set>
14#include <list> 15#include <list>
15#include <opkele/iterator.h> 16#include <opkele/iterator.h>
16#include <opkele/tr1-mem.h> 17#include <opkele/tr1-mem.h>
17 18
18namespace opkele { 19namespace opkele {
19 using std::vector; 20 using std::vector;
20 using std::string; 21 using std::string;
21 using std::map; 22 using std::map;
22 using std::ostream; 23 using std::ostream;
23 using std::multimap; 24 using std::multimap;
24 using std::set; 25 using std::set;
25 using std::list; 26 using std::list;
26 using std::iterator; 27 using std::iterator;
27 using std::forward_iterator_tag; 28 using std::forward_iterator_tag;
28 29
29 /** 30 /**
30 * the OpenID operation mode 31 * the OpenID operation mode
31 */ 32 */
32 typedef enum _mode_t { 33 typedef enum _mode_t {
@@ -185,27 +186,44 @@ namespace opkele {
185 * @return true if yes 186 * @return true if yes
186 */ 187 */
187 bool has_param(const string& n) const { 188 bool has_param(const string& n) const {
188 return has_field(n); } 189 return has_field(n); }
189 /** 190 /**
190 * retrieve the parameter (const version) 191 * retrieve the parameter (const version)
191 * @param n the parameter name 192 * @param n the parameter name
192 * @return the parameter value 193 * @return the parameter value
193 * @throw failed_lookup if there is no such parameter 194 * @throw failed_lookup if there is no such parameter
194 */ 195 */
195 const string& get_param(const string& n) const { 196 const string& get_param(const string& n) const {
196 return get_field(n); } 197 return get_field(n); }
197 198
198 /** 199 /**
199 * parse the OpenID key/value data. 200 * parse the OpenID key/value data.
200 * @param kv the OpenID key/value data 201 * @param kv the OpenID key/value data
201 */ 202 */
202 void parse_keyvalues(const string& kv) { 203 void parse_keyvalues(const string& kv) {
203 from_keyvalues(kv); } 204 from_keyvalues(kv); }
204 205
205 string append_query(const string& url,const char *prefix="openid.") const; 206 string append_query(const string& url,const char *prefix="openid.") const;
206 207
207 }; 208 };
208 209
210 struct openid_endpoint_t {
211 string uri;
212 string claimed_id;
213 string local_id;
214
215 openid_endpoint_t() { }
216 openid_endpoint_t(const string& u,const string& cid,const string& lid)
217 : uri(u), claimed_id(cid), local_id(lid) { }
218
219 bool operator==(const openid_endpoint_t& x) const {
220 return uri==x.uri && local_id==x.local_id; }
221 bool operator<(const openid_endpoint_t& x) const {
222 int c;
223 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 };
226
209} 227}
210 228
211#endif /* __OPKELE_TYPES_H */ 229#endif /* __OPKELE_TYPES_H */