URL: https://github.com/SSSD/sssd/pull/152
Title: #152: Add a tevent wrapper around libcurl's asynchronous interface

pbrezina commented:
"""
Thank you. So far I'm reading `secrets` code trying to figure out my needs to 
comment on `curl` implementation. Here are some comments on the `iobuf` module:

1. `struct sss_iobuf` should be opaque
2. I'm expecting `sss_iobuf_init()` to also allocate `iobuf` context. How about:

```c
sss_iobuf_init() ->
/**
 *  Creates a new buffer with size @size and maximum capacity @max_capacity and 
copy @data to this buffer.
 */
struct sss_iobuf *sss_iobuf_init(TALLOC_CTX *mem_ctx, uint8_t *data, size_t 
size, size_t max_capacity)

/**
 *  Creates a new read-only buffer with size @size and copy @data to this 
buffer.
 */
struct sss_iobuf *sss_iobuf_init_readonly(TALLOC_CTX *mem_ctx, uint8_t *data, 
size_t size, size_t)

sss_iobuf_tc() ->
/**
 *  Creates a new empty buffer with initial size @size and maximum capacity 
@max_capacity. Buffer is initialized to zeros.
 */
struct sss_iobuf *sss_iobuf_init_empty(TALLOC_CTX *mem_ctx, size_t 
initial_size, size_t max_capacity)
```

Non-empty buffers should memcpy data.

And here are two requirements for using this as a replacement for `sss_packet`:
1. Maximum capacity should not be always enforced, consider treating `capacity 
== 0` as unlimited. I will definitely want to replace `sss_packet` at one point 
and you don't always know total size there.

2. Once capacity is unlimited, multiplying the size by factor two indefinitely 
to gain enough space to will become dangerous. Can we grow the buffer by small 
chunks instead? See `sss_packet_grow` for an example.

"""

See the full comment at 
https://github.com/SSSD/sssd/pull/152#issuecomment-279713381
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to