diff options
Diffstat (limited to 'network')
-rw-r--r-- | network/Makefile.am | 2 | ||||
-rw-r--r-- | network/common.c | 20 | ||||
-rw-r--r-- | network/common.h | 4 | ||||
-rw-r--r-- | network/connection.c | 8 | ||||
-rw-r--r-- | network/manager.c | 14 | ||||
-rw-r--r-- | network/manager.h | 6 | ||||
-rw-r--r-- | network/network-api.txt | 199 | ||||
-rw-r--r-- | network/server.c | 14 | ||||
-rwxr-xr-x | network/test-network | 37 |
9 files changed, 6 insertions, 298 deletions
diff --git a/network/Makefile.am b/network/Makefile.am index 71291d93..5966a619 100644 --- a/network/Makefile.am +++ b/network/Makefile.am @@ -19,6 +19,6 @@ AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@ INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/src -EXTRA_DIST = network.conf network-api.txt test-network +EXTRA_DIST = network.conf MAINTAINERCLEANFILES = Makefile.in diff --git a/network/common.c b/network/common.c index 151e4810..980486fc 100644 --- a/network/common.c +++ b/network/common.c @@ -32,7 +32,6 @@ #include <sys/param.h> #include <sys/ioctl.h> #include <sys/socket.h> -#include <sys/stat.h> #include <sys/wait.h> #include <net/if.h> @@ -44,7 +43,6 @@ #include "logging.h" #include "common.h" -#include "textfile.h" static int ctl; static GSList *pids; @@ -372,21 +370,3 @@ done: return 0; } - -int read_remote_name(bdaddr_t *src, bdaddr_t *dst, char *buf, size_t size) -{ - char filename[PATH_MAX + 1], addr[18], *str; - - ba2str(src, addr); - create_name(filename, PATH_MAX, STORAGEDIR, addr, "names"); - - ba2str(dst, addr); - str = textfile_get(filename, addr); - if (!str) - return -ENOENT; - - snprintf(buf, size, "%s", str); - free(str); - - return 0; -} diff --git a/network/common.h b/network/common.h index cc154471..78d0d769 100644 --- a/network/common.h +++ b/network/common.h @@ -21,8 +21,6 @@ * */ -#define MAX_PATH_LENGTH 64 /* D-Bus path */ - #define PANU_UUID "00001115-0000-1000-8000-00805f9b34fb" #define NAP_UUID "00001116-0000-1000-8000-00805f9b34fb" #define GN_UUID "00001117-0000-1000-8000-00805f9b34fb" @@ -41,5 +39,3 @@ 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_down(const char *devname); - -int read_remote_name(bdaddr_t *src, bdaddr_t *dst, char *buf, size_t size); diff --git a/network/connection.c b/network/connection.c index c61eb49c..16d3e383 100644 --- a/network/connection.c +++ b/network/connection.c @@ -28,29 +28,21 @@ #include <stdio.h> #include <errno.h> #include <unistd.h> -#include <sys/stat.h> -#include <sys/param.h> #include <netinet/in.h> #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> -#include <bluetooth/hci_lib.h> -#include <bluetooth/l2cap.h> #include <bluetooth/bnep.h> #include <bluetooth/sdp.h> #include <glib.h> #include <gdbus.h> -#include "../src/dbus-common.h" - #include "logging.h" -#include "textfile.h" #include "glib-helper.h" #include "error.h" #include "common.h" -#include "connection.h" #define NETWORK_PEER_INTERFACE "org.bluez.network.Peer" diff --git a/network/manager.c b/network/manager.c index 7cbf8220..8067b821 100644 --- a/network/manager.c +++ b/network/manager.c @@ -25,34 +25,24 @@ #include <config.h> #endif -#include <errno.h> -#include <ctype.h> -#include <dirent.h> - -#include <sys/stat.h> - #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> #include <bluetooth/bnep.h> #include <bluetooth/sdp.h> -#include <bluetooth/sdp_lib.h> #include <glib.h> #include <gdbus.h> #include "logging.h" -#include "textfile.h" -#include "glib-helper.h" #include "adapter.h" #include "device.h" -#include "error.h" #include "bridge.h" #include "manager.h" #include "common.h" - -#define MAX_NAME_SIZE 256 +#include "connection.h" +#include "server.h" static struct network_conf *conf = NULL;/* Network service configuration */ diff --git a/network/manager.h b/network/manager.h index 9b16c2a3..455b0963 100644 --- a/network/manager.h +++ b/network/manager.h @@ -21,12 +21,6 @@ * */ -#include "connection.h" -#include "server.h" - -#define MAX_PATH_LENGTH 64 /* D-Bus path */ -#define NETWORK_PATH "/org/bluez/network" - struct network_conf { gboolean connection_enabled; gboolean server_enabled; diff --git a/network/network-api.txt b/network/network-api.txt deleted file mode 100644 index 2d46abfd..00000000 --- a/network/network-api.txt +++ /dev/null @@ -1,199 +0,0 @@ -Bluetooth network service API description -***************************************** - -Copyright (C) 2006-2007 Marcel Holtmann <marcel@holtmann.org> - - -Network Manager hierarchy -========================= - -Interface org.bluez.network.Manager -Object path /org/bluez/network - -Methods array{string} ListServers() - - Returns an array of available network devices paths. - Currently only NAP and GN are supported. - - string FindServer(string pattern) - - Returns server path. - - Possible errors: org.bluez.Error.DoesNotExist - org.bluez.Error.Failed - - string CreateConnection(string address, string uuid) - - Creates a network connection object(NAP or GN). - - Possible errors: org.bluez.Error.AlreadyExists - org.bluez.Error.NotSupported - org.bluez.Error.ConnectionAttemptFailed - org.bluez.Error.Failed - - void RemoveConnection(string path) - - Removes a network connection object for a given path. - - Possible errors: org.bluez.Error.DoesNotExist - org.bluez.Error.Failed - - array{string} ListConnections() - - Returns an array of available network connections paths. - - string FindConnection(string pattern) - - Returns connection path. - - Possible errors: org.bluez.Error.DoesNotExist - org.bluez.Error.Failed - - string LastConnection() - - Returns last connected connection path, if none is connected - fallback to last created connection. - - Possible errors: org.bluez.Error.DoesNotExist - - string DefaultConnection() - - Returns default connection path. - - Possible errors: org.bluez.Error.DoesNotExist - - string ChangeDefaultConnection(string pattern) - - Changes default connection path. - - Possible errors: org.bluez.Error.DoesNotExist - -Signals void ConnectionCreated(string path) - - void ConnectionRemoved(string path) - - void DefaultConnectionChanged(string path) - - -Network Server hierarchy (experimental) -======================================= - -Interface org.bluez.network.Server -Object path /org/bluez/network/{gn, nap, panu} - -Methods string GetUUID() - - Returns the UUID-128 string representation of - the server. - - void Enable() - - Enable server and updates service record. - - Possible errors: org.bluez.Error.AlreadyExists - org.bluez.Error.Failed - - void Disable() - - Disable server and remove service record. - - Possible errors: org.bluez.Error.Failed - - bool IsEnabled() - - Returns the server status. - - void SetName(string name) - - Sets the name attribute. - - string GetName() - - Returns the service name. - - void SetAddressRange(string start, string end) - - TBD - - void SetRouting(string interface) - - TBD - - dict GetInfo() - - Returns the server properties. - -Signals void Enabled() - - void Disabled() - - -Network Connection hierarchy (experimental) -=========================================== - -Interface org.bluez.network.Connection -Object path /org/bluez/network/connection* - -Methods string GetAdapter() - - Returns the Bluetooth address of the adapter. - - string GetAddress() - - Returns the Bluetooth address of the ending point. - - string GetUUID() - - Returns the uuid 128 string representation of - the connected service. - - string GetName() - - Returns the string representation of connected host. - - Possible errors: org.bluez.Error.Failed - - string GetDescription() - - Returns the string description of connected host. - - Possible errors: org.bluez.Error.Failed - - string GetInterface() - - Returns the string network interface. - - Possible errors: org.bluez.Error.Failed - - string Connect() - - Connects to host and return the network interface - created. - - Possible errors: org.bluez.Error.ConnectionAttemptFailed - org.bluez.Error.Failed - - void CancelConnect() - - Abort connection attempt in case of errors or - timeouts in the client. - - Possible errors: org.bluez.Error.Failed - - void Disconnect() - - Disconnects to host. - - Possible errors: org.bluez.Error.Failed - - bool IsConnected() - - Returns the connection status. - - dict GetInfo() - - Returns the connection properties. - -Signals void Connected() - - void Disconnected() diff --git a/network/server.c b/network/server.c index 3fa99d25..00e8f0aa 100644 --- a/network/server.c +++ b/network/server.c @@ -29,18 +29,13 @@ #include <unistd.h> #include <stdlib.h> #include <errno.h> -#include <sys/stat.h> -#include <sys/param.h> -#include <net/if.h> #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> -#include <bluetooth/hci_lib.h> #include <bluetooth/bnep.h> #include <bluetooth/l2cap.h> #include <bluetooth/sdp.h> #include <bluetooth/sdp_lib.h> - #include <netinet/in.h> #include <glib.h> @@ -51,19 +46,16 @@ #include "logging.h" #include "error.h" -#include "textfile.h" #include "sdpd.h" #include "glib-helper.h" +#include "bridge.h" +#include "common.h" + #define NETWORK_PEER_INTERFACE "org.bluez.network.Peer" #define NETWORK_HUB_INTERFACE "org.bluez.network.Hub" #define NETWORK_ROUTER_INTERFACE "org.bluez.network.Router" #define SETUP_TIMEOUT 1000 -#define MAX_SETUP_ATTEMPTS 3 - -#include "bridge.h" -#include "common.h" -#include "manager.h" /* Pending Authorization */ struct setup_session { diff --git a/network/test-network b/network/test-network deleted file mode 100755 index f428c25f..00000000 --- a/network/test-network +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python - -import dbus - -bus = dbus.SystemBus() - -manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'), - 'org.bluez.Manager') - -conn = manager.ActivateService('network') - -network = dbus.Interface(bus.get_object(conn, '/org/bluez/network'), - 'org.bluez.network.Manager') - -try: - nap = dbus.Interface(bus.get_object(conn, network.FindServer('nap')), - 'org.bluez.network.Server') -except: - pass - -try: - gn = dbus.Interface(bus.get_object(conn, network.FindServer('gn')), - 'org.bluez.network.Server') -except: - pass - -try: - panu = dbus.Interface(bus.get_object(conn, network.FindServer('panu')), - 'org.bluez.network.Server') -except: - pass - -try: - client = dbus.Interface(bus.get_object(conn, network.LastConnection()), - 'org.bluez.network.Connection') -except: - pass |