diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-08-29 23:51:00 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-08-29 23:51:00 +0200 |
commit | 41708dccb5d831adaf0862da9c1d7fe3c197db3c (patch) | |
tree | ca7b5d1e137becfed48de5609021c337459fdea8 | |
parent | 72994f35faec1a0b8f1f3d2a348f2f70d3611728 (diff) | |
parent | fe8e6804983fd09a3293c5d7ae9a64e03cbc80e0 (diff) |
Merge branch 'for-upstream' of git://gitorious.org/bluez/cktakahasis-clone
-rw-r--r-- | src/adapter.c | 35 | ||||
-rw-r--r-- | src/adapter.h | 4 | ||||
-rw-r--r-- | src/agent.c | 1 | ||||
-rw-r--r-- | src/dbus-common.c | 2 | ||||
-rw-r--r-- | src/dbus-hci.c | 1 | ||||
-rw-r--r-- | src/device.c | 101 | ||||
-rw-r--r-- | src/hcid.h | 58 | ||||
-rw-r--r-- | src/main.c | 33 | ||||
-rw-r--r-- | src/manager.c | 55 | ||||
-rw-r--r-- | src/security.c | 3 | ||||
-rw-r--r-- | src/storage.c | 47 | ||||
-rw-r--r-- | src/storage.h | 61 |
12 files changed, 159 insertions, 242 deletions
diff --git a/src/adapter.c b/src/adapter.c index 16d03958..afd909ba 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -45,21 +45,21 @@ #include <dbus/dbus.h> #include <gdbus.h> +#include "logging.h" +#include "textfile.h" + #include "hcid.h" #include "sdpd.h" - #include "manager.h" #include "adapter.h" #include "device.h" - -#include "textfile.h" #include "dbus-common.h" #include "dbus-hci.h" #include "dbus-database.h" #include "error.h" #include "glib-helper.h" -#include "logging.h" #include "agent.h" +#include "storage.h" #define NUM_ELEMENTS(table) (sizeof(table)/sizeof(const char *)) @@ -331,7 +331,7 @@ static struct bonding_request_info *bonding_request_new(DBusConnection *conn, return bonding; } -const char *mode2str(uint8_t mode) +static const char *mode2str(uint8_t mode) { switch(mode) { case MODE_OFF: @@ -347,20 +347,7 @@ const char *mode2str(uint8_t mode) } } -static uint8_t on_mode(const char *addr) -{ - char mode[14]; - bdaddr_t sba; - - str2ba(addr, &sba); - - if (read_on_mode(&sba, mode, sizeof(mode)) < 0) - return MODE_CONNECTABLE; - - return str2mode(addr, mode); -} - -uint8_t str2mode(const char *addr, const char *mode) +static uint8_t str2mode(const char *addr, const char *mode) { if (strcasecmp("off", mode) == 0) return MODE_OFF; @@ -370,9 +357,13 @@ uint8_t str2mode(const char *addr, const char *mode) return MODE_DISCOVERABLE; else if (strcasecmp("limited", mode) == 0) return MODE_LIMITED; - else if (strcasecmp("on", mode) == 0) - return on_mode(addr); - else + else if (strcasecmp("on", mode) == 0) { + char onmode[14]; + if (read_on_mode(addr, onmode, sizeof(onmode)) < 0) + return MODE_CONNECTABLE; + + return str2mode(addr, onmode); + } else return MODE_UNKNOWN; } diff --git a/src/adapter.h b/src/adapter.h index 7d6ca9cb..b39fcd03 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -145,10 +145,6 @@ void adapter_remove_device(DBusConnection *conn, struct adapter *adapter, struct btd_device *adapter_create_device(DBusConnection *conn, struct adapter *adapter, const char *address); -const char *mode2str(uint8_t mode); - -uint8_t str2mode(const char *addr, const char *mode); - int pending_remote_name_cancel(struct adapter *adapter); void remove_pending_device(struct adapter *adapter); diff --git a/src/agent.c b/src/agent.c index dc95be65..9870cb10 100644 --- a/src/agent.c +++ b/src/agent.c @@ -35,6 +35,7 @@ #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> +#include <bluetooth/sdp.h> #include <glib.h> #include <dbus/dbus.h> diff --git a/src/dbus-common.c b/src/dbus-common.c index 1ef69308..c7853d29 100644 --- a/src/dbus-common.c +++ b/src/dbus-common.c @@ -36,6 +36,7 @@ #include <sys/ioctl.h> #include <bluetooth/bluetooth.h> +#include <bluetooth/hci.h> #include <bluetooth/l2cap.h> #include <glib.h> @@ -44,7 +45,6 @@ #include "logging.h" -#include "hcid.h" #include "manager.h" #include "adapter.h" #include "dbus-hci.h" diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 4141b691..e4c0f345 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -56,6 +56,7 @@ #include "glib-helper.h" #include "dbus-common.h" #include "agent.h" +#include "storage.h" static DBusConnection *connection = NULL; diff --git a/src/device.c b/src/device.c index 3c75cedf..b41c6ff5 100644 --- a/src/device.c +++ b/src/device.c @@ -41,11 +41,10 @@ #include <dbus/dbus.h> #include <gdbus.h> -#include "hcid.h" - #include "logging.h" #include "textfile.h" +#include "hcid.h" #include "adapter.h" #include "device.h" #include "dbus-common.h" @@ -54,6 +53,7 @@ #include "glib-helper.h" #include "agent.h" #include "sdp-xml.h" +#include "storage.h" #define DEFAULT_XML_BUF_SIZE 1024 #define DISCONNECT_TIMER 2 @@ -136,16 +136,6 @@ static gboolean device_is_paired(struct btd_device *device) return ret; } -static char *device_get_name(struct btd_device *device) -{ - struct adapter *adapter = device->adapter; - char filename[PATH_MAX + 1]; - const gchar *source = adapter_get_address(adapter); - - create_name(filename, PATH_MAX, STORAGEDIR, source, "names"); - return textfile_caseget(filename, device->address); -} - static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg, void *user_data) { @@ -155,16 +145,13 @@ static DBusMessage *get_properties(DBusConnection *conn, DBusMessageIter iter; DBusMessageIter dict; bdaddr_t src, dst; - char path[MAX_PATH_LENGTH]; - char buf[64]; - const char *ptr; - char *name, *ppath, **uuids; + char name[248]; + char **uuids; + const char *ptr, *source; dbus_bool_t boolean; uint32_t class; int i; GSList *l; - uint16_t dev_id = adapter_get_dev_id(adapter); - const gchar *source = adapter_get_address(adapter); reply = dbus_message_new_method_return(msg); if (!reply) @@ -182,12 +169,24 @@ static DBusMessage *get_properties(DBusConnection *conn, &device->address); /* Name */ - name = device_get_name(device); - if (name) { + ptr = NULL; + memset(name, 0, sizeof(name)); + source = adapter_get_address(adapter); + + if (read_device_name(source, device->address, name) == 0) { + ptr = name; dbus_message_iter_append_dict_entry(&dict, "Name", - DBUS_TYPE_STRING, &name); + DBUS_TYPE_STRING, &ptr); } + if (read_device_alias(source, device->address, name, sizeof(name)) > 0) + ptr = name; + + /* Alias: use Name if Alias doesn't exist */ + if (ptr) + dbus_message_iter_append_dict_entry(&dict, "Alias", + DBUS_TYPE_STRING, &ptr); + str2ba(source, &src); str2ba(device->address, &dst); @@ -197,17 +196,6 @@ static DBusMessage *get_properties(DBusConnection *conn, DBUS_TYPE_UINT32, &class); } - /* Alias */ - if (get_device_alias(dev_id, &dst, buf, sizeof(buf)) > 0) { - ptr = buf; - dbus_message_iter_append_dict_entry(&dict, "Alias", - DBUS_TYPE_STRING, &ptr); - } else if (name) { - dbus_message_iter_append_dict_entry(&dict, "Alias", - DBUS_TYPE_STRING, &name); - free(name); - } - /* Paired */ boolean = device_is_paired(device); dbus_message_iter_append_dict_entry(&dict, "Paired", @@ -237,60 +225,34 @@ static DBusMessage *get_properties(DBusConnection *conn, g_free(uuids); /* Adapter */ - snprintf(path, sizeof(path), "%s/hci%d", "/org/bluez", dev_id); - ppath = path; + ptr = adapter_get_path(adapter); dbus_message_iter_append_dict_entry(&dict, "Adapter", - DBUS_TYPE_OBJECT_PATH, &ppath); + DBUS_TYPE_OBJECT_PATH, &ptr); dbus_message_iter_close_container(&iter, &dict); return reply; } -static int remove_device_alias(const char *source, const char *destination) -{ - char filename[PATH_MAX + 1]; - - create_name(filename, PATH_MAX, STORAGEDIR, source, "aliases"); - create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - - return textfile_del(filename, destination); -} - static DBusMessage *set_alias(DBusConnection *conn, DBusMessage *msg, const char *alias, void *data) { struct btd_device *device = data; struct adapter *adapter = device->adapter; - bdaddr_t bdaddr; - int ecode; - char *str, filename[PATH_MAX + 1]; - uint16_t dev_id = adapter_get_dev_id(adapter); const gchar *source = adapter_get_address(adapter); - - str2ba(device->address, &bdaddr); + int err; /* Remove alias if empty string */ - if (g_str_equal(alias, "")) { - create_name(filename, PATH_MAX, STORAGEDIR, source, - "names"); - str = textfile_caseget(filename, device->address); - ecode = remove_device_alias(source, device->address); - } else { - str = g_strdup(alias); - ecode = set_device_alias(dev_id, &bdaddr, alias); - } - - if (ecode < 0) + err = write_device_alias(source, device->address, + g_str_equal(alias, "") ? NULL : alias); + if (err < 0) return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed", - strerror(-ecode)); + strerror(-err)); dbus_connection_emit_property_changed(conn, dbus_message_get_path(msg), DEVICE_INTERFACE, "Alias", - DBUS_TYPE_STRING, &str); - - g_free(str); + DBUS_TYPE_STRING, &alias); return dbus_message_new_method_return(msg); } @@ -300,12 +262,9 @@ static DBusMessage *set_trust(DBusConnection *conn, DBusMessage *msg, { struct btd_device *device = data; struct adapter *adapter = device->adapter; - bdaddr_t local; const gchar *source = adapter_get_address(adapter); - str2ba(source, &local); - - write_trust(&local, device->address, GLOBAL_TRUST, value); + write_trust(source, device->address, GLOBAL_TRUST, value); dbus_connection_emit_property_changed(conn, dbus_message_get_path(msg), DEVICE_INTERFACE, "Trusted", @@ -350,7 +309,7 @@ static DBusMessage *set_property(DBusConnection *conn, return set_trust(conn, msg, value, data); } else if (g_str_equal("Alias", property)) { - char *alias; + const char *alias; if (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_STRING) return invalid_args(msg); @@ -23,27 +23,11 @@ * */ -#include <bluetooth/bluetooth.h> -#include <bluetooth/sdp.h> -#include <bluetooth/hci.h> - #define HCID_DEFAULT_DISCOVERABLE_TIMEOUT 180 /* 3 minutes */ /* When all services should trust a remote device */ #define GLOBAL_TRUST "[all]" -enum { - HCID_SET_NAME, - HCID_SET_CLASS, - HCID_SET_VOICE, - HCID_SET_INQMODE, - HCID_SET_PAGETO, - HCID_SET_DISCOVTO, - HCID_SET_PTYPE, - HCID_SET_LM, - HCID_SET_LP, -}; - /* * Scanning modes, used by DEV_SET_MODE * off: remote devices are not allowed to find or connect to this device @@ -108,48 +92,8 @@ void stop_security_manager(int hdev); void set_pin_length(bdaddr_t *sba, int length); -int get_device_alias(uint16_t dev_id, const bdaddr_t *bdaddr, char *alias, size_t size); -int set_device_alias(uint16_t dev_id, const bdaddr_t *bdaddr, const char *alias); - -int get_encryption_key_size(uint16_t dev_id, const bdaddr_t *baddr); - -int write_discoverable_timeout(bdaddr_t *bdaddr, int timeout); -int read_discoverable_timeout(bdaddr_t *bdaddr, int *timeout); -int write_device_mode(bdaddr_t *bdaddr, const char *mode); -int read_device_mode(bdaddr_t *bdaddr, char *mode, int length); -int read_on_mode(bdaddr_t *bdaddr, char *mode, int length); -int write_local_name(bdaddr_t *bdaddr, char *name); -int read_local_name(bdaddr_t *bdaddr, char *name); -int write_local_class(bdaddr_t *bdaddr, uint8_t *class); -int read_local_class(bdaddr_t *bdaddr, uint8_t *class); -int write_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class); -int read_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t *class); -int write_device_name(bdaddr_t *local, bdaddr_t *peer, char *name); -int read_device_name(bdaddr_t *local, bdaddr_t *peer, char *name); -int write_remote_eir(bdaddr_t *local, bdaddr_t *peer, uint8_t *data); -int write_l2cap_info(bdaddr_t *local, bdaddr_t *peer, - uint16_t mtu_result, uint16_t mtu, - uint16_t mask_result, uint32_t mask); -int read_l2cap_info(bdaddr_t *local, bdaddr_t *peer, - uint16_t *mtu_result, uint16_t *mtu, - uint16_t *mask_result, uint32_t *mask); -int write_version_info(bdaddr_t *local, bdaddr_t *peer, uint16_t manufacturer, uint8_t lmp_ver, uint16_t lmp_subver); -int write_features_info(bdaddr_t *local, bdaddr_t *peer, unsigned char *features); -int write_lastseen_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm); -int write_lastused_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm); -int write_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, uint8_t type, int length); -int read_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, uint8_t *type); -int read_pin_length(bdaddr_t *local, bdaddr_t *peer); -int read_pin_code(bdaddr_t *local, bdaddr_t *peer, char *pin); -gboolean read_trust(const bdaddr_t *local, const char *addr, const char *service); -int write_trust(bdaddr_t *local, const char *addr, const char *service, gboolean trust); -GSList *list_trusts(bdaddr_t *local, const char *service); -int write_device_profiles(bdaddr_t *src, bdaddr_t *dst, const char *profiles); -int delete_entry(bdaddr_t *src, const char *storage, const char *key); -int store_record(const gchar *src, const gchar *dst, sdp_record_t *rec); -sdp_record_t *fetch_record(const gchar *src, const gchar *dst, const uint32_t handle); -int delete_record(const gchar *src, const gchar *dst, const uint32_t handle); gboolean plugin_init(GKeyFile *config); void plugin_cleanup(void); + void __probe_servers(const char *adapter); void __remove_servers(const char *adapter); @@ -53,11 +53,20 @@ #include "hcid.h" #include "sdpd.h" #include "adapter.h" -#include "dbus-common.h" -#include "dbus-database.h" #include "dbus-hci.h" +#include "dbus-common.h" #include "agent.h" #include "manager.h" +#include "storage.h" + +enum { + HCID_SET_NAME, + HCID_SET_CLASS, + HCID_SET_PAGETO, + HCID_SET_DISCOVTO, + HCID_SET_LM, + HCID_SET_LP, +}; struct hcid_opts hcid; struct device_opts default_device; @@ -325,7 +334,7 @@ no_address: return device_opts->discovto; } -void update_service_classes(const bdaddr_t *bdaddr, uint8_t value) +static void update_service_classes(const bdaddr_t *bdaddr, uint8_t value) { struct hci_dev_list_req *dl; struct hci_dev_req *dr; @@ -536,15 +545,6 @@ static void configure_device(int dev_id) memset(&dr, 0, sizeof(dr)); dr.dev_id = dev_id; - /* Set packet type */ - if ((device_opts->flags & (1 << HCID_SET_PTYPE))) { - dr.dev_opt = device_opts->pkt_type; - if (ioctl(dd, HCISETPTYPE, (unsigned long) &dr) < 0) { - error("Can't set packet type on hci%d: %s (%d)", - dev_id, strerror(errno), errno); - } - } - /* Set link mode */ if ((device_opts->flags & (1 << HCID_SET_LM))) { dr.dev_opt = device_opts->link_mode; @@ -605,15 +605,6 @@ static void configure_device(int dev_id) WRITE_PAGE_TIMEOUT_CP_SIZE, &cp); } - /* Set voice setting */ - if ((device_opts->flags & (1 << HCID_SET_VOICE))) { - write_voice_setting_cp cp; - - cp.voice_setting = htobl(device_opts->voice); - hci_send_cmd(dd, OGF_HOST_CTL, OCF_WRITE_VOICE_SETTING, - WRITE_VOICE_SETTING_CP_SIZE, &cp); - } - exit(0); } diff --git a/src/manager.c b/src/manager.c index 0b6af1b5..7dfec606 100644 --- a/src/manager.c +++ b/src/manager.c @@ -32,13 +32,10 @@ #include <unistd.h> #include <sys/ioctl.h> #include <sys/socket.h> -#include <sys/stat.h> #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> -#include <bluetooth/sdp.h> -#include <bluetooth/sdp_lib.h> #include <glib.h> @@ -47,7 +44,6 @@ #include <gdbus.h> #include "logging.h" -#include "textfile.h" #include "adapter.h" #include "error.h" #include "manager.h" @@ -89,43 +85,6 @@ int manager_set_adapter_class(uint16_t dev_id, uint8_t *cls) return adapter_set_class(adapter, cls); } -int get_device_alias(uint16_t dev_id, const bdaddr_t *bdaddr, char *alias, size_t size) -{ - struct adapter *adapter = manager_find_adapter_by_id(dev_id); - char filename[PATH_MAX + 1], addr[18], *tmp; - int err; - const gchar *source = adapter_get_address(adapter); - - create_name(filename, PATH_MAX, STORAGEDIR, source, "aliases"); - - ba2str(bdaddr, addr); - - tmp = textfile_get(filename, addr); - if (!tmp) - return -ENXIO; - - err = snprintf(alias, size, "%s", tmp); - - free(tmp); - - return err; -} - -int set_device_alias(uint16_t dev_id, const bdaddr_t *bdaddr, const char *alias) -{ - struct adapter *adapter = manager_find_adapter_by_id(dev_id); - const gchar *source = adapter_get_address(adapter); - char filename[PATH_MAX + 1], addr[18]; - - create_name(filename, PATH_MAX, STORAGEDIR, source, "aliases"); - - create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - - ba2str(bdaddr, addr); - - return textfile_put(filename, addr, alias); -} - static inline DBusMessage *invalid_args(DBusMessage *msg) { return g_dbus_create_error(msg, @@ -140,20 +99,6 @@ static inline DBusMessage *no_such_adapter(DBusMessage *msg) "No such adapter"); } -static inline DBusMessage *no_such_service(DBusMessage *msg) -{ - return g_dbus_create_error(msg, - ERROR_INTERFACE ".NoSuchService", - "No such service"); -} - -static inline DBusMessage *failed_strerror(DBusMessage *msg, int err) -{ - return g_dbus_create_error(msg, - ERROR_INTERFACE ".Failed", - strerror(err)); -} - static int find_by_address(const char *str) { struct hci_dev_list_req *dl; diff --git a/src/security.c b/src/security.c index 5c295574..fd2535fd 100644 --- a/src/security.c +++ b/src/security.c @@ -40,6 +40,7 @@ #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> +#include <bluetooth/sdp.h> #include <glib.h> @@ -48,9 +49,9 @@ #include "logging.h" #include "textfile.h" -#include "hcid.h" #include "adapter.h" #include "dbus-hci.h" +#include "storage.h" typedef enum { REQ_PENDING, diff --git a/src/storage.c b/src/storage.c index f8064254..f85dbb53 100644 --- a/src/storage.c +++ b/src/storage.c @@ -45,7 +45,6 @@ #include <bluetooth/sdp_lib.h> #include "textfile.h" -#include "hcid.h" static inline int create_filename(char *buf, size_t size, const bdaddr_t *bdaddr, const char *name) { @@ -56,6 +55,35 @@ static inline int create_filename(char *buf, size_t size, const bdaddr_t *bdaddr return create_name(buf, size, STORAGEDIR, addr, name); } +int read_device_alias(const char *src, const char *dst, char *alias, size_t size) +{ + char filename[PATH_MAX + 1], *tmp; + int err; + + create_name(filename, PATH_MAX, STORAGEDIR, src, "aliases"); + + tmp = textfile_get(filename, dst); + if (!tmp) + return -ENXIO; + + err = snprintf(alias, size, "%s", tmp); + + free(tmp); + + return err; +} + +int write_device_alias(const char *src, const char *dst, const char *alias) +{ + char filename[PATH_MAX + 1]; + + create_name(filename, PATH_MAX, STORAGEDIR, src, "aliases"); + + create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + + return textfile_put(filename, dst, alias); +} + int write_discoverable_timeout(bdaddr_t *bdaddr, int timeout) { char filename[PATH_MAX + 1], str[32]; @@ -121,11 +149,11 @@ int read_device_mode(bdaddr_t *bdaddr, char *mode, int length) return 0; } -int read_on_mode(bdaddr_t *bdaddr, char *mode, int length) +int read_on_mode(const char *src, char *mode, int length) { char filename[PATH_MAX + 1], *str; - create_filename(filename, PATH_MAX, bdaddr, "config"); + create_name(filename, PATH_MAX, STORAGEDIR, src, "config"); str = textfile_get(filename, "onmode"); if (!str) @@ -270,15 +298,14 @@ int write_device_name(bdaddr_t *local, bdaddr_t *peer, char *name) return textfile_put(filename, addr, str); } -int read_device_name(bdaddr_t *local, bdaddr_t *peer, char *name) +int read_device_name(const char *src, const char *dst, char *name) { - char filename[PATH_MAX + 1], addr[18], *str; + char filename[PATH_MAX + 1], *str; int len; - create_filename(filename, PATH_MAX, local, "names"); + create_name(filename, PATH_MAX, STORAGEDIR, src, "names"); - ba2str(peer, addr); - str = textfile_get(filename, addr); + str = textfile_get(filename, dst); if (!str) return -ENOENT; @@ -581,7 +608,7 @@ static char *service_list_to_string(GSList *services) return g_strdup(str); } -int write_trust(bdaddr_t *local, const char *addr, const char *service, +int write_trust(const char *src, const char *addr, const char *service, gboolean trust) { char filename[PATH_MAX + 1], *str; @@ -589,7 +616,7 @@ int write_trust(bdaddr_t *local, const char *addr, const char *service, gboolean trusted; int ret; - create_filename(filename, PATH_MAX, local, "trusts"); + create_name(filename, PATH_MAX, STORAGEDIR, src, "trusts"); create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); diff --git a/src/storage.h b/src/storage.h new file mode 100644 index 00000000..8a06d4e3 --- /dev/null +++ b/src/storage.h @@ -0,0 +1,61 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2002-2008 Marcel Holtmann <marcel@holtmann.org> + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 + * + */ + +int read_device_alias(const char *src, const char *dst, char *alias, size_t size); +int write_device_alias(const char *src, const char *dst, const char *alias); +int write_discoverable_timeout(bdaddr_t *bdaddr, int timeout); +int read_discoverable_timeout(bdaddr_t *bdaddr, int *timeout); +int write_device_mode(bdaddr_t *bdaddr, const char *mode); +int read_device_mode(bdaddr_t *bdaddr, char *mode, int length); +int read_on_mode(const char *src, char *mode, int length); +int write_local_name(bdaddr_t *bdaddr, char *name); +int read_local_name(bdaddr_t *bdaddr, char *name); +int write_local_class(bdaddr_t *bdaddr, uint8_t *class); +int read_local_class(bdaddr_t *bdaddr, uint8_t *class); +int write_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t class); +int read_remote_class(bdaddr_t *local, bdaddr_t *peer, uint32_t *class); +int write_device_name(bdaddr_t *local, bdaddr_t *peer, char *name); +int read_device_name(const char *src, const char *dst, char *name); +int write_remote_eir(bdaddr_t *local, bdaddr_t *peer, uint8_t *data); +int write_l2cap_info(bdaddr_t *local, bdaddr_t *peer, + uint16_t mtu_result, uint16_t mtu, + uint16_t mask_result, uint32_t mask); +int read_l2cap_info(bdaddr_t *local, bdaddr_t *peer, + uint16_t *mtu_result, uint16_t *mtu, + uint16_t *mask_result, uint32_t *mask); +int write_version_info(bdaddr_t *local, bdaddr_t *peer, uint16_t manufacturer, uint8_t lmp_ver, uint16_t lmp_subver); +int write_features_info(bdaddr_t *local, bdaddr_t *peer, unsigned char *features); +int write_lastseen_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm); +int write_lastused_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm); +int write_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, uint8_t type, int length); +int read_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, uint8_t *type); +int read_pin_length(bdaddr_t *local, bdaddr_t *peer); +int read_pin_code(bdaddr_t *local, bdaddr_t *peer, char *pin); +gboolean read_trust(const bdaddr_t *local, const char *addr, const char *service); +int write_trust(const char *src, const char *addr, const char *service, gboolean trust); +GSList *list_trusts(bdaddr_t *local, const char *service); +int write_device_profiles(bdaddr_t *src, bdaddr_t *dst, const char *profiles); +int delete_entry(bdaddr_t *src, const char *storage, const char *key); +int store_record(const gchar *src, const gchar *dst, sdp_record_t *rec); +sdp_record_t *fetch_record(const gchar *src, const gchar *dst, const uint32_t handle); +int delete_record(const gchar *src, const gchar *dst, const uint32_t handle); |