The 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 informations from a local circular buffer or from a circular buffer in a remote machine. Thou, two different initialization routines are needed:

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

Follows the description of the functions:

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

Syntax:
int spy_open_local(char *keyname, SPY_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_remote()
Opens a SPY id to a remote circular buffer.

Syntax:
int spy_open_remote(char *socketname, SPY_id *sid);
Parameters:
IN: socketname
Path to the remote spy daemon socket
OUT: sid
the SPY id
Returns:
SPY_ERROR_OK in case of success

spy_close()
Closes a previously opened SPY id.

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


Information retrieval

The spy_get routine is used to retreive information both from a local and a remote circular buffer.

Syntax:
int spy_get(SPY_id sid, char **buf, int *bufsize);
Parameters:
IN: sid
a SPY id
OUT: buf
The pointer to the data (See the farm documentation for more information about the format)
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

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

Created:17.9.1997
Last modified:23.9.1997