Debian Codegraph @

crt/s2n/utils/s2n_socket.h

raw symbols SCIP
1 /*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 #pragma once
17
18 /* On Windows, s2n-tls does not provide built-in socket I/O.
19 * Windows users must supply custom I/O callbacks via
20 * s2n_connection_set_recv_cb() / s2n_connection_set_send_cb().
21 */
22 #ifndef _WIN32
23
24 #include "tls/s2n_connection.h"
25
26 /* The default read I/O context for communication over a socket */
27 struct s2n_socket_read_io_context {
28 /* The peer's fd */
29 int fd;
30
31 /* Has TCP_QUICKACK been set since the last read */
32 unsigned int tcp_quickack_set : 1;
33 /* Original SO_RCVLOWAT socket option settings before s2n takes over the fd */
34 unsigned int original_rcvlowat_is_set : 1;
35 int original_rcvlowat_val;
36 };
37
38 /* The default write I/O context for communication over a socket */
39 struct s2n_socket_write_io_context {
40 /* The peer's fd */
41 int fd;
42
43 /* Original TCP_CORK socket option settings before s2n takes over the fd */
44 unsigned int original_cork_is_set : 1;
45 int original_cork_val;
46 };
47
48 int s2n_socket_quickack(struct s2n_connection *conn);
49 int s2n_socket_read_snapshot(struct s2n_connection *conn);
50 int s2n_socket_write_snapshot(struct s2n_connection *conn);
51 int s2n_socket_read_restore(struct s2n_connection *conn);
52 int s2n_socket_write_restore(struct s2n_connection *conn);
53 int s2n_socket_was_corked(struct s2n_connection *conn);
54 int s2n_socket_write_cork(struct s2n_connection *conn);
55 int s2n_socket_write_uncork(struct s2n_connection *conn);
56 int s2n_socket_read(void *io_context, uint8_t *buf, uint32_t len);
57 int s2n_socket_write(void *io_context, const uint8_t *buf, uint32_t len);
58
59 #endif