summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlok Barsode <alok.barsode@azingo.com>2008-09-12 21:52:14 +0530
committerAlok Barsode <alok.barsode@azingo.com>2008-09-12 21:52:14 +0530
commit26e1749b1e18fd55ce32e84654e7a9123630bedf (patch)
treecd035525c86b87bfb6839c0f64bf754a99d35337 /src
parent7d93ead47f6b203feca6bfee78c4494b285539d2 (diff)
Modifying l2raw_connect to take bdaddr_t as parameter.
Diffstat (limited to 'src')
-rw-r--r--src/adapter.c9
-rw-r--r--src/dbus-common.c6
-rw-r--r--src/dbus-common.h2
3 files changed, 9 insertions, 8 deletions
diff --git a/src/adapter.c b/src/adapter.c
index dec30fc0..0f64ae59 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1289,10 +1289,11 @@ static DBusMessage *create_bonding(DBusConnection *conn, DBusMessage *msg,
char *str;
struct btd_adapter *adapter = data;
struct bonding_request_info *bonding;
- bdaddr_t bdaddr;
+ bdaddr_t src, dst;
int sk;
- str2ba(address, &bdaddr);
+ str2ba(address, &dst);
+ str2ba(adapter->address, &src);
/* check if there is a pending discover: requested by D-Bus/non clients */
if (adapter->state & STD_INQUIRY)
@@ -1303,7 +1304,7 @@ static DBusMessage *create_bonding(DBusConnection *conn, DBusMessage *msg,
if (adapter->bonding)
return in_progress(msg, "Bonding in progress");
- if (adapter_find_auth_request(adapter, &bdaddr))
+ if (adapter_find_auth_request(adapter, &dst))
return in_progress(msg, "Bonding in progress");
/* check if a link key already exists */
@@ -1318,7 +1319,7 @@ static DBusMessage *create_bonding(DBusConnection *conn, DBusMessage *msg,
"Bonding already exists");
}
- sk = l2raw_connect(adapter->address, &bdaddr);
+ sk = l2raw_connect(&src, &dst);
if (sk < 0)
return g_dbus_create_error(msg,
ERROR_INTERFACE ".ConnectionAttemptFailed",
diff --git a/src/dbus-common.c b/src/dbus-common.c
index e9295998..6c15dea2 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -54,7 +54,7 @@
#define RECONNECT_RETRY_TIMEOUT 5000
-int l2raw_connect(const char *local, const bdaddr_t *remote)
+int l2raw_connect(const bdaddr_t *src, const bdaddr_t *dst)
{
struct sockaddr_l2 addr;
long arg;
@@ -68,7 +68,7 @@ int l2raw_connect(const char *local, const bdaddr_t *remote)
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
- str2ba(local, &addr.l2_bdaddr);
+ bacpy(&addr.l2_bdaddr, src);
if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
error("Can't bind socket: %s (%d)", strerror(errno), errno);
@@ -89,7 +89,7 @@ int l2raw_connect(const char *local, const bdaddr_t *remote)
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
- bacpy(&addr.l2_bdaddr, remote);
+ bacpy(&addr.l2_bdaddr, dst);
if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
if (errno == EAGAIN || errno == EINPROGRESS)
diff --git a/src/dbus-common.h b/src/dbus-common.h
index e9435d38..5431b701 100644
--- a/src/dbus-common.h
+++ b/src/dbus-common.h
@@ -24,7 +24,7 @@
#define MAX_PATH_LENGTH 64
-int l2raw_connect(const char *local, const bdaddr_t *remote);
+int l2raw_connect(const bdaddr_t *src, const bdaddr_t *dst);
void hcid_dbus_exit(void);
int hcid_dbus_init(void);