qapi: Remove QMP events and commands from user-mode builds
[qemu/ar7.git] / include / qemu / base64.h
blob46a75fbbeb6645767bc4942317e36e5b2d231d0f
1 /*
2 * QEMU base64 helpers
4 * Copyright (c) 2015 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef QEMU_BASE64_H
22 #define QEMU_BASE64_H
26 /**
27 * qbase64_decode:
28 * @input: the (possibly) base64 encoded text
29 * @in_len: length of @input or -1 if NUL terminated
30 * @out_len: filled with length of decoded data
31 * @errp: pointer to a NULL-initialized error object
33 * Attempt to decode the (possibly) base64 encoded
34 * text provided in @input. If the @input text may
35 * contain embedded NUL characters, or may not be
36 * NUL terminated, then @in_len must be set to the
37 * known size of the @input buffer.
39 * Note that embedded NULs, or lack of a NUL terminator
40 * are considered invalid base64 data and errors
41 * will be reported to this effect.
43 * If decoding is successful, the decoded data will
44 * be returned and @out_len set to indicate the
45 * number of bytes in the decoded data. The caller
46 * must use g_free() to free the returned data when
47 * it is no longer required.
49 * Returns: the decoded data or NULL
51 uint8_t *qbase64_decode(const char *input,
52 size_t in_len,
53 size_t *out_len,
54 Error **errp);
57 #endif /* QEMU_BASE64_H */