| 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) 2014 Aleksander Morgado <[email protected]> |
| 7 |
* Copyright (C) 2014 Smith Micro Software, Inc. |
| 8 |
*/ |
| 9 |
|
| 10 |
#ifndef MBIM_PROXY_H |
| 11 |
#define MBIM_PROXY_H |
| 12 |
|
| 13 |
#if !defined (__LIBMBIM_GLIB_H_INSIDE__) && !defined (LIBMBIM_GLIB_COMPILATION) |
| 14 |
#error "Only <libmbim-glib.h> can be included directly." |
| 15 |
#endif |
| 16 |
|
| 17 |
#include <glib-object.h> |
| 18 |
#include <gio/gio.h> |
| 19 |
|
| 20 |
G_BEGIN_DECLS |
| 21 |
|
| 22 |
/** |
| 23 |
* SECTION:mbim-proxy |
| 24 |
* @title: MbimProxy |
| 25 |
* @short_description: MBIM proxy handling routines |
| 26 |
* |
| 27 |
* The #MbimProxy will setup an abstract socket listening on a predefined |
| 28 |
* address, and will take care of synchronizing the access to a set of shared |
| 29 |
* MBIM ports. |
| 30 |
* |
| 31 |
* Multiple #MbimDevice objects may be connected to the #MbimProxy at any given |
| 32 |
* time. The #MbimProxy acts as a stateful proxy (all remote #MbimDevice objects |
| 33 |
* will need to share the same message sequence). |
| 34 |
*/ |
| 35 |
|
| 36 |
#define MBIM_TYPE_PROXY (mbim_proxy_get_type ()) |
| 37 |
#define MBIM_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MBIM_TYPE_PROXY, MbimProxy)) |
| 38 |
#define MBIM_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MBIM_TYPE_PROXY, MbimProxyClass)) |
| 39 |
#define MBIM_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MBIM_TYPE_PROXY)) |
| 40 |
#define MBIM_IS_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MBIM_TYPE_PROXY)) |
| 41 |
#define MBIM_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MBIM_TYPE_PROXY, MbimProxyClass)) |
| 42 |
|
| 43 |
typedef struct _MbimProxy MbimProxy; |
| 44 |
typedef struct _MbimProxyClass MbimProxyClass; |
| 45 |
typedef struct _MbimProxyPrivate MbimProxyPrivate; |
| 46 |
|
| 47 |
/** |
| 48 |
* MBIM_PROXY_SOCKET_PATH: |
| 49 |
* |
| 50 |
* Symbol defining the default abstract socket name where the #MbimProxy will listen. |
| 51 |
* |
| 52 |
* Since: 1.10 |
| 53 |
*/ |
| 54 |
#define MBIM_PROXY_SOCKET_PATH "mbim-proxy" |
| 55 |
|
| 56 |
/** |
| 57 |
* MBIM_PROXY_N_CLIENTS: |
| 58 |
* |
| 59 |
* Symbol defining the #MbimProxy:mbim-proxy-n-clients property. |
| 60 |
* |
| 61 |
* Since: 1.10 |
| 62 |
*/ |
| 63 |
#define MBIM_PROXY_N_CLIENTS "mbim-proxy-n-clients" |
| 64 |
|
| 65 |
/** |
| 66 |
* MBIM_PROXY_N_DEVICES: |
| 67 |
* |
| 68 |
* Symbol defining the #MbimProxy:mbim-proxy-n-devices property. |
| 69 |
* |
| 70 |
* Since: 1.10 |
| 71 |
*/ |
| 72 |
#define MBIM_PROXY_N_DEVICES "mbim-proxy-n-devices" |
| 73 |
|
| 74 |
/** |
| 75 |
* MbimProxy: |
| 76 |
* |
| 77 |
* The #MbimProxy structure contains private data and should only be accessed |
| 78 |
* using the provided API. |
| 79 |
* |
| 80 |
* Since: 1.10 |
| 81 |
*/ |
| 82 |
struct _MbimProxy { |
| 83 |
GObject parent; |
| 84 |
MbimProxyPrivate *priv; |
| 85 |
}; |
| 86 |
|
| 87 |
struct _MbimProxyClass { |
| 88 |
GObjectClass parent; |
| 89 |
}; |
| 90 |
|
| 91 |
GType mbim_proxy_get_type (void); |
| 92 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MbimProxy, g_object_unref) |
| 93 |
|
| 94 |
/** |
| 95 |
* mbim_proxy_new: |
| 96 |
* @error: Return location for error or %NULL. |
| 97 |
* |
| 98 |
* Creates a #MbimProxy object. |
| 99 |
* |
| 100 |
* Returns: (transfer full): a newly created #MbimProxy, or #NULL if @error is set. |
| 101 |
* |
| 102 |
* Since: 1.10 |
| 103 |
*/ |
| 104 |
MbimProxy *mbim_proxy_new (GError **error); |
| 105 |
|
| 106 |
/** |
| 107 |
* mbim_proxy_get_n_clients: (skip) |
| 108 |
* @self: a #MbimProxy. |
| 109 |
* |
| 110 |
* Get the number of clients currently connected to the proxy. |
| 111 |
* |
| 112 |
* Returns: a #guint. |
| 113 |
* |
| 114 |
* Since: 1.10 |
| 115 |
*/ |
| 116 |
guint mbim_proxy_get_n_clients (MbimProxy *self); |
| 117 |
|
| 118 |
/** |
| 119 |
* mbim_proxy_get_n_devices: (skip) |
| 120 |
* @self: a #MbimProxy. |
| 121 |
* |
| 122 |
* Get the number of devices currently connected to the proxy. |
| 123 |
* |
| 124 |
* Returns: a #guint. |
| 125 |
* |
| 126 |
* Since: 1.10 |
| 127 |
*/ |
| 128 |
guint mbim_proxy_get_n_devices (MbimProxy *self); |
| 129 |
|
| 130 |
G_END_DECLS |
| 131 |
|
| 132 |
#endif /* MBIM_PROXY_H */ |