summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAnas Nashif <nashif@intel.com>2007-03-04 06:02:31 +0000
committerAnas Nashif <nashif@intel.com>2007-03-04 06:02:31 +0000
commitc403025da2cb37bcc3e72fbf957fa2df04c63f28 (patch)
tree7ef7a0d907c00a8ad216b0d558b757da3a16f338 /examples
parent8553e5a564a06fec2187c80e9f1b438ca469791b (diff)
downloadwsmancli-c403025da2cb37bcc3e72fbf957fa2df04c63f28.tar.gz
wsmancli-c403025da2cb37bcc3e72fbf957fa2df04c63f28.tar.xz
wsmancli-c403025da2cb37bcc3e72fbf957fa2df04c63f28.zip
added README for exmaples, moved serial. doc to main tree under doc/
Diffstat (limited to 'examples')
-rw-r--r--examples/README83
-rw-r--r--examples/serialize.c133
2 files changed, 83 insertions, 133 deletions
diff --git a/examples/README b/examples/README
new file mode 100644
index 0000000..da22b01
--- /dev/null
+++ b/examples/README
@@ -0,0 +1,83 @@
+
+wsmid_identify
+--------------
+
+Summary:
+ Issue an Identify request and de-serialize the result.
+Options:
+ -p, --product Print Product Vendor
+ -v, --version Print Product Version
+ -P, --protocol Print Protocol Version
+ -u, --endpoint=<uri> Endpoint in form of a URL
+Example:
+
+ % ./wsmid_identify -u http://wsman:secret@example.com:8889/wsman
+
+ Openwsman Project 0.7.0 supporting protocol http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
+
+
+serialize
+----------
+
+Summary:
+ Examples using the XML serialization and de-serialization API.
+Options:
+ None
+Example:
+ run ./serialize in the local directory which will do several serialization and
+ de-serialization routines.
+ For more details, check the file 'doc/README.serialization' in the openwsman
+ repository for detailed documentation of the serialization API.
+
+
+win32_service
+----------------
+Summary:
+ A command-line client to manage and display services on a Microsoft Windows machine
+ with WS-Management support (Vista).
+Options:
+ -u, --endpoint=<uri> Endpoint in form of a URL
+ -l, --list-all List all services
+ -d, --desc Show service description
+ -s, --stop Stop service
+ -S, --start Start service
+ -X, --status Get service status
+ -D, --dump Dump request
+
+ For actions related to one service, add the name of the service as an argument.
+
+Example:
+
+ ./win32_service -u http://wsman:secret@example.com:8889/wsman -l -X
+ ...
+ ...
+ wmiApSrv
+ State: Stopped
+ WMPNetworkSvc
+ State: Stopped
+ WPCSvc
+ State: Stopped
+ WPDBusEnum
+ State: Running
+ wscsvc
+ State: Running
+ WSearch
+ State: Running
+ wuauserv
+ State: Running
+ wudfsvc
+ State: Stopped
+ ...
+ ...
+
+
+ ./win32_service -u http://wsman:secret@example.com:8889/wsman -d wudfsvc
+
+ wudfsvc
+ State: Stopped
+ Description: Manages user-mode driver host processes
+
+
+
+
+
diff --git a/examples/serialize.c b/examples/serialize.c
index 5cb6172..fed4743 100644
--- a/examples/serialize.c
+++ b/examples/serialize.c
@@ -48,139 +48,6 @@
#define CLASSNAME "Sample"
-/*
- ************************************************************************
-
- HOW TO USE SERIALIZATION / DESERIALIZATION
-
- Serialization/deserialization of unsignedByte, unsignedShort,
- unsignedInt, boolean and string built-n XML Schema types is now supported.
- It is possible to serialize/deserialize structures, static and dynamic
- size arrays constructed from these types.
-
- For example, let us have the following schema:
- <xsd:element name="SAMPLE">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="STRING" type="xsd:string"/>
- <xsd:element name="BOOL" type="xsd:boolean"/>
- <xsd:element name="BYTE" type="xsd:unsignedByte"/>
- <xsd:element name="SHORT" type="xsd:unsignedShort"/>
- <xsd:element name="INT" type="xsd:unsignedInt"/>
- <xsd:element name="SHORTS" type="xsd:unsignedShort" minOccurs="3" maxOccurs="3"/>
- <xsd:element name="INTS" type="xsd:unsignedInt" minOccurs="0" maxOccurs="5"/>
- <xsd:element ref="FOO" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="FOO">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="FooSTRING" type="xsd:string"/>
- <xsd:element name="FooINT" type="xsd:unsignedInt"/>
- <xsd:element name="FooBOOL" type="xsd:boolean"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
-
- Each complex element is represented in the C programm by 2 objects - target
- structure (TS) definition and type description object (TDO) - the null
- terminated array of type XmlSerializerInfo elements. The following name
- convention exists: TDO for Foo is named Foo_TypeInfo.
- For our example these structures look the following:
-
- target structures:
-
- typedef struct {
- XML_TYPE_STR FooString;
- XML_TYPE_UINT32 FooInt;
- XML_TYPE_BOOL FooBoolean;
- } Foo;
-
- typedef struct {
- XML_TYPE_STR String;
- XML_TYPE_BOOL Boolean;
- XML_TYPE_UINT8 Byte;
- XML_TYPE_UINT16 Short;
- XML_TYPE_UINT32 Int;
- XML_TYPE_UINT16 Shorts[3];
- XML_TYPE_DYN_ARRAY Ints;
- XML_TYPE_DYN_ARRAY Foos;
- } Sample;
-
- Note, that the field 'Shorts' in Sample is defined as built-in array because
- the number of elements in schema is strictly defined. Elements Ints
- and Foos are defined as dynamic arrays because the number of these elements
- in the document is variable.
-
- For each TS an TDO is defined. Each TDS is defined by the sequence of
- defines described in wsman-xml-serializer.h. The order of defines in TDO
- must be same as the order of fields in TS.
-
- SER_START_ITEMS("FOO", Foo)
- // This is the beginning of the description. The first argument is the
- // name of an element in the XML schema, the second one is the name
- // of the TS type.
- SER_STR("FooSTRING", 1),
- SER_UINT32("FooINT", 1),
- SER_BOOL("FooBOOL", 1),
- // These 3 defines are for string, unsignedInt and boolean XML types
- // accordingly. The first argument is the name of an element in the XML
- // schema, the second one is the number of elements.
- SER_END_ITEMS("FOO", Foo);
- // This Define completes the definition. The arguments are same as
- // for SER_START_ITEMS.
-
- So if we define The TDO for Foo type. It looks like:
- XmlSerializerInfo Foo_TypeInfo[] = {
- ................
- };
- There are some Defines to add XmlSerializerInfo's for basic types XML_TYPE_UINT8,
- XML_TYPE_UINT16, XML_TYPE_UINT32, XML_TYPE_BOOL and XML_TYPE_STR:
- SER_TYPEINFO_UINT8;
- SER_TYPEINFO_UINT16;
- SER_TYPEINFO_UINT32;
- SER_TYPEINFO_BOOL;
- SER_TYPEINFO_STR;
- If you use dymanic arrays of basic types you must define the corespondent
- XmlSerializerInfo before defining TDO including this dynamic array. You will
- refer to these TDOs in SER_DYN_ARRAY define and use the fourth argument for
- these types uint8, uint16, uint32, bool and string as the last argument (see
- below).
-
- Let's do the same for the Sample type.
-
- SER_START_ITEMS(sample)
- SER_STR("STRING", 1),
- SER_BOOL("BOOL", 1),
- SER_UINT8("BYTE", 1),
- SER_UINT16("SHORT", 1),
- SER_UINT32("INT", 1),
- SER_UINT16("SHORTS", 3),
- SER_DYN_ARRAY("INTS", 0, 5, uint32),
- // This dynamic array describes XML element INTS of type unsignedInt
- // with minOccurs=0 and maxOccurs=5.
- SER_DYN_ARRAY("FOOS", 1, 0, Foo),
- // Dynamic array of Foo type elements. maxOccures=0 means
- // "unbounded" in XML schema
- SER_END_ITEMS(sample);
-
-
- These objects can be used in ws_serialize() and ws_deserialize() API.
-
- There are 2 sets of defines SER_IN_* and SER_OUT_*. These defines are used
- if you want to skip the elements while deserialization(serialization). If
- define SER_INOUT_* is used the element is skipped always.
-
- If element name is a QName (with name space prefix) the
- SER_NS_*(ns, name, ..) define set must be used.
-
-
-
- *****************************************************************/
-
-
static void