OSF DCE Application Development Guide--Core Components
Topics in RPC Application Development
* store_read -- Read a certain number of bytes from the opened store.
*
******/
/************************************************************************/
void
store_read(
store_handle_t store_h, /* Store handle. */
unsigned32 buf_size, /* Number of bytes to read. */
store_buf_t buffer, /* Space to return data read in. */
unsigned32 *data_size, /* To return number of bytes read in. */
error_status_t *status
)
{
store_spec_t *spec; /* Our handle pointer. */
store_hdr_t *hdr; /* Pointer to a storelet. */
spec = (store_spec_t *)store_h; /* Get the storelet spec. */
hdr = headers + spec->number; /* Point to the correct storelet. */
/* If the amount we’re to read is less than the amount left to be */
/* read, then read it... */
if (buf_size <= hdr->size)
{
/* Copy bytes from the storelet storage, beginning at off- */
/* set, into the return buffer, up to the size of the */
/* buffer... */
memcpy(buffer, hdr->storage + spec->offset, buf_size);
/* Update the storelet buffer pointer past what we’ve just */
/* read... */
spec->offset += buf_size;
/* Show return size of data read... */
*data_size = buf_size;
*status = error_status_ok;
return;
}
/* If there’s less data left than has been specified to read, don’t */
/* read it... */
*data_size = 0;
*status = -1;
}
/******
*
* store_write -- Write some data into the opened store.
*
******/
void
store_write(
/* handle_t IDL_handle,*/ /* If the server ACF declares */
/* [explicit_handle] */
124245 Tandem Computers Incorporated 16− 19