Change LGPL-2.1+ to LGPL-2.1-or-later
[platform/upstream/glib.git] / glib / gvariant-internal.h
1 /*
2  * Copyright © 2007, 2008 Ryan Lortie
3  * Copyright © 2009, 2010 Codethink Limited
4  *
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19  *
20  * Author: Ryan Lortie <desrt@desrt.ca>
21  */
22
23
24 /* The purpose of this header is to allow certain internal symbols of
25  * GVariant to be put under test cases.
26  */
27
28 #ifndef __G_VARIANT_INTERNAL_H__
29 #define __G_VARIANT_INTERNAL_H__
30
31 /* Hack */
32 #define __GLIB_H_INSIDE__
33
34 #include <glib/gvarianttype.h>
35 #include <glib/gtypes.h>
36
37 #include "gvariant-serialiser.h"
38 #include "gvarianttypeinfo.h"
39
40 #undef __GLIB_H_INSIDE__
41
42 GLIB_AVAILABLE_IN_ALL
43 gboolean                        g_variant_format_string_scan            (const gchar          *string,
44                                                                          const gchar          *limit,
45                                                                          const gchar         **endptr);
46
47 GLIB_AVAILABLE_IN_ALL
48 GVariantType *                  g_variant_format_string_scan_type       (const gchar          *string,
49                                                                          const gchar          *limit,
50                                                                          const gchar         **endptr);
51
52 /* The maximum number of levels of nested container which this implementation
53  * of #GVariant will handle.
54  *
55  * The limit must be at least 64 + 1, to allow D-Bus messages to be wrapped in
56  * a top-level #GVariant. This comes from the D-Bus specification (§(Valid
57  * Signatures)), but also seems generally reasonable. #GDBusMessage wraps its
58  * payload in a top-level tuple.
59  *
60  * The limit is actually set to be a lot greater than 64, to allow much greater
61  * nesting of values off D-Bus. It cannot be set over around 80000, or the risk
62  * of overflowing the stack when parsing type strings becomes too great.
63  *
64  * Aside from those constraints, the choice of this value is arbitrary. The
65  * only restrictions on it from the API are that it has to be greater than 64
66  * (due to D-Bus).
67 */
68 #define G_VARIANT_MAX_RECURSION_DEPTH ((gsize) 128)
69
70 #endif /* __G_VARIANT_INTERNAL_H__ */