summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Laniel <dlaniel@entrouvert.com>2007-06-07 10:20:45 +0000
committerDamien Laniel <dlaniel@entrouvert.com>2007-06-07 10:20:45 +0000
commitcb00d56e4efd8ae21c05024fdd040edd7f42d73d (patch)
treeb1a683737bf53f747645f07a7b9771b1f3032af0
parent3d445940778f8cab095f03445d81a89a3204fe9d (diff)
downloadlasso-cb00d56e4efd8ae21c05024fdd040edd7f42d73d.tar.gz
lasso-cb00d56e4efd8ae21c05024fdd040edd7f42d73d.tar.xz
lasso-cb00d56e4efd8ae21c05024fdd040edd7f42d73d.zip
added lasso_idwsf2_data_service_get_attribute_node
-rw-r--r--lasso/id-wsf-2.0/data_service.c42
-rw-r--r--lasso/id-wsf-2.0/data_service.h3
-rw-r--r--lasso/xml/xml.c2
-rw-r--r--swig/Lasso-wsf2.i5
4 files changed, 52 insertions, 0 deletions
diff --git a/lasso/id-wsf-2.0/data_service.c b/lasso/id-wsf-2.0/data_service.c
index 02a7af56..56937efd 100644
--- a/lasso/id-wsf-2.0/data_service.c
+++ b/lasso/id-wsf-2.0/data_service.c
@@ -227,6 +227,48 @@ lasso_idwsf2_data_service_process_query_response_msg(LassoIdWsf2DataService *ser
return 0;
}
+xmlNode*
+lasso_idwsf2_data_service_get_attribute_node(LassoIdWsf2DataService *service,
+ const gchar *item_id)
+{
+ LassoWsf2Profile *profile = LASSO_WSF2_PROFILE(service);
+ LassoIdWsf2DstRefQueryResponse *response;
+ LassoIdWsf2DstRefItemData *data = NULL;
+ GList *iter;
+
+ response = LASSO_IDWSF2_DSTREF_QUERY_RESPONSE(profile->response);
+
+ /* If no item_id is given, return the first item */
+ if (item_id == NULL && response->Data != NULL && response->Data->data != NULL) {
+ data = LASSO_IDWSF2_DSTREF_ITEM_DATA(response->Data->data);
+ if (data->any != NULL && data->any->data != NULL) {
+ return xmlCopyNode(data->any->data, 1);
+ }
+ }
+ if (item_id == NULL) {
+ return NULL;
+ }
+
+ /* Find the item which has the given item_id */
+ for (iter = g_list_first(response->Data); iter != NULL; iter = g_list_next(iter)) {
+ if (iter->data == NULL) {
+ continue;
+ }
+ if (strcmp(LASSO_IDWSF2_DSTREF_ITEM_DATA(iter->data)->itemIDRef, item_id) == 0) {
+ data = LASSO_IDWSF2_DSTREF_ITEM_DATA(iter->data);
+ break;
+ }
+ }
+
+ if (data == NULL || data->any == NULL || data->any->data == NULL) {
+ /* Item not found */
+ return NULL;
+ }
+
+ /* XXX: there may be more than one xmlnode */
+ return xmlCopyNode(data->any->data, 1);
+}
+
/*****************************************************************************/
/* private methods */
/*****************************************************************************/
diff --git a/lasso/id-wsf-2.0/data_service.h b/lasso/id-wsf-2.0/data_service.h
index 2b3717a1..bfcb7a3a 100644
--- a/lasso/id-wsf-2.0/data_service.h
+++ b/lasso/id-wsf-2.0/data_service.h
@@ -91,6 +91,9 @@ LASSO_EXPORT gint lasso_idwsf2_data_service_build_query_response_msg(
LASSO_EXPORT gint lasso_idwsf2_data_service_process_query_response_msg(
LassoIdWsf2DataService *service, const gchar *message);
+LASSO_EXPORT xmlNode* lasso_idwsf2_data_service_get_attribute_node(LassoIdWsf2DataService *service,
+ const gchar *item_id);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index 939bac5d..a99c7c1a 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -1504,6 +1504,8 @@ lasso_node_new_from_xmlNode(xmlNode *xmlnode)
typename = g_strdup("LassoSaml2EncryptedElement");
} else if (strcmp(node_name, "SvcMD") == 0) {
typename = g_strdup("LassoIdWsf2DiscoSvcMetadata");
+ } else if (strcmp(prefix, "IdWsf2DstRef") == 0 && strcmp(node_name, "Status") == 0) {
+ typename = g_strdup("LassoIdWsf2UtilStatus");
} else {
typename = g_strdup_printf("Lasso%s%s", prefix, node_name);
}
diff --git a/swig/Lasso-wsf2.i b/swig/Lasso-wsf2.i
index 9b762066..f42cccb4 100644
--- a/swig/Lasso-wsf2.i
+++ b/swig/Lasso-wsf2.i
@@ -370,6 +370,9 @@ typedef struct {
THROW_ERROR()
int processQueryResponseMsg(const char *message);
END_THROW_ERROR()
+
+ %newobject getAttributeNode;
+ char* getAttributeNode(const char *item_id = NULL);
}
%{
@@ -438,6 +441,8 @@ typedef struct {
#define LassoIdWsf2DataService_processQueryMsg lasso_idwsf2_data_service_process_query_msg
#define LassoIdWsf2DataService_buildQueryResponseMsg lasso_idwsf2_data_service_build_query_response_msg
#define LassoIdWsf2DataService_processQueryResponseMsg lasso_idwsf2_data_service_process_query_response_msg
+#define LassoIdWsf2DataService_getAttributeNode(self, itemId) \
+ get_xml_string(lasso_idwsf2_data_service_get_attribute_node(self, itemId))
%}