Skip to main content

Callback function input parameters

The structures described in this section hold input parameters that are passed to the callback functions.

Example 1. Replication Agent event structure (rxEVENT)
typedef struct _rxevent {

    LONG    versn;         /* [IN] version of this structure         */

    LONG    errcod;        /* [IN] Error code                        */

    pctCNXH psrccnxhnd;    /* [IN] Source server connection handle   */

    pctCNXH ptgtcnxhnd;    /* [IN] Target server connection handle   */

    pVOID   pusrctx;       /* [OUT] User context pointer             */

    RXACT   action;        /* [OUT] Set to action to take            */

    union {

        rxVEROP verop;     /* [IN] Parameters for version check      */

        rxFILOP filop;     /* [IN] Parameters for file events        */

        rxTRNOP trnop;     /* [IN] Parameters for transaction events */

        rxDATOP datop;     /* [IN] Parameters for data events        */

        rxEXCOP excop;     /* [IN] Parameters for exceptions         */

    } ev;


Table 1. Inputs and outputs

Input/output

Description

Input

Structure version

Input

Error code for the current event

Input

Source server connection handle (can be used to call Replication API functions such as ctReplOpenFile() on the source server)

Input

Target server connection handle (an be used to call Replication API functions such as ctReplOpenFile() on the target server)

Input

Replication Agent unique ID

Input

Source server name

Input

Target server name

Input

Source server node ID

Input

Target server node ID

Input

One of the following structures depending on the type of event:
  • rxVEROP

    For the start agent callback

  • rxFILOP

    For file operation callbacks

  • rxTRNOP

    For transaction operation callbacks

  • rxDATOP

    For data operation callbacks

  • rxEXCOP

    For exception callbacks

Output

Optional user-defined context pointer (can be used to store a pointer to memory allocated by the external library)

Output

Action to take for this event

Supported actions are:
  • RXA_DEFAULT

    Perform the default action for this event.

  • RXA_SKIP

    Skips the default action for this event. For some events this action has no effect; that is, it is treated as RXA_DEFAULT.

  • RXA_SHUTDOWN

    Shut down the Replication Agent.



Example 2. The Replication Agent version structure

The Replication Agent version structure (rxVEROP) is only used for the start agent event. The start agent callback function must set the fields of this structure to the structure versions in use by the external library so that the agent can verify that the external library is compatible. See the sample start agent callback function for an example of setting these values.

typedef struct _rxverop {

    LONG    verop_ver;  /* [OUT] Set to version of rxVEROP    */

    LONG    event_ver;  /* [OUT] Set to version of rxEVENT    */

    LONG    filop_ver;  /* [OUT] Set to version of rxFILOP    */

    LONG    trnop_ver;  /* [OUT] Set to version of rxTRNOP    */

    LONG    datop_ver;  /* [OUT] Set to version of rxDATOP    */

    LONG    excop_ver;  /* [OUT] Set to version of rxEXCOP    */

    LONG    filh_ver;   /* [OUT] Set to version of ctFILH     */

} rxVEROP, *prxVEROP;


Example 3. The file operation structure (rxFILOP)

The file operation structure (rxFILOP) is passed to file operation callbacks.

typedef struct _rxfilop {

    pctCHGB pchgbuf;    /* [IN] File operation details    */

    pctFILH pfilhnd;    /* [IN] File information          */

} rxFILOP, *prxFILOP;


Table 2. Inputs and outputs

Input/output

Description

Input

File operation details for this event (includes log position

Input

File information for this event (includes data file ID, data file name, and data file number if open)



Example 4. The transaction operation structure (rxTRNOP)

The transaction operation structure (rxTRNOP) is passed to transaction operation callbacks.

typedef struct _rxtrnop {

    pctCHGB pchgbuf;    /* [IN] Transaction operation details     */

} rxTRNOP, *prxTRNOP;


Table 3. Inputs and outputs

Input/output

Description

Input

Transaction operation details for this event (includes log position and transaction number)



Example 5. The data operation structure (rxDATOP)

The data operation structure (rxDATOP) is passed to data operation callbacks.

typedef struct _rxdatop {

    pctCHGB pchgbuf;    /* [IN] Data operation details    */

    pctFILH pfilhnd;    /* [IN] File information          */

} rxDATOP, *prxDATOP;


Table 4. Inputs and outputs

Input/output

Description

Input

Data operation details for this event (includes log position, file ID, unique key, record image (the callback can change the key value and record image)



Example 6. The exception operation structure (rxEXCOP)

The exception operation structure (rxEXCOP) is passed to exception callbacks.

typedef struct _rxexcop {

    LONG    errcod;     /* [IN] Error code              */

    pctCHGB pchgbuf;    /* [IN] Operation that failed   */

    pctFILH pfilhnd;    /* [IN] File information        */

} rxEXCOP, *prxEXCOP;


Table 5. Inputs and outputs

Input/output

Description

Input

Error code for this exception.

Input

Details for the operation that failed (includes information relevant to the type of operation that failed — for example, data operation includes log position, file ID, unique key, and record image)

Input

File information for this exception (includes data file ID, data file name, and data file number if open)