blob: ce81942b1992e96bc89b9842d60c9565e34ecfad [file] [log] [blame]
/*
* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __MOBILE_PROVIDER_H
#define __MOBILE_PROVIDER_H
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif
struct localized_name {
gchar *name;
gchar *lang;
};
struct mobile_apn {
gchar *value;
int num_names;
struct localized_name **names;
gchar *username;
gchar *password;
};
struct mobile_provider
{
/*
* the "next" field links providers with
* same name in different countries
*/
struct mobile_provider *next;
gchar country[3];
gchar **networks;
int num_names;
struct localized_name **names;
int num_apns;
struct mobile_apn **apns;
int refcnt;
gboolean primary;
};
struct mobile_provider_db;
typedef void (*ProviderIterFunc)(struct mobile_provider *);
typedef void (*NetworkIterFunc)(gchar *, struct mobile_provider *);
struct mobile_provider_db *mobile_provider_open_db(const gchar *pathname);
void mobile_provider_close_db(struct mobile_provider_db *db);
struct mobile_provider *mobile_provider_lookup_by_name(
const struct mobile_provider_db *db,
const gchar *provider_name);
struct mobile_provider *mobile_provider_lookup_by_network(
const struct mobile_provider_db *db,
const gchar *network_id);
struct mobile_provider *mobile_provider_lookup_best_match(
const struct mobile_provider_db *db,
const gchar *provider_name,
const gchar *network_id);
const gchar *mobile_provider_get_name(struct mobile_provider *provider);
void mobile_provider_foreach_provider(
const struct mobile_provider_db *db,
ProviderIterFunc func);
void mobile_provider_foreach_network(
const struct mobile_provider_db *db,
NetworkIterFunc func);
#ifdef __cplusplus
}
#endif
#endif /* __MOBILE_PROVIDER_H */