libkate 0.4.3
Functions
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

◆ kate_packet_clear()

int kate_packet_clear ( kate_packet kp)

Clears a kate_packet previously initialized by kate_packet_init

Parameters
kpthe kate_packet to clear
Returns
0 success
KATE_E_* error

References kate_packet::data, and KATE_E_INVALID_PARAMETER.

◆ kate_packet_init()

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
kpthe kate_packet to create
nbytesthe number of bytes in the data to wrap
dataa 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().

◆ 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
kpthe kate_packet to wrap
nbytesthe number of bytes in the data to wrap
dataa 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().