aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/tls/gnutls_buffers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/tls/gnutls_buffers.c')
-rw-r--r--src/daemon/https/tls/gnutls_buffers.c94
1 files changed, 0 insertions, 94 deletions
diff --git a/src/daemon/https/tls/gnutls_buffers.c b/src/daemon/https/tls/gnutls_buffers.c
index 8c6bb750..4588e62d 100644
--- a/src/daemon/https/tls/gnutls_buffers.c
+++ b/src/daemon/https/tls/gnutls_buffers.c
@@ -67,58 +67,6 @@
67# include <io_debug.h> 67# include <io_debug.h>
68#endif 68#endif
69 69
70/**
71 * MHD__gnutls_transport_set_errno:
72 * @session: is a #MHD_gtls_session_t structure.
73 * @err: error value to store in session-specific errno variable.
74 *
75 * Store @err in the session-specific errno variable. Useful values
76 * for @err is EAGAIN and EINTR, other values are treated will be
77 * treated as real errors in the push/pull function.
78 *
79 * This function is useful in replacement push/pull functions set by
80 * MHD__gnutls_transport_set_push_function and
81 * MHD_gnutls_transport_set_pullpush_function under Windows, where the
82 * replacement push/pull may not have access to the same @errno
83 * variable that is used by GnuTLS (e.g., the application is linked to
84 * msvcr71.dll and gnutls is linked to msvcrt.dll).
85 *
86 * If you don't have the @session variable easily accessible from the
87 * push/pull function, and don't worry about thread conflicts, you can
88 * also use MHD__gnutls_transport_set_global_errno().
89 **/
90void
91MHD__gnutls_transport_set_errno (MHD_gtls_session_t session, int err)
92{
93 session->internals.errnum = err;
94}
95
96/**
97 * MHD__gnutls_transport_set_global_errno:
98 * @err: error value to store in global errno variable.
99 *
100 * Store @err in the global errno variable. Useful values for @err is
101 * EAGAIN and EINTR, other values are treated will be treated as real
102 * errors in the push/pull function.
103 *
104 * This function is useful in replacement push/pull functions set by
105 * MHD__gnutls_transport_set_push_function and
106 * MHD_gnutls_transport_set_pullpush_function under Windows, where the
107 * replacement push/pull may not have access to the same @errno
108 * variable that is used by GnuTLS (e.g., the application is linked to
109 * msvcr71.dll and gnutls is linked to msvcrt.dll).
110 *
111 * Whether this function is thread safe or not depends on whether the
112 * global variable errno is thread safe, some system libraries make it
113 * a thread-local variable. When feasible, using the guaranteed
114 * thread-safe MHD__gnutls_transport_set_errno() may be better.
115 **/
116void
117MHD__gnutls_transport_set_global_errno (int err)
118{
119 errno = err;
120}
121
122/* Buffers received packets of type APPLICATION DATA and 70/* Buffers received packets of type APPLICATION DATA and
123 * HANDSHAKE DATA. 71 * HANDSHAKE DATA.
124 */ 72 */
@@ -186,23 +134,6 @@ MHD_gnutls_record_buffer_get_size (content_type_t type,
186 } 134 }
187} 135}
188 136
189/**
190 * MHD_gtls_record_check_pending - checks if there are any data to receive in gnutls buffers.
191 * @session: is a #MHD_gtls_session_t structure.
192 *
193 * This function checks if there are any data to receive
194 * in the gnutls buffers. Returns the size of that data or 0.
195 * Notice that you may also use select() to check for data in
196 * a TCP connection, instead of this function.
197 * (gnutls leaves some data in the tcp buffer in order for select
198 * to work).
199 **/
200size_t
201MHD_gtls_record_check_pending (MHD_gtls_session_t session)
202{
203 return MHD_gnutls_record_buffer_get_size (GNUTLS_APPLICATION_DATA, session);
204}
205
206int 137int
207MHD_gtls_record_buffer_get (content_type_t type, MHD_gtls_session_t session, 138MHD_gtls_record_buffer_get (content_type_t type, MHD_gtls_session_t session,
208 opaque * data, size_t length) 139 opaque * data, size_t length)
@@ -1193,31 +1124,6 @@ MHD_gtls_handshake_buffer_put (MHD_gtls_session_t session, opaque * data,
1193 return 0; 1124 return 0;
1194} 1125}
1195 1126
1196int
1197MHD_gtls_handshake_buffer_get_size (MHD_gtls_session_t session)
1198{
1199
1200 return session->internals.handshake_hash_buffer.length;
1201}
1202
1203/* this function does not touch the buffer
1204 * and returns data from it (peek mode!)
1205 */
1206int
1207MHD_gtls_handshake_buffer_peek (MHD_gtls_session_t session, opaque * data,
1208 size_t length)
1209{
1210 if (length > session->internals.handshake_hash_buffer.length)
1211 {
1212 length = session->internals.handshake_hash_buffer.length;
1213 }
1214
1215 MHD__gnutls_buffers_log ("BUF[HSK]: Peeked %d bytes of Data\n", length);
1216
1217 memcpy (data, session->internals.handshake_hash_buffer.data, length);
1218 return length;
1219}
1220
1221/* this function does not touch the buffer 1127/* this function does not touch the buffer
1222 * and returns data from it (peek mode!) 1128 * and returns data from it (peek mode!)
1223 */ 1129 */