summaryrefslogtreecommitdiffabout
path: root/include/opkele/types.h
authorMichael Krelin <hacker@klever.net>2007-12-09 17:22:06 (UTC)
committer Michael Krelin <hacker@klever.net>2007-12-09 22:08:24 (UTC)
commitc34adc6e274c3dbb63af99ca566000e7d218244c (patch) (side-by-side diff)
tree705624c208deb4eaf8d07c119a883e6f4f35236e /include/opkele/types.h
parent60fdaff7888b455b4d07eadc905cefd20f1ddd3c (diff)
downloadlibopkele-c34adc6e274c3dbb63af99ca566000e7d218244c.zip
libopkele-c34adc6e274c3dbb63af99ca566000e7d218244c.tar.gz
libopkele-c34adc6e274c3dbb63af99ca566000e7d218244c.tar.bz2
reworked identity resolution and service discovery
The discovery, which does both XRDS-based (Yadis, XRI, for XRI, using proxy) and HTML-based search, now returns results in opkele:idiscovery_t structure. It uses expat-based parser idigger_t, which itself is not exposed via any header files, but hidden in lib/discovery.cc, the discovery testing program is renamed from openid_resolve to idiscover. Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'include/opkele/types.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/types.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h
index f732a1e..520618d 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -11,6 +11,7 @@
#include <string>
#include <map>
#include <memory>
+#include <set>
namespace opkele {
using std::vector;
@@ -18,6 +19,8 @@ namespace opkele {
using std::map;
using std::ostream;
using std::auto_ptr;
+ using std::multimap;
+ using std::set;
/**
* the OpenID operation mode
@@ -167,6 +170,66 @@ namespace opkele {
*/
ostream& operator << (ostream& o,const params_t& p);
+ namespace xrd {
+
+ struct priority_compare {
+ inline bool operator()(long a,long b) const {
+ return (a<0) ? false : (b<0) ? false : (a<b);
+ }
+ };
+
+ template <typename _DT>
+ class priority_map : public multimap<long,_DT,priority_compare> {
+ typedef multimap<long,_DT,priority_compare> map_type;
+ public:
+
+ inline _DT& add(long priority,const _DT& d) {
+ return insert(typename map_type::value_type(priority,d))->second;
+ }
+ };
+
+ typedef priority_map<string> canonical_ids_t;
+ typedef priority_map<string> local_ids_t;
+ typedef set<string> types_t;
+ typedef priority_map<string> uris_t;
+
+ class service_t {
+ public:
+ types_t types;
+ uris_t uris;
+ local_ids_t local_ids;
+
+ void clear() {
+ types.clear();
+ uris.clear(); local_ids.clear();
+ }
+ };
+ typedef priority_map<service_t> services_t;
+
+ class XRD_t {
+ public:
+ time_t expires;
+
+ canonical_ids_t canonical_ids;
+ local_ids_t local_ids;
+ services_t services;
+
+ void clear() {
+ expires = 0;
+ canonical_ids.clear(); local_ids.clear();
+ services.clear();
+ }
+ bool empty() const {
+ return
+ canonical_ids.empty()
+ && local_ids.empty()
+ && services.empty();
+ }
+
+ };
+
+ }
+
}
#endif /* __OPKELE_TYPES_H */