libkate: kate_packet

# kate_packet

## Functions
int | kate_packet_wrap (kate_packet *kp, size_t nbytes, const void *data)
int | kate_packet_init (kate_packet *kp, size_t nbytes, const void *data)
int | kate_packet_clear (kate_packet *kp)

## Detailed Description

## Function Documentation

int kate_packet_clear | ( | kate_packet * | kp | ) |

Clears a kate_packet previously initialized by kate_packet_init

Parameters:

  | kp | the kate_packet to clear

Returns:
  0 success
  KATE_E_* error

References kate_packet::data, and KATE_E_INVALID_PARAMETER.

int kate_packet_init | ( | kate_packet * | kp,
|  | size_t | nbytes,
|  | const void * | data |
| ) |  |  |

Returns a kate_packet created from the given data. The data is copied, so can be freed once the kate_packet is created. The kate_packet should be cleared when not needed anymore.

Parameters:

  | kp | the kate_packet to create
  | nbytes | the number of bytes in the data to wrap
  | data | a pointer to the data to wrap

Returns:
  0 success
  KATE_E_* error

References KATE_E_INVALID_PARAMETER, KATE_E_OUT_OF_MEMORY, and kate_packet_wrap().

int kate_packet_wrap | ( | kate_packet * | kp,
|  | size_t | nbytes,
|  | const void * | data |
| ) |  |  |

Returns a kate_packet wrapping the given data. The data is not copied, so should stay valid throughout the use of the kate_packet. The kate_packet should not be cleared.

Parameters:

  | kp | the kate_packet to wrap
  | nbytes | the number of bytes in the data to wrap
  | data | a pointer to the data to wrap

Returns:
  0 success
  KATE_E_* error

References kate_packet::data, KATE_E_INVALID_PARAMETER, and kate_packet::nbytes.

Referenced by kate_packet_init().