summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnas Nashif <nashif@intel.com>2007-08-21 23:41:56 +0000
committerAnas Nashif <nashif@intel.com>2007-08-21 23:41:56 +0000
commitd9800d317855b9fef1608b5bdc3afdd7a87b37dd (patch)
treeaa7611ba09c88dadfb86d0bf9f5a7c2e98648d18
parent938c4bb798b18beeae59028334660f555045cdac (diff)
downloadwsmancli-d9800d317855b9fef1608b5bdc3afdd7a87b37dd.tar.gz
wsmancli-d9800d317855b9fef1608b5bdc3afdd7a87b37dd.tar.xz
wsmancli-d9800d317855b9fef1608b5bdc3afdd7a87b37dd.zip
adapt to new iniparser interface
-rw-r--r--configure.in2
-rw-r--r--examples/cpp/EnumInstance.cpp1
-rw-r--r--examples/wsmid_identify.c212
-rw-r--r--src/wsman.c6
4 files changed, 115 insertions, 106 deletions
diff --git a/configure.in b/configure.in
index c363d99..4d9bb4f 100644
--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(wsmancli, 1.2.0)
+AC_INIT(wsmancli, 1.2.9)
AC_CONFIG_SRCDIR(wsmancli.spec.in)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
diff --git a/examples/cpp/EnumInstance.cpp b/examples/cpp/EnumInstance.cpp
index 223ee75..cbb10c0 100644
--- a/examples/cpp/EnumInstance.cpp
+++ b/examples/cpp/EnumInstance.cpp
@@ -35,7 +35,6 @@ int main(int argc, char* argv[])
}
catch (GeneralWsmanException &e) {
- printf("\nError: failed while calling AMT_SOAPEventSubscriber::Delete routine\n");
printf("GeneralWsmanException:\n");
printf("%s\n", e.what());
diff --git a/examples/wsmid_identify.c b/examples/wsmid_identify.c
index f48635c..9feff1c 100644
--- a/examples/wsmid_identify.c
+++ b/examples/wsmid_identify.c
@@ -50,10 +50,10 @@ struct __wsmid_identify
typedef struct __wsmid_identify wsmid_identify;
SER_START_ITEMS(wsmid_identify)
-SER_NS_STR(XML_NS_WSMAN_ID, "ProtocolVersion", 1),
-SER_NS_STR(XML_NS_WSMAN_ID, "ProductVendor", 1),
-SER_NS_STR(XML_NS_WSMAN_ID, "ProductVersion", 1),
-SER_END_ITEMS(wsmid_identify);
+SER_NS_STR(XML_NS_WSMAN_ID, "ProtocolVersion", 1),
+ SER_NS_STR(XML_NS_WSMAN_ID, "ProductVendor", 1),
+ SER_NS_STR(XML_NS_WSMAN_ID, "ProductVersion", 1),
+ SER_END_ITEMS(wsmid_identify);
static char vendor = 0;
@@ -63,104 +63,112 @@ static char *endpoint = NULL;
int main(int argc, char** argv)
{
-
- WsManClient *cl;
- WsXmlDocH doc;
- client_opt_t *options;
- char retval = 0;
- u_error_t *error = NULL;
-
- u_option_entry_t opt[] = {
- { "product", 'p', U_OPTION_ARG_NONE, &vendor,
- "Print Product Vendor", NULL },
- { "version", 'v', U_OPTION_ARG_NONE, &version,
- "Print Product Version", NULL },
- { "protocol", 'P', U_OPTION_ARG_NONE, &protocol,
- "Print Protocol Version", NULL },
- { "endpoint", 'u', U_OPTION_ARG_STRING, &endpoint,
- "Endpoint in form of a URL", "<uri>" },
- { NULL }
- };
-
- 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, "wsmid_identify");
- retval = u_option_context_parse(opt_ctx, &argc, &argv, &error);
-
- u_option_context_free(opt_ctx);
-
- if (error) {
- if (error->message)
- printf ("%s\n", error->message);
- u_error_free(error);
- return 1;
- }
- u_error_free(error);
-
-
- u_uri_t *uri;
- if (endpoint) {
- u_uri_parse((const char *)endpoint, &uri);
- }
- if (!endpoint || !uri) {
- fprintf(stderr, "endpoint option required\n");
- return 1;
- }
-
-/*
-fprintf( stderr, "wsman_create_client( host %s, port %d, path %s, scheme %s, user %s, passwd %s\n", uri->host,
- uri->port,
- uri->path,
- uri->scheme,
- uri->user,
- uri->pwd);
- */
-
- cl = wsmc_create( uri->host,
- uri->port,
- uri->path,
- uri->scheme,
- uri->user,
- uri->pwd);
- options = wsmc_options_init();
-
-
- doc = wsmc_action_identify(cl, options);
-
- WsXmlNodeH soapBody = ws_xml_get_soap_body(doc);
- if (ws_xml_get_child(soapBody, 0, XML_NS_WSMAN_ID, "IdentifyResponse")) {
- wsmid_identify *id = ws_deserialize(wsmc_get_context(cl),
- soapBody,
- wsmid_identify_TypeInfo, "IdentifyResponse",
- XML_NS_WSMAN_ID, NULL,
- 0, 0);
-
- if (vendor)
- printf("%s\n", id->ProductVendor);
- if (version)
- printf("%s\n", id->ProductVersion);
- if (protocol)
- printf("%s\n", id->ProtocolVersion);
-
- if (!protocol && !vendor && !version ) {
- printf("\n");
- printf("%s %s supporting protocol %s\n", id->ProductVendor, id->ProductVersion,id->ProtocolVersion);
- }
-
- }
- if (uri) {
- u_uri_free(uri);
- }
-
- if (doc) {
- ws_xml_destroy_doc(doc);
- }
-
- wsmc_options_destroy(options);
- wsmc_release(cl);
-
-
+
+ WsManClient *cl;
+ WsXmlDocH doc;
+ client_opt_t *options;
+ char retval = 0;
+ u_error_t *error = NULL;
+
+ u_option_entry_t opt[] = {
+ { "product", 'p', U_OPTION_ARG_NONE, &vendor,
+ "Print Product Vendor", NULL },
+ { "version", 'v', U_OPTION_ARG_NONE, &version,
+ "Print Product Version", NULL },
+ { "protocol", 'P', U_OPTION_ARG_NONE, &protocol,
+ "Print Protocol Version", NULL },
+ { "endpoint", 'u', U_OPTION_ARG_STRING, &endpoint,
+ "Endpoint in form of a URL", "<uri>" },
+ { NULL }
+ };
+
+ 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, "wsmid_identify");
+ retval = u_option_context_parse(opt_ctx, &argc, &argv, &error);
+
+ u_option_context_free(opt_ctx);
+
+ if (error) {
+ if (error->message)
+ printf ("%s\n", error->message);
+ u_error_free(error);
+ return 1;
+ }
+ u_error_free(error);
+
+
+ u_uri_t *uri;
+ if (endpoint) {
+ u_uri_parse((const char *)endpoint, &uri);
+ }
+ if (!endpoint || !uri) {
+ fprintf(stderr, "endpoint option required\n");
+ return 1;
+ }
+
+ /*
+ fprintf( stderr, "wsman_create_client( host %s, port %d, path %s, scheme %s, user %s, passwd %s\n", uri->host,
+ uri->port,
+ uri->path,
+ uri->scheme,
+ uri->user,
+ uri->pwd);
+ */
+
+ cl = wsmc_create( uri->host,
+ uri->port,
+ uri->path,
+ uri->scheme,
+ uri->user,
+ uri->pwd);
+ options = wsmc_options_init();
+
+
+ doc = wsmc_action_identify(cl, options);
+ if (doc) {
+ WsXmlNodeH soapBody = ws_xml_get_soap_body(doc);
+ if (ws_xml_get_child(soapBody, 0, XML_NS_WSMAN_ID, "IdentifyResponse")) {
+ wsmid_identify *id = ws_deserialize(wsmc_get_context(cl),
+ soapBody,
+ wsmid_identify_TypeInfo, "IdentifyResponse",
+ XML_NS_WSMAN_ID, NULL,
+ 0, 0);
+
+ if (vendor)
+ printf("%s\n", id->ProductVendor);
+ if (version)
+ printf("%s\n", id->ProductVersion);
+ if (protocol)
+ printf("%s\n", id->ProtocolVersion);
+
+ if (!protocol && !vendor && !version ) {
+ printf("\n");
+ printf("%s %s supporting protocol %s\n", id->ProductVendor, id->ProductVersion,id->ProtocolVersion);
+ }
+
+ }
+ if (uri) {
+ u_uri_free(uri);
+ }
+
+ ws_xml_destroy_doc(doc);
+ } else {
+ if (wsmc_get_response_code(cl) != 200) {
+ fprintf(stderr, "Connection failed. response code = %ld\n",
+ wsmc_get_response_code(cl));
+ if (wsmc_get_fault_string(cl)) {
+ fprintf(stderr, "%s\n",
+ wsmc_get_fault_string(cl));
+ }
+ }
+ }
+
+ wsmc_options_destroy(options);
+ wsmc_release(cl);
+
+
return 0;
}
diff --git a/src/wsman.c b/src/wsman.c
index 36321cf..b75a0b9 100644
--- a/src/wsman.c
+++ b/src/wsman.c
@@ -421,6 +421,8 @@ request_usr_pwd( WsManClient *client, wsman_auth_type_t auth,
*password = u_strdup_printf ("%s", pw);
}
+
+
static hash_t *wsman_options_get_properties(void)
{
int c = 0;
@@ -499,7 +501,7 @@ int main(int argc, char **argv)
filename = (char *) config_file;
if (filename) {
- ini = iniparser_load(filename);
+ ini = iniparser_new(filename);
if (ini == NULL) {
fprintf(stderr, "cannot parse file [%s]",
filename);
@@ -841,7 +843,7 @@ int main(int argc, char **argv)
wsmc_transport_fini(cl);
wsmc_release(cl);
if (ini) {
- iniparser_freedict(ini);
+ iniparser_free(ini);
}
#ifdef DEBUG_VERBOSE
printf(" ****** Transfer Time = %ull usecs ******\n",