Using the Sample Programs
The samples
directory in the SDK contains a number of simple programs, each of which demonstrates how to program some basic functionality using the Wiretap Client API. You can treat these programs as building blocks when you are developing your own Wiretap client: cut, paste, and adapt code from these samples into your own C++ program or Python module.
This section recommends two sample programs that you can read, build (for the C++ version), and run. They will help you become familiar with a few classes and ways of doing things using the Wiretap Client API. After you have done so, you can look at Programming Typical Workflows, which covers basic programming issues and goes into more depth on how to program a variety of workflows.
Trying the listAllServers Sample
The Wiretap Client SDK includes a sample C++ program (listAllServers.C
) and a Python module (listAllServers.py
) that displays a list of all the Wiretap hosts on the network to which your development machine is connected.
The functionality shown in listAllServers.C
is almost identical to that of the command line tool wiretap_server_dump
.
When you examine the code in listAllServers
, you will notice that it does the following:
Initiates the Wiretap Client API.
All Wiretap clients must start with a call to the global function,
WireTapClientInit
or instantiate aWireTapClient
guard object.Uses a
WireTapServerList
object to determine Wiretap servers that can be accessed from the client.Wiretap uses network multicast technology to broadcast Wiretap server nodes to each other, allowing any Wiretap client to obtain a list of active servers. The Wiretap Client API silently finds one server on startup through which it gains knowledge of all others.
Iterates through all the Wiretap servers that are accessible. For each Wiretap server, it obtains a
WireTapServerInfo
object which gives access to:Properties of the server (the sample only gets its display name, IP address, and database)
Your Wiretap client can populate a browser with any or all of the available information.
A
WireTapServerId
objectIn your Wiretap client, you can use this
WireTapServerId
to instantiate aWireTapServerHandle
which is a live connection to a particular Wiretap server and gives access to its node hierarchy.
Uninitiates the Wiretap Client API.
All Wiretap clients must end with a call to the global function,
WireTapClientUninit
or destroyWireTapClient
guard object if it was explicitly instantiated.
Trying the listChildren Sample
The Wiretap Client SDK includes a sample C++ program (listChilden.C
) and a Python module (listChildren.py
) that display a list of the child nodes of a particular node on a particular Wiretap server.
The functionality demonstrated in listChildren
is almost identical to that of the command line tool wiretap_get_children
.
When you examine the code in listChildren
, you will notice that it does the following:
(C++ sample only) Establishes a namespace for this Wiretap host using its host name.
As explained earlier, if a Creative Finishing application is installed on your machine, the IFFFS Wiretap server is also installed, and usually it is running. In this case, the default localhost allows you to run
listChildren.C
. If the default value does not work, you can set the host as an environment variable or hard-code the name of a valid host.Initiates the Wiretap Client API.
All Wiretap clients must start with a call to the
WireTapClientInit
global function or instantiate a WireTapClient guard object.Instantiates a
WireTapServerHandle
using the host name.An instance of
WireTapServerHandle
is an active connection to a particular Wiretap server and gives access to its node hierarchy.Gets the root node of the Wiretap server and finds out how many child nodes it has.
The root node of an IFFFS Wiretap server is named /.
Gets a
WireTapNodeHandle
object for each of the root node’s children.
For each child node, it displays:
Its display name
Its node type
The children of the root node on an IFFFS Wiretap server are VOLUME type nodes. The default VOLUME node is usually named AutodeskMediaStorage. The sample program only gets one level of children.
Your Wiretap client can use these WireTapNodeHandle
objects to populate a browser of the server’s node hierarchy. By nesting calls to getNumChildren
and getChildNode
, your client can drill down through the entire node hierarchy. You can allow the user of your Wiretap client to select the branch to view. For each node, you can display as much information as useful for the user.
Uninitiates the Wiretap Client API.
All Wiretap clients must end with a call to the
WireTapClientUninit
global function or destroy the WireTapClient guard object..