summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-08-27 11:45:28 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-08-27 11:45:28 +0200
commit85586b684b630334778a41c942fe8290ca07ca93 (patch)
tree9666f7afc6adbb58192e31f8c03b4f58f4c5db57
parente94d033441ea79a820c018bc04f49b3ab08ac2f3 (diff)
parentfda18fb2d24cedaaf823cdafecbe8ba69495947c (diff)
Merge branch 'for-upstream' of git://gitorious.org/bluez/cktakahasis-clone
-rw-r--r--src/adapter.c2
-rw-r--r--src/adapter.h6
-rw-r--r--src/agent.c2
-rw-r--r--src/dbus-common.c2
-rw-r--r--src/dbus-common.h4
-rw-r--r--src/dbus-hci.c8
-rw-r--r--src/dbus-hci.h6
-rw-r--r--src/device.c5
-rw-r--r--src/hcid.h29
-rw-r--r--src/main.c2
-rw-r--r--src/security.c32
11 files changed, 39 insertions, 59 deletions
diff --git a/src/adapter.c b/src/adapter.c
index b5e48dcb..c5f3049a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -69,6 +69,8 @@
#define IO_CAPABILITY_NOINPUTOUTPUT 0x03
#define IO_CAPABILITY_INVALID 0xFF
+#define check_address(address) bachk(address)
+
static DBusConnection *connection = NULL;
static GSList *adapter_drivers = NULL;
diff --git a/src/adapter.h b/src/adapter.h
index 4e2366ba..7d6ca9cb 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -24,12 +24,6 @@
#define ADAPTER_INTERFACE "org.bluez.Adapter"
-#define INVALID_DEV_ID 0xFFFF
-
-#define BONDING_TIMEOUT 45000 /* 45 sec */
-
-#define DC_PENDING_TIMEOUT 2000 /* 2 secs */
-
/* Discover types */
#define DISCOVER_TYPE_NONE 0x00
#define STD_INQUIRY 0x01
diff --git a/src/agent.c b/src/agent.c
index feb2b9cf..dc95be65 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -40,6 +40,8 @@
#include <dbus/dbus.h>
#include <gdbus.h>
+#include "logging.h"
+
#include "hcid.h"
#include "adapter.h"
#include "device.h"
diff --git a/src/dbus-common.c b/src/dbus-common.c
index ed41df8d..1ef69308 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -42,6 +42,8 @@
#include <dbus/dbus.h>
#include <gdbus.h>
+#include "logging.h"
+
#include "hcid.h"
#include "manager.h"
#include "adapter.h"
diff --git a/src/dbus-common.h b/src/dbus-common.h
index 8e009f70..e9435d38 100644
--- a/src/dbus-common.h
+++ b/src/dbus-common.h
@@ -24,12 +24,8 @@
#define MAX_PATH_LENGTH 64
-int str2uuid(uuid_t *uuid, const char *string);
-
int l2raw_connect(const char *local, const bdaddr_t *remote);
-#define check_address(address) bachk(address)
-
void hcid_dbus_exit(void);
int hcid_dbus_init(void);
void hcid_dbus_unregister(void);
diff --git a/src/dbus-hci.c b/src/dbus-hci.c
index 9090c4c3..bc1528f8 100644
--- a/src/dbus-hci.c
+++ b/src/dbus-hci.c
@@ -45,8 +45,10 @@
#include <dbus/dbus.h>
#include <gdbus.h>
-#include "hcid.h"
+#include "logging.h"
#include "textfile.h"
+
+#include "hcid.h"
#include "manager.h"
#include "adapter.h"
#include "device.h"
@@ -118,7 +120,7 @@ int dev_rssi_cmp(struct remote_dev_info *d1, struct remote_dev_info *d2)
return rssi1 - rssi2;
}
-int found_device_add(GSList **list, bdaddr_t *bdaddr, int8_t rssi,
+static int found_device_add(GSList **list, bdaddr_t *bdaddr, int8_t rssi,
name_status_t name_status)
{
struct remote_dev_info *dev, match;
@@ -837,7 +839,7 @@ void hcid_dbus_inquiry_start(bdaddr_t *local)
DBUS_TYPE_INVALID);
}
-int found_device_req_name(struct adapter *adapter)
+static int found_device_req_name(struct adapter *adapter)
{
struct hci_request rq;
evt_cmd_status rp;
diff --git a/src/dbus-hci.h b/src/dbus-hci.h
index e052197a..621657d0 100644
--- a/src/dbus-hci.h
+++ b/src/dbus-hci.h
@@ -50,8 +50,6 @@ int unregister_adapter_path(const char *path);
DBusMessage *new_authentication_return(DBusMessage *msg, uint8_t status);
-int get_default_dev_id(void);
-
int cancel_discovery(struct adapter *adapter);
int cancel_periodic_discovery(struct adapter *adapter);
@@ -59,9 +57,6 @@ int active_conn_find_by_bdaddr(const void *data, const void *user_data);
void bonding_request_free(struct bonding_request_info *dev);
int found_device_cmp(const struct remote_dev_info *d1,
const struct remote_dev_info *d2);
-int found_device_add(GSList **list, bdaddr_t *bdaddr, int8_t rssi,
- name_status_t name_status);
-int found_device_req_name(struct adapter *dbus_data);
int set_limited_discoverable(int dd, const uint8_t *cls, gboolean limited);
int set_service_classes(int dd, const uint8_t *cls, uint8_t value);
@@ -69,4 +64,3 @@ int set_service_classes(int dd, const uint8_t *cls, uint8_t value);
void set_dbus_connection(DBusConnection *conn);
DBusConnection *get_dbus_connection(void);
-struct adapter *adapter_find(const bdaddr_t *sba);
diff --git a/src/device.c b/src/device.c
index 196314d5..3c75cedf 100644
--- a/src/device.c
+++ b/src/device.c
@@ -27,7 +27,6 @@
#endif
#include <stdio.h>
-#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
@@ -59,8 +58,6 @@
#define DEFAULT_XML_BUF_SIZE 1024
#define DISCONNECT_TIMER 2
-#define DEVICE_INTERFACE "org.bluez.Device"
-
struct btd_driver_data {
struct btd_device_driver *driver;
void *priv;
@@ -714,7 +711,7 @@ static void iter_append_record(DBusMessageIter *dict, uint32_t handle,
dbus_message_iter_close_container(dict, &entry);
}
-void append_and_grow_string(void *data, const char *str)
+static void append_and_grow_string(void *data, const char *str)
{
sdp_buf_t *buff = data;
int len;
diff --git a/src/hcid.h b/src/hcid.h
index a367c201..d29a0e09 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -23,19 +23,10 @@
*
*/
-#include <time.h>
-#include <sys/types.h>
-
-#include <glib.h>
-
#include <bluetooth/bluetooth.h>
#include <bluetooth/sdp.h>
#include <bluetooth/hci.h>
-#include "logging.h"
-
-#define HCID_CONFIG_FILE CONFIGDIR "/hcid.conf"
-
#define HCID_DEFAULT_DISCOVERABLE_TIMEOUT 180 /* 3 minutes */
/* When all services should trust a remote device */
@@ -100,26 +91,9 @@ struct hcid_opts {
int sock;
};
-extern struct hcid_opts hcid;
-typedef enum {
- REQ_PENDING,
- REQ_SENT
-} req_status_t;
-
-struct hci_req_data {
- int dev_id;
- int event;
- req_status_t status;
- bdaddr_t dba;
- uint16_t ogf;
- uint16_t ocf;
- void *cparam;
- int clen;
-};
+extern struct hcid_opts hcid;
-struct hci_req_data *hci_req_data_new(int dev_id, const bdaddr_t *dba, uint16_t ogf, uint16_t ocf, int event, const void *cparam, int clen);
-void hci_req_queue_append(struct hci_req_data *data);
void hci_req_queue_remove(int dev_id, bdaddr_t *dba);
#define HCID_OFFMODE_DEVDOWN 0
@@ -177,7 +151,6 @@ 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);
diff --git a/src/main.c b/src/main.c
index d5f92300..004eb496 100644
--- a/src/main.c
+++ b/src/main.c
@@ -48,6 +48,8 @@
#include <dbus/dbus.h>
+#include "logging.h"
+
#include "hcid.h"
#include "sdpd.h"
#include "adapter.h"
diff --git a/src/security.c b/src/security.c
index 11655271..4f295a4a 100644
--- a/src/security.c
+++ b/src/security.c
@@ -29,13 +29,9 @@
#include <stdio.h>
#include <errno.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <unistd.h>
#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
#include <time.h>
+#include <unistd.h>
#include <sys/time.h>
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -49,11 +45,29 @@
#include <dbus/dbus.h>
-#include "hcid.h"
+#include "logging.h"
#include "textfile.h"
+
+#include "hcid.h"
#include "adapter.h"
#include "dbus-hci.h"
+typedef enum {
+ REQ_PENDING,
+ REQ_SENT
+} req_status_t;
+
+struct hci_req_data {
+ int dev_id;
+ int event;
+ req_status_t status;
+ bdaddr_t dba;
+ uint16_t ogf;
+ uint16_t ocf;
+ void *cparam;
+ int clen;
+};
+
struct g_io_info {
GIOChannel *channel;
int watch_id;
@@ -64,7 +78,9 @@ static struct g_io_info io_data[HCI_MAX_DEV];
static GSList *hci_req_queue = NULL;
-struct hci_req_data *hci_req_data_new(int dev_id, const bdaddr_t *dba, uint16_t ogf, uint16_t ocf, int event, const void *cparam, int clen)
+static struct hci_req_data *hci_req_data_new(int dev_id, const bdaddr_t *dba,
+ uint16_t ogf, uint16_t ocf, int event,
+ const void *cparam, int clen)
{
struct hci_req_data *data;
@@ -121,7 +137,7 @@ static void hci_req_queue_process(int dev_id)
hci_close_dev(dd);
}
-void hci_req_queue_append(struct hci_req_data *data)
+static void hci_req_queue_append(struct hci_req_data *data)
{
GSList *l;
struct hci_req_data *match;