Remove some outdated server code from network plugin

This commit is contained in:
Marcel Holtmann 2010-07-12 23:46:09 -03:00
parent c59ba92807
commit 8311b1dfc8
10 changed files with 95 additions and 548 deletions

View File

@ -160,7 +160,6 @@ builtin_sources += network/main.c \
network/manager.h network/manager.c \
network/common.h network/common.c \
network/server.h network/server.c \
network/bridge.h network/bridge.c \
network/connection.h network/connection.c
endif

View File

@ -1,148 +0,0 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2004-2010 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 <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <net/if.h>
#include <linux/sockios.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>
#include <bluetooth/bnep.h>
#include "log.h"
#include "bridge.h"
#include "common.h"
static int bridge_socket = -1;
static const char *gn_bridge = NULL;
static const char *nap_bridge = NULL;
int bridge_init(const char *gn_iface, const char *nap_iface)
{
#if 0
struct stat st;
if (stat("/sys/module/bridge", &st) < 0)
return -EOPNOTSUPP;
#endif
bridge_socket = socket(AF_INET, SOCK_STREAM, 0);
if (bridge_socket < 0) {
error("Failed to open bridge socket: %s (%d)",
strerror(errno), errno);
return -errno;
}
gn_bridge = gn_iface;
nap_bridge = nap_iface;
return 0;
}
void bridge_cleanup(void)
{
close(bridge_socket);
bridge_socket = -1;
}
int bridge_create(int id)
{
int err;
const char *name = bridge_get_name(id);
err = ioctl(bridge_socket, SIOCBRADDBR, name);
if (err < 0)
return -errno;
info("bridge %s created", name);
return 0;
}
int bridge_remove(int id)
{
int err;
const char *name = bridge_get_name(id);
err = bnep_if_down(name);
if (err < 0)
return err;
err = ioctl(bridge_socket, SIOCBRDELBR, name);
if (err < 0)
return -errno;
info("bridge %s removed", name);
return 0;
}
int bridge_add_interface(int id, const char *dev)
{
struct ifreq ifr;
int err;
int ifindex = if_nametoindex(dev);
const char *name = bridge_get_name(id);
if (!name)
return -EINVAL;
if (ifindex == 0)
return -ENODEV;
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, name, IFNAMSIZ - 1);
ifr.ifr_ifindex = ifindex;
err = ioctl(bridge_socket, SIOCBRADDIF, &ifr);
if (err < 0)
return err;
info("bridge %s: interface %s added", name, dev);
err = bnep_if_up(name, id);
if (err < 0)
return err;
return 0;
}
const char *bridge_get_name(int id)
{
if (id == BNEP_SVC_GN)
return gn_bridge;
if (id == BNEP_SVC_NAP)
return nap_bridge;
return NULL;
}

View File

@ -1,30 +0,0 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2004-2010 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 bridge_init(const char *gn_iface, const char *nap_iface);
void bridge_cleanup(void);
int bridge_create(int id);
int bridge_remove(int id);
int bridge_add_interface(int id, const char *dev);
const char *bridge_get_name(int id);

View File

@ -34,6 +34,7 @@
#include <sys/socket.h>
#include <sys/wait.h>
#include <net/if.h>
#include <linux/sockios.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>
@ -45,7 +46,6 @@
#include "common.h"
static int ctl;
static GSList *pids;
static struct {
const char *name; /* Friendly name */
@ -58,34 +58,6 @@ static struct {
{ NULL }
};
static const char *panu = NULL;
static const char *gn = NULL;
static const char *nap = NULL;
struct bnep_data {
char *devname;
char *script;
int pid;
};
static gint find_devname(gconstpointer a, gconstpointer b)
{
struct bnep_data *data = (struct bnep_data *) a;
const char *devname = b;
return strcmp(data->devname, devname);
}
static void script_exited(GPid pid, gint status, gpointer data)
{
if (WIFEXITED(status))
DBG("%d exited with status %d", pid, WEXITSTATUS(status));
else
DBG("%d was killed by signal %d", pid, WTERMSIG(status));
g_spawn_close_pid(pid);
}
uint16_t bnep_service_id(const char *svc)
{
int i;
@ -131,8 +103,7 @@ const char *bnep_name(uint16_t id)
return NULL;
}
int bnep_init(const char *panu_script, const char *gn_script,
const char *nap_script)
int bnep_init(void)
{
ctl = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_BNEP);
@ -143,9 +114,6 @@ int bnep_init(const char *panu_script, const char *gn_script,
return -err;
}
panu = panu_script;
gn = gn_script;
nap = nap_script;
return 0;
}
@ -219,155 +187,76 @@ int bnep_connadd(int sk, uint16_t role, char *dev)
return 0;
}
static void bnep_setup(gpointer data)
int bnep_if_up(const char *devname)
{
}
static int bnep_exec(const char **argv)
{
int pid;
GSpawnFlags flags = G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH;
if (!g_spawn_async(NULL, (char **) argv, NULL, flags, bnep_setup, NULL,
&pid, NULL)) {
error("Unable to execute %s %s", argv[0], argv[1]);
return -EINVAL;
}
return pid;
}
int bnep_if_up(const char *devname, uint16_t id)
{
int sd, err;
struct ifreq ifr;
const char *argv[5];
struct bnep_data *bnep = NULL;
GSList *l;
int sk, err;
/* Check if a script is running */
l = g_slist_find_custom(pids, devname, find_devname);
if (l) {
bnep = l->data;
sk = socket(AF_INET, SOCK_DGRAM, 0);
if (bnep->script && !strcmp(bnep->script, "avahi-autoipd")) {
argv[0] = bnep->script;
argv[1] = devname;
argv[2] = "--refresh";
argv[3] = NULL;
bnep->pid = bnep_exec(argv);
}
}
sd = socket(AF_INET, SOCK_DGRAM, 0);
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, devname, IF_NAMESIZE - 1);
ifr.ifr_flags |= IFF_UP;
ifr.ifr_flags |= IFF_MULTICAST;
if ((ioctl(sd, SIOCSIFFLAGS, (caddr_t) &ifr)) < 0) {
err = errno;
error("Could not bring up %s. %s(%d)", devname, strerror(err),
err);
return -err;
err = ioctl(sk, SIOCSIFFLAGS, (caddr_t) &ifr);
close(sk);
if (err < 0) {
error("Could not bring up %s", devname);
return err;
}
if (bnep)
return bnep->pid;
bnep = g_new0(struct bnep_data, 1);
bnep->devname = g_strdup(devname);
if (!id)
goto done;
if (id == BNEP_SVC_PANU)
bnep->script = g_strdup(panu);
else if (id == BNEP_SVC_GN)
bnep->script = g_strdup(gn);
else
bnep->script = g_strdup(nap);
if (!bnep->script)
goto done;
argv[0] = bnep->script;
argv[1] = devname;
if (!strcmp(bnep->script, "avahi-autoipd")) {
argv[2] = "--no-drop-root";
argv[3] = "--no-chroot";
argv[4] = NULL;
} else
argv[2] = NULL;
bnep->pid = bnep_exec(argv);
g_child_watch_add(bnep->pid, script_exited, bnep);
done:
pids = g_slist_append(pids, bnep);
return bnep->pid;
return 0;
}
int bnep_if_down(const char *devname)
{
int sd, err, pid;
struct ifreq ifr;
struct bnep_data *bnep;
GSList *l;
GSpawnFlags flags;
const char *argv[4];
int sk, err;
l = g_slist_find_custom(pids, devname, find_devname);
if (!l)
return 0;
sk = socket(AF_INET, SOCK_DGRAM, 0);
bnep = l->data;
if (!bnep->pid)
goto done;
if (bnep->script && !strcmp(bnep->script, "avahi-autoipd")) {
argv[0] = bnep->script;
argv[1] = devname;
argv[2] = "--kill";
argv[3] = NULL;
flags = G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH;
g_spawn_async(NULL, (char **) argv, NULL, flags, bnep_setup,
(gpointer) devname, &pid, NULL);
goto done;
}
/* Kill script */
err = kill(bnep->pid, SIGTERM);
if (err < 0)
error("kill(%d, SIGTERM): %s (%d)", bnep->pid,
strerror(errno), errno);
done:
sd = socket(AF_INET, SOCK_DGRAM, 0);
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, devname, IF_NAMESIZE - 1);
ifr.ifr_flags &= ~IFF_UP;
/* Bring down the interface */
ioctl(sd, SIOCSIFFLAGS, (caddr_t) &ifr);
err = ioctl(sk, SIOCSIFFLAGS, (caddr_t) &ifr);
pids = g_slist_remove(pids, bnep);
if (bnep->devname)
g_free(bnep->devname);
if (bnep->script)
g_free(bnep->script);
g_free(bnep);
close(sk);
return 0;
}
int bnep_add_to_bridge(const char *devname, const char *bridge)
{
int ifindex = if_nametoindex(devname);
struct ifreq ifr;
int sk, err;
if (!devname || !bridge)
return -EINVAL;
sk = socket(AF_INET, SOCK_STREAM, 0);
if (sk < 0)
return -1;
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, bridge, IFNAMSIZ - 1);
ifr.ifr_ifindex = ifindex;
err = ioctl(sk, SIOCBRADDIF, &ifr);
close(sk);
if (err < 0)
return err;
info("bridge %s: interface %s added", bridge, devname);
return 0;
}

View File

@ -26,8 +26,7 @@
#define GN_UUID "00001117-0000-1000-8000-00805f9b34fb"
#define BNEP_SVC_UUID "0000000f-0000-1000-8000-00805f9b34fb"
int bnep_init(const char *panu_script, const char *gn_script,
const char *nap_script);
int bnep_init(void);
int bnep_cleanup(void);
uint16_t bnep_service_id(const char *svc);
@ -38,5 +37,6 @@ int bnep_kill_connection(bdaddr_t *dst);
int bnep_kill_all_connections(void);
int bnep_connadd(int sk, uint16_t role, char *dev);
int bnep_if_up(const char *devname, uint16_t id);
int bnep_if_up(const char *devname);
int bnep_if_down(const char *devname);
int bnep_add_to_bridge(const char *devname, const char *bridge);

View File

@ -82,7 +82,6 @@ struct __service_16 {
} __attribute__ ((packed));
static DBusConnection *connection = NULL;
static const char *prefix = NULL;
static GSList *peers = NULL;
static struct network_peer *find_peer(GSList *list, const char *path)
@ -174,8 +173,8 @@ static gboolean bnep_watchdog_cb(GIOChannel *chan, GIOCondition cond,
bnep_if_down(nc->dev);
nc->state = DISCONNECTED;
memset(nc->dev, 0, 16);
strncpy(nc->dev, prefix, sizeof(nc->dev) - 1);
memset(nc->dev, 0, sizeof(nc->dev));
strcpy(nc->dev, "bnep%d");
return FALSE;
}
@ -289,7 +288,7 @@ static gboolean bnep_setup_cb(GIOChannel *chan, GIOCondition cond,
goto failed;
}
bnep_if_up(nc->dev, nc->id);
bnep_if_up(nc->dev);
pdev = nc->dev;
uuid = bnep_uuid(nc->id);
@ -632,8 +631,8 @@ int connection_register(struct btd_device *device, const char *path,
nc = g_new0(struct network_conn, 1);
nc->id = id;
memset(nc->dev, 0, 16);
strncpy(nc->dev, prefix, sizeof(nc->dev) - 1);
memset(nc->dev, 0, sizeof(nc->dev));
strcpy(nc->dev, "bnep%d");
nc->state = DISCONNECTED;
nc->peer = peer;
@ -642,17 +641,15 @@ int connection_register(struct btd_device *device, const char *path,
return 0;
}
int connection_init(DBusConnection *conn, const char *iface_prefix)
int connection_init(DBusConnection *conn)
{
connection = dbus_connection_ref(conn);
prefix = iface_prefix;
return 0;
}
void connection_exit()
void connection_exit(void)
{
dbus_connection_unref(connection);
connection = NULL;
prefix = NULL;
}

View File

@ -21,8 +21,8 @@
*
*/
int connection_init(DBusConnection *conn, const char *iface_prefix);
void connection_exit();
int connection_init(DBusConnection *conn);
void connection_exit(void);
int connection_register(struct btd_device *device, const char *path,
bdaddr_t *src, bdaddr_t *dst, uint16_t id);
void connection_unregister(const char *path, uint16_t id);

View File

@ -37,54 +37,23 @@
#include "adapter.h"
#include "device.h"
#include "bridge.h"
#include "manager.h"
#include "common.h"
#include "connection.h"
#include "server.h"
#define IFACE_PREFIX "bnep%d"
#define GN_IFACE "pan0"
#define NAP_IFACE "pan1"
static struct btd_adapter_driver network_panu_server_driver;
static struct btd_adapter_driver network_gn_server_driver;
static struct btd_adapter_driver network_nap_server_driver;
static DBusConnection *connection = NULL;
static struct network_conf {
gboolean connection_enabled;
gboolean server_enabled;
gboolean security;
char *iface_prefix;
char *panu_script;
char *gn_script;
char *nap_script;
char *gn_iface;
char *nap_iface;
} conf = {
.connection_enabled = TRUE,
.server_enabled = TRUE,
.security = TRUE,
.iface_prefix = NULL,
.panu_script = NULL,
.gn_script = NULL,
.nap_script = NULL,
.gn_iface = NULL,
.nap_iface = NULL
};
static void conf_cleanup(void)
{
g_free(conf.iface_prefix);
g_free(conf.panu_script);
g_free(conf.gn_script);
g_free(conf.nap_script);
g_free(conf.gn_iface);
g_free(conf.nap_iface);
}
static void read_config(const char *file)
{
GKeyFile *keyfile;
@ -122,67 +91,11 @@ static void read_config(const char *file)
g_clear_error(&err);
}
#if 0
conf.panu_script = g_key_file_get_string(keyfile, "PANU Role",
"Script", &err);
if (err) {
DBG("%s: %s", file, err->message);
g_clear_error(&err);
}
conf.gn_script = g_key_file_get_string(keyfile, "GN Role",
"Script", &err);
if (err) {
DBG("%s: %s", file, err->message);
g_clear_error(&err);
}
conf.nap_script = g_key_file_get_string(keyfile, "NAP Role",
"Script", &err);
if (err) {
DBG("%s: %s", file, err->message);
g_clear_error(&err);
}
#endif
conf.iface_prefix = g_key_file_get_string(keyfile, "PANU Role",
"Interface", &err);
if (err) {
DBG("%s: %s", file, err->message);
g_clear_error(&err);
}
conf.gn_iface = g_key_file_get_string(keyfile, "GN Role",
"Interface", &err);
if (err) {
DBG("%s: %s", file, err->message);
g_clear_error(&err);
}
conf.nap_iface = g_key_file_get_string(keyfile, "NAP Role",
"Interface", &err);
if (err) {
DBG("%s: %s", file, err->message);
g_clear_error(&err);
}
done:
g_key_file_free(keyfile);
if (!conf.iface_prefix)
conf.iface_prefix = g_strdup(IFACE_PREFIX);
if (!conf.gn_iface)
conf.gn_iface = g_strdup(GN_IFACE);
if (!conf.nap_iface)
conf.nap_iface = g_strdup(NAP_IFACE);
DBG("Config options: InterfacePrefix=%s, PANU_Script=%s, "
"GN_Script=%s, NAP_Script=%s, GN_Interface=%s, "
"NAP_Interface=%s, Security=%s",
conf.iface_prefix, conf.panu_script, conf.gn_script,
conf.nap_script, conf.gn_iface, conf.nap_iface,
conf.security ? "true" : "false");
DBG("Config options: Security=%s",
conf.security ? "true" : "false");
}
static int network_probe(struct btd_device *device, GSList *uuids, uint16_t id)
@ -238,55 +151,22 @@ static void nap_remove(struct btd_device *device)
network_remove(device, BNEP_SVC_NAP);
}
static int network_server_probe(struct btd_adapter *adapter, uint16_t id)
static int network_server_probe(struct btd_adapter *adapter)
{
const gchar *path = adapter_get_path(adapter);
DBG("path %s", path);
if (!conf.server_enabled)
return 0;
return server_register(adapter, id);
return server_register(adapter);
}
static void network_server_remove(struct btd_adapter *adapter, uint16_t id)
static void network_server_remove(struct btd_adapter *adapter)
{
const gchar *path = adapter_get_path(adapter);
DBG("path %s", path);
server_unregister(adapter, id);
}
static int panu_server_probe(struct btd_adapter *adapter)
{
return network_server_probe(adapter, BNEP_SVC_PANU);
}
static int gn_server_probe(struct btd_adapter *adapter)
{
return network_server_probe(adapter, BNEP_SVC_GN);
}
static int nap_server_probe(struct btd_adapter *adapter)
{
return network_server_probe(adapter, BNEP_SVC_NAP);
}
static void panu_server_remove(struct btd_adapter *adapter)
{
network_server_remove(adapter, BNEP_SVC_PANU);
}
static void gn_server_remove(struct btd_adapter *adapter)
{
network_server_remove(adapter, BNEP_SVC_GN);
}
static void nap_server_remove(struct btd_adapter *adapter)
{
network_server_remove(adapter, BNEP_SVC_NAP);
server_unregister(adapter);
}
static struct btd_device_driver network_panu_driver = {
@ -310,29 +190,17 @@ static struct btd_device_driver network_nap_driver = {
.remove = nap_remove,
};
static struct btd_adapter_driver network_panu_server_driver = {
.name = "network-panu-server",
.probe = panu_server_probe,
.remove = panu_server_remove,
};
static struct btd_adapter_driver network_gn_server_driver = {
.name = "network-gn-server",
.probe = gn_server_probe,
.remove = gn_server_remove,
};
static struct btd_adapter_driver network_nap_server_driver = {
.name = "network-nap-server",
.probe = nap_server_probe,
.remove = nap_server_remove,
static struct btd_adapter_driver network_server_driver = {
.name = "network-server",
.probe = network_server_probe,
.remove = network_server_remove,
};
int network_manager_init(DBusConnection *conn)
{
read_config(CONFIGDIR "/network.conf");
if (bnep_init(conf.panu_script, conf.gn_script, conf.nap_script)) {
if (bnep_init()) {
error("Can't init bnep module");
return -1;
}
@ -343,20 +211,14 @@ int network_manager_init(DBusConnection *conn)
* (setup connection request) contains the destination service
* field that defines which service the source is connecting to.
*/
if (bridge_init(conf.gn_iface, conf.nap_iface) < 0) {
error("Can't init bridge module");
return -1;
}
if (server_init(conn, conf.iface_prefix, conf.security) < 0)
if (server_init(conn, conf.security) < 0)
return -1;
/* Register PANU, GN and NAP servers if they don't exist */
btd_register_adapter_driver(&network_panu_server_driver);
btd_register_adapter_driver(&network_gn_server_driver);
btd_register_adapter_driver(&network_nap_server_driver);
/* Register network server if it doesn't exist */
btd_register_adapter_driver(&network_server_driver);
if (connection_init(conn, conf.iface_prefix) < 0)
if (connection_init(conn) < 0)
return -1;
btd_register_device_driver(&network_panu_driver);
@ -380,14 +242,10 @@ void network_manager_exit(void)
connection_exit();
}
btd_unregister_adapter_driver(&network_panu_server_driver);
btd_unregister_adapter_driver(&network_gn_server_driver);
btd_unregister_adapter_driver(&network_nap_server_driver);
btd_unregister_adapter_driver(&network_server_driver);
dbus_connection_unref(connection);
connection = NULL;
bnep_cleanup();
bridge_cleanup();
conf_cleanup();
}

View File

@ -50,7 +50,6 @@
#include "btio.h"
#include "glib-helper.h"
#include "bridge.h"
#include "common.h"
#include "server.h"
@ -88,7 +87,6 @@ struct network_server {
static DBusConnection *connection = NULL;
static GSList *adapters = NULL;
static const char *prefix = NULL;
static gboolean security = TRUE;
static struct network_adapter *find_adapter(GSList *list,
@ -275,16 +273,16 @@ static int server_connadd(struct network_server *ns,
struct network_session *session,
uint16_t dst_role)
{
const char *bridge = "tether";
char devname[16];
const char *bridge;
int err, nsk;
/* Server can be disabled in the meantime */
if (ns->enable == FALSE)
return -EPERM;
memset(devname, 0, 16);
strncpy(devname, prefix, sizeof(devname) - 1);
memset(devname, 0, sizeof(devname));
strcpy(devname, "bnep%d");
nsk = g_io_channel_unix_get_fd(session->io);
err = bnep_connadd(nsk, dst_role, devname);
@ -293,18 +291,13 @@ static int server_connadd(struct network_server *ns,
info("Added new connection: %s", devname);
bridge = bridge_get_name(ns->id);
if (bridge) {
if (bridge_add_interface(ns->id, devname) < 0) {
error("Can't add %s to the bridge %s: %s(%d)",
devname, bridge, strerror(errno),
errno);
return -EPERM;
}
if (bnep_add_to_bridge(devname, bridge) < 0) {
error("Can't add %s to the bridge %s: %s(%d)",
devname, bridge, strerror(errno), errno);
return -EPERM;
}
bnep_if_up(devname, 0);
} else
bnep_if_up(devname, ns->id);
bnep_if_up(devname);
ns->sessions = g_slist_append(ns->sessions, session);
@ -322,8 +315,8 @@ static uint16_t bnep_setup_chk(uint16_t dst_role, uint16_t src_role)
return BNEP_CONN_INVALID_SRC;
case BNEP_SVC_PANU:
if (src_role == BNEP_SVC_PANU ||
src_role == BNEP_SVC_GN ||
src_role == BNEP_SVC_NAP)
src_role == BNEP_SVC_GN ||
src_role == BNEP_SVC_NAP)
return 0;
return BNEP_CONN_INVALID_SRC;
@ -526,24 +519,16 @@ drop:
g_io_channel_shutdown(chan, TRUE, NULL);
}
int server_init(DBusConnection *conn, const char *iface_prefix,
gboolean secure)
int server_init(DBusConnection *conn, gboolean secure)
{
security = secure;
connection = dbus_connection_ref(conn);
prefix = iface_prefix;
if (bridge_create(BNEP_SVC_GN) < 0)
error("Can't create GN bridge");
return 0;
}
void server_exit()
void server_exit(void)
{
if (bridge_remove(BNEP_SVC_GN) < 0)
error("Can't remove GN bridge");
dbus_connection_unref(connection);
connection = NULL;
}
@ -840,11 +825,12 @@ static struct network_adapter *create_adapter(struct btd_adapter *adapter)
return na;
}
int server_register(struct btd_adapter *adapter, uint16_t id)
int server_register(struct btd_adapter *adapter)
{
struct network_adapter *na;
struct network_server *ns;
const char *path;
uint16_t id = BNEP_SVC_NAP;
na = find_adapter(adapters, adapter);
if (!na) {
@ -898,10 +884,11 @@ int server_register(struct btd_adapter *adapter, uint16_t id)
return 0;
}
int server_unregister(struct btd_adapter *adapter, uint16_t id)
int server_unregister(struct btd_adapter *adapter)
{
struct network_adapter *na;
struct network_server *ns;
uint16_t id = BNEP_SVC_NAP;
na = find_adapter(adapters, adapter);
if (!na)

View File

@ -21,14 +21,9 @@
*
*/
int server_init(DBusConnection *conn, const char *iface_prefix,
gboolean secure);
void server_exit();
int server_register(struct btd_adapter *adapter, uint16_t id);
int server_unregister(struct btd_adapter *adapter, uint16_t id);
int server_register_from_file(const char *path, const bdaddr_t *src,
uint16_t id, const char *filename);
int server_store(const char *path);
int server_init(DBusConnection *conn, gboolean secure);
void server_exit(void);
int server_register(struct btd_adapter *adapter);
int server_unregister(struct btd_adapter *adapter);
int server_find_data(const char *path, const char *pattern);