]>
Commit | Line | Data |
---|---|---|
bd1ae178 LP |
1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
2 | #pragma once | |
3 | ||
0c15577a | 4 | #include <sys/uio.h> /* IWYU pragma: export */ |
bd1ae178 | 5 | |
0c15577a DDM |
6 | #include "forward.h" |
7 | #include "iovec-util-fundamental.h" /* IWYU pragma: export */ | |
bd1ae178 | 8 | |
432977a0 LP |
9 | extern const struct iovec iovec_nul_byte; /* Points to a single NUL byte */ |
10 | extern const struct iovec iovec_empty; /* Points to an empty, but valid (i.e. non-NULL) pointer */ | |
045f7b8f | 11 | |
6da2ea9f | 12 | size_t iovec_total_size(const struct iovec *iovec, size_t n) _nonnull_if_nonzero_(1, 2); |
bd1ae178 | 13 | |
6da2ea9f | 14 | bool iovec_increment(struct iovec *iovec, size_t n, size_t k) _nonnull_if_nonzero_(1, 2); |
bd1ae178 | 15 | |
e53d4f34 | 16 | struct iovec* iovec_make_string(struct iovec *iovec, const char *s); |
33d1febb LP |
17 | |
18 | #define IOVEC_MAKE_STRING(s) \ | |
19 | *iovec_make_string(&(struct iovec) {}, s) | |
bd1ae178 | 20 | |
dddc12f9 LP |
21 | #define CONST_IOVEC_MAKE_STRING(s) \ |
22 | (const struct iovec) { \ | |
23 | .iov_base = (char*) s, \ | |
24 | .iov_len = STRLEN(s), \ | |
25 | } | |
26 | ||
e53d4f34 | 27 | void iovec_done_erase(struct iovec *iovec); |
3a856171 | 28 | |
bd1ae178 LP |
29 | char* set_iovec_string_field(struct iovec *iovec, size_t *n_iovec, const char *field, const char *value); |
30 | char* set_iovec_string_field_free(struct iovec *iovec, size_t *n_iovec, const char *field, char *value); | |
31 | ||
6da2ea9f | 32 | void iovec_array_free(struct iovec *iovec, size_t n_iovec) _nonnull_if_nonzero_(1, 2); |
bf38e4c0 | 33 | |
e53d4f34 | 34 | int iovec_memcmp(const struct iovec *a, const struct iovec *b) _pure_; |
4cc467b6 | 35 | |
e53d4f34 | 36 | struct iovec* iovec_memdup(const struct iovec *source, struct iovec *ret); |
664570f5 LP |
37 | |
38 | struct iovec* iovec_append(struct iovec *iovec, const struct iovec *append); |