diff options
author | Anas Nashif <nashif@intel.com> | 2007-11-25 16:40:35 +0000 |
---|---|---|
committer | Anas Nashif <nashif@intel.com> | 2007-11-25 16:40:35 +0000 |
commit | 02cb2d536bfc9120b059cbb7027ca9a235cd2244 (patch) | |
tree | cf17b836b9cbda8077206a6b91a9f6152bfc0415 /examples | |
parent | 9c961db386b2987b6a1d3f96558b6acaecc71140 (diff) | |
download | wsmancli-02cb2d536bfc9120b059cbb7027ca9a235cd2244.tar.gz wsmancli-02cb2d536bfc9120b059cbb7027ca9a235cd2244.tar.xz wsmancli-02cb2d536bfc9120b059cbb7027ca9a235cd2244.zip |
c++ identify example
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cpp/Identify.cpp | 43 | ||||
-rw-r--r-- | examples/cpp/Makefile.am | 5 |
2 files changed, 47 insertions, 1 deletions
diff --git a/examples/cpp/Identify.cpp b/examples/cpp/Identify.cpp new file mode 100644 index 0000000..dabca15 --- /dev/null +++ b/examples/cpp/Identify.cpp @@ -0,0 +1,43 @@ +#include <iostream> +#include <cpp/OpenWsmanClient.h> +#include <u/libu.h> + +using std::cout; + +using namespace WsmanClientNamespace; +int main(int argc, char* argv[]) +{ + const char *endpoint, *resource_uri; + string out; + u_uri_t *uri; + if (argc< 2) { + fprintf(stderr, "Usage: %s <endpoint>\n", argv[0]); + } + endpoint= argv[1]; + + if (!endpoint) { + fprintf(stderr, "endpoint option required\n"); + return 1; + } + if (endpoint != NULL) + if (u_uri_parse((const char *) endpoint, &uri) != 0 ) + return 1; + OpenWsmanClient *client = new OpenWsmanClient( uri->host, + uri->port, + uri->path, + uri->scheme, + "digest", + uri->user, + uri->pwd); + try { + out = client->Identify(); + } + + catch (GeneralWsmanException &e) { + printf("GeneralWsmanException:\n"); + printf("%s\n", e.what()); + + } + cout << "Identify: " << out << "\n"; + return 0; +} diff --git a/examples/cpp/Makefile.am b/examples/cpp/Makefile.am index 9e97bf0..8e10483 100644 --- a/examples/cpp/Makefile.am +++ b/examples/cpp/Makefile.am @@ -6,9 +6,12 @@ CXXFLAGS = \ $(OPENWSMAN_CFLAGS) EnumInstance_SOURCES = \ EnumInstance.cpp +Identify_SOURCES = \ + Identify.cpp noinst_PROGRAMS = \ - EnumInstance + EnumInstance \ + Identify |