diff options
author | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-05-28 14:45:20 -0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-05-29 14:40:05 +0300 |
commit | a8a9649850f8f939ec5df9a53e9eddbbf40afd24 (patch) | |
tree | 0dbe6a617e243b18b1219a0f675d7fe0e580ebb1 /obexd/src | |
parent | 4e309bd193ac1babb2c3e0db2f34ab18d208489b (diff) | |
download | bluez-a8a9649850f8f939ec5df9a53e9eddbbf40afd24.tar.gz |
obex: add obex_getsockname()
Allow obex users to get the source device address.
Diffstat (limited to 'obexd/src')
-rw-r--r-- | obexd/src/obex.c | 10 | ||||
-rw-r--r-- | obexd/src/obex.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/obexd/src/obex.c b/obexd/src/obex.c index a3e7b0e4b..7a1d6122d 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 443a74826..fc1674755 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); |