Skip to content

Commit

Permalink
[ril] Keep track of P-CSCF address. JB#48905
Browse files Browse the repository at this point in the history
And use IMS data profile for IMS data calls.
  • Loading branch information
monich committed Apr 23, 2021
1 parent bd836b4 commit 07e07b6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
44 changes: 31 additions & 13 deletions ofono/drivers/ril/ril_data.c
Expand Up @@ -243,6 +243,7 @@ struct ril_data_call *ril_data_call_dup(const struct ril_data_call *call)
dc->dnses = g_strdupv(call->dnses);
dc->gateways = g_strdupv(call->gateways);
dc->addresses = g_strdupv(call->addresses);
dc->pcscf = g_strdupv(call->pcscf);
return dc;
} else {
return NULL;
Expand All @@ -253,8 +254,9 @@ static void ril_data_call_destroy(struct ril_data_call *call)
{
g_free(call->ifname);
g_strfreev(call->dnses);
g_strfreev(call->addresses);
g_strfreev(call->gateways);
g_strfreev(call->addresses);
g_strfreev(call->pcscf);
}

void ril_data_call_free(struct ril_data_call *call)
Expand Down Expand Up @@ -322,8 +324,7 @@ static gboolean ril_data_call_parse_default(struct ril_data_call *call,

/* RIL_Data_Call_Response_v9 */
if (version >= 9) {
/* PCSCF */
grilio_parser_skip_string(rilp);
call->pcscf = grilio_parser_split_utf8(rilp, " ");

/* RIL_Data_Call_Response_v11 */
if (version >= 11) {
Expand Down Expand Up @@ -354,16 +355,19 @@ static struct ril_data_call *ril_data_call_parse(struct ril_vendor *vendor,

if (parsed) {
DBG("[status=%d,retry=%d,cid=%d,active=%d,type=%s,ifname=%s,"
"mtu=%d,address=%s,dns=%s %s,gateways=%s]",
"mtu=%d,address=%s,dns=%s %s,gateways=%s,pcscf=%s %s]",
call->status, call->retry_time,
call->cid, call->active,
ril_protocol_from_ofono(call->prot),
call->ifname, call->mtu,
call->addresses ? call->addresses[0] : NULL,
call->dnses ? call->dnses[0] : NULL,
call->addresses ? call->addresses[0] : "",
call->dnses ? call->dnses[0] : "",
(call->dnses && call->dnses[0] &&
call->dnses[1]) ? call->dnses[1] : "",
call->gateways ? call->gateways[0] : NULL);
call->gateways ? call->gateways[0] : "",
call->pcscf ? call->pcscf[0] : "",
(call->pcscf && call->pcscf[0] &&
call->pcscf[1]) ? call->pcscf[1] : "");
return call;
} else {
ril_data_call_free(call);
Expand Down Expand Up @@ -429,7 +433,8 @@ static gboolean ril_data_call_equal(const struct ril_data_call *c1,
!g_strcmp0(c1->ifname, c2->ifname) &&
gutil_strv_equal(c1->dnses, c2->dnses) &&
gutil_strv_equal(c1->gateways, c2->gateways) &&
gutil_strv_equal(c1->addresses, c2->addresses);
gutil_strv_equal(c1->addresses, c2->addresses) &&
gutil_strv_equal(c1->pcscf, c2->pcscf);
} else {
return FALSE;
}
Expand Down Expand Up @@ -951,7 +956,8 @@ static gboolean ril_data_call_setup_submit(struct ril_data_request *req)
*
* Makes little sense but it is what it is.
*/
tech = priv->network->data.ril_tech;
tech = (setup->profile_id == RIL_DATA_PROFILE_IMS) ?
RADIO_TECH_LTE : priv->network->data.ril_tech;
if (tech > 2) {
tech += 2;
} else {
Expand Down Expand Up @@ -1014,10 +1020,22 @@ static struct ril_data_request *ril_data_call_setup_new(struct ril_data *data,
g_new0(struct ril_data_request_setup, 1);
struct ril_data_request *req = &setup->req;

setup->profile_id = (priv->use_data_profiles &&
context_type == OFONO_GPRS_CONTEXT_TYPE_MMS) ?
priv->mms_data_profile_id :
RIL_DATA_PROFILE_DEFAULT;
setup->profile_id = RIL_DATA_PROFILE_DEFAULT;
if (priv->use_data_profiles) {
switch (context_type) {
case OFONO_GPRS_CONTEXT_TYPE_MMS:
setup->profile_id = priv->mms_data_profile_id;
break;
case OFONO_GPRS_CONTEXT_TYPE_IMS:
setup->profile_id = RIL_DATA_PROFILE_IMS;
break;
case OFONO_GPRS_CONTEXT_TYPE_ANY:
case OFONO_GPRS_CONTEXT_TYPE_INTERNET:
case OFONO_GPRS_CONTEXT_TYPE_WAP:
break;
}
}

setup->apn = g_strdup(ctx->apn);
setup->username = g_strdup(ctx->username);
setup->password = g_strdup(ctx->password);
Expand Down
3 changes: 2 additions & 1 deletion ofono/drivers/ril/ril_data.h
@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony - RIL-based devices
*
* Copyright (C) 2016-2020 Jolla Ltd.
* Copyright (C) 2016-2021 Jolla Ltd.
* Copyright (C) 2019 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -40,6 +40,7 @@ struct ril_data_call {
char **dnses;
char **gateways;
char **addresses;
char **pcscf;
};

struct ril_data_call_list {
Expand Down
13 changes: 11 additions & 2 deletions ofono/drivers/ril/ril_network.c
@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony - RIL-based devices
*
* Copyright (C) 2015-2020 Jolla Ltd.
* Copyright (C) 2015-2021 Jolla Ltd.
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -696,7 +696,7 @@ struct ril_network_data_profile *ril_network_data_profile_new
ptr += G_ALIGN8(sizeof(*profile));

profile->profile_id = profile_id;
profile->type = RIL_PROFILE_3GPP;
profile->type = RIL_PROFILE_COMMON;
profile->auth_method = auth_method;
profile->proto = context->proto;
profile->enabled = TRUE;
Expand Down Expand Up @@ -825,6 +825,9 @@ static void ril_network_check_data_profiles(struct ril_network *self)
const struct ofono_gprs_primary_context* mms =
ofono_gprs_context_settings_by_type(gprs,
OFONO_GPRS_CONTEXT_TYPE_MMS);
const struct ofono_gprs_primary_context* ims =
ofono_gprs_context_settings_by_type(gprs,
OFONO_GPRS_CONTEXT_TYPE_IMS);
GSList *l = NULL;

if (internet) {
Expand All @@ -840,6 +843,12 @@ static void ril_network_check_data_profiles(struct ril_network *self)
ril_network_data_profile_new(mms,
priv->mms_data_profile_id));
}
if (ims) {
DBG_(self, "ims apn \"%s\"", ims->apn);
l = g_slist_append(l,
ril_network_data_profile_new(ims,
RIL_DATA_PROFILE_IMS));
}

if (ril_network_data_profiles_equal(priv->data_profiles, l)) {
ril_network_data_profiles_free(l);
Expand Down

0 comments on commit 07e07b6

Please sign in to comment.