1gnutls_handshake(3) gnutls gnutls_handshake(3)
2
3
4
6 gnutls_handshake - API function
7
9 #include <gnutls/gnutls.h>
10
11 int gnutls_handshake(gnutls_session_t session);
12
14 gnutls_session_t session
15 is a gnutls_session_t structure.
16
18 This function does the handshake of the TLS/SSL protocol, and initial‐
19 izes the TLS connection.
20
21 This function will fail if any problem is encountered, and will return
22 a negative error code. In case of a client, if the client has asked to
23 resume a session, but the server couldn't, then a full handshake will
24 be performed.
25
26 The non-fatal errors expected by this function are: GNUTLS_E_INTER‐
27 RUPTED, GNUTLS_E_AGAIN, GNUTLS_E_WARNING_ALERT_RECEIVED, and
28 GNUTLS_E_GOT_APPLICATION_DATA, the latter only in a case of rehand‐
29 shake.
30
31 The former two interrupt the handshake procedure due to the lower layer
32 being interrupted, and the latter because of an alert that may be sent
33 by a server (it is always a good idea to check any received alerts). On
34 these errors call this function again, until it returns 0; cf.
35 gnutls_record_get_direction() and gnutls_error_is_fatal(). In DTLS ses‐
36 sions the non-fatal error GNUTLS_E_LARGE_PACKET is also possible, and
37 indicates that the MTU should be adjusted.
38
39 If this function is called by a server after a rehandshake request then
40 GNUTLS_E_GOT_APPLICATION_DATA or GNUTLS_E_WARNING_ALERT_RECEIVED may be
41 returned. Note that these are non fatal errors, only in the specific
42 case of a rehandshake. Their meaning is that the client rejected the
43 rehandshake request or in the case of GNUTLS_E_GOT_APPLICATION_DATA it
44 could also mean that some data were pending.
45
47 GNUTLS_E_SUCCESS on success, otherwise a negative error code.
48
50 Report bugs to <bugs@gnutls.org>.
51 Home page: http://www.gnutls.org
52
53
55 Copyright © 2001-2014 Free Software Foundation, Inc..
56 Copying and distribution of this file, with or without modification,
57 are permitted in any medium without royalty provided the copyright
58 notice and this notice are preserved.
59
61 The full documentation for gnutls is maintained as a Texinfo manual.
62 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
63 visit
64
65 http://www.gnutls.org/manual/
66
67gnutls 3.3.29 gnutls_handshake(3)