2009-11-03 22:05:00 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* OBEX Server
|
|
|
|
*
|
2010-01-07 18:32:49 +08:00
|
|
|
* Copyright (C) 2007-2010 Nokia Corporation
|
2010-01-02 09:09:14 +08:00
|
|
|
* Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
|
2009-11-03 22:05:00 +08:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* 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 <fcntl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <openobex/obex.h>
|
|
|
|
#include <openobex/obex_const.h>
|
|
|
|
|
|
|
|
#include "plugin.h"
|
|
|
|
#include "logging.h"
|
|
|
|
#include "obex.h"
|
|
|
|
#include "dbus.h"
|
|
|
|
#include "mimetype.h"
|
|
|
|
#include "service.h"
|
|
|
|
|
|
|
|
#define LST_TYPE "x-obex/folder-listing"
|
|
|
|
#define CAP_TYPE "x-obex/capability"
|
|
|
|
|
|
|
|
#define FTP_CHANNEL 10
|
|
|
|
#define FTP_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
|
|
|
|
<record> \
|
|
|
|
<attribute id=\"0x0001\"> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"0x1106\"/> \
|
|
|
|
</sequence> \
|
|
|
|
</attribute> \
|
|
|
|
\
|
|
|
|
<attribute id=\"0x0004\"> \
|
|
|
|
<sequence> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"0x0100\"/> \
|
|
|
|
</sequence> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"0x0003\"/> \
|
|
|
|
<uint8 value=\"%u\" name=\"channel\"/> \
|
|
|
|
</sequence> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"0x0008\"/> \
|
|
|
|
</sequence> \
|
|
|
|
</sequence> \
|
|
|
|
</attribute> \
|
|
|
|
\
|
|
|
|
<attribute id=\"0x0009\"> \
|
|
|
|
<sequence> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"0x1106\"/> \
|
|
|
|
<uint16 value=\"0x0100\" name=\"version\"/> \
|
|
|
|
</sequence> \
|
|
|
|
</sequence> \
|
|
|
|
</attribute> \
|
|
|
|
\
|
|
|
|
<attribute id=\"0x0100\"> \
|
|
|
|
<text value=\"%s\" name=\"name\"/> \
|
|
|
|
</attribute> \
|
|
|
|
</record>"
|
|
|
|
|
|
|
|
#define PCSUITE_CHANNEL 24
|
2010-02-22 23:36:51 +08:00
|
|
|
#define PCSUITE_WHO_SIZE 8
|
2009-11-03 22:05:00 +08:00
|
|
|
#define PCSUITE_RECORD "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
|
|
|
|
<record> \
|
|
|
|
<attribute id=\"0x0001\"> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \
|
|
|
|
</sequence> \
|
|
|
|
</attribute> \
|
|
|
|
\
|
|
|
|
<attribute id=\"0x0004\"> \
|
|
|
|
<sequence> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"0x0100\"/> \
|
|
|
|
</sequence> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"0x0003\"/> \
|
|
|
|
<uint8 value=\"%u\" name=\"channel\"/> \
|
|
|
|
</sequence> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"0x0008\"/> \
|
|
|
|
</sequence> \
|
|
|
|
</sequence> \
|
|
|
|
</attribute> \
|
|
|
|
\
|
|
|
|
<attribute id=\"0x0005\"> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"0x1002\"/> \
|
|
|
|
</sequence> \
|
|
|
|
</attribute> \
|
|
|
|
\
|
|
|
|
<attribute id=\"0x0009\"> \
|
|
|
|
<sequence> \
|
|
|
|
<sequence> \
|
|
|
|
<uuid value=\"00005005-0000-1000-8000-0002ee000001\"/> \
|
|
|
|
<uint16 value=\"0x0100\" name=\"version\"/> \
|
|
|
|
</sequence> \
|
|
|
|
</sequence> \
|
|
|
|
</attribute> \
|
|
|
|
\
|
|
|
|
<attribute id=\"0x0100\"> \
|
|
|
|
<text value=\"%s\" name=\"name\"/> \
|
|
|
|
</attribute> \
|
|
|
|
</record>"
|
|
|
|
|
|
|
|
static const guint8 FTP_TARGET[TARGET_SIZE] = {
|
|
|
|
0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11, 0xD2,
|
|
|
|
0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 };
|
|
|
|
|
2010-02-22 23:36:51 +08:00
|
|
|
static const guint8 PCSUITE_WHO[PCSUITE_WHO_SIZE] = {
|
|
|
|
'P','C',' ','S','u','i','t','e' };
|
2009-12-07 20:57:57 +08:00
|
|
|
|
2010-02-26 07:22:59 +08:00
|
|
|
static gint get_by_type(struct OBEX_session *os, gchar *type)
|
2009-11-03 22:05:00 +08:00
|
|
|
{
|
|
|
|
if (type == NULL)
|
|
|
|
return -ENOENT;
|
|
|
|
|
|
|
|
if (g_str_equal(type, CAP_TYPE))
|
2010-02-26 07:22:59 +08:00
|
|
|
return obex_stream_start(os, os->server->capability);
|
2009-11-03 22:05:00 +08:00
|
|
|
|
|
|
|
if (g_str_equal(type, LST_TYPE))
|
2010-02-26 07:22:59 +08:00
|
|
|
return obex_stream_start(os, os->current_folder);
|
2009-11-03 22:05:00 +08:00
|
|
|
|
2010-02-15 19:33:06 +08:00
|
|
|
return -ENOENT;
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
|
2010-02-26 07:22:59 +08:00
|
|
|
static gint ftp_prepare_get(struct obex_session *os, gchar *file)
|
2009-11-03 22:05:00 +08:00
|
|
|
{
|
|
|
|
gboolean root;
|
|
|
|
|
|
|
|
root = g_str_equal(os->server->folder, os->current_folder);
|
|
|
|
|
|
|
|
if (!root || !os->server->symlinks) {
|
|
|
|
struct stat dstat;
|
|
|
|
gint err;
|
|
|
|
|
|
|
|
if (lstat(file, &dstat) < 0) {
|
|
|
|
err = -errno;
|
|
|
|
debug("lstat: %s(%d)", strerror(errno), errno);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (S_ISLNK(dstat.st_mode))
|
|
|
|
return -EPERM;
|
|
|
|
}
|
|
|
|
|
2010-02-26 07:22:59 +08:00
|
|
|
return obex_stream_start(os, file);
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
|
2010-02-26 04:24:59 +08:00
|
|
|
static obex_rsp_t ftp_connect(struct OBEX_session *os)
|
2009-11-10 03:00:41 +08:00
|
|
|
{
|
2010-02-26 04:24:59 +08:00
|
|
|
manager_register_session(os);
|
|
|
|
|
|
|
|
return OBEX_RSP_SUCCESS;
|
2009-11-10 03:00:41 +08:00
|
|
|
}
|
|
|
|
|
2010-02-26 07:22:59 +08:00
|
|
|
static obex_rsp_t ftp_get(struct OBEX_session *os)
|
2009-11-03 22:05:00 +08:00
|
|
|
{
|
|
|
|
gint err;
|
|
|
|
gchar *path;
|
|
|
|
|
|
|
|
if (os->current_folder == NULL) {
|
|
|
|
err = -ENOENT;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2010-02-26 07:22:59 +08:00
|
|
|
err = get_by_type(os, os->type);
|
2009-11-03 22:05:00 +08:00
|
|
|
if (err < 0) {
|
|
|
|
if (!os->name)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
path = g_build_filename(os->current_folder, os->name, NULL);
|
|
|
|
|
2010-02-26 07:22:59 +08:00
|
|
|
err = ftp_prepare_get(os, path);
|
2009-11-03 22:05:00 +08:00
|
|
|
|
|
|
|
g_free(path);
|
|
|
|
|
|
|
|
if (err < 0)
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2010-02-26 07:22:59 +08:00
|
|
|
return OBEX_RSP_SUCCESS;
|
2009-11-03 22:05:00 +08:00
|
|
|
|
|
|
|
fail:
|
|
|
|
switch (err) {
|
|
|
|
case -ENOENT:
|
2010-02-26 07:22:59 +08:00
|
|
|
return OBEX_RSP_NOT_FOUND;
|
|
|
|
|
2009-11-03 22:05:00 +08:00
|
|
|
default:
|
2010-02-26 07:22:59 +08:00
|
|
|
return OBEX_RSP_FORBIDDEN;
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-27 01:22:07 +08:00
|
|
|
static gint ftp_delete(struct OBEX_session *os)
|
2009-11-03 22:05:00 +08:00
|
|
|
{
|
2010-02-27 01:22:07 +08:00
|
|
|
const char *name = obex_session_get_name(os);
|
|
|
|
const char *folder = obex_get_folder(os);
|
2009-11-03 22:05:00 +08:00
|
|
|
gchar *path;
|
|
|
|
int ret = 0;
|
|
|
|
|
2010-02-27 01:22:07 +08:00
|
|
|
if (!(folder && name))
|
2009-11-03 22:05:00 +08:00
|
|
|
return -EINVAL;
|
|
|
|
|
2010-02-27 01:22:07 +08:00
|
|
|
path = g_build_filename(folder, name, NULL);
|
2009-11-03 22:05:00 +08:00
|
|
|
|
|
|
|
if (os->driver->remove(path) < 0)
|
|
|
|
ret = -errno;
|
|
|
|
|
|
|
|
g_free(path);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint ftp_chkput(obex_t *obex, obex_object_t *obj)
|
|
|
|
{
|
|
|
|
struct obex_session *os;
|
|
|
|
|
|
|
|
os = OBEX_GetUserData(obex);
|
|
|
|
if (os == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2009-11-16 14:58:53 +08:00
|
|
|
if (!os->name)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2009-11-03 22:05:00 +08:00
|
|
|
if (os->size == OBJECT_SIZE_DELETE)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return os_prepare_put(os);
|
|
|
|
}
|
|
|
|
|
2010-02-27 01:22:07 +08:00
|
|
|
static obex_rsp_t ftp_put(struct OBEX_session *os)
|
2009-11-03 22:05:00 +08:00
|
|
|
{
|
2010-02-27 01:22:07 +08:00
|
|
|
const char *folder = obex_get_folder(os);
|
|
|
|
const char *name = obex_session_get_name(os);
|
|
|
|
ssize_t size = obex_session_get_size(os);
|
2009-11-03 22:05:00 +08:00
|
|
|
int ret = 0;
|
|
|
|
|
2010-02-27 01:22:07 +08:00
|
|
|
if (folder == NULL)
|
|
|
|
return OBEX_RSP_FORBIDDEN;
|
2009-11-03 22:05:00 +08:00
|
|
|
|
2010-02-27 01:22:07 +08:00
|
|
|
if (name == NULL)
|
|
|
|
return OBEX_RSP_BAD_REQUEST;
|
2009-11-03 22:05:00 +08:00
|
|
|
|
2010-02-27 01:22:07 +08:00
|
|
|
if (size == OBJECT_SIZE_DELETE)
|
2009-11-03 22:05:00 +08:00
|
|
|
ret = ftp_delete(os);
|
|
|
|
|
|
|
|
switch (ret) {
|
|
|
|
case 0:
|
2010-02-27 01:22:07 +08:00
|
|
|
return OBEX_RSP_SUCCESS;
|
2009-11-03 22:05:00 +08:00
|
|
|
case -ENOENT:
|
2010-02-27 01:22:07 +08:00
|
|
|
return OBEX_RSP_NOT_FOUND;
|
2009-11-03 22:05:00 +08:00
|
|
|
case -ENOTEMPTY:
|
2010-02-27 01:22:07 +08:00
|
|
|
return OBEX_RSP_PRECONDITION_FAILED;
|
2009-11-03 22:05:00 +08:00
|
|
|
default:
|
2010-02-27 01:22:07 +08:00
|
|
|
return OBEX_RSP_FORBIDDEN;
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
static obex_rsp_t ftp_setpath(struct OBEX_session *os, obex_object_t *obj)
|
2009-11-03 22:05:00 +08:00
|
|
|
{
|
2010-02-26 23:21:04 +08:00
|
|
|
const gchar *root_folder, *current_folder, *name;
|
2009-11-03 22:05:00 +08:00
|
|
|
guint8 *nonhdr;
|
|
|
|
gchar *fullname;
|
|
|
|
struct stat dstat;
|
|
|
|
gboolean root;
|
2010-02-26 23:21:04 +08:00
|
|
|
obex_rsp_t rsp = OBEX_RSP_SUCCESS;
|
2009-11-03 22:05:00 +08:00
|
|
|
int err;
|
|
|
|
|
|
|
|
if (OBEX_ObjectGetNonHdrData(obj, &nonhdr) != 2) {
|
|
|
|
error("Set path failed: flag and constants not found!");
|
2010-02-26 23:21:04 +08:00
|
|
|
return OBEX_RSP_PRECONDITION_FAILED;
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
name = obex_session_get_name(os);
|
|
|
|
root_folder = obex_get_root_folder(os);
|
|
|
|
current_folder = obex_get_folder(os);
|
|
|
|
root = g_str_equal(root_folder, current_folder);
|
2009-11-03 22:05:00 +08:00
|
|
|
|
|
|
|
/* Check flag "Backup" */
|
|
|
|
if ((nonhdr[0] & 0x01) == 0x01) {
|
|
|
|
debug("Set to parent path");
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
if (root)
|
|
|
|
return OBEX_RSP_FORBIDDEN;
|
2009-11-03 22:05:00 +08:00
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
fullname = g_path_get_dirname(current_folder);
|
|
|
|
obex_set_folder(os, fullname);
|
2009-11-03 22:05:00 +08:00
|
|
|
g_free(fullname);
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
debug("Set to parent path: %s", current_folder);
|
2009-11-03 22:05:00 +08:00
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
return OBEX_RSP_SUCCESS;
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
if (!name) {
|
2009-11-03 22:05:00 +08:00
|
|
|
debug("Set path failed: name missing!");
|
2010-02-26 23:21:04 +08:00
|
|
|
return OBEX_RSP_BAD_REQUEST;
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
if (strlen(name) == 0) {
|
2009-11-03 22:05:00 +08:00
|
|
|
debug("Set to root");
|
2010-02-26 23:21:04 +08:00
|
|
|
obex_set_folder(os, root_folder);
|
|
|
|
return OBEX_RSP_SUCCESS;
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check and set to name path */
|
2010-02-26 23:21:04 +08:00
|
|
|
if (strstr(name, "/") || strcmp(name, "..") == 0) {
|
2009-11-03 22:05:00 +08:00
|
|
|
error("Set path failed: name incorrect!");
|
2010-02-26 23:21:04 +08:00
|
|
|
return OBEX_RSP_FORBIDDEN;
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
fullname = g_build_filename(current_folder, name, NULL);
|
2009-11-03 22:05:00 +08:00
|
|
|
|
|
|
|
debug("Fullname: %s", fullname);
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
if (root && obex_get_symlinks(os))
|
2009-11-03 22:05:00 +08:00
|
|
|
err = stat(fullname, &dstat);
|
|
|
|
else
|
|
|
|
err = lstat(fullname, &dstat);
|
|
|
|
|
|
|
|
if (err < 0) {
|
|
|
|
int err = errno;
|
|
|
|
debug("%s: %s(%d)", root ? "stat" : "lstat",
|
|
|
|
strerror(err), err);
|
|
|
|
if (err == ENOENT)
|
|
|
|
goto not_found;
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
rsp = OBEX_RSP_FORBIDDEN;
|
2009-11-03 22:05:00 +08:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (S_ISDIR(dstat.st_mode) && (dstat.st_mode & S_IRUSR) &&
|
|
|
|
(dstat.st_mode & S_IXUSR)) {
|
2010-02-26 23:21:04 +08:00
|
|
|
obex_set_folder(os, fullname);
|
2009-11-03 22:05:00 +08:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
rsp = OBEX_RSP_FORBIDDEN;
|
2009-11-03 22:05:00 +08:00
|
|
|
goto done;
|
|
|
|
|
|
|
|
not_found:
|
|
|
|
if (nonhdr[0] != 0) {
|
2010-02-26 23:21:04 +08:00
|
|
|
rsp = OBEX_RSP_NOT_FOUND;
|
2009-11-03 22:05:00 +08:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mkdir(fullname, 0755) < 0) {
|
2010-02-26 23:21:04 +08:00
|
|
|
rsp = OBEX_RSP_FORBIDDEN;
|
2009-11-03 22:05:00 +08:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2010-02-26 23:21:04 +08:00
|
|
|
obex_set_folder(os, fullname);
|
2009-11-03 22:05:00 +08:00
|
|
|
|
|
|
|
done:
|
|
|
|
g_free(fullname);
|
2010-02-26 23:21:04 +08:00
|
|
|
return rsp;
|
2009-11-03 22:05:00 +08:00
|
|
|
}
|
|
|
|
|
2010-02-26 04:57:49 +08:00
|
|
|
static void ftp_disconnect(struct OBEX_session *os)
|
2009-11-10 03:00:41 +08:00
|
|
|
{
|
2010-02-26 04:57:49 +08:00
|
|
|
manager_unregister_session(os);
|
2009-11-10 03:00:41 +08:00
|
|
|
}
|
|
|
|
|
2009-11-03 22:05:00 +08:00
|
|
|
struct obex_service_driver pcsuite = {
|
|
|
|
.name = "Nokia OBEX PC Suite Services",
|
|
|
|
.service = OBEX_PCSUITE,
|
|
|
|
.channel = PCSUITE_CHANNEL,
|
|
|
|
.record = PCSUITE_RECORD,
|
|
|
|
.target = FTP_TARGET,
|
2009-11-16 15:17:47 +08:00
|
|
|
.target_size = TARGET_SIZE,
|
2010-02-22 23:36:51 +08:00
|
|
|
.who = PCSUITE_WHO,
|
|
|
|
.who_size = PCSUITE_WHO_SIZE,
|
2009-11-10 03:00:41 +08:00
|
|
|
.connect = ftp_connect,
|
2009-11-03 22:05:00 +08:00
|
|
|
.get = ftp_get,
|
|
|
|
.put = ftp_put,
|
|
|
|
.chkput = ftp_chkput,
|
2009-11-10 03:00:41 +08:00
|
|
|
.setpath = ftp_setpath,
|
|
|
|
.disconnect = ftp_disconnect
|
2009-11-03 22:05:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct obex_service_driver ftp = {
|
|
|
|
.name = "File Transfer server",
|
|
|
|
.service = OBEX_FTP,
|
|
|
|
.channel = FTP_CHANNEL,
|
|
|
|
.record = FTP_RECORD,
|
|
|
|
.target = FTP_TARGET,
|
2009-11-16 15:17:47 +08:00
|
|
|
.target_size = TARGET_SIZE,
|
2009-11-10 03:00:41 +08:00
|
|
|
.connect = ftp_connect,
|
2009-11-03 22:05:00 +08:00
|
|
|
.get = ftp_get,
|
|
|
|
.put = ftp_put,
|
|
|
|
.chkput = ftp_chkput,
|
2009-11-10 03:00:41 +08:00
|
|
|
.setpath = ftp_setpath,
|
|
|
|
.disconnect = ftp_disconnect
|
2009-11-03 22:05:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static int ftp_init(void)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = obex_service_driver_register(&ftp);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
return obex_service_driver_register(&pcsuite);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ftp_exit(void)
|
|
|
|
{
|
|
|
|
obex_service_driver_unregister(&ftp);
|
|
|
|
obex_service_driver_unregister(&pcsuite);
|
|
|
|
}
|
|
|
|
|
2009-11-03 22:11:19 +08:00
|
|
|
OBEX_PLUGIN_DEFINE(ftp, ftp_init, ftp_exit)
|