diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2011-11-27 23:12:07 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2011-11-29 10:47:30 +0200 |
commit | 265cdd5bc3f29ed45c8eb4e5637339509cdcbb8d (patch) | |
tree | bc708cef5cee4e968cb1ff6b4cfae3dbc2d85382 | |
parent | 2d5caf6dc8471689a8b0194fc04f10a4184edb75 (diff) | |
download | obexd-265cdd5bc3f29ed45c8eb4e5637339509cdcbb8d.tar.gz |
bluetooth: add .getpeername support
-rw-r--r-- | plugins/bluetooth.c | 17 | ||||
-rw-r--r-- | 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); }; |