From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd 2/6 v2] bluetooth: add .getpeername support
Date: Sun, 27 Nov 2011 23:12:07 +0200 [thread overview]
Message-ID: <1322428331-28204-2-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1322428331-28204-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
plugins/bluetooth.c | 17 +++++++++++++++++
src/transport.h | 1 +
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 613b2a5..e547857 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -562,9 +562,26 @@ static void bluetooth_stop(void *data)
g_slist_free_full(ios, stop);
}
+static int bluetooth_getpeername(GIOChannel *io, char **name)
+{
+ GError *gerr = NULL;
+ char address[18];
+
+ bt_io_get(io, BT_IO_RFCOMM, &gerr,
+ BT_IO_OPT_DEST, address,
+ BT_IO_OPT_INVALID);
+ if (gerr)
+ return -EINVAL;
+
+ *name = g_strdup(address);
+
+ return 0;
+}
+
static struct obex_transport_driver driver = {
.name = "bluetooth",
.start = bluetooth_start,
+ .getpeername = bluetooth_getpeername,
.stop = bluetooth_stop
};
diff --git a/src/transport.h b/src/transport.h
index 320fafb..b81615b 100644
--- a/src/transport.h
+++ b/src/transport.h
@@ -25,6 +25,7 @@ struct obex_transport_driver {
const char *name;
uint16_t service;
void *(*start) (struct obex_server *server, int *err);
+ int (*getpeername) (GIOChannel *io, char **name);
void (*stop) (void *data);
};
--
1.7.7.3
next prev parent reply other threads:[~2011-11-27 21:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-27 21:12 [PATCH obexd 1/6 v2] bluetooth: make use of secure flag for authorization Luiz Augusto von Dentz
2011-11-27 21:12 ` Luiz Augusto von Dentz [this message]
2011-11-27 21:12 ` [PATCH obexd 3/6 v2] Fix calling getpeername directly on manager.c Luiz Augusto von Dentz
2011-11-27 21:12 ` [PATCH obexd 4/6 v2] Remove obex_get_id Luiz Augusto von Dentz
2011-11-27 21:12 ` [PATCH obexd 5/6 v2] Port core daemon to gobex Luiz Augusto von Dentz
2011-11-29 9:00 ` Johan Hedberg
2011-11-27 21:12 ` [PATCH obexd 6/6 v2] Remove dependency on OpenOBEX Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1322428331-28204-2-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).