typedef srs_result (srs_db_callback)(srs_t *srs, char *data, uint data_len, char *result, uint result_len);
See the Exim for an example implementation of database callback. (In particular, srs.c.)
As most MTAs have database functions built in, the actual database implementation is left to callback functions. This allows for a large amount of flexibility in terms of what database keys look like and what database is actually used. In the exim patch included with libsrs_alt, any of the exim lookup types can be used - so it is very easy to use MySQL, for example.
The function type srs_db_callback is used for both the insert and lookup database callbacks that libsrs_alt makes. The functions are set using srs_set_db_functions.
Insert callback
When performing an SRS forward on an address, the database insert callback function is called with srs set to the current srs_t structure. data contains a pointer to the email address to be stored which is data_len bytes long (a terminating NULL character cannot be guaranteed).
The function should fill result with the database key to include in the SRS address that is generated (and return_len with its byte count). The use of srs_generate_unique_id is available to generate a unique key, but is by no means required.
Lookup callback
When performing an SRS reverse on an SRS0 address, the database lookup callback function is called with srs set to the current srs_t structure. data contains a pointer to the database key found in the address which is data_len bytes long (a terminating NULL character cannot be guaranteed).
The function should fill result with the original email address (and return_len with its byte count).