diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2005-08-29 14:20:44 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2005-08-29 14:20:44 +0000 |
| commit | ea4fea07caa8c194faebcadca48d88a02312b0db (patch) | |
| tree | d1cca8fe1f1cc7853468972a2fb6574a49f32cd5 | |
| parent | c277ec7c61db1b4b8e9669d0a160bb9fa27b6e00 (diff) | |
| download | lasso-ea4fea07caa8c194faebcadca48d88a02312b0db.tar.gz lasso-ea4fea07caa8c194faebcadca48d88a02312b0db.tar.xz lasso-ea4fea07caa8c194faebcadca48d88a02312b0db.zip | |
Added lasso_discovery_get_service_with_providerId()..
| -rw-r--r-- | lasso/id-wsf/discovery.c | 39 | ||||
| -rw-r--r-- | lasso/id-wsf/discovery.h | 4 | ||||
| -rw-r--r-- | swig/Lasso-wsf.i | 4 |
3 files changed, 47 insertions, 0 deletions
diff --git a/lasso/id-wsf/discovery.c b/lasso/id-wsf/discovery.c index a4c4459f..56fe1222 100644 --- a/lasso/id-wsf/discovery.c +++ b/lasso/id-wsf/discovery.c @@ -712,6 +712,45 @@ lasso_discovery_get_service(LassoDiscovery *discovery, const char *service_type) return service; } +LassoDataService* +lasso_discovery_get_service_with_providerId(LassoDiscovery *discovery, const char *providerId) +{ + LassoDiscoQueryResponse *response; + GList *iter; + LassoDiscoResourceOffering *offering = NULL; + LassoDataService *service; + + response = LASSO_DISCO_QUERY_RESPONSE(LASSO_WSF_PROFILE(discovery)->response); + iter = response->ResourceOffering; + if (iter == NULL) { + return NULL; /* resource not found */ + } + + while (iter) { + LassoDiscoResourceOffering *t = iter->data; + iter = g_list_next(iter); + if (t->ServiceInstance == NULL) + continue; + if (strcmp(t->ServiceInstance->ProviderID, providerId) == 0) { + offering = t; + break; + } + } + if (offering == NULL) { + return NULL; /* resource not found */ + } + + if (strcmp(offering->ServiceInstance->ServiceType, LASSO_PP_HREF) == 0) { + service = LASSO_DATA_SERVICE(lasso_personal_profile_service_new( + LASSO_WSF_PROFILE(discovery)->server, offering)); + } else { + service = lasso_data_service_new_full(LASSO_WSF_PROFILE(discovery)->server, + offering); + } + + return service; +} + /*****************************************************************************/ /* private methods */ diff --git a/lasso/id-wsf/discovery.h b/lasso/id-wsf/discovery.h index 49842c2c..f09402c4 100644 --- a/lasso/id-wsf/discovery.h +++ b/lasso/id-wsf/discovery.h @@ -122,6 +122,10 @@ LASSO_EXPORT gint lasso_discovery_process_query_response_msg(LassoDiscovery *dis LASSO_EXPORT LassoDataService* lasso_discovery_get_service(LassoDiscovery *discovery, const char *service_type); +LASSO_EXPORT LassoDataService* lasso_discovery_get_service_with_providerId( + LassoDiscovery *discovery, + const char *providerId); + LASSO_EXPORT LassoDiscoDescription* lasso_discovery_get_description_auto( LassoDiscoResourceOffering *offering, gchar *security_mech); #ifdef __cplusplus diff --git a/swig/Lasso-wsf.i b/swig/Lasso-wsf.i index 81e26781..c3e3cf6a 100644 --- a/swig/Lasso-wsf.i +++ b/swig/Lasso-wsf.i @@ -294,6 +294,9 @@ typedef struct { %newobject getService; LassoDataService* getService(const char *service_type = NULL); + + %newobject getServiceWithProviderId; + LassoDataService* getServiceWithProviderId(const char *service_type = NULL); } %{ @@ -408,6 +411,7 @@ int LassoDiscovery_setSessionFromDump(LassoDiscovery *self, char *dump) { #define LassoDiscovery_processQueryMsg lasso_discovery_process_query_msg #define LassoDiscovery_processQueryResponseMsg lasso_discovery_process_query_response_msg #define LassoDiscovery_getService(self, type) get_node(lasso_discovery_get_service(self, type)) +#define LassoDiscovery_getServiceWithProviderId(self, providerId) get_node(lasso_discovery_get_service_with_providerId(self, providerId)) %} |
