Debian Codegraph @

src/libqmi-glib/qmi-net-port-manager.h

raw
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * libqmi-glib -- GLib/GIO based library to control QMI devices
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA.
19 *
20 * Copyright (C) 2020-2021 Eric Caruso <[email protected]>
21 * Copyright (C) 2020-2021 Andrew Lassalle <[email protected]>
22 * Copyright (C) 2021 Aleksander Morgado <[email protected]>
23 */
24
25 #ifndef _LIBQMI_GLIB_QMI_NET_PORT_MANAGER_H_
26 #define _LIBQMI_GLIB_QMI_NET_PORT_MANAGER_H_
27
28 #include <gio/gio.h>
29 #include <glib-object.h>
30
31 #include "qmi-device.h"
32
33 #define QMI_TYPE_NET_PORT_MANAGER (qmi_net_port_manager_get_type ())
34 #define QMI_NET_PORT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QMI_TYPE_NET_PORT_MANAGER, QmiNetPortManager))
35 #define QMI_NET_PORT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QMI_TYPE_NET_PORT_MANAGER, QmiNetPortManagerClass))
36 #define QMI_IS_NET_PORT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QMI_TYPE_NET_PORT_MANAGER))
37 #define QMI_IS_NET_PORT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QMI_TYPE_NET_PORT_MANAGER))
38 #define QMI_NET_PORT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), QMI_TYPE_NET_PORT_MANAGER, QmiNetPortManagerClass))
39
40 typedef struct _QmiNetPortManager QmiNetPortManager;
41 typedef struct _QmiNetPortManagerClass QmiNetPortManagerClass;
42
43 struct _QmiNetPortManager {
44 GObject parent;
45 };
46
47 struct _QmiNetPortManagerClass {
48 GObjectClass parent;
49
50 gboolean (* list_links) (QmiNetPortManager *self,
51 const gchar *base_ifname,
52 GPtrArray **out_links,
53 GError **error);
54
55 void (* add_link) (QmiNetPortManager *self,
56 guint mux_id,
57 guint initial_mux_id,
58 const gchar *base_ifname,
59 const gchar *ifname_prefix,
60 QmiDeviceAddLinkFlags flags,
61 guint timeout,
62 GCancellable *cancellable,
63 GAsyncReadyCallback callback,
64 gpointer user_data);
65 gchar * (* add_link_finish) (QmiNetPortManager *self,
66 guint *mux_id,
67 GAsyncResult *res,
68 GError **error);
69
70 void (* del_link) (QmiNetPortManager *self,
71 const gchar *ifname,
72 guint mux_id,
73 guint timeout,
74 GCancellable *cancellable,
75 GAsyncReadyCallback callback,
76 gpointer user_data);
77 gboolean (* del_link_finish) (QmiNetPortManager *self,
78 GAsyncResult *res,
79 GError **error);
80
81 void (* del_all_links) (QmiNetPortManager *self,
82 const gchar *base_ifname,
83 GCancellable *cancellable,
84 GAsyncReadyCallback callback,
85 gpointer user_data);
86 gboolean (* del_all_links_finish) (QmiNetPortManager *self,
87 GAsyncResult *res,
88 GError **error);
89 };
90
91 GType qmi_net_port_manager_get_type (void);
92 G_DEFINE_AUTOPTR_CLEANUP_FUNC (QmiNetPortManager, g_object_unref)
93
94 gboolean qmi_net_port_manager_list_links (QmiNetPortManager *self,
95 const gchar *base_ifname,
96 GPtrArray **out_links,
97 GError **error);
98
99 void qmi_net_port_manager_add_link (QmiNetPortManager *self,
100 guint mux_id,
101 guint initial_mux_id,
102 const gchar *base_ifname,
103 const gchar *ifname_prefix,
104 QmiDeviceAddLinkFlags flags,
105 guint timeout,
106 GCancellable *cancellable,
107 GAsyncReadyCallback callback,
108 gpointer user_data);
109 gchar *qmi_net_port_manager_add_link_finish (QmiNetPortManager *self,
110 guint *mux_id,
111 GAsyncResult *res,
112 GError **error);
113
114 void qmi_net_port_manager_del_link (QmiNetPortManager *self,
115 const gchar *ifname,
116 guint mux_id,
117 guint timeout,
118 GCancellable *cancellable,
119 GAsyncReadyCallback callback,
120 gpointer user_data);
121 gboolean qmi_net_port_manager_del_link_finish (QmiNetPortManager *self,
122 GAsyncResult *res,
123 GError **error);
124
125 void qmi_net_port_manager_del_all_links (QmiNetPortManager *self,
126 const gchar *base_ifname,
127 GCancellable *cancellable,
128 GAsyncReadyCallback callback,
129 gpointer user_data);
130 gboolean qmi_net_port_manager_del_all_links_finish (QmiNetPortManager *self,
131 GAsyncResult *res,
132 GError **error);
133
134 #endif /* _LIBQMI_GLIB_QMI_NET_PORT_MANAGER_H_ */