Registering Framework Callbacks
Registers framework-provided callback functions with the plugin. The function for registering framework callbacks must be the first to be called after the plugin is loaded. Subsequent plugin features depend on these callbacks for logging, request dispatching, and database operations.
Header File
#include "frame.h"
Prototype
uint32_t KdcPluginSetCb(KdcCallbacks cb);
Parameters
Parameter |
Type |
Required (Yes/No) |
Description |
|---|---|---|---|
cb |
KdcCallbacks |
Yes |
Framework callback structure containing pointers for logging, request handling, and database operations. |
Return Values
Return Value |
Description |
|---|---|
0 |
Success |
Non-zero |
Failure |
Examples
KdcCallbacks callbacks = {
.kdcLog = log_callback,
.kdcRegisterRequestHandle = register_handler,
.kdcUnRegisterRequestHandle = unregister_handler,
.kdcDbExecuteSql = db_execute,
.kdcDbQuerySql = db_query,
.kdcDbFree = db_free,
.kdcDbSync = db_sync
};
uint32_t ret = KdcPluginSetCb(callbacks);
if (ret != 0) {
// Handle the error.
}
Precautions
This API must be the first to be called after the plugin is loaded to register framework-provided callback functions with the plugin. Subsequent APIs depend on these callbacks.
Parent topic: kdc_agent Plugin APIs