linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: linux-bluetooth@vger.kernel.org
Cc: emilio.pozuelo@collabora.co.uk,
	Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Subject: [PATCH 3/6] obex: add obex_getsockname()
Date: Tue, 28 May 2013 14:45:20 -0300	[thread overview]
Message-ID: <1369763123-17949-3-git-send-email-gustavo@padovan.org> (raw)
In-Reply-To: <1369763123-17949-1-git-send-email-gustavo@padovan.org>

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Allow obex users to get the source device address.
---
 obexd/src/obex.c | 10 ++++++++++
 obexd/src/obex.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index a3e7b0e..7a1d612 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -1226,6 +1226,16 @@ int obex_getpeername(struct obex_session *os, char **name)
 	return transport->getpeername(os->io, name);
 }
 
+int obex_getsockname(struct obex_session *os, char **name)
+{
+	struct obex_transport_driver *transport = os->server->transport;
+
+	if (transport == NULL || transport->getsockname == NULL)
+		return -ENOTSUP;
+
+	return transport->getsockname(os->io, name);
+}
+
 int memncmp0(const void *a, size_t na, const void *b, size_t nb)
 {
 	if (na != nb)
diff --git a/obexd/src/obex.h b/obexd/src/obex.h
index 443a748..fc16747 100644
--- a/obexd/src/obex.h
+++ b/obexd/src/obex.h
@@ -46,6 +46,7 @@ ssize_t obex_get_apparam(struct obex_session *os, const uint8_t **buffer);
 ssize_t obex_get_non_header_data(struct obex_session *os,
 							const uint8_t **data);
 int obex_getpeername(struct obex_session *os, char **name);
+int obex_getsockname(struct obex_session *os, char **name);
 
 /* Just a thin wrapper around memcmp to deal with NULL values */
 int memncmp0(const void *a, size_t na, const void *b, size_t nb);
-- 
1.8.1.4


  parent reply	other threads:[~2013-05-28 17:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 17:45 [PATCH 1/6] transport: add getsockname to transport driver Gustavo Padovan
2013-05-28 17:45 ` [PATCH 2/6] bluetooth: add getsockname() entry in the bluetooth driver Gustavo Padovan
2013-05-28 17:45 ` Gustavo Padovan [this message]
2013-05-28 17:45 ` [PATCH 4/6] obex: get src and dst address and store it Gustavo Padovan
2013-05-28 17:45 ` [PATCH 5/6] session: add Source and Destination properties Gustavo Padovan
2013-05-28 17:45 ` [PATCH 6/6] manager: remove unused call to obex_getpeername() Gustavo Padovan
2013-05-29 11:41 ` [PATCH 1/6] transport: add getsockname to transport driver 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=1369763123-17949-3-git-send-email-gustavo@padovan.org \
    --to=gustavo@padovan.org \
    --cc=emilio.pozuelo@collabora.co.uk \
    --cc=gustavo.padovan@collabora.co.uk \
    --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).