@@ -144,7 +144,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h include/history.h \
include/audio-settings.h include/nettime.h \
include/ctm.h \
include/sim-auth.h \
- include/gprs-provision.h include/emulator.h \
+ include/emulator.h \
include/location-reporting.h \
include/gnss.h \
include/private-network.h \
deleted file mode 100644
@@ -1,49 +0,0 @@
-/*
- *
- * oFono - Open Telephony stack for Linux
- *
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
- *
- * 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
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef __OFONO_GPRS_PROVISION_H
-#define __OFONO_GPRS_PROVISION_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#include "gprs-context.h"
-
-struct ofono_gprs_provision_data {
- uint32_t type; /* Multiple types can be set in a bitmap */
- enum ofono_gprs_proto proto;
- char *name;
- char *apn;
- char *username;
- char *password;
- enum ofono_gprs_auth_method auth_method;
- char *message_proxy;
- char *message_center;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __OFONO_GPRS_PROVISION_H */
@@ -43,6 +43,7 @@
#include "ofono.h"
#include "common.h"
+#include "provisiondb.h"
#include "storage.h"
#include "simutil.h"
#include "util.h"
@@ -2371,7 +2372,7 @@ static DBusMessage *gprs_get_contexts(DBusConnection *conn,
return reply;
}
-static void provision_context(const struct ofono_gprs_provision_data *ap,
+static void provision_context(const struct provision_db_entry *ap,
struct ofono_gprs *gprs)
{
unsigned int id;
@@ -2463,7 +2464,7 @@ static void provision_context(const struct ofono_gprs_provision_data *ap,
static void provision_contexts(struct ofono_gprs *gprs, const char *mcc,
const char *mnc, const char *spn)
{
- struct ofono_gprs_provision_data *settings;
+ struct provision_db_entry *settings;
size_t count;
size_t i;
@@ -581,10 +581,10 @@ void __ofono_nettime_info_received(struct ofono_modem *modem,
#include <ofono/sim-auth.h>
-#include <ofono/gprs-provision.h>
+struct provision_db_entry;
bool __ofono_provision_get_settings(const char *mcc,
const char *mnc, const char *spn,
- struct ofono_gprs_provision_data **settings,
+ struct provision_db_entry **settings,
size_t *count);
#include <ofono/emulator.h>
@@ -11,6 +11,8 @@
#include <stddef.h>
+#include <ofono/gprs-context.h>
+
#include "provisiondb.h"
#include "ofono.h"
@@ -18,11 +20,11 @@ static struct provision_db *pdb;
bool __ofono_provision_get_settings(const char *mcc,
const char *mnc, const char *spn,
- struct ofono_gprs_provision_data **settings,
+ struct provision_db_entry **settings,
size_t *count)
{
size_t n_contexts;
- struct ofono_gprs_provision_data *contexts;
+ struct provision_db_entry *contexts;
int r;
size_t i;
uint32_t type;
@@ -38,7 +40,7 @@ bool __ofono_provision_get_settings(const char *mcc,
n_contexts, mcc, mnc, spn);
for (i = 0; i < n_contexts; i++) {
- struct ofono_gprs_provision_data *ap = contexts + i;
+ struct provision_db_entry *ap = contexts + i;
DBG("APN: %s, Type: %x, Proto: %x",
ap->apn, ap->type, ap->proto);
@@ -50,7 +52,7 @@ bool __ofono_provision_get_settings(const char *mcc,
/* Make sure there are no duplicates */
for (i = 0, type = 0; i < n_contexts; i++) {
- struct ofono_gprs_provision_data *ap = contexts + i;
+ struct provision_db_entry *ap = contexts + i;
if (type & ap->type) {
ofono_warn("Duplicate detected for %s%s, spn: %s",
@@ -21,8 +21,7 @@
#include <ell/ell.h>
#define OFONO_API_SUBJECT_TO_CHANGE
-#include <ofono/modem.h>
-#include <ofono/gprs-provision.h>
+#include <ofono/gprs-context.h>
#include "provisiondb.h"
@@ -205,7 +204,7 @@ static struct provision_data *__get_provision_data(struct node *node)
}
static int __get_string(struct provision_db *pdb, uint64_t offset,
- char **out_str)
+ const char **out_str)
{
if (!offset) {
*out_str = NULL;
@@ -220,13 +219,13 @@ static int __get_string(struct provision_db *pdb, uint64_t offset,
}
static int __get_contexts(struct provision_db *pdb, uint64_t offset,
- struct ofono_gprs_provision_data **contexts,
+ struct provision_db_entry **contexts,
size_t *n_contexts)
{
void *start = pdb->addr + pdb->contexts_offset;
uint64_t num;
uint64_t i;
- struct ofono_gprs_provision_data *ret;
+ struct provision_db_entry *ret;
int r;
if (offset + sizeof(__le64) >= pdb->contexts_size)
@@ -238,7 +237,7 @@ static int __get_contexts(struct provision_db *pdb, uint64_t offset,
if (offset + num * sizeof(struct context) > pdb->contexts_size)
return -EPROTO;
- ret = l_new(struct ofono_gprs_provision_data, num);
+ ret = l_new(struct provision_db_entry, num);
for (i = 0; i < num; i++, offset += sizeof(struct context)) {
struct context *context = start + offset;
@@ -375,8 +374,7 @@ static int key_from_mcc_mnc(const char *mcc, const char *mnc, uint32_t *key)
int provision_db_lookup(struct provision_db *pdb,
const char *mcc, const char *mnc, const char *match_spn,
- struct ofono_gprs_provision_data **items,
- size_t *n_items)
+ struct provision_db_entry **items, size_t *n_items)
{
int r;
uint32_t key;
@@ -422,7 +420,7 @@ int provision_db_lookup(struct provision_db *pdb,
}
for (i = 0; i < count; i++) {
- char *spn;
+ const char *spn;
r = __get_string(pdb, L_LE64_TO_CPU(data[i].spn_offset), &spn);
if (r < 0)
@@ -5,14 +5,27 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-struct ofono_gprs_provision_data;
+#include <stdint.h>
+
struct provision_db;
+struct provision_db_entry {
+ uint32_t type; /* Multiple types can be set in a bitmap */
+ enum ofono_gprs_proto proto;
+ const char *name;
+ const char *apn;
+ const char *username;
+ const char *password;
+ enum ofono_gprs_auth_method auth_method;
+ const char *message_proxy;
+ const char *message_center;
+};
+
struct provision_db *provision_db_new(const char *pathname);
struct provision_db *provision_db_new_default(void);
void provision_db_free(struct provision_db *pdb);
int provision_db_lookup(struct provision_db *pdb,
const char *mcc, const char *mnc, const char *spn,
- struct ofono_gprs_provision_data **items,
+ struct provision_db_entry **items,
size_t *n_items);
@@ -18,8 +18,8 @@
#include <ell/ell.h>
#define OFONO_API_SUBJECT_TO_CHANGE
-#include <ofono/modem.h>
-#include <ofono/gprs-provision.h>
+#include <ofono/types.h>
+#include <ofono/gprs-context.h>
#include "provisiondb.h"
@@ -29,7 +29,7 @@ static int lookup_apn(const char *match_mcc, const char *match_mnc,
const char *match_spn)
{
struct provision_db *pdb;
- struct ofono_gprs_provision_data *contexts;
+ struct provision_db_entry *contexts;
size_t n_contexts;
int r;
size_t i;
@@ -58,7 +58,7 @@ static int lookup_apn(const char *match_mcc, const char *match_mnc,
}
for (i = 0; i < n_contexts; i++) {
- struct ofono_gprs_provision_data *ap = contexts + i;
+ struct provision_db_entry *ap = contexts + i;
fprintf(stdout, "\nName: %s\n", ap->name);
fprintf(stdout, "APN: %s\n", ap->apn);