The extended spy library


Index


SPY id

The spy library is based on SPY ids. They are used to allow several sources of information.

The definition of the SPY id type:

This is a primitive type so the access to the internal stucture should not be done.

All the routines of the library have a parameter of this type.


Initialization

The inizialization routines are used to create and destroy SPY ids, used for the information retrieval.

The spy library can be used to extract information from a local circular buffer, from a circular buffer in a remote machine or from a YBOS file. Thou, three different initialization routines are needed:

On the other side, only one dispose function is needed: spy_close_ext. It uses the SPY id to distinguish between the three cases.

Follows the description of the functions:

spy_open_CB()
Opens a SPY id to a local circular buffer.

Syntax:
int spy_open_CB(char *keyname, SPY_ext_id *sid);
Parameters:
IN: keyname
Keyname of the local circular buffer
OUT: sid
the SPY id
Returns:
SPY_ERROR_OK in case of success

spy_open_inet()
Opens a SPY id to a remote circular buffer.

Syntax:
int spy_open_inet(char *raddr, int rport, SPY_ext_id *sid);
Parameters:
IN: raddr
address of the remote farm machine (can be a.b.c.d or 1.2.3.4)
IN: rport
port number of the remote farm spy daemon
OUT: sid
the SPY id
Returns:
SPY_ERROR_OK in case of success

spy_open_ybos()
Opens a SPY id to a YBOS file.

Syntax:
int spy_open_ybos(char *filename, SPY_ext_id *sid);
Parameters:
IN: filename
Path to the YBOS file
OUT: sid
the SPY id
Returns:
SPY_ERROR_OK in case of success

spy_close_ext()
Closes a previously opened SPY id.

Syntax:
int spy_close_ext(SPY_ext_id sid);
Parameters:
IN: sid
the SPY id to close
Returns:
SPY_ERROR_OK in case of success


Information retrieval

The spy_get_ext routine is used to retreive information from all the sources.

Syntax:
int spy_get_ext(SPY_ext_id sid, char **buf, int *bufsize);
Parameters:
IN: sid
a SPY id
OUT: buf
The pointer to the data, as in the buffer between farm builder and farm recorder.
Must be disposed by the caller
OUT: bufsize
The size of the data
Returns:
SPY_ERROR_OK in case of success
SPY_ERROR_EMPTY if no data available
Note:
Remember to dispose buf to prevent the memory leak problem


Required files

In order to use this library you should include the spy_extended.h and link the libspy_exteded.a and the cybos libraries.


Spy libraries. Top of the page.
Send comments to: Igor Sfiligoi

Created:14.12.1998
Last modified:16.12.1998