OpenClovis Logo

Files | Classes | Typedefs | Enumerations | Functions
API Reference Pages
Buffer Management

Defines, Structures, Typedefs, Functions. More...

Files

file  clBufferApi.h
 Header file of Buffer Management related APIs.

Classes

struct  ClBufferPoolConfigT
 The type of the buffer configuration info. More...

Typedefs

typedef ClPtrT ClBufferHandleT
 The type of the handle for the buffer messages.
typedef enum ClBufferMode ClBufferModeT
 The config mode of the Buffer.

Enumerations

enum  ClBufferMode {
  CL_BUFFER_NATIVE_MODE,
  CL_BUFFER_PREALLOCATED_MODE
}
 The config mode of the Buffer. More...
enum  ClBufferSeekTypeT {
  CL_BUFFER_SEEK_SET = 0,
  CL_BUFFER_SEEK_CUR,
  CL_BUFFER_SEEK_END
}

Functions

ClRcT clBufferChecksum16Compute (ClBufferHandleT messageHandle, ClUint32T startOffset, ClUint32T length, ClUint16T *pChecksum)
 Computes a 16-bit checksum on a message.
ClRcT clBufferChecksum32Compute (ClBufferHandleT messageHandle, ClUint32T startOffset, ClUint32T length, ClUint32T *pChecksum)
 Computes a 32-bit checksum on a message.
ClRcT clBufferClear (ClBufferHandleT messageHandle)
 Deletes the content of the buffer message.
ClRcT clBufferConcatenate (ClBufferHandleT destination, ClBufferHandleT *pSource)
 Concatenates source message to destination message.
ClRcT clBufferCreate (ClBufferHandleT *pMessageHandle)
 Creates a new message.
ClRcT clBufferCreateAndAllocate (ClUint32T size, ClBufferHandleT *pMessageHandle)
 Creates buffers for a requested size of a message.
ClRcT clBufferDataPrepend (ClBufferHandleT messageHandle, ClUint8T *pByteBuffer, ClUint32T numberOfBytesToWrite)
 Prepends specified number of bytes at the begining of message.
ClRcT clBufferDelete (ClBufferHandleT *pMessageHandle)
 Deletes the Buffers.
ClRcT clBufferDuplicate (ClBufferHandleT messageHandle, ClBufferHandleT *pDuplicatedMessage)
 Duplicates a message.
ClRcT clBufferFinalize (void)
 Cleans up the Buffer Management library.
ClRcT clBufferFlatten (ClBufferHandleT messageHandle, ClUint8T **ppFlattenBuffer)
 Flattens message into a single buffer.
ClRcT clBufferHeaderTrim (ClBufferHandleT messageHandle, ClUint32T numberOfBytes)
 Trims the start of the message.
ClRcT clBufferInitialize (const ClBufferPoolConfigT *pConfig)
 Initializes the Buffer Management library.
ClRcT clBufferKernelToUserCopy (ClBufferHandleT kernelMessageHandle, ClBufferHandleT userMessageHandle)
 Copies message from kernel-space to user-space.
ClRcT clBufferLengthCalc (ClBufferHandleT bufferHandle)
 Recompute the message length & set internal variable.
ClRcT clBufferLengthGet (ClBufferHandleT messageHandle, ClUint32T *pMessageLength)
 Returns the length of the message.
ClRcT clBufferNBytesRead (ClBufferHandleT messageHandle, ClUint8T *pByteBuffer, ClUint32T *pNumberOfBytesToRead)
 Reads the specified number of bytes of data from a message.
ClRcT clBufferNBytesWrite (ClBufferHandleT messageHandle, ClUint8T *pByteBuffer, ClUint32T numberOfBytesToWrite)
 Writes the specified number bytes of data from a message.
ClRcT clBufferReadOffsetGet (ClBufferHandleT messageHandle, ClUint32T *pReadOffset)
 Returns current read offset of the message.
ClRcT clBufferReadOffsetSet (ClBufferHandleT messageHandle, ClInt32T newReadOffset, ClBufferSeekTypeT seekType)
 Sets current read offset of the message.
ClRcT clBufferShrink (ClPoolShrinkOptionsT *pShrinkOptions)
 Frees up the unused pools of all sizes.
ClRcT clBufferToBufferCopy (ClBufferHandleT sourceMessage, ClUint32T sourceMessageOffset, ClBufferHandleT destinationMessage, ClUint32T numberOfBytes)
 Copies specific number of bytes from one message to another.
ClRcT clBufferTrailerTrim (ClBufferHandleT messageHandle, ClUint32T numberOfBytes)
 Trims the tail of the message.
ClRcT clBufferUserToKernelCopy (ClBufferHandleT userMessageHandle, ClBufferHandleT *pKernelMessageHandle)
 Copies message from user-space to kernel-space.
ClRcT clBufferWriteOffsetGet (ClBufferHandleT messageHandle, ClUint32T *pWriteOffset)
 Returns current write offset of the message.
ClRcT clBufferWriteOffsetSet (ClBufferHandleT messageHandle, ClInt32T newWriteOffset, ClBufferSeekTypeT seekType)
 Sets current write offset of the message.
ClRcT clDbgBufferPrint (ClBufferHandleT buffer)
 Dumps the buffer for debugging, etc.

Detailed Description

Defines, Structures, Typedefs, Functions.

Typedef Documentation

The config mode of the Buffer.

When configured in native mode, malloc is used for fetching the memory for the configured buffer pools instead of the clovis pool implementation.

Enumeration Type Documentation

The config mode of the Buffer.

When configured in native mode, malloc is used for fetching the memory for the configured buffer pools instead of the clovis pool implementation.

Enumerator:
CL_BUFFER_NATIVE_MODE 

In this mode the buffer library uses the malloc and free for allocating and deallocating memory for buffers.

CL_BUFFER_PREALLOCATED_MODE 

This mode makes buffer library uses Clovis implementation of Pool for allocating and deallocating memory for buffers.

Enumerator:
CL_BUFFER_SEEK_SET 

This is to set the read or write offset pointer to a position mentioned from the BEGINING of the Buffer message.

CL_BUFFER_SEEK_CUR 

This is to set the read or write offset pointer to a position mentioned from the CURRENT position of the pointer of the Buffer message.

CL_BUFFER_SEEK_END 

This is to set the read or write offset pointer to a position mentioned from the END of the Buffer message.

Function Documentation

ClRcT clBufferChecksum16Compute ( ClBufferHandleT  messageHandle,
ClUint32T  startOffset,
ClUint32T  length,
ClUint16T *  pChecksum 
)

Computes a 16-bit checksum on a message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API for which the checksum is to be computed.
startOffsetOffset from the beginning of the message, from which the data for computing the checksum begins.
lengthNumber of bytes of data for which the checksum is to be computed.
pChecksum(out) Pointer to variable of type ClUint32T in which the computed checksum is returned.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to compute a 16-bit checksum on a message from startOffset for length number of bytes in the message. This checksum can be used to check the validity of the buffer message after passing it through a network.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferChecksum32Compute()
ClRcT clBufferChecksum32Compute ( ClBufferHandleT  messageHandle,
ClUint32T  startOffset,
ClUint32T  length,
ClUint32T *  pChecksum 
)

Computes a 32-bit checksum on a message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API for which the checksum is to be computed.
startOffsetOffset from the beginning of the message, from which the data for computing the checksum begins.
lengthNumber of bytes of data for which the checksum is to be computed.
pChecksum(out) Pointer to variable of type ClUint32T in which the computed checksum is returned.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to compute a 32-bit checksum on a message from startOffset for length number of bytes in the message. This checksum can be used to check the validity of the buffer message after passing it through a network.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferChecksum16Compute()
ClRcT clBufferClear ( ClBufferHandleT  messageHandle)

Deletes the content of the buffer message.

Header File:
clBufferApi.h
Parameters
pMessageHandlePointer to the message handle returned by clBufferCreate() API.
Return values
CL_OKThe buffer message is cleared successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to delete message buffer(s) designated by the handle obtained through clBufferCreate() API. The handle is still available for re-use.
Library Files:
ClBuffer
See Also
clBufferDelete(), clBufferCreateAndAllocate(), clBufferCreate()
ClRcT clBufferConcatenate ( ClBufferHandleT  destination,
ClBufferHandleT pSource 
)

Concatenates source message to destination message.

Header File:
clBufferApi.h
Parameters
destinationThis is buffer message handle to which the pSource buffer message will be concatinated. The handle of the concatenated message will be the same destination buffer message handle .
pSource(in/out) Pointer to buffer message handle of the message, which is to be concatenated with destination buffer message.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to concatenate the pSource buffer message to the end of destination message. The pSource message handle will become not-usable after this concatination operation and the pSource message will be deleted. The write offset of the resultant destination message will be set to end of the message and the read offset of the to start of the message.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferDataAppend(), clBufferDelete(), clBufferDataPrepend()
ClRcT clBufferCreate ( ClBufferHandleT pMessageHandle)

Creates a new message.

Header File:
clBufferApi.h
Parameters
pMessageHandle(out) A pointer to the handle of type ClBufferHandleT designating the buffer for a message created.
Return values
CL_OKThe API successfully created a buffer for a message.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_NO_MEMORYOn memory allocation failure.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to create a buffer for a message. It allocates a buffer of 2 kilobytes size, even if a write operation on the buffer is to be performed at a later stage in the application. The write operation on the buffer handle provided by this API, the buffer management library will use this pre-allocated buffer.
Library Files:
ClBuffer
See Also
clBufferCreateAndAllocate(), clBufferDelete(), clBufferClear()
ClRcT clBufferCreateAndAllocate ( ClUint32T  size,
ClBufferHandleT pMessageHandle 
)

Creates buffers for a requested size of a message.

Header File:
clBufferApi.h
Parameters
sizeInitial size of a message buffer in bytes.
pMessageHandleA pointer to the buffer message of type ClBufferHandleT designating the message buffer created.
Return values
CL_OKThe buffers for a message are successfully created.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_NO_MEMORYOn memory allocation failure.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to create buffers to hold a message of size mentioned by size. It allocates the buffers even if the write operation is to be performed at a later stage in application. As a write is performed onto this buffer handle returned by this API, the buffer management library will use these pre-allocated buffers.
Library Files:
ClBuffer
See Also
clBufferDelete(), clBufferClear(), clBufferCreate()
ClRcT clBufferDataPrepend ( ClBufferHandleT  messageHandle,
ClUint8T *  pByteBuffer,
ClUint32T  numberOfBytesToWrite 
)

Prepends specified number of bytes at the begining of message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API.
pByteBufferPointer to a variable of type ClUint8T, in which numberOfBytesToRead bytes of data is returned.
numberOfBytesToWriteNumber of bytes to be written.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to prepend numberOfBytesToWrite number of bytes at the beginning of the buffer message. The write offset of the buffer message will be updated and is set to numberOfBytesToWrite, i.e. the next write-operation performed will begin the write at numberOfBytesToWrite offset from the starting of the message. Note that the current write offset is lost. Hence, it is advisable to preserve the write offset before invoking this API.
Library Files:
ClBuffer
See Also
clBufferNBytesWrite(), clBufferConcatenate(), clBufferDelete()
ClRcT clBufferDelete ( ClBufferHandleT pMessageHandle)

Deletes the Buffers.

Header File:
clBufferApi.h
Parameters
pMessageHandlePointer to the message handle, which is to be deleted.
Return values
CL_OKThe Buffers are deleted successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to delete message buffer(s) designated by the handle obtained through clBufferCreate() API. Successful invocation of this API will make the handle invalid.
Library Files:
ClBuffer
See Also
clBufferClear(), clBufferCreateAndAllocate(), clBufferCreate()
ClRcT clBufferDuplicate ( ClBufferHandleT  messageHandle,
ClBufferHandleT pDuplicatedMessage 
)

Duplicates a message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API, which is to be duplicated.
pDuplicatedMessage(out) Pointer to variable of type ClBufferHandleT, in which handle of the duplicate message is returned.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
CL_ERR_INVALID_PARAMETEROn passing an invalid parameter.
CL_ERR_NO_MEMORYOn memory allocation failure.
Description:
This API is used to make duplicate copy of messageHandle. The newly created buffer message handle will be returned in pDuplicateMessage. The read and write offsets of the newly created buffer message are set to the values same as that of the messageHandle.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferDelete(), clBufferToBufferCopy()
ClRcT clBufferFinalize ( void  )

Cleans up the Buffer Management library.

Header File:
clBufferApi.h
Parameters:
None
Return values
CL_OKThe API executed successfully.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is should be called when an application decides of not using the buffer management library any more. The application must have invoked clBufferInitialize() before it invokes this function. It is called typically when an application calling this function is shutting down and wants to releave all the resources used by it.
Library Files:
ClBuffer
See Also
clBufferInitialize()
ClRcT clBufferFlatten ( ClBufferHandleT  messageHandle,
ClUint8T **  ppFlattenBuffer 
)

Flattens message into a single buffer.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to message returned by clBufferCreate() API.
ppFlattenBuffer(out) The flatten buffer would be returned in this location. This must be a valid pointer and cannot be NULL.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
CL_ERR_NO_MEMORYOn memory allocation failure.
Description:
This API is used to copy the message from a buffer message into a single flat buffer stream. The buffer library will allocate the memory for the flat buffer stream and this has to be freed by the caller of this API.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferDelete()
ClRcT clBufferHeaderTrim ( ClBufferHandleT  messageHandle,
ClUint32T  numberOfBytes 
)

Trims the start of the message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API.
numberOfBytesNumber of bytes to delete from the start of the message.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
CL_ERR_INVALID_PARAMETEROn passing an invalid parameter.
Description:
This API is used to delete a specific number of bytes from the start of the message pointed by messageHandle. If the read/write offset is in the region being deleted, the read/write offset will be set to 0, i.e, the beginning of the message, after performing the trim operation.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferHeaderTrim(), clBufferDelete()
ClRcT clBufferInitialize ( const ClBufferPoolConfigT pConfig)

Initializes the Buffer Management library.

Header File:
clBufferApi.h
Parameters:
Parameters
pConfigThis should contain the pool configuration to be used by the Buffer library. If NULL is passed then the default pool configuration will be used.
Return values
CL_OKThe API executed successfully.
CL_ERR_NO_MEMORYOn memory allocation failure.
CL_ERR_INITIALIZEDIf the Buffer Management library is already initialized.
Description:
This API is used to initialize the Buffer Management library. It must be called before calling any other Buffer library APIs. Since Buffer library uses OpenClovis OSAL APIs, the OSAL library should be initialized before intializing the Buffer library.
Library Files:
ClBuffer
See Also
clBufferFinalize()
ClRcT clBufferKernelToUserCopy ( ClBufferHandleT  kernelMessageHandle,
ClBufferHandleT  userMessageHandle 
)

Copies message from kernel-space to user-space.

Header File:
clBufferApi.h
Note
This API is available only inside the kernel. It cannot be invoked from the user-space.
Parameters
kernelMessageHandleHandle to kernel-space message returned by clBufferCreate() API, from which data is to be copied into user-space message.
userMessageHandleHandle to user-space message returned by clBufferCreate() API,into which data is to be copied from kernel-space message.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
CL_ERR_NO_MEMORYOn memory allocation failure.
Description:
This API is used to copy a message from kernel-space to user-space. The user-space message must be created in user space. The contents of the kernel-space message will be copied into the user-space message.Write offset would be set to the end and read offset would point to the beginning of the user-space message.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferDelete(), clBufferUserToKernelCopy()
ClRcT clBufferLengthCalc ( ClBufferHandleT  bufferHandle)

Recompute the message length & set internal variable.

Parameters
messageHandleHandle to the message returned by clBufferCreate() API.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to recompute the total message length, to be used if another entity (IOC) fools with the buffers.
Library Files:
ClBuffer
ClRcT clBufferLengthGet ( ClBufferHandleT  messageHandle,
ClUint32T *  pMessageLength 
)

Returns the length of the message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API.
pMessageLength(out) Pointer to a variable of type ClUint32T, in which the total length of the message is returned.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to retrieve the total length of the message. There is no impact on the read and write offset of the message even on subsequent invocation of this API.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferNBytesWrite()
ClRcT clBufferNBytesRead ( ClBufferHandleT  messageHandle,
ClUint8T *  pByteBuffer,
ClUint32T *  pNumberOfBytesToRead 
)

Reads the specified number of bytes of data from a message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API.
pByteBufferPointer to a stream of memory of type ClUint8T*, in which *pNumberOfBytesToRead of the read data is returned. Memory allocation and deallocation for this parameter must be done by the caller.
pNumberOfBytesToReadPointer to variable of type ClUint32T, which contains number of bytes of data to be read. And the number of bytes of data that has been successfully read is returned in this parameter.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to read *pNumberOfBytesToRead number of bytes of data from a buffer message pointed by messageHandle, starting from the where the last read has stopped at in that buffer message. If the buffer doesnt contain *pNumberOfBytesToRead number of bytes of data then *pNumberOfBytesToRead parameter will be updated with actually read number of bytes. The current read offset(or pointer), is automatically updated by *pNumberOfBytesToRead bytes after every read, so that the next read operation starts from the point where this read has left at.
Library Files:
ClBuffer
See Also
clBufferClear(), clBufferNBytesWrite(), clBufferCreate()
ClRcT clBufferNBytesWrite ( ClBufferHandleT  messageHandle,
ClUint8T *  pByteBuffer,
ClUint32T  numberOfBytesToWrite 
)

Writes the specified number bytes of data from a message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API into which n bytes of data is to be written.
pByteBufferPointer to the byte buffer from which numberOfBytesToWrite bytes are to be written into the buffer message.
numberOfBytesToWriteNumber of bytes to be written.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to write n bytes of data into the message referred by the message handle, starting from the current write offset. While writing data to a buffer message if the buffer gets full then a new buffer will be allocated automatically and then the write continues into that buffer. The write offset is automatically updated by numberOfBytesToWrite bytes after every write, so that the next write can continue from the point where this write ended at.
Library Files:
ClBuffer
See Also
clBufferClear(), clBufferNBytesRead(), clBufferCreate()
ClRcT clBufferReadOffsetGet ( ClBufferHandleT  messageHandle,
ClUint32T *  pReadOffset 
)

Returns current read offset of the message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API.
pReadOffsetPointer to a variable of type ClUint32T, in which the current read offset is returned.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to retrieve the current read offset of the buffer message. This offset is updated on invoking the clBufferNBytesRead() API or it can be set using clBufferReadOffsetSet().
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferWriteOffsetGet() clBufferDelete(), clBufferReadOffsetSet() clBufferWriteOffsetSet(), clBufferTrailerTrim() clBufferHeaderTrim(), clBufferNBytesRead()
ClRcT clBufferReadOffsetSet ( ClBufferHandleT  messageHandle,
ClInt32T  newReadOffset,
ClBufferSeekTypeT  seekType 
)

Sets current read offset of the message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API
seekTypeThis parameter accepts the following values:
  • CL_BUFFER_SEEK_SET: The read offset should be set to a position from the beginning of the message.
  • CL_BUFFER_SEEK_CUR: The read offset should be set to a position from its current location.
  • CL_BUFFER_SEEK_END: The read offset should be set to a position from the the end of the message.
newReadOffsetThe offset at which the current read offset is to be set. If seekType is set to CL_BUFFER_SEEK_SET then the value of newReadOffset should be 0 or greater, for CL_BUFFER_SEEK_CUR it can be a positive of negative number and for CL_BUFFER_END it should be 0 or a negative number.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
CL_ERR_INVALID_PARAMETEROn passing an invalid parameter.
Description:
This API is used to set the read offset of the buffer message pointed by the messageHandle. This is used, when an application wants to read the data from the buffer message from a specific point onwards. This offset is also automatically updated on invoking the clBufferNBytesRead().
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferWriteOffsetGet(), clBufferDelete(), clBufferWriteOffsetSet(), clBufferTrailerTrim(), clBufferHeaderTrim(), clBufferNBytesRead()
ClRcT clBufferShrink ( ClPoolShrinkOptionsT *  pShrinkOptions)

Frees up the unused pools of all sizes.

Header File:
clBufferApi.h
Parameters
pShrinkOptionsThis is pointer to the shrik option parameter of type ClPoolShrinkOptionsT. The values that can be passed are
  • CL_POOL_SHRINK_DEFAULT: This option will free half of total unused pools.
  • CL_POOL_SHRINK_ONE: This option will free only one pool of all the unused pools.
  • CL_POOL_SHRINK_ALL: This option will free all the unused pools.
Return values
CL_OKThe API executed successfully.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to free the unused pools. The new pools of a size get allocated when there is shortage of space for creating new buffer messages. And after using the buffer messages they will be freed using clBufferDelete(), but the pool remains. So these pools are required to be freed up at times.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferDelete()
ClRcT clBufferToBufferCopy ( ClBufferHandleT  sourceMessage,
ClUint32T  sourceMessageOffset,
ClBufferHandleT  destinationMessage,
ClUint32T  numberOfBytes 
)

Copies specific number of bytes from one message to another.

Header File:
clBufferApi.h
Parameters
sourceMessageHandle to the message returned by clBufferCreate() API, from which data is to be copied.
sourceMessageOffsetOffset with respect to beginning of sourceMessage, from where the copying is to begin.
destinationMessageHandle to the message returned by clBufferCreate() API, into which data is being copied.
numberOfBytesNumber of bytes to be copied from sourceMessage to destinationMessage.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
CL_ERR_INVALID_PARAMETEROn passing an invalid parameter.
CL_ERR_NO_MEMORYOn memory allocation failure.
Description:
This API is used to copy the numberOfBytes bytes starting at sourceMessageOffset offset in sourceMessage. The data will be copied in destinationMessage starting at write offset of the message.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferReadOffsetGet(), clBufferDelete(), clBufferWriteOffsetGet(), clBufferToBufferCopy(), clBufferDuplicate()
ClRcT clBufferTrailerTrim ( ClBufferHandleT  messageHandle,
ClUint32T  numberOfBytes 
)

Trims the tail of the message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API.
numberOfBytesNumber of bytes to delete from the tail of the message.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
CL_ERR_INVALID_PARAMETEROn passing an invalid parameter.
Description:
This API is used to delete a specific number of bytes from tail of the message pointed by messageHandle. If the read/write offset is in the region being deleted, the read/write offset will be set to length of the buffer message, i.e, the end of the message, after performing the trim operation.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferHeaderTrim(), clBufferDelete()
ClRcT clBufferUserToKernelCopy ( ClBufferHandleT  userMessageHandle,
ClBufferHandleT pKernelMessageHandle 
)

Copies message from user-space to kernel-space.

Header File:
clBufferApi.h
Note
This API is available only inside the kernel. It cannot be invoked from the user-space.
Parameters
userMessageHandleHandle to message returned by clBufferCreate() API, which is to be copied into kernel space.
pKernelMessageHandle(out) Pointer to variable of type ClBufferHandleT, in which the handle to message in the kernel space is returned.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
CL_ERR_NO_MEMORYOn memory allocation failure.
Description:
This API is used to copy a message from user-space to kernel-space. The kernel space message will be created by the Buffer Management Library and the handle to created message will be returned. Write offset would be set to the end and read offset would point to the beginning of the kernel space message.
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferDelete(), clBufferKernelToUserCopy()
ClRcT clBufferWriteOffsetGet ( ClBufferHandleT  messageHandle,
ClUint32T *  pWriteOffset 
)

Returns current write offset of the message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate API
pWriteOffsetPointer to a variable of type ClUint32T, in which the current write offset is returned.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
Description:
This API is used to retrieve the current write offset of the message. This offset is updated on invoking the clBufferNBytesWrite() API or directly through clBufferWriteOffsetSet().
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferReadOffsetGet(), clBufferDelete(), clBufferReadOffsetSet(), clBufferWriteOffsetSet(), clBufferTrailerTrim(), clBufferHeaderTrim()
ClRcT clBufferWriteOffsetSet ( ClBufferHandleT  messageHandle,
ClInt32T  newWriteOffset,
ClBufferSeekTypeT  seekType 
)

Sets current write offset of the message.

Header File:
clBufferApi.h
Parameters
messageHandleHandle to the message returned by clBufferCreate() API.
seekTypeThis parameter can accept the following values:
  • CL_BUFFER_SEEK_SET: The write offset should be set to a position from the beginning of the message.
  • CL_BUFFER_SEEK_CUR: The write offset should be set to a position from its current location.
  • CL_BUFFER_SEEK_END: The write offset should be set to a position from the the end of the message.
newWriteOffsetThe offset at which the current write offset is to be set. If seekType is set to CL_BUFFER_SEEK_SET then the value of newWriteOffset should be 0 or greater, for CL_BUFFER_SEEK_CUR it can be a positive of negative number and for CL_BUFFER_END it should be 0 or a negative number.
Return values
CL_OKThe API executed successfully.
CL_ERR_NULL_POINTEROn passing a NULL pointer.
CL_ERR_INVALID_HANDLEOn passing an invalid handle.
CL_ERR_NOT_INITIALIZEDIf Buffer Management library is not initialized.
CL_ERR_INVALID_PARAMETERIf an invalid parameter is passed.
Description:
This API is used to set the current write offset of the buffer message pointed by messageHandle. The application wanting to write some data to the buffer message starting at a perticular point in the buffer message should set the buffer message's current write offset to that point and then do the write operation. This offset is also automatically updated on invoking the clBufferNBytesWrite().
Library Files:
ClBuffer
See Also
clBufferCreate(), clBufferWriteOffsetGet(), clBufferDelete(), clBufferReadOffsetSet(), clBufferTrailerTrim(), clBufferHeaderTrim(), clBufferNBytesRead()

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen