blob: 932d6bc05170f11c09b4c05e87141903e8351ad4 [file] [log] [blame]
/*
*
* Connection Manager
*
* Copyright (C) 2007-2009 Intel Corporation. All rights reserved.
*
* 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 __CONNMAN_DEVICE_H
#define __CONNMAN_DEVICE_H
#include <connman/types.h>
#include <connman/network.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* SECTION:device
* @title: Device primitives
* @short_description: Functions for handling devices
*/
enum connman_device_type {
CONNMAN_DEVICE_TYPE_UNKNOWN = 0,
CONNMAN_DEVICE_TYPE_ETHERNET = 1,
CONNMAN_DEVICE_TYPE_WIFI = 2,
CONNMAN_DEVICE_TYPE_WIMAX = 3,
CONNMAN_DEVICE_TYPE_BLUETOOTH = 4,
CONNMAN_DEVICE_TYPE_GPS = 5,
CONNMAN_DEVICE_TYPE_CELLULAR = 18,
CONNMAN_DEVICE_TYPE_VENDOR = 10000,
};
enum connman_device_mode {
CONNMAN_DEVICE_MODE_UNKNOWN = 0,
CONNMAN_DEVICE_MODE_NETWORK_SINGLE = 1,
CONNMAN_DEVICE_MODE_NETWORK_MULTIPLE = 2,
CONNMAN_DEVICE_MODE_TRANSPORT_IP = 3,
};
enum connman_device_cellular_family {
CONNMAN_DEVICE_CELLULAR_FAMILY_CDMA,
CONNMAN_DEVICE_CELLULAR_FAMILY_GSM
};
struct connman_device;
enum connman_ipconfig_type;
enum connman_element_error;
struct connman_device *connman_device_create(const char *node,
enum connman_device_type type);
struct connman_device *connman_device_ref(struct connman_device *device);
void connman_device_unref(struct connman_device *device);
enum connman_device_type connman_device_get_type(struct connman_device *device);
const char *connman_device_get_name(struct connman_device *device);
const char *connman_device_get_path(struct connman_device *device);
void connman_device_set_index(struct connman_device *device, int index);
int connman_device_get_index(struct connman_device *device);
const char *connman_device_get_interface(struct connman_device *device);
void connman_device_set_interface(struct connman_device *device,
const char *interface, const char *control);
const char *connman_device_get_control(struct connman_device *device);
void connman_device_set_ident(struct connman_device *device,
const char *ident);
void connman_device_set_mode(struct connman_device *device,
enum connman_device_mode mode);
enum connman_device_mode connman_device_get_mode(struct connman_device *device);
int connman_device_set_powered(struct connman_device *device,
connman_bool_t powered);
void connman_device_set_powered_failed(struct connman_device *device,
enum connman_element_error error);
int connman_device_set_carrier(struct connman_device *device,
connman_bool_t carrier);
struct connman_network_operator;
void connman_device_set_home_provider(struct connman_device *device,
struct connman_network_operator *op);
struct connman_network_operator *connman_device_get_home_provider(
struct connman_device *device);
void connman_device_set_scanning_supported(struct connman_device *device,
connman_bool_t supported);
void connman_device_flush_networks(struct connman_device *device);
int connman_device_set_scanning_state(struct connman_device *device,
connman_bool_t scanning);
int connman_device_set_scanning(struct connman_device *device,
connman_bool_t scanning);
int connman_device_set_disconnected(struct connman_device *device,
connman_bool_t disconnected);
connman_bool_t connman_device_get_disconnected(struct connman_device *device);
int connman_device_set_connected(struct connman_device *device,
connman_bool_t connected);
int connman_device_set_string(struct connman_device *device,
const char *key, const char *value);
const char *connman_device_get_string(struct connman_device *device,
const char *key);
void connman_device_set_prl_version(struct connman_device *device,
guint prl_version);
void connman_device_set_unlock_properties(struct connman_device *device,
const char *unlock_required,
guint unlock_retries,
gboolean lock_enabled);
void connman_device_set_cellular_family(struct connman_device *device,
enum connman_device_cellular_family family);
int connman_device_add_network(struct connman_device *device,
struct connman_network *network);
struct connman_network *connman_device_get_network(struct connman_device *device,
const char *identifier);
int connman_device_remove_network(struct connman_device *device,
const char *identifier);
struct connman_ipconfig *connman_device_add_ipconfig(struct connman_device *device,
enum connman_ipconfig_type type);
int connman_device_bgscan_get_short(const struct connman_device *device);
int connman_device_bgscan_get_long(const struct connman_device *device);
const char *connman_device_bgscan_get_method(const struct
connman_device *device);
int connman_device_bgscan_get_signal_threshold(const struct connman_device *);
int connman_device_scan(struct connman_device *device);
void connman_device_auto_connect(struct connman_device *device);
void connman_device_set_found_networks(struct connman_device *device,
GPtrArray *networks);
const char *connman_device_get_selected_network(struct connman_device *device);
void connman_device_clear_selected_network(struct connman_device *device);
void connman_device_set_apn_list(struct connman_device *device,
GPtrArray *apn_list);
void connman_device_set_provider_requires_roaming(struct connman_device *device,
connman_bool_t requires_roaming);
int connman_device_register(struct connman_device *device);
void connman_device_unregister(struct connman_device *device);
void *connman_device_get_data(struct connman_device *device);
void connman_device_set_data(struct connman_device *device, void *data);
connman_bool_t connman_device_roaming_allowed(struct connman_device *device);
void connman_device_rp_filter_disable(struct connman_device *device);
void connman_device_rp_filter_enable(struct connman_device *device);
struct connman_dbus_method_callback;
struct connman_device_driver {
const char *name;
enum connman_device_type type;
int priority;
int (*probe) (struct connman_device *device);
void (*remove) (struct connman_device *device);
int (*enable) (struct connman_device *device);
int (*disable) (struct connman_device *device);
int (*connect) (struct connman_device *device);
int (*disconnect) (struct connman_device *device);
int (*scan) (struct connman_device *device);
int (*join) (struct connman_device *device,
struct connman_network *network);
int (*require_pin) (struct connman_device *device,
const char *pin, connman_bool_t require,
struct connman_dbus_method_callback *cb);
int (*enter_pin) (struct connman_device *device,
const char *pin,
struct connman_dbus_method_callback *cb);
int (*unblock_pin) (struct connman_device *device,
const char *unblock_code, const char *pin,
struct connman_dbus_method_callback *cb);
int (*change_pin) (struct connman_device *device,
const char *old_pin, const char *new_pin,
struct connman_dbus_method_callback *cb);
int (*register_on_network) (struct connman_device *device,
const char *network_id,
struct connman_dbus_method_callback *cb);
};
int connman_device_driver_register(struct connman_device_driver *driver);
void connman_device_driver_unregister(struct connman_device_driver *driver);
#ifdef __cplusplus
}
#endif
#endif /* __CONNMAN_DEVICE_H */