author | Michael Krelin <hacker@klever.net> | 2008-02-03 15:29:07 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-02-03 15:29:07 (UTC) |
commit | 23a6d48436e24d3d145b742984ef68ec3bae2bfd (patch) (unidiff) | |
tree | 9cd085f583f4235e4f21e640cfc1b1ab1fb04b06 /include/opkele | |
parent | d1c45af16b3bd31f65d03eec0fcd1c61b4d69fb0 (diff) | |
download | libopkele-23a6d48436e24d3d145b742984ef68ec3bae2bfd.zip libopkele-23a6d48436e24d3d145b742984ef68ec3bae2bfd.tar.gz libopkele-23a6d48436e24d3d145b742984ef68ec3bae2bfd.tar.bz2 |
added provisions for discovery on RP
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | include/opkele/discovery.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/opkele/discovery.h b/include/opkele/discovery.h index 677d7bb..4471597 100644 --- a/include/opkele/discovery.h +++ b/include/opkele/discovery.h | |||
@@ -1,30 +1,29 @@ | |||
1 | #ifndef __OPKELE_DISCOVERY_H | 1 | #ifndef __OPKELE_DISCOVERY_H |
2 | #define __OPKELE_DISCOVERY_H | 2 | #define __OPKELE_DISCOVERY_H |
3 | 3 | ||
4 | #include <string> | 4 | #include <string> |
5 | #include <opkele/types.h> | 5 | #include <opkele/types.h> |
6 | #include <opkele/basic_rp.h> | ||
7 | 6 | ||
8 | namespace opkele { | 7 | namespace opkele { |
9 | using std::string; | 8 | using std::string; |
10 | 9 | ||
11 | namespace xrd { | 10 | namespace xrd { |
12 | 11 | ||
13 | struct priority_compare { | 12 | struct priority_compare { |
14 | inline bool operator()(long a,long b) const { | 13 | inline bool operator()(long a,long b) const { |
15 | return (a<0) ? false : (b<0) ? true : (a<b); | 14 | return (a<0) ? false : (b<0) ? true : (a<b); |
16 | } | 15 | } |
17 | }; | 16 | }; |
18 | 17 | ||
19 | template <typename _DT> | 18 | template <typename _DT> |
20 | class priority_map : public multimap<long,_DT,priority_compare> { | 19 | class priority_map : public multimap<long,_DT,priority_compare> { |
21 | typedef multimap<long,_DT,priority_compare> map_type; | 20 | typedef multimap<long,_DT,priority_compare> map_type; |
22 | public: | 21 | public: |
23 | 22 | ||
24 | inline _DT& add(long priority,const _DT& d) { | 23 | inline _DT& add(long priority,const _DT& d) { |
25 | return insert(typename map_type::value_type(priority,d))->second; | 24 | return insert(typename map_type::value_type(priority,d))->second; |
26 | } | 25 | } |
27 | 26 | ||
28 | bool has_value(const _DT& d) const { | 27 | bool has_value(const _DT& d) const { |
29 | for(typename map_type::const_iterator i=this->begin();i!=this->end();++i) | 28 | for(typename map_type::const_iterator i=this->begin();i!=this->end();++i) |
30 | if(i->second==d) return true; | 29 | if(i->second==d) return true; |
@@ -71,42 +70,46 @@ namespace opkele { | |||
71 | 70 | ||
72 | void clear() { | 71 | void clear() { |
73 | expires = 0; | 72 | expires = 0; |
74 | canonical_ids.clear(); local_ids.clear(); | 73 | canonical_ids.clear(); local_ids.clear(); |
75 | services.clear(); | 74 | services.clear(); |
76 | provider_id.clear(); | 75 | provider_id.clear(); |
77 | } | 76 | } |
78 | bool empty() const { | 77 | bool empty() const { |
79 | return | 78 | return |
80 | canonical_ids.empty() | 79 | canonical_ids.empty() |
81 | && local_ids.empty() | 80 | && local_ids.empty() |
82 | && services.empty(); | 81 | && services.empty(); |
83 | } | 82 | } |
84 | 83 | ||
85 | }; | 84 | }; |
86 | 85 | ||
87 | } | 86 | } |
88 | 87 | ||
89 | typedef util::output_iterator_proxy<openid_endpoint_t> | 88 | typedef util::output_iterator_proxy<openid_endpoint_t> |
90 | endpoint_discovery_iterator; | 89 | endpoint_discovery_iterator; |
91 | 90 | ||
92 | string idiscover( | 91 | string idiscover( |
93 | endpoint_discovery_iterator oi, | 92 | endpoint_discovery_iterator oi, |
94 | const string& identity); | 93 | const string& identity); |
94 | void yadiscover( | ||
95 | endpoint_discovery_iterator oi, | ||
96 | const string& yurl, | ||
97 | const char **types, bool redirs=false); | ||
95 | 98 | ||
96 | struct idiscovery_t { | 99 | struct idiscovery_t { |
97 | bool xri_identity; | 100 | bool xri_identity; |
98 | string normalized_id; | 101 | string normalized_id; |
99 | string canonicalized_id; | 102 | string canonicalized_id; |
100 | xrd::XRD_t xrd; | 103 | xrd::XRD_t xrd; |
101 | 104 | ||
102 | idiscovery_t() { } | 105 | idiscovery_t() { } |
103 | 106 | ||
104 | void clear() { | 107 | void clear() { |
105 | normalized_id.clear(); canonicalized_id.clear(); | 108 | normalized_id.clear(); canonicalized_id.clear(); |
106 | xrd.clear(); | 109 | xrd.clear(); |
107 | } | 110 | } |
108 | 111 | ||
109 | }; | 112 | }; |
110 | } | 113 | } |
111 | 114 | ||
112 | #endif /* __OPKELE_DISCOVERY_H */ | 115 | #endif /* __OPKELE_DISCOVERY_H */ |