aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/aws/s2n/stuffer/s2n_stuffer.h
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2022-12-14 15:26:54 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2022-12-14 15:26:54 +0300
commit4925d989167591a367baa018abd3dde8b24ce47f (patch)
tree1853212a7f126028a55f7ba871105c081089256d /contrib/restricted/aws/s2n/stuffer/s2n_stuffer.h
parent6aec14798ad91ed132f3da681c3d5b9c6fb2240d (diff)
downloadydb-4925d989167591a367baa018abd3dde8b24ce47f.tar.gz
Update contrib/restricted/aws/s2n to 1.3.29
Diffstat (limited to 'contrib/restricted/aws/s2n/stuffer/s2n_stuffer.h')
-rw-r--r--contrib/restricted/aws/s2n/stuffer/s2n_stuffer.h59
1 files changed, 31 insertions, 28 deletions
diff --git a/contrib/restricted/aws/s2n/stuffer/s2n_stuffer.h b/contrib/restricted/aws/s2n/stuffer/s2n_stuffer.h
index 52b6761e54..9f496e09a0 100644
--- a/contrib/restricted/aws/s2n/stuffer/s2n_stuffer.h
+++ b/contrib/restricted/aws/s2n/stuffer/s2n_stuffer.h
@@ -31,7 +31,7 @@
*/
#define S2N_WIPE_PATTERN 'w'
-#define SIZEOF_IN_BITS( t ) (sizeof(t) * CHAR_BIT)
+#define SIZEOF_IN_BITS(t) (sizeof(t) * CHAR_BIT)
#define SIZEOF_UINT24 3
@@ -45,23 +45,23 @@ struct s2n_stuffer {
uint32_t high_water_mark;
/* Was this stuffer alloc()'d ? */
- unsigned int alloced:1;
+ unsigned int alloced : 1;
/* Is this stuffer growable? */
- unsigned int growable:1;
+ unsigned int growable : 1;
/* Can this stuffer be safely resized?
* A growable stuffer can be temporarily tainted by a raw read/write,
* preventing it from resizing. */
- unsigned int tainted:1;
+ unsigned int tainted : 1;
};
-#define s2n_stuffer_data_available( s ) ((s)->write_cursor - (s)->read_cursor)
-#define s2n_stuffer_space_remaining( s ) ((s)->blob.size - (s)->write_cursor)
-#define s2n_stuffer_is_wiped( s ) ((s)->high_water_mark == 0)
-#define s2n_stuffer_is_freed( s ) ((s)->blob.data == NULL)
+#define s2n_stuffer_data_available(s) ((s)->write_cursor - (s)->read_cursor)
+#define s2n_stuffer_space_remaining(s) ((s)->blob.size - (s)->write_cursor)
+#define s2n_stuffer_is_wiped(s) ((s)->high_water_mark == 0)
+#define s2n_stuffer_is_freed(s) ((s)->blob.data == NULL)
/* Check basic validity constraints on the stuffer: e.g. that cursors point within the blob */
-extern S2N_RESULT s2n_stuffer_validate(const struct s2n_stuffer* stuffer);
+extern S2N_RESULT s2n_stuffer_validate(const struct s2n_stuffer *stuffer);
/* Initialize and destroying stuffers */
extern int s2n_stuffer_init(struct s2n_stuffer *stuffer, struct s2n_blob *in);
@@ -88,10 +88,11 @@ extern bool s2n_stuffer_is_consumed(struct s2n_stuffer *stuffer);
extern int s2n_stuffer_read(struct s2n_stuffer *stuffer, struct s2n_blob *out);
extern int s2n_stuffer_erase_and_read(struct s2n_stuffer *stuffer, struct s2n_blob *out);
extern int s2n_stuffer_write(struct s2n_stuffer *stuffer, const struct s2n_blob *in);
-extern int s2n_stuffer_read_bytes(struct s2n_stuffer *stuffer, uint8_t * out, uint32_t n);
-extern int s2n_stuffer_erase_and_read_bytes(struct s2n_stuffer *stuffer, uint8_t * data, uint32_t size);
-extern int s2n_stuffer_write_bytes(struct s2n_stuffer *stuffer, const uint8_t * in, const uint32_t n);
-extern int s2n_stuffer_writev_bytes(struct s2n_stuffer *stuffer, const struct iovec* iov, size_t iov_count, uint32_t offs, uint32_t size);
+extern int s2n_stuffer_read_bytes(struct s2n_stuffer *stuffer, uint8_t *out, uint32_t n);
+extern int s2n_stuffer_erase_and_read_bytes(struct s2n_stuffer *stuffer, uint8_t *data, uint32_t size);
+extern int s2n_stuffer_write_bytes(struct s2n_stuffer *stuffer, const uint8_t *in, const uint32_t n);
+extern int s2n_stuffer_writev_bytes(struct s2n_stuffer *stuffer, const struct iovec *iov, size_t iov_count,
+ uint32_t offs, uint32_t size);
extern int s2n_stuffer_skip_read(struct s2n_stuffer *stuffer, uint32_t n);
extern int s2n_stuffer_skip_write(struct s2n_stuffer *stuffer, const uint32_t n);
@@ -105,15 +106,16 @@ extern void *s2n_stuffer_raw_write(struct s2n_stuffer *stuffer, const uint32_t d
extern void *s2n_stuffer_raw_read(struct s2n_stuffer *stuffer, uint32_t data_len);
/* Send/receive stuffer to/from a file descriptor */
-extern int s2n_stuffer_recv_from_fd(struct s2n_stuffer *stuffer, const int rfd, const uint32_t len, uint32_t *bytes_written);
+extern int s2n_stuffer_recv_from_fd(struct s2n_stuffer *stuffer, const int rfd, const uint32_t len,
+ uint32_t *bytes_written);
extern int s2n_stuffer_send_to_fd(struct s2n_stuffer *stuffer, const int wfd, const uint32_t len, uint32_t *bytes_sent);
/* Read and write integers in network order */
-extern int s2n_stuffer_read_uint8(struct s2n_stuffer *stuffer, uint8_t * u);
-extern int s2n_stuffer_read_uint16(struct s2n_stuffer *stuffer, uint16_t * u);
-extern int s2n_stuffer_read_uint24(struct s2n_stuffer *stuffer, uint32_t * u);
-extern int s2n_stuffer_read_uint32(struct s2n_stuffer *stuffer, uint32_t * u);
-extern int s2n_stuffer_read_uint64(struct s2n_stuffer *stuffer, uint64_t * u);
+extern int s2n_stuffer_read_uint8(struct s2n_stuffer *stuffer, uint8_t *u);
+extern int s2n_stuffer_read_uint16(struct s2n_stuffer *stuffer, uint16_t *u);
+extern int s2n_stuffer_read_uint24(struct s2n_stuffer *stuffer, uint32_t *u);
+extern int s2n_stuffer_read_uint32(struct s2n_stuffer *stuffer, uint32_t *u);
+extern int s2n_stuffer_read_uint64(struct s2n_stuffer *stuffer, uint64_t *u);
extern int s2n_stuffer_write_uint8(struct s2n_stuffer *stuffer, const uint8_t u);
extern int s2n_stuffer_write_uint16(struct s2n_stuffer *stuffer, const uint16_t u);
@@ -130,7 +132,7 @@ struct s2n_stuffer_reservation {
uint8_t length;
};
/* Check basic validity constraints on the s2n_stuffer_reservation: e.g. stuffer validity. */
-extern S2N_RESULT s2n_stuffer_reservation_validate(const struct s2n_stuffer_reservation* reservation);
+extern S2N_RESULT s2n_stuffer_reservation_validate(const struct s2n_stuffer_reservation *reservation);
int s2n_stuffer_reserve_uint8(struct s2n_stuffer *stuffer, struct s2n_stuffer_reservation *reservation);
extern int s2n_stuffer_reserve_uint16(struct s2n_stuffer *stuffer, struct s2n_stuffer_reservation *reservation);
extern int s2n_stuffer_reserve_uint24(struct s2n_stuffer *stuffer, struct s2n_stuffer_reservation *reservation);
@@ -144,20 +146,21 @@ extern int s2n_stuffer_read_base64(struct s2n_stuffer *stuffer, struct s2n_stuff
extern int s2n_stuffer_write_base64(struct s2n_stuffer *stuffer, struct s2n_stuffer *in);
/* Useful for text manipulation ... */
-#define s2n_stuffer_write_char( stuffer, c ) s2n_stuffer_write_uint8( (stuffer), (uint8_t) (c) )
-#define s2n_stuffer_read_char( stuffer, c ) s2n_stuffer_read_uint8( (stuffer), (uint8_t *) (c) )
-#define s2n_stuffer_write_str( stuffer, c ) s2n_stuffer_write_bytes( (stuffer), (const uint8_t *) (c), strlen((c)) )
-#define s2n_stuffer_write_text( stuffer, c, n ) s2n_stuffer_write_bytes( (stuffer), (const uint8_t *) (c), (n) )
-#define s2n_stuffer_read_text( stuffer, c, n ) s2n_stuffer_read_bytes( (stuffer), (uint8_t *) (c), (n) )
-extern int s2n_stuffer_read_expected_str(struct s2n_stuffer *stuffer, const char* expected);
+#define s2n_stuffer_write_char(stuffer, c) s2n_stuffer_write_uint8((stuffer), (uint8_t) (c))
+#define s2n_stuffer_read_char(stuffer, c) s2n_stuffer_read_uint8((stuffer), (uint8_t *) (c))
+#define s2n_stuffer_write_str(stuffer, c) s2n_stuffer_write_bytes((stuffer), (const uint8_t *) (c), strlen((c)))
+#define s2n_stuffer_write_text(stuffer, c, n) s2n_stuffer_write_bytes((stuffer), (const uint8_t *) (c), (n))
+#define s2n_stuffer_read_text(stuffer, c, n) s2n_stuffer_read_bytes((stuffer), (uint8_t *) (c), (n))
+extern int s2n_stuffer_read_expected_str(struct s2n_stuffer *stuffer, const char *expected);
extern int s2n_stuffer_peek_char(struct s2n_stuffer *stuffer, char *c);
extern int s2n_stuffer_read_token(struct s2n_stuffer *stuffer, struct s2n_stuffer *token, char delim);
extern int s2n_stuffer_read_line(struct s2n_stuffer *stuffer, struct s2n_stuffer *token);
extern int s2n_stuffer_peek_check_for_str(struct s2n_stuffer *s2n_stuffer, const char *expected);
extern int s2n_stuffer_skip_whitespace(struct s2n_stuffer *stuffer, uint32_t *skipped);
extern int s2n_stuffer_skip_to_char(struct s2n_stuffer *stuffer, char target);
-extern int s2n_stuffer_skip_expected_char(struct s2n_stuffer *stuffer, const char expected, const uint32_t min, const uint32_t max, uint32_t *skipped);
-extern int s2n_stuffer_skip_read_until(struct s2n_stuffer *stuffer, const char* target);
+extern int s2n_stuffer_skip_expected_char(struct s2n_stuffer *stuffer, const char expected, const uint32_t min,
+ const uint32_t max, uint32_t *skipped);
+extern int s2n_stuffer_skip_read_until(struct s2n_stuffer *stuffer, const char *target);
extern int s2n_stuffer_alloc_ro_from_string(struct s2n_stuffer *stuffer, const char *str);
extern int s2n_stuffer_init_ro_from_string(struct s2n_stuffer *stuffer, uint8_t *data, uint32_t length);