summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/types.h4
-rw-r--r--lib/discovery.cc6
2 files changed, 10 insertions, 0 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h
index d959021..4e1415f 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -196,44 +196,48 @@ namespace opkele {
196 }; 196 };
197 197
198 typedef priority_map<string> canonical_ids_t; 198 typedef priority_map<string> canonical_ids_t;
199 typedef priority_map<string> local_ids_t; 199 typedef priority_map<string> local_ids_t;
200 typedef set<string> types_t; 200 typedef set<string> types_t;
201 typedef priority_map<string> uris_t; 201 typedef priority_map<string> uris_t;
202 202
203 class service_t { 203 class service_t {
204 public: 204 public:
205 types_t types; 205 types_t types;
206 uris_t uris; 206 uris_t uris;
207 local_ids_t local_ids; 207 local_ids_t local_ids;
208 string provider_id;
208 209
209 void clear() { 210 void clear() {
210 types.clear(); 211 types.clear();
211 uris.clear(); local_ids.clear(); 212 uris.clear(); local_ids.clear();
213 provider_id.clear();
212 } 214 }
213 }; 215 };
214 typedef priority_map<service_t> services_t; 216 typedef priority_map<service_t> services_t;
215 217
216 class XRD_t { 218 class XRD_t {
217 public: 219 public:
218 time_t expires; 220 time_t expires;
219 221
220 canonical_ids_t canonical_ids; 222 canonical_ids_t canonical_ids;
221 local_ids_t local_ids; 223 local_ids_t local_ids;
222 services_t services; 224 services_t services;
225 string provider_id;
223 226
224 void clear() { 227 void clear() {
225 expires = 0; 228 expires = 0;
226 canonical_ids.clear(); local_ids.clear(); 229 canonical_ids.clear(); local_ids.clear();
227 services.clear(); 230 services.clear();
231 provider_id.clear();
228 } 232 }
229 bool empty() const { 233 bool empty() const {
230 return 234 return
231 canonical_ids.empty() 235 canonical_ids.empty()
232 && local_ids.empty() 236 && local_ids.empty()
233 && services.empty(); 237 && services.empty();
234 } 238 }
235 239
236 }; 240 };
237 241
238 } 242 }
239 243
diff --git a/lib/discovery.cc b/lib/discovery.cc
index bc7d6fb..81727c0 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -227,24 +227,27 @@ namespace opkele {
227 }else{ 227 }else{
228 skipping = -1; 228 skipping = -1;
229 } 229 }
230 }else{ 230 }else{
231 int pt_s = pt_stack.size(); 231 int pt_s = pt_stack.size();
232 if(pt_s==1) { 232 if(pt_s==1) {
233 if(is_qelement(n,NSURI_XRD "\tCanonicalID")) { 233 if(is_qelement(n,NSURI_XRD "\tCanonicalID")) {
234 assert(xrd); 234 assert(xrd);
235 cdata = &(xrd->canonical_ids.add(element_priority(a),string())); 235 cdata = &(xrd->canonical_ids.add(element_priority(a),string()));
236 }else if(is_qelement(n,NSURI_XRD "\tLocalID")) { 236 }else if(is_qelement(n,NSURI_XRD "\tLocalID")) {
237 assert(xrd); 237 assert(xrd);
238 cdata = &(xrd->local_ids.add(element_priority(a),string())); 238 cdata = &(xrd->local_ids.add(element_priority(a),string()));
239 }else if(is_qelement(n,NSURI_XRD "\tProviderID")) {
240 assert(xrd);
241 cdata = &(xrd->provider_id);
239 }else if(is_qelement(n,NSURI_XRD "\tService")) { 242 }else if(is_qelement(n,NSURI_XRD "\tService")) {
240 assert(xrd); 243 assert(xrd);
241 xrd_service = &(xrd->services.add(element_priority(a), 244 xrd_service = &(xrd->services.add(element_priority(a),
242 service_t())); 245 service_t()));
243 pt_stack.push_back(n); 246 pt_stack.push_back(n);
244 }else if(is_qelement(n,NSURI_XRD "\tStatus")) { 247 }else if(is_qelement(n,NSURI_XRD "\tStatus")) {
245 for(;*a;) { 248 for(;*a;) {
246 if(!strcasecmp(*(a++),"code")) { 249 if(!strcasecmp(*(a++),"code")) {
247 if(sscanf(*(a++),"%ld",&status_code)==1 && status_code!=100) { 250 if(sscanf(*(a++),"%ld",&status_code)==1 && status_code!=100) {
248 cdata = &status_string; 251 cdata = &status_string;
249 pt_stack.push_back(n); 252 pt_stack.push_back(n);
250 break; 253 break;
@@ -264,24 +267,27 @@ namespace opkele {
264 if(is_qelement(pt_stack.back().c_str(), NSURI_XRD "\tService")) { 267 if(is_qelement(pt_stack.back().c_str(), NSURI_XRD "\tService")) {
265 if(is_qelement(n,NSURI_XRD "\tType")) { 268 if(is_qelement(n,NSURI_XRD "\tType")) {
266 assert(xrd); assert(xrd_service); 269 assert(xrd); assert(xrd_service);
267 cdata_buf.clear(); 270 cdata_buf.clear();
268 cdata = &cdata_buf; 271 cdata = &cdata_buf;
269 }else if(is_qelement(n,NSURI_XRD "\tURI")) { 272 }else if(is_qelement(n,NSURI_XRD "\tURI")) {
270 assert(xrd); assert(xrd_service); 273 assert(xrd); assert(xrd_service);
271 cdata = &(xrd_service->uris.add(element_priority(a),string())); 274 cdata = &(xrd_service->uris.add(element_priority(a),string()));
272 }else if(is_qelement(n,NSURI_XRD "\tLocalID") 275 }else if(is_qelement(n,NSURI_XRD "\tLocalID")
273 || is_qelement(n,NSURI_OPENID10 "\tDelegate") ) { 276 || is_qelement(n,NSURI_OPENID10 "\tDelegate") ) {
274 assert(xrd); assert(xrd_service); 277 assert(xrd); assert(xrd_service);
275 cdata = &(xrd_service->local_ids.add(element_priority(a),string())); 278 cdata = &(xrd_service->local_ids.add(element_priority(a),string()));
279 }else if(is_qelement(n,NSURI_XRD "\tProviderID")) {
280 assert(xrd); assert(xrd_service);
281 cdata = &(xrd_service->provider_id);
276 }else{ 282 }else{
277 skipping = 1; 283 skipping = 1;
278 } 284 }
279 }else 285 }else
280 skipping = 1; 286 skipping = 1;
281 }else if(xmode&xmode_html) { 287 }else if(xmode&xmode_html) {
282 html_start_element(n,a); 288 html_start_element(n,a);
283 }else{ 289 }else{
284 skipping = 1; 290 skipping = 1;
285 } 291 }
286 } 292 }
287 } 293 }