summaryrefslogtreecommitdiff
path: root/src/libmbim-glib/mbim-proxy.h
blob: 4d5e470655c3f718df15f6406cc4a5849234b35d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * libmbim-glib -- GLib/GIO based library to control MBIM devices
 *
 * Copyright (C) 2014 Aleksander Morgado <aleksander@lanedo.com>
 * Copyright (C) 2014 Smith Micro Software, Inc.
 */

#ifndef MBIM_PROXY_H
#define MBIM_PROXY_H

#if !defined (__LIBMBIM_GLIB_H_INSIDE__) && !defined (LIBMBIM_GLIB_COMPILATION)
#error "Only <libmbim-glib.h> can be included directly."
#endif

#include <glib-object.h>
#include <gio/gio.h>

G_BEGIN_DECLS

/**
 * SECTION:mbim-proxy
 * @title: MbimProxy
 * @short_description: MBIM proxy handling routines
 *
 * The #MbimProxy will setup an abstract socket listening on a predefined
 * address, and will take care of synchronizing the access to a set of shared
 * MBIM ports.
 *
 * Multiple #MbimDevice objects may be connected to the #MbimProxy at any given
 * time. The #MbimProxy acts as a stateful proxy (all remote #MbimDevice objects
 * will need to share the same message sequence).
 */

#define MBIM_TYPE_PROXY            (mbim_proxy_get_type ())
#define MBIM_PROXY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MBIM_TYPE_PROXY, MbimProxy))
#define MBIM_PROXY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MBIM_TYPE_PROXY, MbimProxyClass))
#define MBIM_IS_PROXY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MBIM_TYPE_PROXY))
#define MBIM_IS_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MBIM_TYPE_PROXY))
#define MBIM_PROXY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), MBIM_TYPE_PROXY, MbimProxyClass))

typedef struct _MbimProxy MbimProxy;
typedef struct _MbimProxyClass MbimProxyClass;
typedef struct _MbimProxyPrivate MbimProxyPrivate;

/**
 * MBIM_PROXY_SOCKET_PATH:
 *
 * Symbol defining the default abstract socket name where the #MbimProxy will listen.
 *
 * Since: 1.10
 */
#define MBIM_PROXY_SOCKET_PATH "mbim-proxy"

/**
 * MBIM_PROXY_N_CLIENTS:
 *
 * Symbol defining the #MbimProxy:mbim-proxy-n-clients property.
 *
 * Since: 1.10
 */
#define MBIM_PROXY_N_CLIENTS "mbim-proxy-n-clients"

/**
 * MBIM_PROXY_N_DEVICES:
 *
 * Symbol defining the #MbimProxy:mbim-proxy-n-devices property.
 *
 * Since: 1.10
 */
#define MBIM_PROXY_N_DEVICES "mbim-proxy-n-devices"

/**
 * MbimProxy:
 *
 * The #MbimProxy structure contains private data and should only be accessed
 * using the provided API.
 *
 * Since: 1.10
 */
struct _MbimProxy {
    GObject parent;
    MbimProxyPrivate *priv;
};

struct _MbimProxyClass {
    GObjectClass parent;
};

GType mbim_proxy_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MbimProxy, g_object_unref)

/**
 * mbim_proxy_new:
 * @error: Return location for error or %NULL.
 *
 * Creates a #MbimProxy object.
 *
 * Returns: (transfer full): a newly created #MbimProxy, or #NULL if @error is set.
 *
 * Since: 1.10
 */
MbimProxy *mbim_proxy_new (GError **error);

/**
 * mbim_proxy_get_n_clients: (skip)
 * @self: a #MbimProxy.
 *
 * Get the number of clients currently connected to the proxy.
 *
 * Returns: a #guint.
 *
 * Since: 1.10
 */
guint mbim_proxy_get_n_clients (MbimProxy *self);

/**
 * mbim_proxy_get_n_devices: (skip)
 * @self: a #MbimProxy.
 *
 * Get the number of devices currently connected to the proxy.
 *
 * Returns: a #guint.
 *
 * Since: 1.10
 */
guint mbim_proxy_get_n_devices (MbimProxy *self);

G_END_DECLS

#endif /* MBIM_PROXY_H */