XML Security Library

LibXML2
LibXSLT
OpenSSL

buffer

Name

buffer -- 

Synopsis


enum        xmlSecAllocMode;
struct      xmlSecBuffer;
void        xmlSecBufferSetDefaultAllocMode (xmlSecAllocMode defAllocMode,
                                             size_t defInitialSize);
xmlSecBufferPtr xmlSecBufferCreate          (size_t size);
void        xmlSecBufferDestroy             (xmlSecBufferPtr buf);
int         xmlSecBufferInitialize          (xmlSecBufferPtr buf,
                                             size_t size);
void        xmlSecBufferFinalize            (xmlSecBufferPtr buf);
unsigned char* xmlSecBufferGetData          (xmlSecBufferPtr buf);
int         xmlSecBufferSetData             (xmlSecBufferPtr buf,
                                             unsigned char *data,
                                             size_t size);
size_t      xmlSecBufferGetSize             (xmlSecBufferPtr buf);
int         xmlSecBufferSetSize             (xmlSecBufferPtr buf,
                                             size_t size);
size_t      xmlSecBufferGetMaxSize          (xmlSecBufferPtr buf);
int         xmlSecBufferSetMaxSize          (xmlSecBufferPtr buf,
                                             size_t size);
void        xmlSecBufferEmpty               (xmlSecBufferPtr buf);
int         xmlSecBufferAppend              (xmlSecBufferPtr buf,
                                             unsigned char *data,
                                             size_t size);
int         xmlSecBufferPrepend             (xmlSecBufferPtr buf,
                                             unsigned char *data,
                                             size_t size);
int         xmlSecBufferRemoveHead          (xmlSecBufferPtr buf,
                                             size_t size);
int         xmlSecBufferRemoveTail          (xmlSecBufferPtr buf,
                                             size_t size);
int         xmlSecBufferBase64NodeContentRead
                                            (xmlSecBufferPtr buf,
                                             xmlNodePtr node);
int         xmlSecBufferBase64NodeContentWrite
                                            (xmlSecBufferPtr buf,
                                             xmlNodePtr node,
                                             int columns);
xmlOutputBufferPtr xmlSecBufferCreateOutputBuffer
                                            (xmlSecBufferPtr buf);

Description

Details

enum xmlSecAllocMode

typedef enum {
    xmlSecAllocModeExact = 0,
    xmlSecAllocModeDouble
} xmlSecAllocMode;

The memory allocation mode (used by xmlSecBuffer and xmlSecList).

xmlSecAllocModeExact

the memory allocation mode that minimizes total allocated memory size.

xmlSecAllocModeDouble

the memory allocation mode that tries to minimize the number of malloc calls.


struct xmlSecBuffer

struct xmlSecBuffer {
    unsigned char* 	data;
    size_t 		size;
    size_t		maxSize;
    xmlSecAllocMode 	allocMode;
};

Binary data buffer.

unsigned char *data

the pointer to buffer data.

size_t size

the current data size.

size_t maxSize

the max data size (allocated buffer size).

xmlSecAllocMode allocMode

the buffer memory allocation mode.


xmlSecBufferSetDefaultAllocMode ()

void        xmlSecBufferSetDefaultAllocMode (xmlSecAllocMode defAllocMode,
                                             size_t defInitialSize);

Sets new global default allocation mode and minimal intial size.

defAllocMode :

the new default buffer allocation mode.

defInitialSize :

the new default buffer minimal intial size.


xmlSecBufferCreate ()

xmlSecBufferPtr xmlSecBufferCreate          (size_t size);

Allocates and initalizes new memory buffer with given size. Caller is responsible for calling xmlSecBufferDestroy function to free the buffer.

size :

the intial size.

Returns :

pointer to newly allocated buffer or NULL if an error occurs.


xmlSecBufferDestroy ()

void        xmlSecBufferDestroy             (xmlSecBufferPtr buf);

Desrtoys buffer object created with xmlSecBufferCreate function.

buf :

the pointer to buffer object.


xmlSecBufferInitialize ()

int         xmlSecBufferInitialize          (xmlSecBufferPtr buf,
                                             size_t size);

Initializes buffer object buf. Caller is responsible for calling xmlSecBufferFinalize function to free allocated resources.

buf :

the pointer to buffer object.

size :

the initial buffer size.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferFinalize ()

void        xmlSecBufferFinalize            (xmlSecBufferPtr buf);

Frees allocated resource for a buffer intialized with xmlSecBufferInitialize function.

buf :

the pointer to buffer object.


xmlSecBufferGetData ()

unsigned char* xmlSecBufferGetData          (xmlSecBufferPtr buf);

Gets pointer to buffer's data.

buf :

the pointer to buffer object.

Returns :

pointer to buffer's data.


xmlSecBufferSetData ()

int         xmlSecBufferSetData             (xmlSecBufferPtr buf,
                                             unsigned char *data,
                                             size_t size);

Sets the value of the buffer to data.

buf :

the pointer to buffer object.

data :

the data.

size :

the data size.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferGetSize ()

size_t      xmlSecBufferGetSize             (xmlSecBufferPtr buf);

Gets the current buffer data size.

buf :

the pointer to buffer object.

Returns :

the current data size.


xmlSecBufferSetSize ()

int         xmlSecBufferSetSize             (xmlSecBufferPtr buf,
                                             size_t size);

Sets new buffer data size. If necessary, buffer grows to have at least size bytes.

buf :

the pointer to buffer object.

size :

the new data size.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferGetMaxSize ()

size_t      xmlSecBufferGetMaxSize          (xmlSecBufferPtr buf);

Gets the maximum (allocated) buffer size.

buf :

the pointer to buffer object.

Returns :

the maximum (allocated) buffer size.


xmlSecBufferSetMaxSize ()

int         xmlSecBufferSetMaxSize          (xmlSecBufferPtr buf,
                                             size_t size);

Sets new buffer maximum size. If necessary, buffer grows to have at least size bytes.

buf :

the pointer to buffer object.

size :

the new maximum size.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferEmpty ()

void        xmlSecBufferEmpty               (xmlSecBufferPtr buf);

Empties the buffer.

buf :

the pointer to buffer object.


xmlSecBufferAppend ()

int         xmlSecBufferAppend              (xmlSecBufferPtr buf,
                                             unsigned char *data,
                                             size_t size);

Appends the data after the current data stored in the buffer.

buf :

the pointer to buffer object.

data :

the data.

size :

the data size.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferPrepend ()

int         xmlSecBufferPrepend             (xmlSecBufferPtr buf,
                                             unsigned char *data,
                                             size_t size);

Prepends the data before the current data stored in the buffer.

buf :

the pointer to buffer object.

data :

the data.

size :

the data size.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferRemoveHead ()

int         xmlSecBufferRemoveHead          (xmlSecBufferPtr buf,
                                             size_t size);

Removes size bytes from the beginning of the current buffer.

buf :

the pointer to buffer object.

size :

the number of bytes to be removed.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferRemoveTail ()

int         xmlSecBufferRemoveTail          (xmlSecBufferPtr buf,
                                             size_t size);

Removes size bytes from the end of current buffer.

buf :

the pointer to buffer object.

size :

the number of bytes to be removed.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferBase64NodeContentRead ()

int         xmlSecBufferBase64NodeContentRead
                                            (xmlSecBufferPtr buf,
                                             xmlNodePtr node);

Reads the content of the node, base64 decodes it and stores the result in the buffer.

buf :

the pointer to buffer object.

node :

the pointer to node.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferBase64NodeContentWrite ()

int         xmlSecBufferBase64NodeContentWrite
                                            (xmlSecBufferPtr buf,
                                             xmlNodePtr node,
                                             int columns);

Sets the content of the node to the base64 encoded buffer data.

buf :

the pointer to buffer object.

node :

the pointer to a node.

columns :

the max line size fro base64 encoded data.

Returns :

0 on success or a negative value if an error occurs.


xmlSecBufferCreateOutputBuffer ()

xmlOutputBufferPtr xmlSecBufferCreateOutputBuffer
                                            (xmlSecBufferPtr buf);

Creates new LibXML output buffer to store data in the buf. Caller is responsible for destroying buf when processing is done.

buf :

the pointer to buffer.

Returns :

pointer to newly allocated output buffer or NULL if an error occurs.



Aleksey Sanin