Debian Codegraph @

src/xdp-utils.h

raw symbols SCIP
1 /*
2 * Copyright © 2014, 2016 Red Hat, Inc
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This program 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.
10 *
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.
15 *
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/>.
18 *
19 * Authors:
20 * Alexander Larsson <[email protected]>
21 * Matthias Clasen <[email protected]>
22 */
23
24 #pragma once
25
26 #include <errno.h>
27 #include <stdint.h>
28 #include <stdio.h>
29 #include <sys/stat.h>
30 #include <sys/types.h>
31 #include <unistd.h>
32
33 #include <gio/gio.h>
34 #include <glib/gstdio.h>
35
36 #include "xdp-sealed-fd.h"cxx . . $ `<file>/src/xdp-sealed-fd.h`/
37 #include "xdp-types.h"cxx . . $ `<file>/src/xdp-types.h`/
38
39 gbooleancxx . . $ gboolean# xdp_is_valid_app_idcxx . . $ xdp_is_valid_app_id(5c4306d8553b3696). (const char *string);
40 gbooleancxx . . $ gboolean# xdp_is_valid_tokencxx . . $ xdp_is_valid_token(5c4306d8553b3696). (const char *string);
41
42 char *xdp_get_app_id_from_desktop_idcxx . . $ xdp_get_app_id_from_desktop_id(a8b8e32347182212). (const char *desktop_id);
43
44 typedef enumcxx . . $ $anonymous_type_8e225346ad0b2bac_0#
45 {
46 XDP_ICON_TYPE_DESKTOPcxx . . $ XDP_ICON_TYPE_DESKTOP.,
47 XDP_ICON_TYPE_NOTIFICATIONcxx . . $ XDP_ICON_TYPE_NOTIFICATION.,
48 } XdpIconTypecxx . . $ XdpIconType#;
49
50 gbooleancxx . . $ gboolean# xdp_validate_iconcxx . . $ xdp_validate_icon(d2530f8b074c20c3). (XdpSealedFdcxx . . $ XdpSealedFd# *icon,
51 XdpIconTypecxx . . $ XdpIconType# icon_type,
52 char **out_format,
53 char **out_size);
54
55 gbooleancxx . . $ gboolean# xdp_validate_soundcxx . . $ xdp_validate_sound(e41b30277faed9bf). (XdpSealedFdcxx . . $ XdpSealedFd# *sound);
56
57 typedef void (*XdpPeerDisconnectCallbackcxx . . $ XdpPeerDisconnectCallback#) (const char *name,
58 gpointercxx . . $ gpointer# user_data);
59
60 guintcxx . . $ guint# xdp_connection_track_peer_disconnectcxx . . $ xdp_connection_track_peer_disconnect(e6f369cc4a2ac753). (GDBusConnectioncxx . . $ GDBusConnection# *connection,
61 XdpPeerDisconnectCallbackcxx . . $ XdpPeerDisconnectCallback# peer_disconnect_cb,
62 gpointercxx . . $ gpointer# user_data);
63
64 void xdp_connection_untrack_peer_disconnectcxx . . $ xdp_connection_untrack_peer_disconnect(21eb64a5380286b0). (GDBusConnectioncxx . . $ GDBusConnection# *connection,
65 guintcxx . . $ guint# subscription_id);
66
67 gbooleancxx . . $ gboolean# xdp_connection_get_pidfd_synccxx . . $ xdp_connection_get_pidfd_sync(ccf5f9aa2b04f667). (GDBusConnectioncxx . . $ GDBusConnection# *connection,
68 const char *sender,
69 GCancellablecxx . . $ GCancellable# *cancellable,
70 int *out_pidfd,
71 uint32_tcxx . . $ uint32_t# *out_pid,
72 GErrorcxx . . $ GError# **error);
73
74 XdpAppInfocxx . . $ XdpAppInfo# * xdp_invocation_get_app_infocxx . . $ xdp_invocation_get_app_info(36d3606d1003be6). (GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation);
75
76 typedef int XdpFdcxx . . $ XdpFd#;
77 G_DEFINE_AUTO_CLEANUP_FREE_FUNCcxx . . $ glib_auto_cleanup_XdpFd(11b0e290e57a7e53).(XdpFd, close, -1)
78
79 void xdp_set_documents_mountpointcxx . . $ xdp_set_documents_mountpoint(85c52e162fed56f9). (const char *path);
80 const char * xdp_get_documents_mountpointcxx . . $ xdp_get_documents_mountpoint(33a1f659e94feb42). (void);
81 char * xdp_get_alternate_document_pathcxx . . $ xdp_get_alternate_document_path(a713fe7b9a57cf96). (const char *path, const char *app_id);
82
83 gbooleancxx . . $ gboolean# xdp_variant_contains_keycxx . . $ xdp_variant_contains_key(3acb228297ef692c). (GVariantcxx . . $ GVariant# *dictionary,
84 const char *key);
85
86 typedef gbooleancxx . . $ gboolean# (*XdpOptionKeyValidatecxx . . $ XdpOptionKeyValidate#) (const char *key,
87 GVariantcxx . . $ GVariant# *value,
88 GVariantcxx . . $ GVariant# *options,
89 gpointercxx . . $ gpointer# user_data,
90 GErrorcxx . . $ GError# **error);
91
92 typedef structcxx . . $ $anonymous_type_8e225346ad0b2bac_1# {
93 const char *keycxx . . $ $anonymous_type_8e225346ad0b2bac_1#key.;
94 const GVariantTypecxx . . $ GVariantType# *typecxx . . $ $anonymous_type_8e225346ad0b2bac_1#type.;
95 XdpOptionKeyValidatecxx . . $ XdpOptionKeyValidate# validatecxx . . $ $anonymous_type_8e225346ad0b2bac_1#validate.;
96 } XdpOptionKeycxx . . $ XdpOptionKey#;
97
98 gbooleancxx . . $ gboolean# xdp_filter_optionscxx . . $ xdp_filter_options(e9350dfce557ba5e). (GVariantcxx . . $ GVariant# *options_in,
99 GVariantBuildercxx . . $ GVariantBuilder# *options_out,
100 const XdpOptionKeycxx . . $ XdpOptionKey# *supported_options,
101 int n_supported_options,
102 gpointercxx . . $ gpointer# user_data,
103 GErrorcxx . . $ GError# **error);
104
105 typedef enumcxx . . $ $anonymous_type_8e225346ad0b2bac_2# {
106 XDG_DESKTOP_PORTAL_ERROR_FAILEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_FAILED. = 0,
107 XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT.,
108 XDG_DESKTOP_PORTAL_ERROR_NOT_FOUNDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_NOT_FOUND.,
109 XDG_DESKTOP_PORTAL_ERROR_EXISTScxx . . $ XDG_DESKTOP_PORTAL_ERROR_EXISTS.,
110 XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_NOT_ALLOWED.,
111 XDG_DESKTOP_PORTAL_ERROR_CANCELLEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_CANCELLED.,
112 XDG_DESKTOP_PORTAL_ERROR_WINDOW_DESTROYEDcxx . . $ XDG_DESKTOP_PORTAL_ERROR_WINDOW_DESTROYED.
113 } XdgDesktopPortalErrorEnumcxx . . $ XdgDesktopPortalErrorEnum#;
114
115 #define XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:115:9`! xdg_desktop_portal_error_quark ()
116
117 GQuarkcxx . . $ GQuark# xdg_desktop_portal_error_quarkcxx . . $ xdg_desktop_portal_error_quark(db52760e79bf9054). (void);
118
119 #define XDP_AUTOLOCKcxx . . $ `src/xdp-utils.h:119:9`!(name) \
120 g_autoptr(GMutexLocker) G_PASTE (name ## locker, __LINE__) = \
121 g_mutex_locker_new (&G_LOCK_NAME (name)); \
122 (void) G_PASTE (name ## locker, __LINE__);
123
124
125 char * xdp_maybe_quotecxx . . $ xdp_maybe_quote(2050848944e00d54). (const char *arg,
126 gbooleancxx . . $ gboolean# quote_escape);
127 char * xdp_maybe_quote_argvcxx . . $ xdp_maybe_quote_argv(ad8dedb09956fee3). (const char *argv[],
128 gbooleancxx . . $ gboolean# quote_escape);
129
130 char * xdp_spawncxx . . $ xdp_spawn(7346b297b379bb8a). (GErrorcxx . . $ GError# **error,
131 const char *argv0,
132 ...) G_GNUC_NULL_TERMINATEDcxx . . $ `<external>/12741050725406041920/gmacros.h:330:9`!;
133 char * xdp_spawn_fullcxx . . $ xdp_spawn_full(45b3cf19a9373672). (const char * const *argv,
134 int source_fd,
135 int target_fd,
136 GErrorcxx . . $ GError# **error);
137
138 /**
139 * xdp_is_valid_filename:
140 * @filename: a filename to validate
141 *
142 * Checks whether @filename is a valid bare filename, i.e. a single path
143 * component that is safe to append to a directory path. Specifically, a
144 * valid filename must be non-empty and must not contain a path separator
145 * ('/').
146 *
147 * This does NOT check for filesystem length limits or invalid characters
148 * beyond '/'.
149 *
150 * Returns: %TRUE if @filename is valid, %FALSE otherwise
151 */
152 gbooleancxx . . $ gboolean# xdp_is_valid_filenamecxx . . $ xdp_is_valid_filename(5c4306d8553b3696). (const char *filename);
153
154 char * xdp_canonicalize_filenamecxx . . $ xdp_canonicalize_filename(a8b8e32347182212). (const char *path);
155 gbooleancxx . . $ gboolean# xdp_has_path_prefixcxx . . $ xdp_has_path_prefix(5ae29d726ae57f88). (const char *str,
156 const char *prefix);
157
158 gbooleancxx . . $ gboolean# xdp_pid_to_pidfdcxx . . $ xdp_pid_to_pidfd(68895b23c4696f7e). (pid_tcxx . . $ pid_t# pid,
159 int *pidfd_out,
160 GErrorcxx . . $ GError# **error);
161
162 gbooleancxx . . $ gboolean# xdp_pidfds_to_pidscxx . . $ xdp_pidfds_to_pids(94ca259b32cf3f78). (const int *pidfds,
163 pid_tcxx . . $ pid_t# *pids,
164 gintcxx . . $ gint# count,
165 GErrorcxx . . $ GError# **error);
166
167 gbooleancxx . . $ gboolean# xdp_pidfd_get_pidnscxx . . $ xdp_pidfd_get_pidns(40904b3abaf3a9b1). (int pidfd,
168 ino_tcxx . . $ ino_t# *ns,
169 GErrorcxx . . $ GError# **error);
170
171 gbooleancxx . . $ gboolean# xdp_map_pids_fullcxx . . $ xdp_map_pids_full(3e57b5d6b165cf51). (DIRcxx . . $ DIR# *proc,
172 ino_tcxx . . $ ino_t# pidns,
173 pid_tcxx . . $ pid_t# *pids,
174 guintcxx . . $ guint# n_pids,
175 uid_tcxx . . $ uid_t# target_uid,
176 GErrorcxx . . $ GError# **error);
177
178 gbooleancxx . . $ gboolean# xdp_map_pidscxx . . $ xdp_map_pids(5f334dc0f459180). (ino_tcxx . . $ ino_t# pidns,
179 pid_tcxx . . $ pid_t# *pids,
180 guintcxx . . $ guint# n_pids,
181 GErrorcxx . . $ GError# **error);
182
183 gbooleancxx . . $ gboolean# xdp_map_tidscxx . . $ xdp_map_tids(766ff89140cb637c). (ino_tcxx . . $ ino_t# pidns,
184 pid_tcxx . . $ pid_t# owner_pid,
185 pid_tcxx . . $ pid_t# *tids,
186 guintcxx . . $ guint# n_tids,
187 GErrorcxx . . $ GError# **error);
188
189 static inline gbooleancxx . . $ gboolean#
190 xdp_is_fd_list_index_validcxx . . $ xdp_is_fd_list_index_valid(583ff2827abeba2c). (GUnixFDListcxx . . $ GUnixFDList# *fd_list,
191 int fd_id)
192 {
193 return (fd_id >= 0 && fd_id < g_unix_fd_list_get_lengthcxx . . $ g_unix_fd_list_get_length(7ddaba1b89c413c0). (fd_list));
194 }
195
196 int xdp_get_portal_call_fdcxx . . $ xdp_get_portal_call_fd(57b895fb290201ec). (GUnixFDListcxx . . $ GUnixFDList# *fd_list,
197 int fd_id,
198 GErrorcxx . . $ GError# **error);
199
200 gbooleancxx . . $ gboolean# xdp_copy_fd_to_listscxx . . $ xdp_copy_fd_to_lists(b3b9a798b317fda6). (GUnixFDListcxx . . $ GUnixFDList# *fd_list_src,
201 GUnixFDListcxx . . $ GUnixFDList# *fd_list_dst,
202 int fd_id,
203 int *fd_id_out,
204 GErrorcxx . . $ GError# **error);
205
206 /*
207 * Cryptographically secure 128-bit hex-encoded key.
208 * Keys are unguessable and can be used on their own to mediate access to
209 * a resource.
210 */
211 char *xdp_generate_keycxx . . $ xdp_generate_key(2800c983397da93f). (GErrorcxx . . $ GError# **error);
212
213 /*
214 * Non-secure guessable token, suitable for D-Bus object paths.
215 * Tokens are essentially names and must be scoped to something else
216 * (e.g. a peer) for proper access control. Collisions are negligible
217 * and callers do not need to check for them.
218 */
219 char *xdp_generate_tokencxx . . $ xdp_generate_token(41208ce6ca65dd58). (void);
220
221 #define XDP_EXPORT_TESTcxx . . $ `src/xdp-utils.h:221:9`! XDP_EXPORT
222 #define XDP_EXPORTcxx . . $ `src/xdp-utils.h:222:9`! __attribute__((visibility("default"))) extern