From e1733517e5958b3850d3f0353ed43699712b9398 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 29 Mar 2007 22:51:38 +0000 Subject: merged changes by Sumeet: references --- src/wsman-client-options.c | 1 + src/wsman.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'src') diff --git a/src/wsman-client-options.c b/src/wsman-client-options.c index a2e0226..c8ddebf 100644 --- a/src/wsman-client-options.c +++ b/src/wsman-client-options.c @@ -112,6 +112,7 @@ WsActions action_data[] = { {"create", WSMAN_ACTION_TRANSFER_CREATE}, {"delete", WSMAN_ACTION_TRANSFER_DELETE}, {"enumerate", WSMAN_ACTION_ENUMERATION}, + { "references", WSMAN_ACTION_ENUMERATE_REFERENCE_INSTANCES}, {"pull", WSMAN_ACTION_PULL}, {"release", WSMAN_ACTION_RELEASE}, {"invoke", WSMAN_ACTION_CUSTOM}, diff --git a/src/wsman.c b/src/wsman.c index f613ad6..69c4e5a 100644 --- a/src/wsman.c +++ b/src/wsman.c @@ -103,6 +103,7 @@ int main(int argc, char **argv) WsXmlDocH rqstDoc; actionOptions *options; WsXmlDocH enum_response; + WsXmlDocH reference_response; WsXmlDocH resource; char *enumeration_mode, *binding_enumeration_mode, *resource_uri_with_selectors; @@ -357,6 +358,40 @@ int main(int argc, char **argv) } u_free(enumContext); break; + case WSMAN_ACTION_ENUMERATE_REFERENCE_INSTANCES: + fprintf(stderr, "Enumerate Reference Instances. resource_uri: %s\n", resource_uri); + reference_response = wsenum_reference_instances(cl, resource_uri, options); + wsman_output(cl, reference_response); + if (reference_response) { + if (!(wsman_client_get_response_code(cl) == 200 || + wsman_client_get_response_code(cl) == 400 || + wsman_client_get_response_code(cl) == 500)) { + break; + } + enumContext = wsenum_get_enum_context(reference_response); + ws_xml_destroy_doc(reference_response); + } else { + break; + } + + if (!wsman_options_get_step_request()) { + while (enumContext != NULL && enumContext[0] != 0) { + + doc = wsenum_pull(cl, resource_uri, options, enumContext); + wsman_output(cl, doc); + + if (wsman_client_get_response_code(cl) != 200 && + wsman_client_get_response_code(cl) != 400 && + wsman_client_get_response_code(cl) != 500) { + break; + } + enumContext = wsenum_get_enum_context(doc); + if (doc) { + ws_xml_destroy_doc(doc); + } + } + } + break; default: fprintf(stderr, "Action not supported\n"); retVal = 1; -- cgit