De-serializer#

Configure#

struct ntl_deserializer#

Structure to assist de-serialization into a null-terminated list.

Public Members

int (*partition_as_sized_bufs)(char*, size_t, struct sized_buffer ***p)#

mandatory callback that partition a string to n smaller tokens, each representing a NTL element

size_t elem_size#

the size of each NTL element

void (*init_elem)(void*)#

NTL elements initialization callback (ignored if NULL)

void (*elem_from_buf)(char *buf, size_t size, void *recipient)#

callback that matches each token created at partition_as_sized_bufs to a NTL element

ntl_t *ntl_recipient_p#

a NTL pointer that should receive the resulting NTL

De-serialize a buffer into NTL#

size_t ntl_from_buf2(char *buf, size_t size, struct ntl_deserializer *deserializer)#

De-serialize buffer into a null-terminated list.

Note

this will pass each one of the NTL’s elements by its address at the callback

Parameters:
  • buf – the buffer containing the data to be de-serialized into the NTL

  • size – the buffer size

  • deserializer – the de-serializer config structure

Returns:

the amount of elements in the new NTL