Skip to content

Commit

Permalink
[ofono] Expose P-CSCF address(es) via D-Bus. JB#48905
Browse files Browse the repository at this point in the history
  • Loading branch information
monich committed Jun 3, 2021
1 parent cfb75f4 commit c8dbf54
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
14 changes: 14 additions & 0 deletions ofono/doc/connman-api.txt
Expand Up @@ -278,6 +278,13 @@ Properties boolean Active [readwrite]
via this proxy. All other values are left
out in this case.

array{string} ProxyCSCF [readonly, optional]

Holds the list of P-CSCF (SIP proxy) for this
context. Only used by IMS connections.

This is a Sailfish OS specific extension.

dict IPv6.Settings [readonly, optional]

Holds all the IPv6 network settings
Expand All @@ -304,6 +311,13 @@ Properties boolean Active [readwrite]

Holds the gateway IP for this connection.

array{string} ProxyCSCF [readonly, optional]

Holds the list of P-CSCF (SIP proxy) for this
context. Only used by IMS connections.

This is a Sailfish OS specific extension.

string MessageProxy [readwrite, MMS only]

Holds the MMS Proxy setting.
Expand Down
5 changes: 5 additions & 0 deletions ofono/include/gprs-context.h
Expand Up @@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2015-2021 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
Expand Down Expand Up @@ -128,6 +129,8 @@ void ofono_gprs_context_set_ipv4_gateway(struct ofono_gprs_context *gc,
const char *gateway);
void ofono_gprs_context_set_ipv4_dns_servers(struct ofono_gprs_context *gc,
const char **dns);
void ofono_gprs_context_set_ipv4_proxy_cscf(struct ofono_gprs_context *gc,
const char **pcscf); /* Since mer/1.23+git30 */

void ofono_gprs_context_set_ipv6_address(struct ofono_gprs_context *gc,
const char *address);
Expand All @@ -137,6 +140,8 @@ void ofono_gprs_context_set_ipv6_gateway(struct ofono_gprs_context *gc,
const char *gateway);
void ofono_gprs_context_set_ipv6_dns_servers(struct ofono_gprs_context *gc,
const char **dns);
void ofono_gprs_context_set_ipv6_proxy_cscf(struct ofono_gprs_context *gc,
const char **pcscf); /* Since mer/1.23+git30 */

void ofono_gprs_context_signal_change(struct ofono_gprs_context *gc,
unsigned int cid);
Expand Down
40 changes: 39 additions & 1 deletion ofono/src/gprs.c
Expand Up @@ -3,7 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2015-2020 Jolla Ltd.
* Copyright (C) 2015-2021 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
Expand Down Expand Up @@ -97,6 +97,7 @@ struct ipv4_settings {
char *netmask;
char *gateway;
char **dns;
char **pcscf;
char *proxy;
};

Expand All @@ -105,6 +106,7 @@ struct ipv6_settings {
unsigned char prefix_len;
char *gateway;
char **dns;
char **pcscf;
};

struct context_settings {
Expand Down Expand Up @@ -410,6 +412,7 @@ static void context_settings_free(struct context_settings *settings)
g_free(settings->ipv4->netmask);
g_free(settings->ipv4->gateway);
g_strfreev(settings->ipv4->dns);
g_strfreev(settings->ipv4->pcscf);
g_free(settings->ipv4->proxy);

g_free(settings->ipv4);
Expand All @@ -420,6 +423,7 @@ static void context_settings_free(struct context_settings *settings)
g_free(settings->ipv6->ip);
g_free(settings->ipv6->gateway);
g_strfreev(settings->ipv6->dns);
g_strfreev(settings->ipv6->pcscf);

g_free(settings->ipv6);
settings->ipv6 = NULL;
Expand Down Expand Up @@ -484,6 +488,11 @@ static void context_settings_append_ipv4(struct context_settings *settings,
DBUS_TYPE_STRING,
&settings->ipv4->dns);

if (settings->ipv4->pcscf)
ofono_dbus_dict_append_array(&array, "ProxyCSCF",
DBUS_TYPE_STRING,
&settings->ipv4->pcscf);

done:
dbus_message_iter_close_container(&variant, &array);

Expand Down Expand Up @@ -549,6 +558,11 @@ static void context_settings_append_ipv6(struct context_settings *settings,
DBUS_TYPE_STRING,
&settings->ipv6->dns);

if (settings->ipv6->pcscf)
ofono_dbus_dict_append_array(&array, "ProxyCSCF",
DBUS_TYPE_STRING,
&settings->ipv6->pcscf);

done:
dbus_message_iter_close_container(&variant, &array);

Expand Down Expand Up @@ -3417,6 +3431,18 @@ void ofono_gprs_context_set_ipv4_dns_servers(struct ofono_gprs_context *gc,
settings->ipv4->dns = g_strdupv((char **) dns);
}

void ofono_gprs_context_set_ipv4_proxy_cscf(struct ofono_gprs_context *gc,
const char **pcscf)
{
struct context_settings *settings = gc->settings;

if (settings->ipv4 == NULL)
return;

g_strfreev(settings->ipv4->pcscf);
settings->ipv4->pcscf = g_strdupv((char **) pcscf);
}

void ofono_gprs_context_set_ipv6_address(struct ofono_gprs_context *gc,
const char *address)
{
Expand Down Expand Up @@ -3464,6 +3490,18 @@ void ofono_gprs_context_set_ipv6_dns_servers(struct ofono_gprs_context *gc,
settings->ipv6->dns = g_strdupv((char **) dns);
}

void ofono_gprs_context_set_ipv6_proxy_cscf(struct ofono_gprs_context *gc,
const char **pcscf)
{
struct context_settings *settings = gc->settings;

if (settings->ipv6 == NULL)
return;

g_strfreev(settings->ipv6->pcscf);
settings->ipv6->pcscf = g_strdupv((char **) pcscf);
}

void ofono_gprs_context_signal_change(struct ofono_gprs_context *gc,
unsigned int cid)
{
Expand Down

0 comments on commit c8dbf54

Please sign in to comment.