You can use Python to write a Wiretap client that can run immediately, without compiling.
If you need to become familiar with Python, visit the web site: http://www.python.org/
Your Wiretap client will be a Python module (a .py file). To run your module, you will need a dynamic library that provides Python bindings to the C++ version of the Wiretap Client API. Check the next section to see if a Python library is available for your platform. If there is, you can proceed to Setting Up the Python Environment.
There is a pre-compiled version of the Wiretap Client API that was compiled with Python 2.7. It is only available for these platforms:
You will find the appropriate version of the Wiretap dynamic library for Python in your wiretap_install_dir. The following table indicates the names of the library files and the path to these files.
There is no library file for Windows. You need to compile a .dll as described in Setting Up the Python Environment.
| OS | Platform (Bits) | Compiler/ Version | Path to Library Files | Wiretap Library File for Python |
|---|---|---|---|---|
| Linux RHEL 6 | x86-64(64) | GCC 4.4.6 |
wiretap_install_dir/lib/opt/LINUX/ x86_64/RHEL6/GCC_4_4_6/Python2.7 |
libwiretapPythonClientAPI.so |
| Mac OSX | Intel(64) | GCC 5.1 |
wiretap_install_dir/lib/opt/MACOSX/ fat/10_9_5/GCC_5_1/Python* |
libwiretapPythonClientAPI.dylib |
To use a version of Python other than the recommended version 2.7, or if your OS does not come with Python (Windows), set up your development environment using the following steps:
For more details, see http://www.boost.org.
If you need to get Python, go to the Python web site:
or
- Linux 32-bit: /usr/lib/python2.7/lib-dynload
- Linux 64-bit: /usr/lib64/python2.7/lib-dynload
- Mac OS X: /usr/lib/python2.7/lib-dynload
- Windows: C:\Python27\DLLs
Once you have ensured that Python is installed and can find the required libraries, you can run the sample Python modules (.py files) included in the Wiretap Client SDK.
python wiretap_install_dir/samples/python/moduleName.py
where,
The Wiretap Client SDK does not include documentation specifically for the Python version of the API. However, you can view the list of classes and their member functions in the API by using the Python commands dir and help as shown below.
To get help for the Python API:
python
The python prompt (>>>) appears.
import libwiretapPythonClientAPI as wiretap
dir(wiretap)
help (wiretap.WireTapServerHandle)
For detailed information about the member functions of a class, you must use the Wiretap C++ API reference documentation.
To get more information about the methods of a class:
The Python API is designed to resemble the C++ API as much as possible. However, there are a few differences between the C++ and Python versions of the API. Unlike C++, Python does not support pointers and references. Python uses objects in situations where C++ would use pointers and references.
In the Wiretap Client API, some C++ accessor methods have output parameters that pass references to integers. The equivalent Python methods pass an instance of WireTapInt, which is used to represent the int base type.
These are the Python method declarations that differ from the equivalent C++ declarations:
class WireTapServerHandle bool getVersion( WireTapInt &major, WireTapInt &minor ) const bool getProtocolVersion( WireTapInt &major, WireTapInt &minor ) const class WireTapNodeHandle bool getNumAvailableMetaDataStreams( WireTapInt &numStreams ) const bool getNumChildren( WireTapInt &numChildren ) const bool getNumFrames( WireTapInt &numFrames ) const bool getNodeType( WireTapInt &type ) const bool linkToFrames( python::list pathList ) class WireTapServerList bool getNumNodes( WireTapInt &numberOfNodes )