mirror of git://git.sysmocom.de/ofono
gprs: Add support for exposing proxy information for MMS context
This commit is contained in:
parent
9c476f1f0a
commit
87cd9f57b3
|
@ -211,6 +211,26 @@ Properties boolean Active [readwrite]
|
|||
|
||||
Holds the gateway IP for this connection.
|
||||
|
||||
string Proxy [readonly, MMS only]
|
||||
|
||||
Holds the current proxy information for
|
||||
using this context.
|
||||
|
||||
In combination with the Interface value
|
||||
this allows access to the services offered
|
||||
by this context.
|
||||
|
||||
It is possible that this reflects just the
|
||||
MessageProxy property if such a routing can
|
||||
be set up. However this can also be pointing
|
||||
to a local proxy on 127.0.0.1 and then using
|
||||
the loopback interace lo for it.
|
||||
|
||||
Users of this context should bind to the
|
||||
provided interface and only attempt access
|
||||
via this proxy. All other values are left
|
||||
out in this case.
|
||||
|
||||
string MessageProxy [readwrite, MMS only]
|
||||
|
||||
Holds the MMS Proxy setting.
|
||||
|
|
23
src/gprs.c
23
src/gprs.c
|
@ -90,12 +90,14 @@ struct ofono_gprs_context {
|
|||
};
|
||||
|
||||
struct context_settings {
|
||||
enum ofono_gprs_context_type type;
|
||||
char *interface;
|
||||
gboolean static_ip;
|
||||
char *ip;
|
||||
char *netmask;
|
||||
char *gateway;
|
||||
char **dns;
|
||||
char *proxy;
|
||||
};
|
||||
|
||||
struct pri_context {
|
||||
|
@ -219,6 +221,7 @@ static void context_settings_free(struct context_settings *settings)
|
|||
g_free(settings->netmask);
|
||||
g_free(settings->gateway);
|
||||
g_strfreev(settings->dns);
|
||||
g_free(settings->proxy);
|
||||
|
||||
g_free(settings);
|
||||
}
|
||||
|
@ -245,11 +248,18 @@ static void context_settings_append_variant(struct context_settings *settings,
|
|||
dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
|
||||
typesig, &array);
|
||||
if (settings == NULL)
|
||||
goto end;
|
||||
goto done;
|
||||
|
||||
ofono_dbus_dict_append(&array, "Interface",
|
||||
DBUS_TYPE_STRING, &settings->interface);
|
||||
|
||||
if (settings->type == OFONO_GPRS_CONTEXT_TYPE_MMS) {
|
||||
if (settings->proxy)
|
||||
ofono_dbus_dict_append(&array, "Proxy",
|
||||
DBUS_TYPE_STRING, &settings->proxy);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (settings->static_ip == TRUE)
|
||||
method = "static";
|
||||
else
|
||||
|
@ -274,7 +284,7 @@ static void context_settings_append_variant(struct context_settings *settings,
|
|||
DBUS_TYPE_STRING,
|
||||
&settings->dns);
|
||||
|
||||
end:
|
||||
done:
|
||||
dbus_message_iter_close_container(&variant, &array);
|
||||
|
||||
dbus_message_iter_close_container(iter, &variant);
|
||||
|
@ -384,7 +394,11 @@ static void pri_update_context_settings(struct pri_context *ctx,
|
|||
if (ctx->settings)
|
||||
context_settings_free(ctx->settings);
|
||||
|
||||
ctx->settings = g_new0(struct context_settings, 1);
|
||||
ctx->settings = g_try_new0(struct context_settings, 1);
|
||||
if (!ctx->settings)
|
||||
return;
|
||||
|
||||
ctx->settings->type = ctx->type;
|
||||
|
||||
ctx->settings->interface = g_strdup(interface);
|
||||
ctx->settings->static_ip = static_ip;
|
||||
|
@ -393,6 +407,9 @@ static void pri_update_context_settings(struct pri_context *ctx,
|
|||
ctx->settings->gateway = g_strdup(gateway);
|
||||
ctx->settings->dns = g_strdupv((char **)dns);
|
||||
|
||||
if (ctx->type == OFONO_GPRS_CONTEXT_TYPE_MMS && ctx->message_proxy)
|
||||
ctx->settings->proxy = g_strdup(ctx->message_proxy);
|
||||
|
||||
pri_ifupdown(interface, TRUE);
|
||||
|
||||
pri_context_signal_settings(ctx);
|
||||
|
|
Loading…
Reference in New Issue