/src/gnutls/lib/buffers.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2000-2012 Free Software Foundation, Inc. |
3 | | * |
4 | | * Author: Nikos Mavrogiannopoulos |
5 | | * |
6 | | * This file is part of GnuTLS. |
7 | | * |
8 | | * The GnuTLS is free software; you can redistribute it and/or |
9 | | * modify it under the terms of the GNU Lesser General Public License |
10 | | * as published by the Free Software Foundation; either version 2.1 of |
11 | | * the License, or (at your option) any later version. |
12 | | * |
13 | | * This library is distributed in the hope that it will be useful, but |
14 | | * WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | | * Lesser General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU Lesser General Public License |
19 | | * along with this program. If not, see <https://www.gnu.org/licenses/> |
20 | | * |
21 | | */ |
22 | | |
23 | | #ifndef GNUTLS_LIB_BUFFERS_H |
24 | | # define GNUTLS_LIB_BUFFERS_H |
25 | | |
26 | | # include "mbuffers.h" |
27 | | |
28 | | # define MBUFFER_FLUSH 1 |
29 | | |
30 | | void |
31 | | _gnutls_record_buffer_put(gnutls_session_t session, |
32 | | content_type_t type, uint64_t seq, |
33 | | mbuffer_st * bufel); |
34 | | |
35 | | inline static int _gnutls_record_buffer_get_size(gnutls_session_t session) |
36 | 0 | { |
37 | 0 | return session->internals.record_buffer.byte_length; |
38 | 0 | } Unexecuted instantiation: heartbeat.c:_gnutls_record_buffer_get_size Unexecuted instantiation: key_share.c:_gnutls_record_buffer_get_size Unexecuted instantiation: pre_shared_key.c:_gnutls_record_buffer_get_size Unexecuted instantiation: status_request.c:_gnutls_record_buffer_get_size Unexecuted instantiation: supported_versions.c:_gnutls_record_buffer_get_size |
39 | | |
40 | | # define NO_TIMEOUT_FUNC_SET(session) unlikely(session->internals.pull_timeout_func == gnutls_system_recv_timeout \ |
41 | | && session->internals.pull_func != system_read) |
42 | | |
43 | | /*- |
44 | | * record_check_unprocessed: |
45 | | * @session: is a #gnutls_session_t structure. |
46 | | * |
47 | | * This function checks if there are unprocessed data |
48 | | * in the gnutls record buffers. Those data might not |
49 | | * be complete records. |
50 | | * |
51 | | * Returns: Returns the size of the data or zero. |
52 | | -*/ |
53 | | inline static size_t record_check_unprocessed(gnutls_session_t session) |
54 | 0 | { |
55 | 0 | return session->internals.record_recv_buffer.byte_length; |
56 | 0 | } Unexecuted instantiation: session_ticket.c:record_check_unprocessed Unexecuted instantiation: heartbeat.c:record_check_unprocessed Unexecuted instantiation: key_share.c:record_check_unprocessed Unexecuted instantiation: pre_shared_key.c:record_check_unprocessed Unexecuted instantiation: status_request.c:record_check_unprocessed Unexecuted instantiation: supported_versions.c:record_check_unprocessed |
57 | | |
58 | | int _gnutls_record_buffer_get(content_type_t type, |
59 | | gnutls_session_t session, uint8_t * data, |
60 | | size_t length, uint8_t seq[8]); |
61 | | int _gnutls_record_buffer_get_packet(content_type_t type, |
62 | | gnutls_session_t session, |
63 | | gnutls_packet_t * packet); |
64 | | ssize_t _gnutls_io_read_buffered(gnutls_session_t, size_t n, |
65 | | content_type_t, unsigned int *ms); |
66 | | int _gnutls_io_clear_peeked_data(gnutls_session_t session); |
67 | | |
68 | | ssize_t _gnutls_io_write_buffered(gnutls_session_t session, |
69 | | mbuffer_st * bufel, unsigned int mflag); |
70 | | |
71 | | int _gnutls_handshake_io_cache_int(gnutls_session_t, |
72 | | gnutls_handshake_description_t, |
73 | | mbuffer_st * bufel); |
74 | | |
75 | | ssize_t |
76 | | _gnutls_handshake_io_recv_int(gnutls_session_t session, |
77 | | gnutls_handshake_description_t htype, |
78 | | handshake_buffer_st * hsk, unsigned int optional); |
79 | | |
80 | | ssize_t _gnutls_io_write_flush(gnutls_session_t session); |
81 | | int _gnutls_io_check_recv(gnutls_session_t session, unsigned int ms); |
82 | | ssize_t _gnutls_handshake_io_write_flush(gnutls_session_t session); |
83 | | |
84 | | inline static void _gnutls_handshake_buffer_clear(handshake_buffer_st * hsk) |
85 | 0 | { |
86 | 0 | _gnutls_buffer_clear(&hsk->data); |
87 | 0 | hsk->htype = -1; |
88 | 0 | } Unexecuted instantiation: heartbeat.c:_gnutls_handshake_buffer_clear Unexecuted instantiation: key_share.c:_gnutls_handshake_buffer_clear Unexecuted instantiation: pre_shared_key.c:_gnutls_handshake_buffer_clear Unexecuted instantiation: status_request.c:_gnutls_handshake_buffer_clear Unexecuted instantiation: supported_versions.c:_gnutls_handshake_buffer_clear |
89 | | |
90 | | inline static void _gnutls_handshake_buffer_init(handshake_buffer_st * hsk) |
91 | 0 | { |
92 | 0 | memset(hsk, 0, sizeof(*hsk)); |
93 | 0 | _gnutls_buffer_init(&hsk->data); |
94 | 0 | hsk->htype = -1; |
95 | 0 | } Unexecuted instantiation: heartbeat.c:_gnutls_handshake_buffer_init Unexecuted instantiation: key_share.c:_gnutls_handshake_buffer_init Unexecuted instantiation: pre_shared_key.c:_gnutls_handshake_buffer_init Unexecuted instantiation: status_request.c:_gnutls_handshake_buffer_init Unexecuted instantiation: supported_versions.c:_gnutls_handshake_buffer_init |
96 | | |
97 | | inline static void _gnutls_handshake_recv_buffer_clear(gnutls_session_t session) |
98 | 0 | { |
99 | 0 | int i; |
100 | 0 | for (i = 0; i < session->internals.handshake_recv_buffer_size; i++) |
101 | 0 | _gnutls_handshake_buffer_clear(&session->internals. |
102 | 0 | handshake_recv_buffer[i]); |
103 | 0 | session->internals.handshake_recv_buffer_size = 0; |
104 | 0 | _mbuffer_head_clear(&session->internals.handshake_header_recv_buffer); |
105 | 0 | } Unexecuted instantiation: heartbeat.c:_gnutls_handshake_recv_buffer_clear Unexecuted instantiation: key_share.c:_gnutls_handshake_recv_buffer_clear Unexecuted instantiation: pre_shared_key.c:_gnutls_handshake_recv_buffer_clear Unexecuted instantiation: status_request.c:_gnutls_handshake_recv_buffer_clear Unexecuted instantiation: supported_versions.c:_gnutls_handshake_recv_buffer_clear |
106 | | |
107 | | inline static void _gnutls_handshake_recv_buffer_init(gnutls_session_t session) |
108 | 0 | { |
109 | 0 | int i; |
110 | 0 | for (i = 0; i < MAX_HANDSHAKE_MSGS; i++) { |
111 | 0 | _gnutls_handshake_buffer_init(&session->internals. |
112 | 0 | handshake_recv_buffer[i]); |
113 | 0 | } |
114 | 0 | session->internals.handshake_recv_buffer_size = 0; |
115 | 0 | _mbuffer_head_init(&session->internals.handshake_header_recv_buffer); |
116 | 0 | } Unexecuted instantiation: heartbeat.c:_gnutls_handshake_recv_buffer_init Unexecuted instantiation: key_share.c:_gnutls_handshake_recv_buffer_init Unexecuted instantiation: pre_shared_key.c:_gnutls_handshake_recv_buffer_init Unexecuted instantiation: status_request.c:_gnutls_handshake_recv_buffer_init Unexecuted instantiation: supported_versions.c:_gnutls_handshake_recv_buffer_init |
117 | | |
118 | | int _gnutls_parse_record_buffered_msgs(gnutls_session_t session); |
119 | | |
120 | | ssize_t |
121 | | _gnutls_recv_in_buffers(gnutls_session_t session, content_type_t type, |
122 | | gnutls_handshake_description_t htype, unsigned int ms); |
123 | | |
124 | | # define _gnutls_handshake_io_buffer_clear( session) \ |
125 | | _mbuffer_head_clear( &session->internals.handshake_send_buffer); \ |
126 | | _gnutls_handshake_recv_buffer_clear( session); |
127 | | |
128 | | #endif /* GNUTLS_LIB_BUFFERS_H */ |