summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-03-12 21:43:07 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-03-12 21:43:07 +0000
commit118d58046f5dbf1f539e997d4d1e339422582f4c (patch)
tree4a6ccfc337bb940098c28fbca3a5f4b2f21c7d9e
parent6bfa88d706cc57a0c975c980dabec5d8ed67dcc0 (diff)
Remove the transfer service skeleton since it is useless
-rw-r--r--Makefile.am2
-rw-r--r--acinclude.m413
-rw-r--r--configure.in1
-rw-r--r--transfer/Makefile.am21
-rw-r--r--transfer/main.c189
-rw-r--r--transfer/process.c124
-rw-r--r--transfer/process.h25
-rw-r--r--transfer/server.c281
-rw-r--r--transfer/server.h25
-rw-r--r--transfer/session.c242
-rw-r--r--transfer/session.h40
-rw-r--r--transfer/transfer-api.txt20
-rw-r--r--transfer/transfer.service4
13 files changed, 1 insertions, 986 deletions
diff --git a/Makefile.am b/Makefile.am
index 8ce19cdd..4a91fb8a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
SUBDIRS = doc sbc eglib common sdpd hcid daemon plugins \
- transfer network serial input audio print sync \
+ network serial input audio print sync \
tools rfcomm dund pand hidd \
cups test scripts
diff --git a/acinclude.m4 b/acinclude.m4
index 2e0c58c5..79c72825 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -107,12 +107,6 @@ AC_DEFUN([AC_PATH_GMODULE], [
AC_SUBST(GMODULE_LIBS)
])
-AC_DEFUN([AC_PATH_OPENOBEX], [
- PKG_CHECK_MODULES(OPENOBEX, openobex > 1.1, openobex_found=yes, openobex_found=no)
- AC_SUBST(OPENOBEX_CFLAGS)
- AC_SUBST(OPENOBEX_LIBS)
-])
-
AC_DEFUN([AC_PATH_OPENSYNC], [
PKG_CHECK_MODULES(OPENSYNC, glib-2.0 opensync-1.0 osengine-1.0, opensync_found=yes, opensync_found=no)
AC_SUBST(OPENSYNC_CFLAGS)
@@ -176,7 +170,6 @@ AC_DEFUN([AC_ARG_BLUEZ], [
hal_enable=${hal_found}
usb_enable=${usb_found}
alsa_enable=${alsa_found}
- obex_enable=${openobex_found}
glib_enable=no
gstreamer_enable=${gstreamer_found}
audio_enable=yes
@@ -216,7 +209,6 @@ AC_DEFUN([AC_ARG_BLUEZ], [
AC_ARG_ENABLE(all, AC_HELP_STRING([--enable-all], [enable all extra options below]), [
dbus_enable=${enableval}
- obex_enable=${enableval}
alsa_enable=${enableval}
hcid_enable=${enableval}
sdpd_enable=${enableval}
@@ -253,10 +245,6 @@ AC_DEFUN([AC_ARG_BLUEZ], [
alsa_enable=${enableval}
])
- AC_ARG_ENABLE(obex, AC_HELP_STRING([--enable-obex], [enable OBEX support]), [
- obex_enable=${enableval}
- ])
-
AC_ARG_ENABLE(glib, AC_HELP_STRING([--enable-glib], [enable GLib support]), [
glib_enable=${enableval}
])
@@ -395,7 +383,6 @@ AC_DEFUN([AC_ARG_BLUEZ], [
AM_CONDITIONAL(USB, test "${usb_enable}" = "yes" && test "${usb_found}" = "yes")
AM_CONDITIONAL(SBC, test "${alsa_enable}" = "yes" || test "${gstreamer_enable}" = "yes")
AM_CONDITIONAL(ALSA, test "${alsa_enable}" = "yes" && test "${alsa_found}" = "yes")
- AM_CONDITIONAL(OBEX, test "${obex_enable}" = "yes" && test "${openobex_found}" = "yes")
AM_CONDITIONAL(GSTREAMER, test "${gstreamer_enable}" = "yes" && test "${gstreamer_found}" = "yes")
AM_CONDITIONAL(AUDIOSERVICE, test "${audio_enable}" = "yes")
AM_CONDITIONAL(INPUTSERVICE, test "${input_enable}" = "yes")
diff --git a/configure.in b/configure.in
index 0058b9a9..d8a7aaf0 100644
--- a/configure.in
+++ b/configure.in
@@ -45,7 +45,6 @@ AC_OUTPUT([
common/Makefile
daemon/Makefile
plugins/Makefile
- transfer/Makefile
network/Makefile
serial/Makefile
input/Makefile
diff --git a/transfer/Makefile.am b/transfer/Makefile.am
deleted file mode 100644
index 0dae6c09..00000000
--- a/transfer/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-
-if OBEX
-servicedir = $(libdir)/bluetooth
-
-noinst_PROGRAMS = bluetoothd-service-transfer
-
-bluetoothd_service_transfer_SOURCES = main.c \
- server.h server.c session.h session.c \
- process.h process.c
-
-LDADD = $(top_builddir)/common/libhelper.a \
- @GLIB_LIBS@ @DBUS_LIBS@ @OPENOBEX_LIBS@ @BLUEZ_LIBS@
-endif
-
-AM_CFLAGS = @BLUEZ_CFLAGS@ @OPENOBEX_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@
-
-INCLUDES = -I$(top_srcdir)/common
-
-EXTRA_DIST = transfer.service transfer-api.txt
-
-MAINTAINERCLEANFILES = Makefile.in
diff --git a/transfer/main.c b/transfer/main.c
deleted file mode 100644
index 4b0015fc..00000000
--- a/transfer/main.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- *
- * BlueZ - Bluetooth protocol stack for Linux
- *
- * Copyright (C) 2006-2008 Marcel Holtmann <marcel@holtmann.org>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <signal.h>
-
-#include <glib.h>
-
-#include <dbus/dbus.h>
-
-#include "logging.h"
-#include "dbus.h"
-
-#include "server.h"
-#include "session.h"
-
-#define SERVICE_PATH "/org/bluez/transfer"
-
-static GMainLoop *main_loop;
-
-static DBusConnection *system_bus;
-
-static DBusHandlerResult error_reply(DBusConnection *conn,
- DBusMessage *msg, const char *str)
-{
- return send_message_and_unref(conn,
- dbus_message_new_error(msg, "org.bluez.transfer.Error", str));
-}
-
-static DBusHandlerResult push_message(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- DBusMessage *reply;
- const char *address, *pathname, *identifier;
- struct session_data *session;
-
- if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &address,
- DBUS_TYPE_STRING, &pathname, DBUS_TYPE_INVALID) == FALSE)
- return error_reply(conn, msg, "Invalid arguments");
-
- debug("Requesting push of %s to %s", pathname, address);
-
- reply = dbus_message_new_method_return(msg);
- if (!reply)
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
-
- session = session_create(conn, msg);
- if (!session) {
- dbus_message_unref(reply);
- return DBUS_HANDLER_RESULT_NEED_MEMORY;
- }
-
- identifier = session_connect(session, address, pathname);
- if (!identifier) {
- session_destroy(session);
- dbus_message_unref(reply);
- return error_reply(conn, msg, "Unable to connect session");
- }
-
- debug("Created new session at %s", identifier);
-
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &identifier,
- DBUS_TYPE_INVALID);
-
- dbus_connection_send(conn, reply, NULL);
-
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult manager_handler(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- if (dbus_message_is_method_call(msg, "org.bluez.transfer.Manager", "Push"))
- return push_message(conn, msg, data);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static DBusObjectPathVTable manager_table = {
- .message_function = manager_handler,
-};
-
-static int setup_manager(void)
-{
- if (dbus_connection_register_object_path(system_bus,
- SERVICE_PATH, &manager_table, NULL) == FALSE) {
- error("Service path registration failed");
- return -1;
- }
-
- return 0;
-}
-
-static void sig_term(int sig)
-{
- g_main_loop_quit(main_loop);
-}
-
-static void sig_hup(int sig)
-{
-}
-
-static void sig_debug(int sig)
-{
- toggle_debug();
-}
-
-int main(int argc, char *argv[])
-{
- struct sigaction sa;
-
- start_logging("transfer", "Bluetooth transfer service ver %s", VERSION);
-
- memset(&sa, 0, sizeof(sa));
- sa.sa_flags = SA_NOCLDSTOP;
- sa.sa_handler = sig_term;
- sigaction(SIGTERM, &sa, NULL);
- sigaction(SIGINT, &sa, NULL);
- sa.sa_handler = sig_hup;
- sigaction(SIGHUP, &sa, NULL);
-
- sa.sa_handler = sig_debug;
- sigaction(SIGUSR2, &sa, NULL);
-
- sa.sa_handler = SIG_IGN;
- sigaction(SIGCHLD, &sa, NULL);
- sigaction(SIGPIPE, &sa, NULL);
-
- enable_debug();
-
- main_loop = g_main_loop_new(NULL, FALSE);
-
- system_bus = init_dbus(NULL, NULL, NULL);
- if (!system_bus) {
- g_main_loop_unref(main_loop);
- exit(1);
- }
-
- if (setup_manager() < 0) {
- dbus_connection_unref(system_bus);
- g_main_loop_unref(main_loop);
- exit(1);
- }
-
- start_server(9);
-
- g_main_loop_run(main_loop);
-
- stop_server();
-
- dbus_connection_unregister_object_path(system_bus, SERVICE_PATH);
-
- dbus_connection_unref(system_bus);
-
- g_main_loop_unref(main_loop);
-
- info("Exit");
-
- stop_logging();
-
- return 0;
-}
diff --git a/transfer/process.c b/transfer/process.c
deleted file mode 100644
index 0e401956..00000000
--- a/transfer/process.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * BlueZ - Bluetooth protocol stack for Linux
- *
- * Copyright (C) 2006-2008 Marcel Holtmann <marcel@holtmann.org>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/wait.h>
-
-#include <glib.h>
-
-#include "logging.h"
-#include "process.h"
-
-static void child_exit(GPid pid, gint status, gpointer data)
-{
- debug("Child with PID %d exits with status %d", pid, status);
-
- debug("Exit status %d", WEXITSTATUS(status));
-}
-
-int create_reader(uid_t uid, const char *pathname,
- GIOFunc func, gpointer user_data)
-{
- pid_t pid;
- unsigned char buf[512];
- int fd, pfd[2], len, written;
-
- if (pipe(pfd) < 0) {
- error("Failed to create new pipe");
- return -1;
- }
-
- pid = fork();
- if (pid < 0) {
- error("Failed to fork new process");
- close(pfd[0]);
- close(pfd[1]);
- return -1;
- }
-
- if (pid > 0) {
- GIOChannel *io;
-
- g_child_watch_add(pid, child_exit, NULL);
-
- close(pfd[1]);
-
- io = g_io_channel_unix_new(pfd[0]);
- g_io_channel_set_close_on_unref(io, TRUE);
-
- g_io_add_watch(io, G_IO_IN | G_IO_ERR | G_IO_HUP, func,
- user_data);
-
- g_io_channel_unref(io);
-
- return 0;
- }
-
- /* Child process */
-
- close(pfd[0]);
-
- if (setuid(uid) < 0) {
- error("Failed to switch to UID %d", uid);
- close(pfd[1]);
- exit(EXIT_FAILURE);
- }
-
- fd = open(pathname, O_RDONLY);
- if (fd < 0) {
- error("Failed to open file %s: %s",
- pathname, strerror(errno));
- close(pfd[1]);
- exit(EXIT_FAILURE);
- }
-
- while (1) {
- len = read(fd, buf, sizeof(buf));
- if (len <= 0) {
- debug("Reading failed");
- break;
- }
-
- written = write(pfd[1], buf, len);
- if (written < len) {
- debug("Writing failed");
- break;
- }
- }
-
- debug("Reader finished");
-
- close(fd);
-
- close(pfd[1]);
-
- exit(EXIT_SUCCESS);
-}
diff --git a/transfer/process.h b/transfer/process.h
deleted file mode 100644
index c6f877ec..00000000
--- a/transfer/process.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *
- * BlueZ - Bluetooth protocol stack for Linux
- *
- * Copyright (C) 2006-2008 Marcel Holtmann <marcel@holtmann.org>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-int create_reader(uid_t uid, const char *pathname,
- GIOFunc func, gpointer user_data);
diff --git a/transfer/server.c b/transfer/server.c
deleted file mode 100644
index eb1bee0a..00000000
--- a/transfer/server.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- *
- * BlueZ - Bluetooth protocol stack for Linux
- *
- * Copyright (C) 2006-2008 Marcel Holtmann <marcel@holtmann.org>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <sys/socket.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/rfcomm.h>
-#include <bluetooth/sdp.h>
-#include <bluetooth/sdp_lib.h>
-
-#include <glib.h>
-
-#include "logging.h"
-#include "server.h"
-
-static sdp_session_t *sdp_session = NULL;
-
-static gboolean session_event(GIOChannel *chan, GIOCondition cond, gpointer data)
-{
- if (cond & (G_IO_HUP | G_IO_ERR))
- return FALSE;
-
- debug("Incoming data session");
-
- return FALSE;
-}
-
-static gboolean connect_event(GIOChannel *chan, GIOCondition cond, gpointer data)
-{
- GIOChannel *io;
- struct sockaddr_rc addr;
- socklen_t optlen;
- int sk, nsk;
-
- sk = g_io_channel_unix_get_fd(chan);
-
- memset(&addr, 0, sizeof(addr));
- optlen = sizeof(addr);
-
- nsk = accept(sk, (struct sockaddr *) &addr, &optlen);
- if (nsk < 0)
- return TRUE;
-
- io = g_io_channel_unix_new(nsk);
- g_io_channel_set_close_on_unref(io, TRUE);
-
- g_io_add_watch(io, G_IO_IN | G_IO_HUP | G_IO_ERR,
- session_event, NULL);
-
- g_io_channel_unref(io);
-
- return TRUE;
-}
-
-static GIOChannel *setup_rfcomm(uint8_t channel)
-{
- GIOChannel *io;
- struct sockaddr_rc addr;
- int sk;
-
- sk = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
- if (sk < 0)
- return NULL;
-
- memset(&addr, 0, sizeof(addr));
- addr.rc_family = AF_BLUETOOTH;
- bacpy(&addr.rc_bdaddr, BDADDR_ANY);
- addr.rc_channel = channel;
-
- if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- close(sk);
- return NULL;
- }
-
- if (listen(sk, 10) < 0) {
- close(sk);
- return NULL;
- }
-
- io = g_io_channel_unix_new(sk);
- g_io_channel_set_close_on_unref(io, TRUE);
-
- g_io_add_watch(io, G_IO_IN, connect_event, NULL);
-
- return io;
-}
-
-static int setup_sdp_for_push(uint8_t channel)
-{
- sdp_record_t *record;
- sdp_list_t *svclass_id, *pfseq, *apseq, *root;
- uuid_t root_uuid, opush_uuid, l2cap_uuid, rfcomm_uuid, obex_uuid;
- sdp_profile_desc_t profile[1];
- sdp_list_t *aproto, *proto[3];
- sdp_data_t *chan;
- uint8_t formats[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xFF };
- void *dtds[sizeof(formats)], *values[sizeof(formats)];
- int i;
- uint8_t dtd = SDP_UINT8;
- sdp_data_t *sflist;
-
- if (!sdp_session) {
- sdp_session = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0);
- if (!sdp_session) {
- error("Connection to SDP server failed");
- return -1;
- }
- }
-
- record = sdp_record_alloc();
- if (!record) {
- error("Allocation of service record failed");
- return -1;
- }
-
- sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
- root = sdp_list_append(0, &root_uuid);
- sdp_set_browse_groups(record, root);
-
- sdp_uuid16_create(&opush_uuid, OBEX_OBJPUSH_SVCLASS_ID);
- svclass_id = sdp_list_append(0, &opush_uuid);
- sdp_set_service_classes(record, svclass_id);
-
- sdp_uuid16_create(&profile[0].uuid, OBEX_OBJPUSH_PROFILE_ID);
- profile[0].version = 0x0100;
- pfseq = sdp_list_append(0, profile);
- sdp_set_profile_descs(record, pfseq);
-
- sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
- proto[0] = sdp_list_append(0, &l2cap_uuid);
- apseq = sdp_list_append(0, proto[0]);
-
- sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
- proto[1] = sdp_list_append(0, &rfcomm_uuid);
- chan = sdp_data_alloc(SDP_UINT8, &channel);
- proto[1] = sdp_list_append(proto[1], chan);
- apseq = sdp_list_append(apseq, proto[1]);
-
- sdp_uuid16_create(&obex_uuid, OBEX_UUID);
- proto[2] = sdp_list_append(0, &obex_uuid);
- apseq = sdp_list_append(apseq, proto[2]);
-
- aproto = sdp_list_append(0, apseq);
- sdp_set_access_protos(record, aproto);
-
- for (i = 0; i < sizeof(formats); i++) {
- dtds[i] = &dtd;
- values[i] = &formats[i];
- }
- sflist = sdp_seq_alloc(dtds, values, sizeof(formats));
- sdp_attr_add(record, SDP_ATTR_SUPPORTED_FORMATS_LIST, sflist);
-
- sdp_set_info_attr(record, "OBEX Object Push", 0, 0);
-
- if (sdp_record_register(sdp_session, record, 0) < 0) {
- error("Registration of service record failed");
- sdp_record_free(record);
- return -1;
- }
-
- sdp_record_free(record);
-
- return 0;
-}
-
-static int setup_sdp_for_ftp(uint8_t channel)
-{
- sdp_record_t *record;
- sdp_list_t *svclass_id, *pfseq, *apseq, *root;
- uuid_t root_uuid, opush_uuid, l2cap_uuid, rfcomm_uuid, obex_uuid;
- sdp_profile_desc_t profile[1];
- sdp_list_t *aproto, *proto[3];
- sdp_data_t *chan;
-
- if (!sdp_session) {
- sdp_session = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0);
- if (!sdp_session) {
- error("Connection to SDP server failed");
- return -1;
- }
- }
-
- record = sdp_record_alloc();
- if (!record) {
- error("Allocation of service record failed");
- return -1;
- }
-
- sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
- root = sdp_list_append(0, &root_uuid);
- sdp_set_browse_groups(record, root);
-
- sdp_uuid16_create(&opush_uuid, OBEX_FILETRANS_SVCLASS_ID);
- svclass_id = sdp_list_append(0, &opush_uuid);
- sdp_set_service_classes(record, svclass_id);
-
- sdp_uuid16_create(&profile[0].uuid, OBEX_FILETRANS_PROFILE_ID);
- profile[0].version = 0x0100;
- pfseq = sdp_list_append(0, profile);
- sdp_set_profile_descs(record, pfseq);
-
- sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
- proto[0] = sdp_list_append(0, &l2cap_uuid);
- apseq = sdp_list_append(0, proto[0]);
-
- sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
- proto[1] = sdp_list_append(0, &rfcomm_uuid);
- chan = sdp_data_alloc(SDP_UINT8, &channel);
- proto[1] = sdp_list_append(proto[1], chan);
- apseq = sdp_list_append(apseq, proto[1]);
-
- sdp_uuid16_create(&obex_uuid, OBEX_UUID);
- proto[2] = sdp_list_append(0, &obex_uuid);
- apseq = sdp_list_append(apseq, proto[2]);
-
- aproto = sdp_list_append(0, apseq);
- sdp_set_access_protos(record, aproto);
-
- sdp_set_info_attr(record, "OBEX File Transfer", 0, 0);
-
- if (sdp_record_register(sdp_session, record, 0) < 0) {
- error("Registration of service record failed");
- sdp_record_free(record);
- return -1;
- }
-
- sdp_record_free(record);
-
- return 0;
-}
-
-static GIOChannel *server_io = NULL;
-
-int start_server(uint8_t channel)
-{
- server_io = setup_rfcomm(channel);
- if (!server_io)
- return -1;
-
- if (setup_sdp_for_push(channel) < 0) {
- g_io_channel_unref(server_io);
- server_io = NULL;
- }
-
- setup_sdp_for_ftp(channel);
-
- return 0;
-}
-
-void stop_server(void)
-{
- sdp_close(sdp_session);
-
- if (server_io)
- g_io_channel_unref(server_io);
-}
diff --git a/transfer/server.h b/transfer/server.h
deleted file mode 100644
index 6094fa01..00000000
--- a/transfer/server.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *
- * BlueZ - Bluetooth protocol stack for Linux
- *
- * Copyright (C) 2006-2008 Marcel Holtmann <marcel@holtmann.org>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-int start_server(uint8_t channel);
-void stop_server(void);
diff --git a/transfer/session.c b/transfer/session.c
deleted file mode 100644
index 74f34649..00000000
--- a/transfer/session.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- *
- * BlueZ - Bluetooth protocol stack for Linux
- *
- * Copyright (C) 2006-2008 Marcel Holtmann <marcel@holtmann.org>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/rfcomm.h>
-
-#include <glib.h>
-
-#include <dbus/dbus.h>
-
-#include "logging.h"
-
-#include "process.h"
-#include "session.h"
-
-static DBusHandlerResult cancel_message(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- DBusMessage *reply;
- struct session_data *session = data;
-
- reply = dbus_message_new_method_return(msg);
- if (!reply)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- debug("Cancel of session at %s", session->identifier);
-
- dbus_message_append_args(reply, DBUS_TYPE_INVALID);
-
- dbus_connection_send(conn, reply, NULL);
-
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult session_handler(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- if (dbus_message_is_method_call(msg, "org.bluez.transfer.Session", "Cancel"))
- return cancel_message(conn, msg, data);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static DBusObjectPathVTable session_table = {
- .message_function = session_handler,
-};
-
-struct session_data *session_create(DBusConnection *conn, DBusMessage *msg)
-{
- struct session_data *session;
-
- session = malloc(sizeof(*session));
- if (!session)
- return NULL;
-
- memset(session, 0, sizeof(*session));
-
- session->conn = dbus_connection_ref(conn);
-
- session->msg = dbus_message_ref(msg);
-
- return session;
-}
-
-void session_destroy(struct session_data *session)
-{
- if (!session)
- return;
-
- if (session->identifier) {
- dbus_connection_unregister_object_path(session->conn,
- session->identifier);
- free(session->identifier);
- }
-
- dbus_message_unref(session->msg);
-
- dbus_connection_unref(session->conn);
-
- free(session);
-}
-
-static gboolean connect_callback(GIOChannel *chan,
- GIOCondition cond, gpointer data)
-{
- struct session_data *session = data;
- int sk;
-
- debug("Connection for session %s established", session->identifier);
-
- sk = g_io_channel_unix_get_fd(session->rfcomm_io);
-
- close(sk);
-
- return FALSE;
-}
-
-static int rfcomm_connect(struct session_data *session)
-{
- struct sockaddr_rc addr;
- long arg;
- int sk;
-
- sk = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
- if (sk < 0)
- return -1;
-
- arg = fcntl(sk, F_GETFL);
- if (arg < 0) {
- close(sk);
- return -1;
- }
-
- arg |= O_NONBLOCK;
-
- if (fcntl(sk, F_SETFL, arg) < 0) {
- close(sk);
- return -1;
- }
-
- session->rfcomm_io = g_io_channel_unix_new(sk);
- if (!session->rfcomm_io) {
- close(sk);
- return -1;
- }
-
- g_io_channel_set_close_on_unref(session->rfcomm_io, TRUE);
-
- memset(&addr, 0, sizeof(addr));
- addr.rc_family = AF_BLUETOOTH;
- bacpy(&addr.rc_bdaddr, &session->bdaddr);
- addr.rc_channel = session->channel;
-
- if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- if (errno != EAGAIN && errno != EINPROGRESS) {
- close(sk);
- return -1;
- }
- }
-
- g_io_add_watch(session->rfcomm_io, G_IO_OUT, connect_callback, session);
-
- return 0;
-}
-
-static gboolean data_event(GIOChannel *chan, GIOCondition cond, gpointer data)
-{
- unsigned char buf[64];
- gsize len;
- GIOError err;
- int i;
-
- debug("Data event");
-
- if (cond & (G_IO_HUP | G_IO_ERR))
- return FALSE;
-
- memset(buf, 0, sizeof(buf));
-
- err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf) - 1, &len);
- if (err == G_IO_ERROR_AGAIN)
- return TRUE;
-
- for (i = 0; i < len; i++)
- if (!isprint(buf[i]))
- buf[i] = '.';
-
- debug("%s", buf);
-
- return TRUE;
-}
-
-const char *session_connect(struct session_data *session,
- const char *address, const char *pathname)
-{
- const char *sender;
- char path[128];
-
- sender = dbus_message_get_sender(session->msg);
-
- session->uid = dbus_bus_get_unix_user(session->conn, sender, NULL);
-
- debug("Request by user %d", session->uid);
-
- create_reader(session->uid, pathname, data_event, NULL);
-
- str2ba(address, &session->bdaddr);
-
- session->channel = 1;
-
- snprintf(path, sizeof(path), "/org/bluez/transfer/%d%d",
- session->uid, rand());
-
- session->identifier = strdup(path);
- if (!session->identifier)
- return NULL;
-
- if (dbus_connection_register_object_path(session->conn, path,
- &session_table, session) == FALSE) {
- free(session->identifier);
- session->identifier = NULL;
- return NULL;
- }
-
- if (rfcomm_connect(session) < 0)
- return NULL;
-
- return session->identifier;
-}
diff --git a/transfer/session.h b/transfer/session.h
deleted file mode 100644
index 86357cbf..00000000
--- a/transfer/session.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * BlueZ - Bluetooth protocol stack for Linux
- *
- * Copyright (C) 2006-2008 Marcel Holtmann <marcel@holtmann.org>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include <bluetooth/bluetooth.h>
-
-struct session_data {
- DBusConnection *conn;
- DBusMessage *msg;
- uid_t uid;
- bdaddr_t bdaddr;
- uint8_t channel;
- char *identifier;
- GIOChannel *rfcomm_io;
-};
-
-struct session_data *session_create(DBusConnection *conn, DBusMessage *msg);
-void session_destroy(struct session_data *session);
-
-const char *session_connect(struct session_data *session,
- const char *address, const char *pathname);
diff --git a/transfer/transfer-api.txt b/transfer/transfer-api.txt
deleted file mode 100644
index 3deeb5dc..00000000
--- a/transfer/transfer-api.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Bluetooth transfer service API description
-******************************************
-
-Copyright (C) 2006-2007 Marcel Holtmann <marcel@holtmann.org>
-
-
-Manager hierarchy
-=================
-
-Service org.bluez.transfer
-Interface org.bluez.transfer.Manager
-Object path /org/bluez/transfer
-
-
-Session hierarchy
-=================
-
-Service org.bluez.transfer
-Interface org.bluez.transfer.Session
-Object path /org/bluez/transfer/{session}
diff --git a/transfer/transfer.service b/transfer/transfer.service
deleted file mode 100644
index 2f7b8aa4..00000000
--- a/transfer/transfer.service
+++ /dev/null
@@ -1,4 +0,0 @@
-[Bluetooth Service]
-Identifier=transfer
-Name=Transfer service
-Description=Bluetooth OBEX based Transfer service