buffer\datum questions

Olya olyasib12 at gmail.com
Thu Aug 2 06:02:01 CEST 2012


02.08.2012 06:05, Nikos Mavrogiannopoulos пишет:

> There is _gnutls_bin2hex() that given your buffer's data and length
> fields it would save the hex output in the array you specified.

Do I have to allocate that char * array or _gnutls_bin2hex() will take care of that?

>> 5) What does various _prefix() functions do?
> 
> 
> They are used to store the TLS variable length fields. That is they
> prepend the size of the buffer before the data. The prefix size is the
> number of bits used for the length (8,16,24,32).

What's the meaning of check in

_gnutls_buffer_pop_prefix (gnutls_buffer_st * buf, size_t * data_size, int check) ?

And few more related questions:

1) Why _gnutls_buffer_replace_data( gnutls_buffer_st * buf, gnutls_datum_t * data)
uses datum while _append() uses data & size?

2) Do I have to pre-allocate memory for the datum, copy my data to datum, call
_replace() and deallocate datum? Could you give simple example of _replace() usage?

3) When should I use _gnutls_buffer_reset() ?

Thank you for detailed explanations - it's too good to leave it be in my inbox :-)
Should I add them to doc/cha-internals.texi or there's more appropriate place for that?

best regards,
Olga.





More information about the Gnutls-devel mailing list