bearer: new helper 'MMBearerConnectResult' type
Instead of returning 3 variables in connect_finish(), return a single reference counted struct. This simplifies how the result is built and passed within a GSimpleAsyncResult to each _finish() method. This also simplifies the dialling step in the 3GPP connection sequence, as we can use the same new type.
This commit is contained in:
@@ -71,22 +71,15 @@ connect_3gpp_context_complete_and_free (Connect3gppContext *ctx)
|
|||||||
g_slice_free (Connect3gppContext, ctx);
|
g_slice_free (Connect3gppContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static MMBearerConnectResult *
|
||||||
connect_3gpp_finish (MMBroadbandBearer *self,
|
connect_3gpp_finish (MMBroadbandBearer *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPort **data,
|
|
||||||
MMBearerIpConfig **ipv4_config,
|
|
||||||
MMBearerIpConfig **ipv6_config,
|
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
|
|
||||||
*data = g_object_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
|
return mm_bearer_connect_result_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
|
||||||
*ipv4_config = mm_bearer_ip_config_new ();
|
|
||||||
mm_bearer_ip_config_set_method (*ipv4_config, MM_BEARER_IP_METHOD_DHCP);
|
|
||||||
*ipv6_config = NULL;
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void connect_3gpp_context_step (Connect3gppContext *ctx);
|
static void connect_3gpp_context_step (Connect3gppContext *ctx);
|
||||||
@@ -312,10 +305,20 @@ connect_3gpp_context_step (Connect3gppContext *ctx)
|
|||||||
case CONNECT_3GPP_CONTEXT_STEP_LAST:
|
case CONNECT_3GPP_CONTEXT_STEP_LAST:
|
||||||
/* Clear context */
|
/* Clear context */
|
||||||
ctx->self->priv->connect_pending = NULL;
|
ctx->self->priv->connect_pending = NULL;
|
||||||
/* Set data port as result */
|
|
||||||
g_simple_async_result_set_op_res_gpointer (ctx->result,
|
/* Setup result */
|
||||||
g_object_ref (ctx->data),
|
{
|
||||||
g_object_unref);
|
MMBearerIpConfig *ipv4_config;
|
||||||
|
|
||||||
|
ipv4_config = mm_bearer_ip_config_new ();
|
||||||
|
mm_bearer_ip_config_set_method (ipv4_config, MM_BEARER_IP_METHOD_DHCP);
|
||||||
|
g_simple_async_result_set_op_res_gpointer (
|
||||||
|
ctx->result,
|
||||||
|
mm_bearer_connect_result_new (ctx->data, ipv4_config, NULL),
|
||||||
|
(GDestroyNotify)mm_bearer_connect_result_unref);
|
||||||
|
g_object_unref (ipv4_config);
|
||||||
|
}
|
||||||
|
|
||||||
connect_3gpp_context_complete_and_free (ctx);
|
connect_3gpp_context_complete_and_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -36,23 +36,6 @@ G_DEFINE_TYPE (MMBearerIridium, mm_bearer_iridium, MM_TYPE_BEARER);
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Connect */
|
/* Connect */
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
MMPort *data;
|
|
||||||
MMBearerIpConfig *ipv4_config;
|
|
||||||
MMBearerIpConfig *ipv6_config;
|
|
||||||
} ConnectResult;
|
|
||||||
|
|
||||||
static void
|
|
||||||
connect_result_free (ConnectResult *result)
|
|
||||||
{
|
|
||||||
if (result->ipv4_config)
|
|
||||||
g_object_unref (result->ipv4_config);
|
|
||||||
if (result->ipv6_config)
|
|
||||||
g_object_unref (result->ipv6_config);
|
|
||||||
g_object_unref (result->data);
|
|
||||||
g_free (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MMBearerIridium *self;
|
MMBearerIridium *self;
|
||||||
GSimpleAsyncResult *result;
|
GSimpleAsyncResult *result;
|
||||||
@@ -75,25 +58,15 @@ connect_context_complete_and_free (ConnectContext *ctx)
|
|||||||
g_free (ctx);
|
g_free (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static MMBearerConnectResult *
|
||||||
connect_finish (MMBearer *self,
|
connect_finish (MMBearer *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPort **data,
|
|
||||||
MMBearerIpConfig **ipv4_config,
|
|
||||||
MMBearerIpConfig **ipv6_config,
|
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ConnectResult *result;
|
|
||||||
|
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
|
|
||||||
result = (ConnectResult *) g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
|
return mm_bearer_connect_result_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
|
||||||
*data = MM_PORT (g_object_ref (result->data));
|
|
||||||
*ipv4_config = (result->ipv4_config ? g_object_ref (result->ipv4_config) : NULL);
|
|
||||||
*ipv6_config = (result->ipv6_config ? g_object_ref (result->ipv6_config) : NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -141,7 +114,6 @@ dial_ready (MMBaseModem *modem,
|
|||||||
ConnectContext *ctx)
|
ConnectContext *ctx)
|
||||||
{
|
{
|
||||||
MMBearerIpConfig *config;
|
MMBearerIpConfig *config;
|
||||||
ConnectResult *result;
|
|
||||||
|
|
||||||
/* DO NOT check for cancellable here. If we got here without errors, the
|
/* DO NOT check for cancellable here. If we got here without errors, the
|
||||||
* bearer is really connected and therefore we need to reflect that in
|
* bearer is really connected and therefore we need to reflect that in
|
||||||
@@ -169,16 +141,13 @@ dial_ready (MMBaseModem *modem,
|
|||||||
config = mm_bearer_ip_config_new ();
|
config = mm_bearer_ip_config_new ();
|
||||||
mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_PPP);
|
mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_PPP);
|
||||||
|
|
||||||
/* Build result */
|
|
||||||
result = g_new0 (ConnectResult, 1);
|
|
||||||
result->data = g_object_ref (ctx->primary);
|
|
||||||
result->ipv4_config = config;
|
|
||||||
result->ipv6_config = g_object_ref (config);
|
|
||||||
|
|
||||||
/* Set operation result */
|
/* Set operation result */
|
||||||
g_simple_async_result_set_op_res_gpointer (ctx->result,
|
g_simple_async_result_set_op_res_gpointer (
|
||||||
result,
|
ctx->result,
|
||||||
(GDestroyNotify)connect_result_free);
|
mm_bearer_connect_result_new (MM_PORT (ctx->primary), config, NULL),
|
||||||
|
(GDestroyNotify)mm_bearer_connect_result_unref);
|
||||||
|
g_object_unref (config);
|
||||||
|
|
||||||
connect_context_complete_and_free (ctx);
|
connect_context_complete_and_free (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -96,28 +96,15 @@ detailed_connect_context_complete_and_free (DetailedConnectContext *ctx)
|
|||||||
g_free (ctx);
|
g_free (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static MMBearerConnectResult *
|
||||||
connect_3gpp_finish (MMBroadbandBearer *self,
|
connect_3gpp_finish (MMBroadbandBearer *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPort **data,
|
|
||||||
MMBearerIpConfig **ipv4_config,
|
|
||||||
MMBearerIpConfig **ipv6_config,
|
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
MMBearerIpConfig *config;
|
|
||||||
|
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
|
|
||||||
config = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
|
return mm_bearer_connect_result_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
|
||||||
|
|
||||||
/* In the default implementation, we assume only IPv4 is supported */
|
|
||||||
*ipv4_config = g_object_ref (config);
|
|
||||||
*ipv6_config = NULL;
|
|
||||||
/* We used the input suggested data port */
|
|
||||||
*data = NULL;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean connect_3gpp_qmistatus (DetailedConnectContext *ctx);
|
static gboolean connect_3gpp_qmistatus (DetailedConnectContext *ctx);
|
||||||
@@ -209,9 +196,11 @@ connect_3gpp_qmistatus_ready (MMBaseModem *modem,
|
|||||||
ctx->self);
|
ctx->self);
|
||||||
config = mm_bearer_ip_config_new ();
|
config = mm_bearer_ip_config_new ();
|
||||||
mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_DHCP);
|
mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_DHCP);
|
||||||
g_simple_async_result_set_op_res_gpointer (ctx->result,
|
g_simple_async_result_set_op_res_gpointer (
|
||||||
config,
|
ctx->result,
|
||||||
(GDestroyNotify)g_object_unref);
|
mm_bearer_connect_result_new (ctx->data, config, NULL),
|
||||||
|
(GDestroyNotify)mm_bearer_connect_result_unref);
|
||||||
|
g_object_unref (config);
|
||||||
detailed_connect_context_complete_and_free (ctx);
|
detailed_connect_context_complete_and_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -47,23 +47,6 @@ struct _MMBearerQmiPrivate {
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Connect */
|
/* Connect */
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
MMPort *data;
|
|
||||||
MMBearerIpConfig *ipv4_config;
|
|
||||||
MMBearerIpConfig *ipv6_config;
|
|
||||||
} ConnectResult;
|
|
||||||
|
|
||||||
static void
|
|
||||||
connect_result_free (ConnectResult *result)
|
|
||||||
{
|
|
||||||
if (result->ipv4_config)
|
|
||||||
g_object_unref (result->ipv4_config);
|
|
||||||
if (result->ipv6_config)
|
|
||||||
g_object_unref (result->ipv6_config);
|
|
||||||
g_object_unref (result->data);
|
|
||||||
g_slice_free (ConnectResult, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CONNECT_STEP_FIRST,
|
CONNECT_STEP_FIRST,
|
||||||
CONNECT_STEP_OPEN_QMI_PORT,
|
CONNECT_STEP_OPEN_QMI_PORT,
|
||||||
@@ -129,25 +112,15 @@ connect_context_complete_and_free (ConnectContext *ctx)
|
|||||||
g_slice_free (ConnectContext, ctx);
|
g_slice_free (ConnectContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static MMBearerConnectResult *
|
||||||
connect_finish (MMBearer *self,
|
connect_finish (MMBearer *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPort **data,
|
|
||||||
MMBearerIpConfig **ipv4_config,
|
|
||||||
MMBearerIpConfig **ipv6_config,
|
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ConnectResult *result;
|
|
||||||
|
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
|
|
||||||
result = (ConnectResult *) g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
|
return mm_bearer_connect_result_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
|
||||||
*data = MM_PORT (g_object_ref (result->data));
|
|
||||||
*ipv4_config = (result->ipv4_config ? g_object_ref (result->ipv4_config) : NULL);
|
|
||||||
*ipv6_config = (result->ipv6_config ? g_object_ref (result->ipv6_config) : NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void connect_context_step (ConnectContext *ctx);
|
static void connect_context_step (ConnectContext *ctx);
|
||||||
@@ -744,7 +717,6 @@ connect_context_step (ConnectContext *ctx)
|
|||||||
/* If one of IPv4 or IPv6 succeeds, we're connected */
|
/* If one of IPv4 or IPv6 succeeds, we're connected */
|
||||||
if (ctx->packet_data_handle_ipv4 || ctx->packet_data_handle_ipv6) {
|
if (ctx->packet_data_handle_ipv4 || ctx->packet_data_handle_ipv6) {
|
||||||
MMBearerIpConfig *config;
|
MMBearerIpConfig *config;
|
||||||
ConnectResult *result;
|
|
||||||
|
|
||||||
/* Port is connected; update the state */
|
/* Port is connected; update the state */
|
||||||
mm_port_set_connected (MM_PORT (ctx->data), TRUE);
|
mm_port_set_connected (MM_PORT (ctx->data), TRUE);
|
||||||
@@ -771,20 +743,15 @@ connect_context_step (ConnectContext *ctx)
|
|||||||
config = mm_bearer_ip_config_new ();
|
config = mm_bearer_ip_config_new ();
|
||||||
mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_DHCP);
|
mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_DHCP);
|
||||||
|
|
||||||
/* Build result */
|
|
||||||
result = g_slice_new0 (ConnectResult);
|
|
||||||
result->data = g_object_ref (ctx->data);
|
|
||||||
if (ctx->packet_data_handle_ipv4)
|
|
||||||
result->ipv4_config = g_object_ref (config);
|
|
||||||
if (ctx->packet_data_handle_ipv6)
|
|
||||||
result->ipv6_config = g_object_ref (config);
|
|
||||||
|
|
||||||
g_object_unref (config);
|
|
||||||
|
|
||||||
/* Set operation result */
|
/* Set operation result */
|
||||||
g_simple_async_result_set_op_res_gpointer (ctx->result,
|
g_simple_async_result_set_op_res_gpointer (
|
||||||
result,
|
ctx->result,
|
||||||
(GDestroyNotify)connect_result_free);
|
mm_bearer_connect_result_new (
|
||||||
|
ctx->data,
|
||||||
|
ctx->packet_data_handle_ipv4 ? config : NULL,
|
||||||
|
ctx->packet_data_handle_ipv6 ? config : NULL),
|
||||||
|
(GDestroyNotify)mm_bearer_connect_result_unref);
|
||||||
|
g_object_unref (config);
|
||||||
} else {
|
} else {
|
||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
|
103
src/mm-bearer.c
103
src/mm-bearer.c
@@ -13,6 +13,7 @@
|
|||||||
* Copyright (C) 2008 - 2009 Novell, Inc.
|
* Copyright (C) 2008 - 2009 Novell, Inc.
|
||||||
* Copyright (C) 2009 - 2011 Red Hat, Inc.
|
* Copyright (C) 2009 - 2011 Red Hat, Inc.
|
||||||
* Copyright (C) 2011 Google, Inc.
|
* Copyright (C) 2011 Google, Inc.
|
||||||
|
* Copyright (C) 2011 - 2013 Aleksander Morgado <aleksander@gnu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -373,17 +374,11 @@ connect_ready (MMBearer *self,
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean launch_disconnect = FALSE;
|
gboolean launch_disconnect = FALSE;
|
||||||
MMPort *data = NULL;
|
MMBearerConnectResult *result;
|
||||||
MMBearerIpConfig *ipv4_config = NULL;
|
|
||||||
MMBearerIpConfig *ipv6_config = NULL;
|
|
||||||
|
|
||||||
/* NOTE: connect() implementations *MUST* handle cancellations themselves */
|
/* NOTE: connect() implementations *MUST* handle cancellations themselves */
|
||||||
if (!MM_BEARER_GET_CLASS (self)->connect_finish (self,
|
result = MM_BEARER_GET_CLASS (self)->connect_finish (self, res, &error);
|
||||||
res,
|
if (!result) {
|
||||||
&data,
|
|
||||||
&ipv4_config,
|
|
||||||
&ipv6_config,
|
|
||||||
&error)) {
|
|
||||||
mm_dbg ("Couldn't connect bearer '%s': '%s'",
|
mm_dbg ("Couldn't connect bearer '%s': '%s'",
|
||||||
self->priv->path,
|
self->priv->path,
|
||||||
error->message);
|
error->message);
|
||||||
@@ -400,11 +395,7 @@ connect_ready (MMBearer *self,
|
|||||||
/* Handle cancellations detected after successful connection */
|
/* Handle cancellations detected after successful connection */
|
||||||
else if (g_cancellable_is_cancelled (self->priv->connect_cancellable)) {
|
else if (g_cancellable_is_cancelled (self->priv->connect_cancellable)) {
|
||||||
mm_dbg ("Connected bearer '%s', but need to disconnect", self->priv->path);
|
mm_dbg ("Connected bearer '%s', but need to disconnect", self->priv->path);
|
||||||
|
mm_bearer_connect_result_unref (result);
|
||||||
g_clear_object (&data);
|
|
||||||
g_clear_object (&ipv4_config);
|
|
||||||
g_clear_object (&ipv6_config);
|
|
||||||
|
|
||||||
g_simple_async_result_set_error (
|
g_simple_async_result_set_error (
|
||||||
simple,
|
simple,
|
||||||
MM_CORE_ERROR,
|
MM_CORE_ERROR,
|
||||||
@@ -416,15 +407,12 @@ connect_ready (MMBearer *self,
|
|||||||
mm_dbg ("Connected bearer '%s'", self->priv->path);
|
mm_dbg ("Connected bearer '%s'", self->priv->path);
|
||||||
|
|
||||||
/* Update bearer and interface status */
|
/* Update bearer and interface status */
|
||||||
bearer_update_status_connected (self,
|
bearer_update_status_connected (
|
||||||
mm_port_get_device (data),
|
self,
|
||||||
ipv4_config,
|
mm_port_get_device (mm_bearer_connect_result_peek_data (result)),
|
||||||
ipv6_config);
|
mm_bearer_connect_result_peek_ipv4_config (result),
|
||||||
|
mm_bearer_connect_result_peek_ipv6_config (result));
|
||||||
g_clear_object (&data);
|
mm_bearer_connect_result_unref (result);
|
||||||
g_clear_object (&ipv4_config);
|
|
||||||
g_clear_object (&ipv6_config);
|
|
||||||
|
|
||||||
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
g_simple_async_result_set_op_res_gboolean (simple, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1123,3 +1111,72 @@ mm_bearer_class_init (MMBearerClass *klass)
|
|||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
g_object_class_install_property (object_class, PROP_CONFIG, properties[PROP_CONFIG]);
|
g_object_class_install_property (object_class, PROP_CONFIG, properties[PROP_CONFIG]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Helpers to implement connect() */
|
||||||
|
|
||||||
|
struct _MMBearerConnectResult {
|
||||||
|
volatile gint ref_count;
|
||||||
|
MMPort *data;
|
||||||
|
MMBearerIpConfig *ipv4_config;
|
||||||
|
MMBearerIpConfig *ipv6_config;
|
||||||
|
};
|
||||||
|
|
||||||
|
MMBearerConnectResult *
|
||||||
|
mm_bearer_connect_result_ref (MMBearerConnectResult *result)
|
||||||
|
{
|
||||||
|
g_atomic_int_inc (&result->ref_count);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mm_bearer_connect_result_unref (MMBearerConnectResult *result)
|
||||||
|
{
|
||||||
|
if (g_atomic_int_dec_and_test (&result->ref_count)) {
|
||||||
|
if (result->ipv4_config)
|
||||||
|
g_object_unref (result->ipv4_config);
|
||||||
|
if (result->ipv6_config)
|
||||||
|
g_object_unref (result->ipv6_config);
|
||||||
|
if (result->data)
|
||||||
|
g_object_unref (result->data);
|
||||||
|
g_slice_free (MMBearerConnectResult, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MMPort *
|
||||||
|
mm_bearer_connect_result_peek_data (MMBearerConnectResult *result)
|
||||||
|
{
|
||||||
|
return result->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
MMBearerIpConfig *
|
||||||
|
mm_bearer_connect_result_peek_ipv4_config (MMBearerConnectResult *result)
|
||||||
|
{
|
||||||
|
return result->ipv4_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
MMBearerIpConfig *
|
||||||
|
mm_bearer_connect_result_peek_ipv6_config (MMBearerConnectResult *result)
|
||||||
|
{
|
||||||
|
return result->ipv6_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
MMBearerConnectResult *
|
||||||
|
mm_bearer_connect_result_new (MMPort *data,
|
||||||
|
MMBearerIpConfig *ipv4_config,
|
||||||
|
MMBearerIpConfig *ipv6_config)
|
||||||
|
{
|
||||||
|
MMBearerConnectResult *result;
|
||||||
|
|
||||||
|
/* 'data' must always be given */
|
||||||
|
g_assert (MM_IS_PORT (data));
|
||||||
|
|
||||||
|
result = g_slice_new0 (MMBearerConnectResult);
|
||||||
|
result->ref_count = 1;
|
||||||
|
result->data = g_object_ref (data);
|
||||||
|
if (ipv4_config)
|
||||||
|
result->ipv4_config = g_object_ref (ipv4_config);
|
||||||
|
if (ipv6_config)
|
||||||
|
result->ipv6_config = g_object_ref (ipv6_config);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
* Author: Aleksander Morgado <aleksander@lanedo.com>
|
* Author: Aleksander Morgado <aleksander@lanedo.com>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Google, Inc.
|
* Copyright (C) 2011 Google, Inc.
|
||||||
|
* Copyright (C) 2011 - 2013 Aleksander Morgado <aleksander@gnu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MM_BEARER_H
|
#ifndef MM_BEARER_H
|
||||||
@@ -26,6 +27,21 @@
|
|||||||
|
|
||||||
#include "mm-base-modem.h"
|
#include "mm-base-modem.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Helpers to implement connect() */
|
||||||
|
|
||||||
|
typedef struct _MMBearerConnectResult MMBearerConnectResult;
|
||||||
|
MMBearerConnectResult *mm_bearer_connect_result_new (MMPort *data,
|
||||||
|
MMBearerIpConfig *ipv4_config,
|
||||||
|
MMBearerIpConfig *ipv6_config);
|
||||||
|
void mm_bearer_connect_result_unref (MMBearerConnectResult *result);
|
||||||
|
MMBearerConnectResult *mm_bearer_connect_result_ref (MMBearerConnectResult *result);
|
||||||
|
MMPort *mm_bearer_connect_result_peek_data (MMBearerConnectResult *result);
|
||||||
|
MMBearerIpConfig *mm_bearer_connect_result_peek_ipv4_config (MMBearerConnectResult *result);
|
||||||
|
MMBearerIpConfig *mm_bearer_connect_result_peek_ipv6_config (MMBearerConnectResult *result);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define MM_TYPE_BEARER (mm_bearer_get_type ())
|
#define MM_TYPE_BEARER (mm_bearer_get_type ())
|
||||||
#define MM_BEARER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BEARER, MMBearer))
|
#define MM_BEARER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BEARER, MMBearer))
|
||||||
#define MM_BEARER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BEARER, MMBearerClass))
|
#define MM_BEARER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BEARER, MMBearerClass))
|
||||||
@@ -63,12 +79,9 @@ struct _MMBearerClass {
|
|||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
gboolean (* connect_finish) (MMBearer *bearer,
|
MMBearerConnectResult * (* connect_finish) (MMBearer *bearer,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPort **data,
|
GError **error);
|
||||||
MMBearerIpConfig **ipv4_config,
|
|
||||||
MMBearerIpConfig **ipv6_config,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Disconnect this bearer */
|
/* Disconnect this bearer */
|
||||||
void (* disconnect) (MMBearer *bearer,
|
void (* disconnect) (MMBearer *bearer,
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
* Copyright (C) 2008 - 2009 Novell, Inc.
|
* Copyright (C) 2008 - 2009 Novell, Inc.
|
||||||
* Copyright (C) 2009 - 2012 Red Hat, Inc.
|
* Copyright (C) 2009 - 2012 Red Hat, Inc.
|
||||||
* Copyright (C) 2011 - 2012 Google, Inc.
|
* Copyright (C) 2011 - 2012 Google, Inc.
|
||||||
|
* Copyright (C) 2011 - 2013 Aleksander Morgado <aleksander@gnu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -67,45 +68,9 @@ mm_broadband_bearer_get_3gpp_cid (MMBroadbandBearer *self)
|
|||||||
return self->priv->cid;
|
return self->priv->cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/* Detailed connect result, used in both CDMA and 3GPP sequences */
|
|
||||||
typedef struct {
|
|
||||||
MMPort *data;
|
|
||||||
MMBearerIpConfig *ipv4_config;
|
|
||||||
MMBearerIpConfig *ipv6_config;
|
|
||||||
} DetailedConnectResult;
|
|
||||||
|
|
||||||
static void
|
|
||||||
detailed_connect_result_free (DetailedConnectResult *result)
|
|
||||||
{
|
|
||||||
if (result->ipv4_config)
|
|
||||||
g_object_unref (result->ipv4_config);
|
|
||||||
if (result->ipv6_config)
|
|
||||||
g_object_unref (result->ipv6_config);
|
|
||||||
if (result->data)
|
|
||||||
g_object_unref (result->data);
|
|
||||||
g_slice_free (DetailedConnectResult, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DetailedConnectResult *
|
|
||||||
detailed_connect_result_new (MMPort *data,
|
|
||||||
MMBearerIpConfig *ipv4_config,
|
|
||||||
MMBearerIpConfig *ipv6_config)
|
|
||||||
{
|
|
||||||
DetailedConnectResult *result;
|
|
||||||
|
|
||||||
result = g_slice_new0 (DetailedConnectResult);
|
|
||||||
if (data)
|
|
||||||
result->data = g_object_ref (data);
|
|
||||||
if (ipv4_config)
|
|
||||||
result->ipv4_config = g_object_ref (ipv4_config);
|
|
||||||
if (ipv6_config)
|
|
||||||
result->ipv6_config = g_object_ref (ipv6_config);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Detailed connect context, used in both CDMA and 3GPP sequences */
|
/* Detailed connect context, used in both CDMA and 3GPP sequences */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MMBroadbandBearer *self;
|
MMBroadbandBearer *self;
|
||||||
MMBaseModem *modem;
|
MMBaseModem *modem;
|
||||||
@@ -120,25 +85,15 @@ typedef struct {
|
|||||||
guint max_cid;
|
guint max_cid;
|
||||||
} DetailedConnectContext;
|
} DetailedConnectContext;
|
||||||
|
|
||||||
static gboolean
|
static MMBearerConnectResult *
|
||||||
detailed_connect_finish (MMBroadbandBearer *self,
|
detailed_connect_finish (MMBroadbandBearer *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPort **data,
|
|
||||||
MMBearerIpConfig **ipv4_config,
|
|
||||||
MMBearerIpConfig **ipv6_config,
|
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
DetailedConnectResult *result;
|
|
||||||
|
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
|
|
||||||
result = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
|
return mm_bearer_connect_result_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
|
||||||
|
|
||||||
*data = (result->data ? g_object_ref (result->data) : NULL);
|
|
||||||
*ipv4_config = (result->ipv4_config ? g_object_ref (result->ipv4_config) : NULL);
|
|
||||||
*ipv6_config = (result->ipv6_config ? g_object_ref (result->ipv6_config) : NULL);
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -153,7 +108,7 @@ detailed_connect_context_complete_and_free (DetailedConnectContext *ctx)
|
|||||||
g_object_unref (ctx->secondary);
|
g_object_unref (ctx->secondary);
|
||||||
g_object_unref (ctx->self);
|
g_object_unref (ctx->self);
|
||||||
g_object_unref (ctx->modem);
|
g_object_unref (ctx->modem);
|
||||||
g_free (ctx);
|
g_slice_free (DetailedConnectContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -195,7 +150,7 @@ detailed_connect_context_new (MMBroadbandBearer *self,
|
|||||||
{
|
{
|
||||||
DetailedConnectContext *ctx;
|
DetailedConnectContext *ctx;
|
||||||
|
|
||||||
ctx = g_new0 (DetailedConnectContext, 1);
|
ctx = g_slice_new0 (DetailedConnectContext);
|
||||||
ctx->self = g_object_ref (self);
|
ctx->self = g_object_ref (self);
|
||||||
ctx->modem = MM_BASE_MODEM (g_object_ref (modem));
|
ctx->modem = MM_BASE_MODEM (g_object_ref (modem));
|
||||||
ctx->primary = g_object_ref (primary);
|
ctx->primary = g_object_ref (primary);
|
||||||
@@ -252,8 +207,8 @@ dial_cdma_ready (MMBaseModem *modem,
|
|||||||
/* Assume only IPv4 is given */
|
/* Assume only IPv4 is given */
|
||||||
g_simple_async_result_set_op_res_gpointer (
|
g_simple_async_result_set_op_res_gpointer (
|
||||||
ctx->result,
|
ctx->result,
|
||||||
detailed_connect_result_new (ctx->data, config, NULL),
|
mm_bearer_connect_result_new (ctx->data, config, NULL),
|
||||||
(GDestroyNotify)detailed_connect_result_free);
|
(GDestroyNotify)mm_bearer_connect_result_unref);
|
||||||
detailed_connect_context_complete_and_free (ctx);
|
detailed_connect_context_complete_and_free (ctx);
|
||||||
|
|
||||||
g_object_unref (config);
|
g_object_unref (config);
|
||||||
@@ -631,8 +586,8 @@ get_ip_config_3gpp_ready (MMBroadbandModem *modem,
|
|||||||
|
|
||||||
g_simple_async_result_set_op_res_gpointer (
|
g_simple_async_result_set_op_res_gpointer (
|
||||||
ctx->result,
|
ctx->result,
|
||||||
detailed_connect_result_new (ctx->data, ipv4_config, ipv6_config),
|
mm_bearer_connect_result_new (ctx->data, ipv4_config, ipv6_config),
|
||||||
(GDestroyNotify)detailed_connect_result_free);
|
(GDestroyNotify)mm_bearer_connect_result_unref);
|
||||||
detailed_connect_context_complete_and_free (ctx);
|
detailed_connect_context_complete_and_free (ctx);
|
||||||
|
|
||||||
if (ipv4_config)
|
if (ipv4_config)
|
||||||
@@ -686,8 +641,8 @@ dial_3gpp_ready (MMBroadbandModem *modem,
|
|||||||
|
|
||||||
g_simple_async_result_set_op_res_gpointer (
|
g_simple_async_result_set_op_res_gpointer (
|
||||||
ctx->result,
|
ctx->result,
|
||||||
detailed_connect_result_new (ctx->data, config, NULL),
|
mm_bearer_connect_result_new (ctx->data, config, NULL),
|
||||||
(GDestroyNotify)detailed_connect_result_free);
|
(GDestroyNotify)mm_bearer_connect_result_unref);
|
||||||
detailed_connect_context_complete_and_free (ctx);
|
detailed_connect_context_complete_and_free (ctx);
|
||||||
|
|
||||||
g_object_unref (config);
|
g_object_unref (config);
|
||||||
@@ -997,23 +952,6 @@ connect_3gpp (MMBroadbandBearer *self,
|
|||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* CONNECT */
|
/* CONNECT */
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
MMPort *data;
|
|
||||||
MMBearerIpConfig *ipv4_config;
|
|
||||||
MMBearerIpConfig *ipv6_config;
|
|
||||||
} ConnectResult;
|
|
||||||
|
|
||||||
static void
|
|
||||||
connect_result_free (ConnectResult *result)
|
|
||||||
{
|
|
||||||
if (result->ipv4_config)
|
|
||||||
g_object_unref (result->ipv4_config);
|
|
||||||
if (result->ipv6_config)
|
|
||||||
g_object_unref (result->ipv6_config);
|
|
||||||
g_object_unref (result->data);
|
|
||||||
g_free (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MMBroadbandBearer *self;
|
MMBroadbandBearer *self;
|
||||||
GSimpleAsyncResult *result;
|
GSimpleAsyncResult *result;
|
||||||
@@ -1027,81 +965,36 @@ connect_context_complete_and_free (ConnectContext *ctx)
|
|||||||
g_object_unref (ctx->result);
|
g_object_unref (ctx->result);
|
||||||
g_object_unref (ctx->suggested_data);
|
g_object_unref (ctx->suggested_data);
|
||||||
g_object_unref (ctx->self);
|
g_object_unref (ctx->self);
|
||||||
g_free (ctx);
|
g_slice_free (ConnectContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static MMBearerConnectResult *
|
||||||
connect_finish (MMBearer *self,
|
connect_finish (MMBearer *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPort **data,
|
|
||||||
MMBearerIpConfig **ipv4_config,
|
|
||||||
MMBearerIpConfig **ipv6_config,
|
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ConnectResult *result;
|
|
||||||
|
|
||||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
|
|
||||||
result = (ConnectResult *) g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
|
return mm_bearer_connect_result_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
|
||||||
*data = MM_PORT (g_object_ref (result->data));
|
|
||||||
*ipv4_config = (result->ipv4_config ? g_object_ref (result->ipv4_config) : NULL);
|
|
||||||
*ipv6_config = (result->ipv6_config ? g_object_ref (result->ipv6_config) : NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
connect_succeeded (ConnectContext *ctx,
|
connect_succeeded (ConnectContext *ctx,
|
||||||
ConnectionType connection_type,
|
ConnectionType connection_type,
|
||||||
MMPort *data,
|
MMBearerConnectResult *result)
|
||||||
MMBearerIpConfig *ipv4_config,
|
|
||||||
MMBearerIpConfig *ipv6_config)
|
|
||||||
{
|
{
|
||||||
ConnectResult *result;
|
|
||||||
MMPort *real_data;
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
if (data != ctx->suggested_data)
|
|
||||||
mm_dbg ("Suggested to use port '%s/%s' for connection, but using '%s/%s' instead",
|
|
||||||
mm_port_subsys_get_string (mm_port_get_subsys (ctx->suggested_data)),
|
|
||||||
mm_port_get_device (ctx->suggested_data),
|
|
||||||
mm_port_subsys_get_string (mm_port_get_subsys (data)),
|
|
||||||
mm_port_get_device (data));
|
|
||||||
real_data = data;
|
|
||||||
} else
|
|
||||||
real_data = g_object_ref (ctx->suggested_data);
|
|
||||||
|
|
||||||
/* Port is connected; update the state */
|
|
||||||
mm_port_set_connected (real_data, TRUE);
|
|
||||||
|
|
||||||
/* Keep connected port and type of connection */
|
/* Keep connected port and type of connection */
|
||||||
ctx->self->priv->port = g_object_ref (real_data);
|
ctx->self->priv->port = g_object_ref (mm_bearer_connect_result_peek_data (result));
|
||||||
ctx->self->priv->connection_type = connection_type;
|
ctx->self->priv->connection_type = connection_type;
|
||||||
|
|
||||||
/* Build result */
|
/* Port is connected; update the state */
|
||||||
result = g_new0 (ConnectResult, 1);
|
mm_port_set_connected (ctx->self->priv->port, TRUE);
|
||||||
result->data = real_data;
|
|
||||||
result->ipv4_config = ipv4_config;
|
|
||||||
result->ipv6_config = ipv6_config;
|
|
||||||
|
|
||||||
/* Set operation result */
|
/* Set operation result */
|
||||||
g_simple_async_result_set_op_res_gpointer (ctx->result,
|
g_simple_async_result_set_op_res_gpointer (ctx->result,
|
||||||
result,
|
result,
|
||||||
(GDestroyNotify)connect_result_free);
|
(GDestroyNotify)mm_bearer_connect_result_unref);
|
||||||
|
|
||||||
connect_context_complete_and_free (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
connect_failed (ConnectContext *ctx,
|
|
||||||
GError *error)
|
|
||||||
{
|
|
||||||
/* On errors, close the data port */
|
|
||||||
if (MM_IS_AT_SERIAL_PORT (ctx->suggested_data))
|
|
||||||
mm_serial_port_close (MM_SERIAL_PORT (ctx->suggested_data));
|
|
||||||
|
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
|
||||||
connect_context_complete_and_free (ctx);
|
connect_context_complete_and_free (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1110,20 +1003,18 @@ connect_cdma_ready (MMBroadbandBearer *self,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
ConnectContext *ctx)
|
ConnectContext *ctx)
|
||||||
{
|
{
|
||||||
|
MMBearerConnectResult *result;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
MMBearerIpConfig *ipv4_config = NULL;
|
|
||||||
MMBearerIpConfig *ipv6_config = NULL;
|
|
||||||
MMPort *data = NULL;
|
|
||||||
|
|
||||||
if (!MM_BROADBAND_BEARER_GET_CLASS (self)->connect_cdma_finish (self,
|
result = MM_BROADBAND_BEARER_GET_CLASS (self)->connect_cdma_finish (self, res, &error);
|
||||||
res,
|
if (!result) {
|
||||||
&data,
|
g_simple_async_result_take_error (ctx->result, error);
|
||||||
&ipv4_config,
|
connect_context_complete_and_free (ctx);
|
||||||
&ipv6_config,
|
return;
|
||||||
&error))
|
}
|
||||||
connect_failed (ctx, error);
|
|
||||||
else
|
/* take result */
|
||||||
connect_succeeded (ctx, CONNECTION_TYPE_CDMA, data, ipv4_config, ipv6_config);
|
connect_succeeded (ctx, CONNECTION_TYPE_CDMA, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1131,20 +1022,18 @@ connect_3gpp_ready (MMBroadbandBearer *self,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
ConnectContext *ctx)
|
ConnectContext *ctx)
|
||||||
{
|
{
|
||||||
|
MMBearerConnectResult *result;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
MMBearerIpConfig *ipv4_config = NULL;
|
|
||||||
MMBearerIpConfig *ipv6_config = NULL;
|
|
||||||
MMPort *data = NULL;
|
|
||||||
|
|
||||||
if (!MM_BROADBAND_BEARER_GET_CLASS (self)->connect_3gpp_finish (self,
|
result = MM_BROADBAND_BEARER_GET_CLASS (self)->connect_3gpp_finish (self, res, &error);
|
||||||
res,
|
if (!result) {
|
||||||
&data,
|
g_simple_async_result_take_error (ctx->result, error);
|
||||||
&ipv4_config,
|
connect_context_complete_and_free (ctx);
|
||||||
&ipv6_config,
|
return;
|
||||||
&error))
|
}
|
||||||
connect_failed (ctx, error);
|
|
||||||
else
|
/* take result */
|
||||||
connect_succeeded (ctx, CONNECTION_TYPE_3GPP, data, ipv4_config, ipv6_config);
|
connect_succeeded (ctx, CONNECTION_TYPE_3GPP, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1238,7 +1127,7 @@ connect (MMBearer *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* In this context, we only keep the stuff we'll need later */
|
/* In this context, we only keep the stuff we'll need later */
|
||||||
ctx = g_new0 (ConnectContext, 1);
|
ctx = g_slice_new0 (ConnectContext);
|
||||||
ctx->self = g_object_ref (self);
|
ctx->self = g_object_ref (self);
|
||||||
ctx->suggested_data = g_object_ref (suggested_data);
|
ctx->suggested_data = g_object_ref (suggested_data);
|
||||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
* Author: Aleksander Morgado <aleksander@lanedo.com>
|
* Author: Aleksander Morgado <aleksander@lanedo.com>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 - 2012 Google, Inc.
|
* Copyright (C) 2011 - 2012 Google, Inc.
|
||||||
|
* Copyright (C) 2011 - 2013 Aleksander Morgado <aleksander@gnu.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MM_BROADBAND_BEARER_H
|
#ifndef MM_BROADBAND_BEARER_H
|
||||||
@@ -55,12 +56,9 @@ struct _MMBroadbandBearerClass {
|
|||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
gboolean (* connect_3gpp_finish) (MMBroadbandBearer *self,
|
MMBearerConnectResult * (* connect_3gpp_finish) (MMBroadbandBearer *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPort **data,
|
GError **error);
|
||||||
MMBearerIpConfig **ipv4_config,
|
|
||||||
MMBearerIpConfig **ipv6_config,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Dialing sub-part of 3GPP connection */
|
/* Dialing sub-part of 3GPP connection */
|
||||||
void (* dial_3gpp) (MMBroadbandBearer *self,
|
void (* dial_3gpp) (MMBroadbandBearer *self,
|
||||||
@@ -113,12 +111,9 @@ struct _MMBroadbandBearerClass {
|
|||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
gboolean (* connect_cdma_finish) (MMBroadbandBearer *self,
|
MMBearerConnectResult * (* connect_cdma_finish) (MMBroadbandBearer *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMPort **data,
|
GError **error);
|
||||||
MMBearerIpConfig **ipv4_config,
|
|
||||||
MMBearerIpConfig **ipv6_config,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Full CDMA disconnection sequence */
|
/* Full CDMA disconnection sequence */
|
||||||
void (* disconnect_cdma) (MMBroadbandBearer *self,
|
void (* disconnect_cdma) (MMBroadbandBearer *self,
|
||||||
|
Reference in New Issue
Block a user