# Buffer
[OMXMLSecurity]

## Defines
#define | OXS_BUFFER_INITIAL_SIZE 1024
## Typedefs
typedef struct oxs_buffer | oxs_buffer_t
## Enumerations
enum | oxs_AllocMode { oxs_alloc_mode_exact = 0, oxs_alloc_mode_double }
## Functions
AXIS2_EXTERN axis2_status_t | oxs_buffer_free (oxs_buffer_t *buffer, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | oxs_buffer_remove_head (oxs_buffer_t *buffer, const axutil_env_t *env, int size)
AXIS2_EXTERN axis2_status_t | oxs_buffer_remove_tail (oxs_buffer_t *buffer, const axutil_env_t *env, int size)
AXIS2_EXTERN axis2_status_t | oxs_buffer_populate (oxs_buffer_t *buffer, const axutil_env_t *env, unsigned char *data, int size)
AXIS2_EXTERN axis2_status_t | oxs_buffer_append (oxs_buffer_t *buffer, const axutil_env_t *env, unsigned char *data, int size)
AXIS2_EXTERN axis2_status_t | oxs_buffer_prepend (oxs_buffer_t *buffer, const axutil_env_t *env, unsigned char *data, int size)
AXIS2_EXTERN axis2_status_t | oxs_buffer_read_file (oxs_buffer_t *buffer, const axutil_env_t *env, const axis2_char_t *filename)
AXIS2_EXTERN axis2_status_t | oxs_buffer_set_size (oxs_buffer_t *buffer, const axutil_env_t *env, int size)
AXIS2_EXTERN axis2_status_t | oxs_buffer_set_max_size (oxs_buffer_t *buffer, const axutil_env_t *env, int size)
AXIS2_EXTERN unsigned char * | oxs_buffer_get_data (oxs_buffer_t *buffer, const axutil_env_t *env)
AXIS2_EXTERN int | oxs_buffer_get_size (oxs_buffer_t *buffer, const axutil_env_t *env)
AXIS2_EXTERN int | oxs_buffer_get_max_size (oxs_buffer_t *buffer, const axutil_env_t *env)
AXIS2_EXTERN oxs_buffer_t * | oxs_buffer_dup (oxs_buffer_t *buffer, const axutil_env_t *env)
AXIS2_EXTERN oxs_buffer_t * | oxs_buffer_create (const axutil_env_t *env)

## Typedef Documentation

typedef struct oxs_buffer oxs_buffer_t

Type name for struct oxs_buffer

## Enumeration Type Documentation

enum oxs_AllocMode

Allocate mode for the buffer oxs_alloc_mode_exact : Minimizes the allocated memory size oxs_alloc_mode_double : Minimizes number of Malloc calls

## Function Documentation

AXIS2_EXTERN axis2_status_t oxs_buffer_append | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env,
|  | unsigned char * | data,
|  | int | size |
| ) |  |  |

Append data (to the end) pointer to the OMXMLSec buffer struct pointer to environment struct the data for the buffer the effective length of data

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_buffer_free | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env |
| ) |  |  |

Free function of the buffer

Parameters:

  | buffer | pointer to the OMXMLSec buffer struct
  | env | pointer to environment struct

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN unsigned char* oxs_buffer_get_data | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env |
| ) |  |  |

Returns data pointer to the OMXMLSec buffer struct pointer to environment struct

Returns:
  data in the buffer

AXIS2_EXTERN int oxs_buffer_get_max_size | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env |
| ) |  |  |

Returns the maximum size of the buffer pointer to the OMXMLSec buffer struct pointer to environment struct

Returns:
  the maximum size of the buffer

AXIS2_EXTERN int oxs_buffer_get_size | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env |
| ) |  |  |

Returns the effective length of the buffer pointer to the OMXMLSec buffer struct pointer to environment struct

Returns:
  the effective length of the buffer as int

AXIS2_EXTERN axis2_status_t oxs_buffer_populate | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env,
|  | unsigned char * | data,
|  | int | size |
| ) |  |  |

populates the buffer using the set the as the useful length pointer to the OMXMLSec buffer struct pointer to environment struct the data for the buffer the effective length of data

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_buffer_prepend | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env,
|  | unsigned char * | data,
|  | int | size |
| ) |  |  |

Prepends data (to the front of the buffer) pointer to the OMXMLSec buffer struct pointer to environment struct the data for the buffer the effective length of data

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_buffer_read_file | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env,
|  | const axis2_char_t * | filename |
| ) |  |  |

Reads a file specified by pointer to the OMXMLSec buffer struct pointer to environment struct The name of the file

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_buffer_remove_head | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env,
|  | int | size |
| ) |  |  |

Removes the first (size) charcters from the buffer

Parameters:

  | buffer | pointer to the OMXMLSec buffer struct
  | env | pointer to environment struct
  | size | number of characters to be removed

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_buffer_remove_tail | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env,
|  | int | size |
| ) |  |  |

Removes the last (size) charcters from the buffer

Parameters:

  | buffer | pointer to the OMXMLSec buffer struct
  | env | pointer to environment struct
  | size | number of characters to be removed

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_buffer_set_max_size | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env,
|  | int | size |
| ) |  |  |

Sets the maximum size of the buffer. Usually this will be allocated dynamically pointer to the OMXMLSec buffer struct pointer to environment struct the maximum size of the buffer

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_buffer_set_size | ( | oxs_buffer_t * | buffer,
|  | const axutil_env_t * | env,
|  | int | size |
| ) |  |  |

Sets the size pointer to the OMXMLSec buffer struct pointer to environment struct the value of the size

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE