diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2023-03-14 12:50:27 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2023-03-18 17:12:27 +0100 |
commit | 99b4f4d6d6f18321489bae50f1762b29165f7de1 (patch) | |
tree | 980ce47c1e7e84b91403ecc8f8263c8d05dfc1c3 /include | |
parent | 3b2f38aeafa1d6d2976dd5581ef46a5d3b463825 (diff) | |
download | ouroboros-99b4f4d6d6f18321489bae50f1762b29165f7de1.tar.gz ouroboros-99b4f4d6d6f18321489bae50f1762b29165f7de1.zip |
irmd: Use buffer_t for piggybacked data
Instead of passing a const void * and len, it now passes buffer_t to
operations that send piggybacked data (flow_req_arr and flow_reply)
and a buffer_t * for operations that send and receive piggybacked data
(flow_alloc and flow_accept).
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/utils.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h index bd174149..f5f8610d 100644 --- a/include/ouroboros/utils.h +++ b/include/ouroboros/utils.h @@ -25,16 +25,20 @@ #include <stdint.h> #include <unistd.h> +#include <string.h> #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define ABS(a) ((a) > 0 ? (a) : -(a)) +#define clrbuf(buf) do { memset(&(buf), 0, sizeof(buf)); } while (0); +#define freebuf(buf) do { free((buf).data); clrbuf(buf); } while (0); typedef struct { uint8_t * data; size_t len; } buffer_t; + /* * Returns the number of characters a uint would * need when represented as a string |