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
|
.TH LIBTERMINPUT_UNMARSHAL_STATE 3 LIBTERMINPUT
.SH NAME
libterminput_unmarshal_state \- Unmarshal the input parsing state
.br
libterminput_unmarshal_input \- Unmarshal the parsed input
.SH SYNOPSIS
.nf
#include <libterminput.h>
struct libterminput_unmarshaller {
int (*load)(struct libterminput_unmarshaller *\fIthis\fP, void *\fIdata\fP, size_t \fIsize\fP);
union {
void *ptr;
int i;
size_t zu;
} user;
};
int libterminput_unmarshal_state(struct libterminput_unmarshaller *\fIhow\fP, struct libterminput_state *\fIwhat\fP);
int libterminput_unmarshal_input(struct libterminput_unmarshaller *\fIhow\fP, union libterminput_input *\fIwhat\fP);
.fi
.PP
Link with
.IR \-lterminput .
.SH DESCRIPTION
The
.BR libterminput_unmarshal_state ()
and
.BR libterminput_unmarshal_input ()
function unmarshals state into
.I *what
using
.IR *how->load .
.PP
.I *how->load
must return 0 on success and -1 on failure, and may set
.I errno
to indicate the error.
.I how
is fed back into
.I *how->load
(as
.IR this )
so that the
.I *how->load
function can use and modify
.I how->user
which contains application-defined data
(typically a buffer, a file descriptor, or
the size of the serialisation).
.I data
will be set to the output buffer for the data
read by
.I *how-load
and
.I size
will be set to the number of bytes to read
into from
.IR data .
.SH RETURN VALUE
The
.BR libterminput_unmarshal_state ()
and
.BR libterminput_unmarshal_input ()
functions return 0 upon successful completion.
On failure,
.B -1
is returnes, but
.I errno
remains unmodified, however any changes to
.I errno
by
.I *how->load
will remain.
.SH ERRORS
The
.BR libterminput_unmarshal_state ()
and
.BR libterminput_unmarshal_input ()
functions fail, without further modifying
.IR errno ,
if
.I *how->load
fails. The functions will also fail if:
.TP
.B EINVAL
The read serialisation was invalid for the used
version of the library (not a proper serialisation
or containing data from a newer version of the
library).
.SH EXAMPLES
None.
.SH APPLICATION USAGE
None.
.SH RATIONALE
None.
.SH FUTURE DIRECTIONS
None.
.SH HISTORY
The
.BR libterminput_unmarshal_state ()
and
.BR libterminput_unmarshal_input ()
functions were added in version 1.1 of libterminput.
.SH NOTES
None.
.SH BUGS
None.
.SH SEE ALSO
.BR libterminput_marshal_state (3)
|