1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
.TH libaxl_receive_handshake 3 libaxl
.SH NAME
libaxl_receive_handshake - Finish connection handshake
.B (ADVANCED)
.SH SYNOPSIS
.nf
#include <libaxl.h>
#define LIBAXL_HANDSHAKE_FAILED 0
#define LIBAXL_HANDSHAKE_SUCCESS 1
#define LIBAXL_HANDSHAKE_AUTHENTICATE 2
int libaxl_receive_handshake(LIBAXL_CONTEXT *\fIctx\fP, int *\fImajorp\fP, int *\fIminorp\fP, char **\fIreasonp\fP, int \fIflags\fP);
.fi
.SH DESCRIPTION
The
.BR libaxl_receive_handshake ()
function receives the display server's part of
the handshake, which is sent in response to the
client's handshake message which is sent with the
.BR libaxl_send_handshake ()
function.
.PP
The value of the
.I ctx
parameter shall be the thread's state for the
connection to the display server.
.PP
If the
.I majorp
parameter is set to a
.RI non- NULL
pointer and the
.BR libaxl_receive_handshake ()
function returns
.B LIBAXL_HANDSHAKE_SUCCESS
or
.BR LIBAXL_HANDSHAKE_FAILED ,
.I *majorp
will be set to the major version number for a
version of the X protocol that the display server
supports, which is not necessarily the version
that the library uses.
.PP
If the
.I minorp
parameter is set to a
.RI non- NULL
pointer and the
.BR libaxl_receive_handshake ()
function returns
.B LIBAXL_HANDSHAKE_SUCCESS
or
.BR LIBAXL_HANDSHAKE_FAILED ,
.I *minorp
will be set to the minor version number for the
verison for which the major version number was
returned in
.I *majorp
(or if
.I majorp
is
.IR NULL :
would have been returned).
.PP
If the
.I reasonp
parameter is set to a
.RI non- NULL
pointer and the
.BR libaxl_receive_handshake ()
function returns
.B LIBAXL_HANDSHAKE_FAILED
or
.BR LIBAXL_HANDSHAKE_AUTHENTICATE ,
.I *reasonp
will be set to a dynamically allocated string
(which the caller must deallocate with the
.BR free (3)
function) providing an authorisation
protocol-specific reason which the handshake
failed. If The
.BR libaxl_receive_handshake ()
function returns any other value, and the
.I reasonp
paramater is set to a
.RI non- NULL ,
.I *reasonp
will be set to
.IR NULL .
.PP
Flags to used in the fourth argument when the
.BR libaxl_receive_handshake ()
function calls the
.BR recv (3)
function shall be specified in the
.I flags
parameter.
.SH RETURN VALUE
The
.BR libaxl_receive_handshake ()
function return
.B LIBAXL_HANDSHAKE_SUCCESS
upon successful completion with successful handshake
(beware, this value is not 0!),
.B LIBAXL_HANDSHAKE_FAILURE
upon successful completion with handshake failure,
.B LIBAXL_HANDSHAKE_AUTHENTICATE
upon successful completion handshake rejection
due to insufficient or incorrect authentication,
or a negative libaxl error code on failure.
.SH ERRORS
The
.BR libaxl_receive_handshake ()
function can only fail if:
.TP
TODO errors
.SH NOTES
The
.BR libaxl_receive_handshake ()
function's behaviour is unspecified if the
.I SO_PEEK_OFF
socket option is active or the
.I MSG_PEEK
flag is used.
.SH SEE ALSO
.BR libaxl_connect (3),
.BR libaxl_send_handshake (3),
.BR libaxl_send (3),
.BR libaxl_connect_without_handshake (3)
|