From 5cef6368c06e3f1775943aa7c837f7676165569a Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 17 May 2007 04:54:56 +0000 Subject: reduced complexity of command line client --- src/Makefile.am | 4 +- src/wsman-client-options.c | 520 --------------------------------------------- src/wsman-client-options.h | 54 ----- src/wsman.c | 401 +++++++++++++++++++++++++++++----- 4 files changed, 343 insertions(+), 636 deletions(-) delete mode 100644 src/wsman-client-options.c delete mode 100644 src/wsman-client-options.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 0f65f4a..8b50b88 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,9 +7,7 @@ wsman_LDADD = \ $(OPENWSMAN_LIBS) \ -lwsman_curl_client_transport -wsman_SOURCES = wsman.c \ - wsman-client-options.c \ - wsman-client-options.h +wsman_SOURCES = wsman.c bin_PROGRAMS = \ wsman diff --git a/src/wsman-client-options.c b/src/wsman-client-options.c deleted file mode 100644 index 9547170..0000000 --- a/src/wsman-client-options.c +++ /dev/null @@ -1,520 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2004-2006 Intel Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * - Neither the name of Intel Corp. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *******************************************************************************/ - -/** - * @author Anas Nashif - */ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#ifdef HAVE_UNISTD_H -#include -#endif - - -#include "u/libu.h" -#include "wsman-client-api.h" -#include "wsman-client-transport.h" -#include "wsman-client-options.h" -#include "wsman-debug.h" - -#if 0 -static char *auth_methods[] = { - "basic", - "digest", - "ntlm", - NULL, -}; -#endif - -static const char **wsman_argv = NULL; - - -static int server_port = 0; -static char *cafile = NULL; -static char *username = NULL; -static char *password = NULL; -static char *server = "localhost"; -static char *agent = NULL; -static char *url_path = NULL; -static char *authentication_method = NULL; -static char verify_peer = 1; -static char verify_host = 1; -static int transport_timeout = 0; -static char *proxy = NULL; -static char *proxy_upwd = NULL; - - -static int debug_level = -1; -static char *test_case = NULL; -static int enum_max_elements = 0; -char enum_optimize = 0; -char enum_estimate = 0; -char dump_request = 0; -char step = 0; -char request_only = 0; -char cim_extensions = 0; -char cim_references = 0; -char cim_associators = 0; -static char *enum_mode = NULL; -static char *binding_enum_mode = NULL; -static char *enum_context = NULL; - - -static char *cim_namespace = NULL; -static char *fragment = NULL; -static char *wsm_filter = NULL; -static char *wsm_dialect = NULL; -static char *input = NULL; - -static unsigned long operation_timeout = 0; -static unsigned long max_envelope_size = 0; - -static char *_action = NULL; -static char *config_file = NULL; -static char *output_file = NULL; -static char *resource_uri = NULL; -static char *invoke_method = NULL; -static char **properties = NULL; - - -WsActions action_data[] = { - {"get", WSMAN_ACTION_TRANSFER_GET}, - {"put", WSMAN_ACTION_TRANSFER_PUT}, - {"create", WSMAN_ACTION_TRANSFER_CREATE}, - {"delete", WSMAN_ACTION_TRANSFER_DELETE}, - {"enumerate", WSMAN_ACTION_ENUMERATION}, - {"pull", WSMAN_ACTION_PULL}, - {"release", WSMAN_ACTION_RELEASE}, - {"invoke", WSMAN_ACTION_CUSTOM}, - {"identify", WSMAN_ACTION_IDENTIFY}, - {"test", WSMAN_ACTION_TEST}, - {NULL, 0}, -}; - -char wsman_parse_options(int argc, char **argv) -{ - - char retval = 0; - u_error_t *error = NULL; - - u_option_entry_t options[] = { - {"debug", 'd', U_OPTION_ARG_INT, &debug_level, - "Set the verbosity of debugging output.", "1-6"}, - {"cafile", 'c', U_OPTION_ARG_STRING, &cafile, - "Certificate file", ""}, - {"username", 'u', U_OPTION_ARG_STRING, &username, - "User name", ""}, - {"path", 'g', U_OPTION_ARG_STRING, &url_path, - "Path", ""}, - {"input", 'J', U_OPTION_ARG_STRING, &input, - "File with resource for Create and Put operations in XML, can be a SOAP envelope", - ""}, - {"password", 'p', U_OPTION_ARG_STRING, &password, - "Password", ""}, - {"hostname", 'h', U_OPTION_ARG_STRING, &server, - "Host name", ""}, - {"port", 'P', U_OPTION_ARG_INT, &server_port, - "Server Port", ""}, - {"proxy", 'X', U_OPTION_ARG_STRING, &proxy, - "Proxy name", ""}, - {"proxyauth", 'Y', U_OPTION_ARG_STRING, &proxy_upwd, - "Proxy user:pwd", ""}, - {"auth", 'y', U_OPTION_ARG_STRING, &authentication_method, - "Authentication Method", ""}, - {"method", 'a', U_OPTION_ARG_STRING, &invoke_method, - "Method (Works only with 'invoke')", ""}, - {"prop", 'k', U_OPTION_ARG_STRING_ARRAY, &properties, - "Properties with key value pairs (For 'put', 'invoke' and 'create')", - ""}, - {"config-file", 'C', U_OPTION_ARG_STRING, &config_file, - "Alternate configuration file", ""}, - {"out-file", 'O', U_OPTION_ARG_STRING, &output_file, - "Write output to file", ""}, - {"noverifypeer", 'V', U_OPTION_ARG_NONE, &verify_peer, - "Not to verify peer certificate", NULL}, - {"noverifyhost", 'v', U_OPTION_ARG_NONE, &verify_host, - "Not to verify hostname", NULL}, - {"transport-timeout", 'I', U_OPTION_ARG_INT, &transport_timeout, - "Transport timeout in seconds", "