Dynamic Probe Class Library

DPCL Class Reference


Chapter 4. Callback data types

The data types in this chapter are used as callback routines.

Regardless of the parameter used, the same type of callback function is used. It consists of a datatype and it's related parameters. For instance:

typedef void (*GCBFuncType) (GCBSysType sys,
                             GCBTagType tag,
                             GCBObjType obj,
                             GCBMsgType msg);

Data types

GCBFuncType

Description

This data type represents a pointer to the callback function. Explicit, user-supplied callback functions are used in all asynchronous function calls.

Most non-blocking functions in the Process and Application classes use the ack_cb_fp parameter to designate the callback function to be used. In these cases, the daemon returns a callback message of type AisStatus *.

Other functions, such as bexecute, binstall, and the phase-related functions use the data_cb_fp parameter to designate the callback function to be used. In these cases, the user application returns a callback message with the Ais_send() call.

Regardless of the how the callback function is designated, the same data type, GCBFuncType is used. GCBFuncType requires four members, which must be designated in the following order:

typedef void (*GCBFuncType) (GCBSysType sys,
                             GCBTagType tag,
                             GCBObjType obj,
                             GCBMsgType msg);

The members of the GCBFuncType data type are as follows:

Table 5. GCBFuncType Data Types
Data Type Description
GCBSysType sys System data structure
GCBTagType tag User-supplied tag value
GCBObjType obj Object that registers the callback
GCBMsgType msg Activating or invoking message

GCBMsgType

Synopsis

Parameter of GCBFuncType.

typedef void *GCBMsgType;

Description

This data type is used by the message parameter of a callback function. The message parameter is supplied by the system at the time the callback is invoked. It is the arrival of this message that causes the callback function to be invoked. The callback function must know the actual data type of the message and explicitly cast the pointer to be of that type.

GCBObjType

Synopsis

Parameter of GCBFuncType.

typedef void *GCBObjType;

Description

This data type is used by the object parameter of a callback function. The object parameter is supplied by the system at the time the callback is registered. The object parameter represents a pointer to the object that invokes the asynchronous operation that causes the callback to be invoked. The callback function must know the actual data type of the invoking object and explicitly cast the pointer to be of that type.

GCBSysType

Description

This structure is provided as the data type of an input parameter to each callback function as it is invoked. The structure is filled in by the system each time a callback is invoked as the system prepares to invoke the callback.

The following are members of the GCBSysType structure.

Table 6. GCBSysType Structure Types
Structure Type Description
int msg_socket Socket over which the message was received
int msg_type Message type
int msg_size Size of the message that was received

GCBTagType

Synopsis

Parameter of GCBFuncType.

typedef void *GCBTagType;

Description

This data type is used by the tag parameter of a callback function. The tag parameter is supplied by the user at the time the callback is registered. Tags are declared as a void * to provide adequate space for the tag to be a pointer. The tag itself only has meaning to the callback function and is not used by the callback system.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]