| 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) 2013-2017 Aleksander Morgado <[email protected]> |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef QMI_PROXY_H |
| 24 |
#define QMI_PROXY_H |
| 25 |
|
| 26 |
/** |
| 27 |
* SECTION:qmi-proxy |
| 28 |
* @title: QmiProxy |
| 29 |
* @short_description: QMI proxy handling routines |
| 30 |
* |
| 31 |
* The #QmiProxy will setup an abstract socket listening on a predefined |
| 32 |
* address, and will take care of synchronizing the access to a set of shared |
| 33 |
* QMI ports. |
| 34 |
* |
| 35 |
* Multiple #QmiDevice objects may be connected to the #QmiProxy at any given |
| 36 |
* time. The #QmiProxy acts as a stateless proxy for non-CTL services (messages |
| 37 |
* are transferred unmodified), and as a stateful proxy for the CTL service (all |
| 38 |
* remote #QmiDevice objects will need to share the same CTL message sequence |
| 39 |
* ID). |
| 40 |
*/ |
| 41 |
|
| 42 |
#include <glib-object.h> |
| 43 |
#include <gio/gio.h> |
| 44 |
|
| 45 |
#define QMI_TYPE_PROXY (qmi_proxy_get_type ()) |
| 46 |
#define QMI_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QMI_TYPE_PROXY, QmiProxy)) |
| 47 |
#define QMI_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QMI_TYPE_PROXY, QmiProxyClass)) |
| 48 |
#define QMI_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QMI_TYPE_PROXY)) |
| 49 |
#define QMI_IS_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), QMI_TYPE_PROXY)) |
| 50 |
#define QMI_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), QMI_TYPE_PROXY, QmiProxyClass)) |
| 51 |
|
| 52 |
typedef struct _QmiProxy QmiProxy; |
| 53 |
typedef struct _QmiProxyClass QmiProxyClass; |
| 54 |
typedef struct _QmiProxyPrivate QmiProxyPrivate; |
| 55 |
|
| 56 |
/** |
| 57 |
* QMI_PROXY_SOCKET_PATH: |
| 58 |
* |
| 59 |
* Symbol defining the default abstract socket name where the #QmiProxy will listen. |
| 60 |
* |
| 61 |
* Since: 1.8 |
| 62 |
*/ |
| 63 |
#define QMI_PROXY_SOCKET_PATH "qmi-proxy" |
| 64 |
|
| 65 |
/** |
| 66 |
* QMI_PROXY_N_CLIENTS: |
| 67 |
* |
| 68 |
* Symbol defining the #QmiProxy:qmi-proxy-n-clients property. |
| 69 |
* |
| 70 |
* Since: 1.8 |
| 71 |
*/ |
| 72 |
#define QMI_PROXY_N_CLIENTS "qmi-proxy-n-clients" |
| 73 |
|
| 74 |
/** |
| 75 |
* QmiProxy: |
| 76 |
* |
| 77 |
* The #QmiProxy structure contains private data and should only be accessed |
| 78 |
* using the provided API. |
| 79 |
* |
| 80 |
* Since: 1.8 |
| 81 |
*/ |
| 82 |
struct _QmiProxy { |
| 83 |
GObject parent; |
| 84 |
QmiProxyPrivate *priv; |
| 85 |
}; |
| 86 |
|
| 87 |
struct _QmiProxyClass { |
| 88 |
GObjectClass parent; |
| 89 |
}; |
| 90 |
|
| 91 |
GType qmi_proxy_get_type (void); |
| 92 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC (QmiProxy, g_object_unref) |
| 93 |
|
| 94 |
/** |
| 95 |
* qmi_proxy_new: |
| 96 |
* @error: Return location for error or %NULL. |
| 97 |
* |
| 98 |
* Creates a #QmiProxy listening in the default proxy addess. |
| 99 |
* |
| 100 |
* Returns: A newly created #QmiProxy, or %NULL if @error is set. |
| 101 |
* |
| 102 |
* Since: 1.8 |
| 103 |
*/ |
| 104 |
QmiProxy *qmi_proxy_new (GError **error); |
| 105 |
|
| 106 |
/** |
| 107 |
* qmi_proxy_get_n_clients: |
| 108 |
* @self: a #QmiProxy. |
| 109 |
* |
| 110 |
* Get the number of clients currently connected to the proxy. |
| 111 |
* |
| 112 |
* Returns: a #guint. |
| 113 |
* |
| 114 |
* Since: 1.8 |
| 115 |
*/ |
| 116 |
guint qmi_proxy_get_n_clients (QmiProxy *self); |
| 117 |
|
| 118 |
#endif /* QMI_PROXY_H */ |