aboutsummaryrefslogtreecommitdiffstats
path: root/src/Instance.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-18 16:36:42 +0100
committerMax Kellermann <max@duempel.org>2014-01-26 00:10:05 +0100
commit5c4a42caa088335868342b25a834962cbc0d08a2 (patch)
tree388c039572317877f798e0f0c25d9e3c04ddcae3 /src/Instance.hxx
parente847788569bd91ca136160694a49665097c0e8ab (diff)
downloadmpd-5c4a42caa088335868342b25a834962cbc0d08a2.tar.gz
mpd-5c4a42caa088335868342b25a834962cbc0d08a2.tar.xz
mpd-5c4a42caa088335868342b25a834962cbc0d08a2.zip
neighbor: new subsystem to detect file servers on the local network
This commit adds the NeighborPlugin API which can be used to detect nearby file servers that can be used by input plugins. This list of servers is exported using the new "listneighbors" command. The idle even "neighbor" notifies interested clients when a new neighbor is found or an existing one is lost. There's a lot missing currently: protocol&user documentation, and a way to "mount" remote servers into the music database. Obviously, some code from the UPnP database plugin can be moved to a neighbor plugin.
Diffstat (limited to 'src/Instance.hxx')
-rw-r--r--src/Instance.hxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/Instance.hxx b/src/Instance.hxx
index ca7bb5197..a14719839 100644
--- a/src/Instance.hxx
+++ b/src/Instance.hxx
@@ -24,10 +24,24 @@
#include "db/DatabaseListener.hxx"
#include "Compiler.h"
+#ifdef ENABLE_NEIGHBOR_PLUGINS
+#include "neighbor/Listener.hxx"
+class NeighborGlue;
+#endif
+
class ClientList;
struct Partition;
-struct Instance final : public DatabaseListener {
+struct Instance final
+ : public DatabaseListener
+#ifdef ENABLE_NEIGHBOR_PLUGINS
+ , public NeighborListener
+#endif
+{
+#ifdef ENABLE_NEIGHBOR_PLUGINS
+ NeighborGlue *neighbors;
+#endif
+
ClientList *client_list;
Partition *partition;
@@ -53,6 +67,12 @@ struct Instance final : public DatabaseListener {
private:
virtual void OnDatabaseModified();
+
+#ifdef ENABLE_NEIGHBOR_PLUGINS
+ /* virtual methods from class NeighborListener */
+ virtual void FoundNeighbor(const NeighborInfo &info) override;
+ virtual void LostNeighbor(const NeighborInfo &info) override;
+#endif
};
#endif