Debian Codegraph @

src/libmbim-glib/mbim-helpers.h

raw
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 /*
4 * libmbim-glib -- GLib/GIO based library to control MBIM devices
5 *
6 * Copyright (C) 2013 - 2021 Aleksander Morgado <[email protected]>
7 */
8
9 #ifndef _LIBMBIM_GLIB_MBIM_HELPERS_H_
10 #define _LIBMBIM_GLIB_MBIM_HELPERS_H_
11
12 #if !defined (LIBMBIM_GLIB_COMPILATION)
13 #error "This is a private header!!"
14 #endif
15
16 #include <glib.h>
17 #include <gio/gio.h>
18
19 G_BEGIN_DECLS
20
21 /******************************************************************************/
22 /* Helpers to read variables from a bytearray without assuming alignment. The
23 * caller should ensure the buffer contains the required amount of bytes in each
24 * case. */
25
26 G_GNUC_INTERNAL
27 guint16 mbim_helpers_read_unaligned_guint16 (const guint8 *buffer);
28 G_GNUC_INTERNAL
29 guint32 mbim_helpers_read_unaligned_guint32 (const guint8 *buffer);
30 G_GNUC_INTERNAL
31 guint32 mbim_helpers_read_unaligned_gint32 (const guint8 *buffer);
32 G_GNUC_INTERNAL
33 guint64 mbim_helpers_read_unaligned_guint64 (const guint8 *buffer);
34
35 /******************************************************************************/
36
37 G_GNUC_INTERNAL
38 gboolean mbim_helpers_check_user_allowed (uid_t uid,
39 GError **error);
40
41 G_GNUC_INTERNAL
42 gboolean mbim_helpers_check_group_allowed (uid_t uid,
43 GError **error);
44
45 G_GNUC_INTERNAL
46 gchar *mbim_helpers_get_devpath (const gchar *cdc_wdm_path,
47 GError **error);
48
49 G_GNUC_INTERNAL
50 gchar *mbim_helpers_get_devname (const gchar *cdc_wdm_path,
51 GError **error);
52
53 G_GNUC_INTERNAL
54 gboolean mbim_helpers_list_links_wdm (GFile *sysfs_file,
55 GCancellable *cancellable,
56 GPtrArray *previous_links,
57 GPtrArray **out_links,
58 GError **error);
59
60 G_GNUC_INTERNAL
61 gboolean mbim_helpers_list_links_wwan (const gchar *base_ifname,
62 GFile *sysfs_file,
63 GCancellable *cancellable,
64 GPtrArray *previous_links,
65 GPtrArray **out_links,
66 GError **error);
67
68 G_END_DECLS
69
70 #endif /* _LIBMBIM_GLIB_MBIM_HELPERS_H_ */