From 730775d1226a30c37ff551955f093ddfcd18e600 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Tue, 26 Aug 2008 13:59:06 -0300 Subject: Cleanup: unnecessary includes and defines, moved some declarations --- src/adapter.h | 6 ------ src/device.c | 5 +---- src/hcid.h | 28 +--------------------------- src/security.c | 31 ++++++++++++++++++++----------- 4 files changed, 22 insertions(+), 48 deletions(-) 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/device.c b/src/device.c index 196314d5..3c75cedf 100644 --- a/src/device.c +++ b/src/device.c @@ -27,7 +27,6 @@ #endif #include -#include #include #include #include @@ -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..fa62c706 100644 --- a/src/hcid.h +++ b/src/hcid.h @@ -23,19 +23,10 @@ * */ -#include -#include - -#include - #include #include #include -#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 diff --git a/src/security.c b/src/security.c index 11655271..58fc3471 100644 --- a/src/security.c +++ b/src/security.c @@ -29,12 +29,6 @@ #include #include -#include -#include -#include -#include -#include -#include #include #include #include @@ -49,10 +43,23 @@ #include -#include "hcid.h" #include "textfile.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; @@ -64,7 +71,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 +130,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; -- cgit From bae34785e2fb371509eb0a2c7529f0fe2454dde8 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Tue, 26 Aug 2008 15:00:23 -0300 Subject: Removed warnings --- src/agent.c | 2 ++ src/dbus-common.c | 2 ++ src/dbus-hci.c | 4 +++- src/hcid.h | 1 - src/main.c | 2 ++ src/security.c | 7 +++++++ 6 files changed, 16 insertions(+), 2 deletions(-) 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 #include +#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 #include +#include "logging.h" + #include "hcid.h" #include "manager.h" #include "adapter.h" diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 65b28da0..19acacea 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -45,8 +45,10 @@ #include #include -#include "hcid.h" +#include "logging.h" #include "textfile.h" + +#include "hcid.h" #include "manager.h" #include "adapter.h" #include "device.h" diff --git a/src/hcid.h b/src/hcid.h index fa62c706..d29a0e09 100644 --- a/src/hcid.h +++ b/src/hcid.h @@ -151,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 +#include "logging.h" + #include "hcid.h" #include "sdpd.h" #include "adapter.h" diff --git a/src/security.c b/src/security.c index 58fc3471..4f295a4a 100644 --- a/src/security.c +++ b/src/security.c @@ -29,7 +29,9 @@ #include #include +#include #include +#include #include #include #include @@ -43,8 +45,13 @@ #include +#include "logging.h" #include "textfile.h" +#include "hcid.h" +#include "adapter.h" +#include "dbus-hci.h" + typedef enum { REQ_PENDING, REQ_SENT -- cgit From fda18fb2d24cedaaf823cdafecbe8ba69495947c Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Tue, 26 Aug 2008 16:41:58 -0300 Subject: Cleanup: declaring some functions as static and removed some useless declarations --- src/adapter.c | 2 ++ src/dbus-common.h | 4 ---- src/dbus-hci.c | 4 ++-- src/dbus-hci.h | 6 ------ 4 files changed, 4 insertions(+), 12 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/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 19acacea..8ae43371 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -120,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; @@ -839,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); -- cgit