summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAnas Nashif <nashif@intel.com>2008-03-03 19:50:31 +0000
committerAnas Nashif <nashif@intel.com>2008-03-03 19:50:31 +0000
commit6a0fa43a4e637718e923a8e4b3f1b2fe9f5338ce (patch)
tree8bcf998e897592b328543d76bbe8f1f06a6b4d51 /examples
parent49996770e4878592a3ceca9c48736a4d9774b873 (diff)
downloadwsmancli-6a0fa43a4e637718e923a8e4b3f1b2fe9f5338ce.tar.gz
wsmancli-6a0fa43a4e637718e923a8e4b3f1b2fe9f5338ce.tar.xz
wsmancli-6a0fa43a4e637718e923a8e4b3f1b2fe9f5338ce.zip
update with new API support complex filters
Diffstat (limited to 'examples')
-rw-r--r--examples/enum_epr.c44
-rw-r--r--examples/win32_service.c2
2 files changed, 23 insertions, 23 deletions
diff --git a/examples/enum_epr.c b/examples/enum_epr.c
index 88805b5..7b94942 100644
--- a/examples/enum_epr.c
+++ b/examples/enum_epr.c
@@ -54,44 +54,44 @@ typedef struct __WsmanEpr WsmanEpr;
static int collect_epr(WsManClient *cl, WsXmlDocH doc, void *data)
{
-
+
if (!doc) {
return 0;
}
list_t *list = (list_t *)data;
WsXmlNodeH resource_uri_node, node1, node2, node3, node4;
-
+
WsmanEpr *epr = (WsmanEpr *)u_zalloc(sizeof(WsmanEpr));
WsXmlNodeH body = ws_xml_get_soap_body(doc);
-
+
if (body != NULL)
node1 = ws_xml_get_child(body, 0, XML_NS_ENUMERATION, WSENUM_PULL_RESP);
- else
+ else
return 0;
-
+
if (node1 != NULL )
node2 = ws_xml_get_child(node1, 0, XML_NS_ENUMERATION, WSENUM_ITEMS);
else
return 0;
- if (node2 != NULL)
+ if (node2 != NULL)
node3 = ws_xml_get_child(node2, 0, XML_NS_ADDRESSING, WSA_EPR);
else
return 0;
- if (node3 != NULL)
+ if (node3 != NULL)
node4 = ws_xml_get_child(node3, 0, XML_NS_ADDRESSING, WSA_REFERENCE_PARAMETERS);
else
return 0;
-
- if (node4 != NULL)
+
+ if (node4 != NULL)
resource_uri_node = ws_xml_get_child(node4, 0, XML_NS_WS_MAN, WSM_RESOURCE_URI);
else
return 0;
-
+
if (resource_uri_node != NULL) {
epr->resource_uri = u_strdup(ws_xml_get_node_text(resource_uri_node));
} else {
@@ -108,14 +108,14 @@ static int collect_epr(WsManClient *cl, WsXmlDocH doc, void *data)
char* attrVal = ws_xml_find_attr_value(selector, XML_NS_WS_MAN, WSM_NAME);
if ( attrVal == NULL )
attrVal = ws_xml_find_attr_value(selector, NULL, WSM_NAME);
-
+
if ( attrVal ) {
if (!hash_alloc_insert(epr->selectors, u_strdup(attrVal), u_strdup(ws_xml_get_node_text(selector)))) {
error("hash_alloc_insert failed");
}
}
}
-
+
}
lnode_t *n = lnode_create(epr);
@@ -128,7 +128,7 @@ static int collect_epr(WsManClient *cl, WsXmlDocH doc, void *data)
int main(int argc, char** argv)
{
-
+
WsManClient *cl;
client_opt_t *options;
char retval = 0;
@@ -141,7 +141,7 @@ int main(int argc, char** argv)
{ NULL }
};
- u_option_context_t *opt_ctx;
+ u_option_context_t *opt_ctx;
opt_ctx = u_option_context_new("");
u_option_context_set_ignore_unknown_options(opt_ctx, FALSE);
u_option_context_add_main_entries(opt_ctx, opt, "Win32 Service");
@@ -173,17 +173,17 @@ int main(int argc, char** argv)
uri->path,
uri->scheme,
uri->user,
- uri->pwd);
+ uri->pwd);
wsmc_transport_init(cl, NULL);
options = wsmc_options_init();
wsmc_set_action_option(options, FLAG_ENUMERATION_ENUM_EPR);
-
+
list_t *l = list_create(LISTCOUNT_T_MAX);
- wsmc_action_enumerate_and_pull(cl, argv[1] , options, collect_epr, l );
-
-
+ wsmc_action_enumerate_and_pull(cl, argv[1] , options, NULL, collect_epr, l );
+
+
printf("returned items: %d\n", (int)list_count(l));
lnode_t *node = list_first(l);
while(node) {
@@ -197,14 +197,14 @@ int main(int argc, char** argv)
printf("\t%s = %s\n", (char*) hnode_getkey(hn),
(char*) hnode_get(hn) );
}
-
+
node = list_next (l, node);
- }
+ }
if (uri) {
u_uri_free(uri);
}
-
+
wsmc_options_destroy(options);
wsmc_release(cl);
return 0;
diff --git a/examples/win32_service.c b/examples/win32_service.c
index 5c96e4e..6c37ec7 100644
--- a/examples/win32_service.c
+++ b/examples/win32_service.c
@@ -246,7 +246,7 @@ int main(int argc, char** argv)
if (listall) {
if (dump) wsmc_set_action_option(options,FLAG_DUMP_REQUEST );
- wsmc_action_enumerate_and_pull(cl, RESOURCE_URI, options, list_services, NULL );
+ wsmc_action_enumerate_and_pull(cl, RESOURCE_URI, options, NULL, list_services, NULL );
} else if (start && argv[1]) {
if (dump) wsmc_set_action_option(options,FLAG_DUMP_REQUEST );
wsmc_add_selector(options, "Name", argv[1]);