mirror of git://git.sysmocom.de/ofono
Clean-up in sim.c.
This commit is contained in:
parent
983d16ca37
commit
da0bdb1cbf
|
@ -89,7 +89,7 @@ static void registration_status_callback(const struct ofono_error *error,
|
|||
struct network_operator_data {
|
||||
struct ofono_network_operator *info;
|
||||
struct ofono_modem *modem;
|
||||
struct sim_eons_operator_info *eons_info;
|
||||
const struct sim_eons_operator_info *eons_info;
|
||||
};
|
||||
|
||||
static inline const char *network_operator_status_to_string(int status)
|
||||
|
@ -425,11 +425,11 @@ static void set_network_operator_name(struct ofono_modem *modem,
|
|||
|
||||
static void set_network_operator_eons_info(struct ofono_modem *modem,
|
||||
struct network_operator_data *opd,
|
||||
struct sim_eons_operator_info *eons_info)
|
||||
const struct sim_eons_operator_info *eons_info)
|
||||
{
|
||||
struct network_registration_data *netreg = modem->network_registration;
|
||||
DBusConnection *conn = dbus_gsm_connection();
|
||||
struct sim_eons_operator_info *old_eons_info = opd->eons_info;
|
||||
const struct sim_eons_operator_info *old_eons_info = opd->eons_info;
|
||||
const char *path;
|
||||
const char *oldname;
|
||||
const char *newname;
|
||||
|
@ -1220,7 +1220,7 @@ static void sim_opl_read_cb(struct ofono_modem *modem, int ok,
|
|||
|
||||
for (l = netreg->operator_list; l; l = l->next) {
|
||||
struct network_operator_data *opd = l->data;
|
||||
struct sim_eons_operator_info *eons_info;
|
||||
const struct sim_eons_operator_info *eons_info;
|
||||
|
||||
eons_info = sim_eons_lookup(netreg->eons, opd->info->mcc,
|
||||
opd->info->mnc);
|
||||
|
|
26
src/sim.c
26
src/sim.c
|
@ -65,13 +65,6 @@ struct sim_manager_data {
|
|||
GSList *ready_notify;
|
||||
gboolean ready;
|
||||
GQueue *simop_q;
|
||||
|
||||
GSList *spdi;
|
||||
|
||||
GSList *opl;
|
||||
int opl_num;
|
||||
int opl_size;
|
||||
int opl_current;
|
||||
};
|
||||
|
||||
static char **get_own_numbers(GSList *own_numbers)
|
||||
|
@ -127,18 +120,6 @@ static void sim_manager_destroy(gpointer userdata)
|
|||
g_queue_free(data->simop_q);
|
||||
data->simop_q = NULL;
|
||||
}
|
||||
|
||||
if (data->spdi) {
|
||||
g_slist_foreach(data->spdi, (GFunc)g_free, NULL);
|
||||
g_slist_free(data->spdi);
|
||||
data->spdi = NULL;
|
||||
}
|
||||
|
||||
if (data->opl) {
|
||||
g_slist_foreach(data->opl, (GFunc)g_free, NULL);
|
||||
g_slist_free(data->opl);
|
||||
data->opl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static DBusMessage *sim_get_properties(DBusConnection *conn,
|
||||
|
@ -181,7 +162,10 @@ static GDBusMethodTable sim_manager_methods[] = {
|
|||
{ }
|
||||
};
|
||||
|
||||
static GDBusSignalTable sim_manager_signals[] = { { } };
|
||||
static GDBusSignalTable sim_manager_signals[] = {
|
||||
{ "PropertyChanged", "sv" },
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
static void sim_msisdn_read_cb(struct ofono_modem *modem, int ok,
|
||||
|
@ -202,7 +186,7 @@ static void sim_msisdn_read_cb(struct ofono_modem *modem, int ok,
|
|||
if (structure != OFONO_SIM_FILE_STRUCTURE_FIXED)
|
||||
return;
|
||||
|
||||
if (length < 14 || record_length < 14 || length < record_length)
|
||||
if (record_length < 14 || length < record_length)
|
||||
return;
|
||||
|
||||
total = length / record_length;
|
||||
|
|
|
@ -32,6 +32,13 @@
|
|||
#include "util.h"
|
||||
#include "smsutil.h"
|
||||
|
||||
struct sim_eons {
|
||||
struct sim_eons_operator_info *pnn_list;
|
||||
GSList *opl_list;
|
||||
gboolean pnn_valid;
|
||||
int pnn_max;
|
||||
};
|
||||
|
||||
struct spdi_operator {
|
||||
char mcc[OFONO_MAX_MCC_LENGTH + 1];
|
||||
char mnc[OFONO_MAX_MNC_LENGTH + 1];
|
||||
|
@ -171,6 +178,10 @@ static gint spdi_operator_compare(gconstpointer a, gconstpointer b)
|
|||
return strcmp(opa->mnc, opb->mnc);
|
||||
}
|
||||
|
||||
struct sim_spdi {
|
||||
GSList *operators;
|
||||
};
|
||||
|
||||
struct sim_spdi *sim_spdi_new(const guint8 *tlv, int length)
|
||||
{
|
||||
const guint8 *plmn_list;
|
||||
|
@ -290,11 +301,11 @@ static struct opl_operator *opl_operator_alloc(const guint8 *record)
|
|||
}
|
||||
|
||||
void sim_eons_add_opl_record(struct sim_eons *eons,
|
||||
const guint8 *tlv, int length)
|
||||
const guint8 *contents, int length)
|
||||
{
|
||||
struct opl_operator *oper;
|
||||
|
||||
oper = opl_operator_alloc(tlv);
|
||||
oper = opl_operator_alloc(contents);
|
||||
|
||||
if (oper->id > eons->pnn_max) {
|
||||
g_free(oper);
|
||||
|
@ -324,7 +335,7 @@ void sim_eons_free(struct sim_eons *eons)
|
|||
g_free(eons);
|
||||
}
|
||||
|
||||
static struct sim_eons_operator_info *
|
||||
static const struct sim_eons_operator_info *
|
||||
sim_eons_lookup_common(struct sim_eons *eons,
|
||||
const char *mcc, const char *mnc,
|
||||
gboolean have_lac, guint16 lac)
|
||||
|
@ -372,14 +383,15 @@ static struct sim_eons_operator_info *
|
|||
return &eons->pnn_list[opl->id - 1];
|
||||
}
|
||||
|
||||
struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
|
||||
const struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
|
||||
const char *mcc,
|
||||
const char *mnc)
|
||||
{
|
||||
return sim_eons_lookup_common(eons, mcc, mnc, FALSE, 0);
|
||||
}
|
||||
|
||||
struct sim_eons_operator_info *sim_eons_lookup_with_lac(struct sim_eons *eons,
|
||||
const struct sim_eons_operator_info *sim_eons_lookup_with_lac(
|
||||
struct sim_eons *eons,
|
||||
const char *mcc,
|
||||
const char *mnc,
|
||||
guint16 lac)
|
||||
|
|
|
@ -30,10 +30,6 @@ enum sim_fileid {
|
|||
#define SIM_EFSPN_DC_HOME_PLMN_BIT 0x1
|
||||
#define SIM_EFSPN_DC_ROAMING_SPN_BIT 0x2
|
||||
|
||||
struct sim_spdi {
|
||||
GSList *operators;
|
||||
};
|
||||
|
||||
struct sim_eons_operator_info {
|
||||
char *longname;
|
||||
gboolean long_ci;
|
||||
|
@ -42,25 +38,19 @@ struct sim_eons_operator_info {
|
|||
char *info;
|
||||
};
|
||||
|
||||
struct sim_eons {
|
||||
struct sim_eons_operator_info *pnn_list;
|
||||
GSList *opl_list;
|
||||
gboolean pnn_valid;
|
||||
int pnn_max;
|
||||
};
|
||||
|
||||
struct sim_eons *sim_eons_new(int pnn_records);
|
||||
void sim_eons_add_pnn_record(struct sim_eons *eons, int record,
|
||||
const guint8 *tlv, int length);
|
||||
gboolean sim_eons_pnn_is_empty(struct sim_eons *eons);
|
||||
void sim_eons_add_opl_record(struct sim_eons *eons,
|
||||
const guint8 *tlv, int length);
|
||||
const guint8 *contents, int length);
|
||||
void sim_eons_optimize(struct sim_eons *eons);
|
||||
struct sim_eons_operator_info *sim_eons_lookup_with_lac(struct sim_eons *eons,
|
||||
const char *mcc,
|
||||
const char *mnc,
|
||||
guint16 lac);
|
||||
struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
|
||||
const struct sim_eons_operator_info *sim_eons_lookup_with_lac(
|
||||
struct sim_eons *eons,
|
||||
const char *mcc,
|
||||
const char *mnc,
|
||||
guint16 lac);
|
||||
const struct sim_eons_operator_info *sim_eons_lookup(struct sim_eons *eons,
|
||||
const char *mcc,
|
||||
const char *mnc);
|
||||
void sim_eons_free(struct sim_eons *eons);
|
||||
|
|
Loading…
Reference in New Issue