pbms_get_callback
Description
size_t pbms_get_callback ( void * caller_data ,const char * buffer ,size_t size ,pbms_bool reset )
This is the prototype for a user defined callback function of type PBMS_WRITE_CALLBACK_FUNC which is passed into the pbms_get_data_cb() function. The callback is called repeatedly by pbms_get_data_cb() to get BLOB data from the PBMS daemon and pass it back to the client.
Parameters
caller_data
The caller_data parameter passed into the pbms_get_data_cb() function which is a pointer to a user defined data structure.
buffer
The buffer containing next block of BLOB data.
size
The size of the buffer.
reset
A flag to indicate that the data transfer has been restarted from the beginning and the buffer contains the BLOB data at offset 0.
Return Values

The value of size on success.

Any other value on failure.

Example
/*
 * This is an example of a callback to stream a file from the PBMS daemon.
 * In this case the caller_data is a pointer to a file handle.
 */
size_t file_callback(void *caller_data, const char *buffer, size_t size, pbms_bool reset)
{
	int *fh = (int*) caller_data;

	if (reset) {
		lseek(fh, 0, SEEK_SET);
	}
	if (size) {
		size = write(fh, buffer, size);
	}
	return size;
}
		
Related functions
pbms_get_data_cb()