summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-09 16:38:49 +0000
committerDavid Robillard <d@drobilla.net>2012-05-09 16:38:49 +0000
commitffdf4624323af943a2f3f7241fa87d97afc50460 (patch)
treee6faffb9d979cba055bde24d1957420abdea851a /src
parent6932da9169a38a5a8eafc63357b9ede00cb46117 (diff)
downloadingen-ffdf4624323af943a2f3f7241fa87d97afc50460.tar.gz
ingen-ffdf4624323af943a2f3f7241fa87d97afc50460.tar.bz2
ingen-ffdf4624323af943a2f3f7241fa87d97afc50460.zip
Remove old HTTP and OSC stuff.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4329 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/gui/ConnectWindow.cpp17
-rw-r--r--src/http/HTTPClientReceiver.cpp232
-rw-r--r--src/http/HTTPClientReceiver.hpp85
-rw-r--r--src/http/HTTPClientSender.cpp137
-rw-r--r--src/http/HTTPClientSender.hpp105
-rw-r--r--src/http/HTTPEngineReceiver.cpp227
-rw-r--r--src/http/HTTPEngineReceiver.hpp75
-rw-r--r--src/http/HTTPEngineSender.cpp197
-rw-r--r--src/http/HTTPEngineSender.hpp123
-rw-r--r--src/http/HTTPSender.cpp155
-rw-r--r--src/http/HTTPSender.hpp60
-rw-r--r--src/http/ingen_http_client.cpp53
-rw-r--r--src/http/ingen_http_server.cpp53
-rw-r--r--src/http/wscript28
-rw-r--r--src/ingen/main.cpp22
-rw-r--r--src/osc/OSCClientReceiver.cpp277
-rw-r--r--src/osc/OSCClientReceiver.hpp87
-rw-r--r--src/osc/OSCClientSender.cpp228
-rw-r--r--src/osc/OSCClientSender.hpp105
-rw-r--r--src/osc/OSCEngineReceiver.cpp587
-rw-r--r--src/osc/OSCEngineReceiver.hpp119
-rw-r--r--src/osc/OSCEngineSender.cpp240
-rw-r--r--src/osc/OSCEngineSender.hpp115
-rw-r--r--src/osc/OSCSender.cpp110
-rw-r--r--src/osc/OSCSender.hpp51
-rw-r--r--src/osc/ingen_osc_client.cpp54
-rw-r--r--src/osc/ingen_osc_server.cpp52
-rw-r--r--src/osc/macros.h31
-rw-r--r--src/osc/wscript28
-rw-r--r--src/shared/Configuration.cpp16
30 files changed, 12 insertions, 3657 deletions
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 538d5c59..6c5a8e2b 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -148,13 +148,9 @@ ConnectWindow::connect(bool existing)
Ingen::Shared::World* world = _app->world();
-#if defined(HAVE_LIBLO) || defined(HAVE_SOUP)
+#ifdef HAVE_SOCKET
if (_mode == CONNECT_REMOTE) {
-#ifdef HAVE_LIBLO
- string uri = "osc.udp://localhost:16180";
-#else
- string uri = "http://localhost:16180";
-#endif
+ string uri = "unix:///tmp/ingen.sock";
if (_widgets_loaded) {
const std::string& user_uri = _url_entry->get_text();
if (Raul::URI::is_valid(user_uri))
@@ -176,14 +172,13 @@ ConnectWindow::connect(bool existing)
sigc::mem_fun(this, &ConnectWindow::gtk_callback), 40);
} else if (_mode == LAUNCH_REMOTE) {
-#ifdef HAVE_LIBLO
int port = _port_spinbutton->get_value_as_int();
char port_str[8];
snprintf(port_str, sizeof(port_str), "%u", port);
const string cmd = string("ingen -e -E ").append(port_str);
if (Raul::Process::launch(cmd)) {
- const std::string engine_uri = string("osc.udp://localhost:").append(port_str);
+ const std::string engine_uri = string("tcp://localhost:").append(port_str);
SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
world->set_engine(world->interface(engine_uri, tsci));
@@ -197,12 +192,8 @@ ConnectWindow::connect(bool existing)
} else {
error << "Failed to launch ingen process." << endl;
}
-#else
- error << "No OSC support" << endl;
-#endif
-
} else
-#endif // defined(HAVE_LIBLO) || defined(HAVE_SOUP)
+#endif
if (_mode == INTERNAL) {
if (!world->local_engine())
world->load_module("server");
diff --git a/src/http/HTTPClientReceiver.cpp b/src/http/HTTPClientReceiver.cpp
deleted file mode 100644
index 64554ce4..00000000
--- a/src/http/HTTPClientReceiver.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/socket.h>
-
-#include <libsoup/soup.h>
-
-#include "ingen/shared/World.hpp"
-#include "raul/log.hpp"
-
-#include "HTTPClientReceiver.hpp"
-
-#define LOG(s) s << "[HTTPClientReceiver] "
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-
-using namespace Serialisation;
-
-namespace Client {
-
-HTTPClientReceiver::HTTPClientReceiver(
- Shared::World* world,
- const std::string& url,
- SharedPtr<ClientInterface> target)
- : _target(target)
- , _world(world)
- , _url(url)
-{
- _client_session = soup_session_sync_new();
- start(false);
- assert(_client_session);
-}
-
-HTTPClientReceiver::~HTTPClientReceiver()
-{
- stop();
-}
-
-HTTPClientReceiver::Listener::Listener(HTTPClientReceiver* receiver, const std::string& uri)
- : _uri(uri)
- , _receiver(receiver)
-{
- const string port_str = uri.substr(uri.find_last_of(":")+1);
- int port = atoi(port_str.c_str());
-
- LOG(info) << "Client HTTP listen: " << uri << " (port " << port << ")" << endl;
-
- struct sockaddr_in servaddr;
-
- // Create listen address
- memset(&servaddr, 0, sizeof(servaddr));
- servaddr.sin_family = AF_INET;
- servaddr.sin_port = htons(port);
-
- // Create listen socket
- if ((_sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- LOG(error) << "Error creating listening socket: %s" << strerror(errno) << endl;
- _sock = -1;
- return;
- }
-
- // Set remote address (FIXME: always localhost)
- if (inet_aton("127.0.0.1", &servaddr.sin_addr) <= 0) {
- LOG(error) << "Invalid remote IP address" << endl;
- _sock = -1;
- return;
- }
-
- // Connect to server
- if (connect(_sock, (struct sockaddr*)&servaddr, sizeof(servaddr)) < 0) {
- LOG(error) << "Error calling connect: " << strerror(errno) << endl;
- _sock = -1;
- return;
- }
-}
-
-HTTPClientReceiver::Listener::~Listener()
-{
- close(_sock);
-}
-
-void
-HTTPClientReceiver::send(SoupMessage* msg)
-{
- assert(SOUP_IS_SESSION(_client_session));
- assert(SOUP_IS_MESSAGE(msg));
- soup_session_queue_message(_client_session, msg, message_callback, this);
-}
-
-void
-HTTPClientReceiver::close_session()
-{
- if (_client_session) {
- SoupSession* s = _client_session;
- _client_session = NULL;
- soup_session_abort(s);
- }
-}
-
-void
-HTTPClientReceiver::update(const std::string& str)
-{
- //LOG(info) << _world->parser()->parse_update(_world, _target.get(), str, _url);
-}
-
-void
-HTTPClientReceiver::Listener::_run()
-{
- char in = '\0';
- char last = '\0';
- char llast = '\0';
- string recv;
-
- while (true) {
- while (read(_sock, &in, 1) > 0 ) {
- recv += in;
- if (in == '\n' && last == '\n' && llast == '\n') {
- if (!recv.empty()) {
- _receiver->update(recv);
- recv.clear();
- last = '\0';
- llast = '\0';
- }
- break;
- }
- llast = last;
- last = in;
- }
- }
-
- LOG(info) << "HTTP listener finished" << endl;
-}
-
-void
-HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, void* ptr)
-{
- if (ptr == NULL)
- return;
-
- HTTPClientReceiver* me = (HTTPClientReceiver*)ptr;
- const string path = soup_message_get_uri(msg)->path;
-
- if (msg->response_body->data == NULL) {
- LOG(error) << "Empty client message" << endl;
- return;
- }
-
- if (path == "/") {
- me->_target->response(0, SUCCESS);
-
- } else if (path == "/plugins") {
- if (msg->response_body->data == NULL) {
- LOG(error) << "Empty response" << endl;
- } else {
- Glib::Mutex::Lock lock(me->_mutex);
- me->_target->response(0, SUCCESS);
- me->_world->parser()->parse_string(me->_world, me->_target.get(),
- Glib::ustring(msg->response_body->data), me->_url);
- }
-
- } else if (path.substr(0, 6) == "/patch") {
- if (msg->response_body->data == NULL) {
- LOG(error) << "Empty response" << endl;
- } else {
- Glib::Mutex::Lock lock(me->_mutex);
- me->_target->response(0, SUCCESS);
- me->_world->parser()->parse_string(
- me->_world,
- me->_target.get(),
- Glib::ustring(msg->response_body->data),
- "");
- }
-
- } else if (path == "/stream") {
- if (msg->response_body->data == NULL) {
- LOG(error) << "Empty response" << endl;
- } else {
- Glib::Mutex::Lock lock(me->_mutex);
- string uri = string(soup_uri_to_string(soup_message_get_uri(msg), false));
- uri = uri.substr(0, uri.find_last_of(":"));
- uri += string(":") + msg->response_body->data;
- LOG(info) << "Stream URI: " << uri << endl;
- me->_listener = boost::shared_ptr<Listener>(new Listener(me, uri));
- me->_listener->start();
- }
-
- } else {
- LOG(error) << "Unknown message: " << path << endl;
- me->update(msg->response_body->data);
- }
-}
-
-void
-HTTPClientReceiver::start(bool dump)
-{
- if (!_world->parser())
- _world->load_module("serialisation");
-
- SoupMessage* msg = soup_message_new("GET", (_url + "/stream").c_str());
- assert(SOUP_IS_MESSAGE(msg));
- soup_session_queue_message(_client_session, msg, message_callback, this);
-}
-
-void
-HTTPClientReceiver::stop()
-{
- //unregister_client();
- close_session();
-}
-
-} // namespace Client
-} // namespace Ingen
-
diff --git a/src/http/HTTPClientReceiver.hpp b/src/http/HTTPClientReceiver.hpp
deleted file mode 100644
index 795dac5d..00000000
--- a/src/http/HTTPClientReceiver.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_CLIENT_HTTPCLIENTRECEIVER_HPP
-#define INGEN_CLIENT_HTTPCLIENTRECEIVER_HPP
-
-#include <cstdlib>
-
-#include <boost/utility.hpp>
-#include <glibmm/thread.h>
-
-#include "ingen/ClientInterface.hpp"
-#include "ingen/serialisation/Parser.hpp"
-#include "raul/Deletable.hpp"
-#include "raul/SharedPtr.hpp"
-#include "raul/Thread.hpp"
-#include "sord/sordmm.hpp"
-
-typedef struct _SoupSession SoupSession;
-typedef struct _SoupMessage SoupMessage;
-
-namespace Ingen {
-namespace Client {
-
-class HTTPClientReceiver : public boost::noncopyable, public Raul::Deletable
-{
-public:
- HTTPClientReceiver(Shared::World* world,
- const std::string& url,
- SharedPtr<ClientInterface> target);
-
- ~HTTPClientReceiver();
-
- void send(SoupMessage* msg);
- void close_session();
-
- std::string uri() const { return _url; }
-
- void start(bool dump);
- void stop();
-
- static void message_callback(SoupSession* session, SoupMessage* msg, void* ptr);
-
-private:
- void update(const std::string& str);
-
- class Listener : public Raul::Thread {
- public:
- Listener(HTTPClientReceiver* receiver, const std::string& uri);
- ~Listener();
- void _run();
- private:
- std::string _uri;
- int _sock;
- HTTPClientReceiver* _receiver;
- };
-
- friend class Listener;
-
- SharedPtr<Listener> _listener;
- Glib::Mutex _mutex;
- SharedPtr<ClientInterface> _target;
- Shared::World* _world;
- const std::string _url;
- SoupSession* _client_session;
- bool _quit_flag;
-};
-
-} // namespace Client
-} // namespace Ingen
-
-#endif // INGEN_CLIENT_HTTPCLIENTRECEIVER_HPP
diff --git a/src/http/HTTPClientSender.cpp b/src/http/HTTPClientSender.cpp
deleted file mode 100644
index ed5299dd..00000000
--- a/src/http/HTTPClientSender.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <string>
-
-#include <libsoup/soup.h>
-
-#include "ingen/serialisation/Serialiser.hpp"
-#include "ingen/shared/World.hpp"
-#include "raul/Atom.hpp"
-#include "raul/AtomRDF.hpp"
-#include "raul/log.hpp"
-
-#include "../server/Engine.hpp"
-
-#include "HTTPClientSender.hpp"
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-namespace Server {
-
-void
-HTTPClientSender::response(int32_t id, Status status)
-{
- if (status) {
- warn << "HTTP Error " << id
- << " (" << ingen_status_string(status) << ")" << endl;
- }
-}
-
-void
-HTTPClientSender::error(const std::string& msg)
-{
- warn << "HTTP send error " << msg << endl;
-}
-
-void
-HTTPClientSender::put(const URI& uri,
- const Resource::Properties& properties,
- Resource::Graph ctx)
-{
- const std::string request_uri = (Raul::Path::is_path(uri))
- ? _url + "/patch" + uri.substr(uri.find("/"))
- : uri.str();
-
- const Shared::World& world = _engine.world();
- Sord::Model model(world.rdf_world());
- for (Resource::Properties::const_iterator i = properties.begin();
- i != properties.end(); ++i)
- model.add_statement(
- Sord::URI(world.rdf_world(), request_uri),
- Sord::URI(world.rdf_world(), i->first),
- AtomRDF::atom_to_node(model, i->second));
-
- const string str = model.write_to_string("", SERD_TURTLE);
- send_chunk(str);
-}
-
-void
-HTTPClientSender::delta(const URI& uri,
- const Resource::Properties& remove,
- const Resource::Properties& add)
-{
-}
-
-void
-HTTPClientSender::del(const URI& uri)
-{
- send_chunk(string("<").append(uri.str()).append("> a <http://www.w3.org/2002/07/owl#Nothing> ."));
-}
-
-void
-HTTPClientSender::connect(const Path& src_path, const Path& dst_path)
-{
- const string msg = string(
- "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
- "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n").append(
- "<> ingen:connection [\n"
- "\tingen:destination <").append(dst_path.str()).append("> ;\n"
- "\tingen:source <").append(src_path.str()).append(">\n] .\n");
- send_chunk(msg);
-}
-
-void
-HTTPClientSender::disconnect(const URI& src,
- const URI& dst)
-{
-}
-
-void
-HTTPClientSender::disconnect_all(const Raul::Path& parent_patch_path,
- const Raul::Path& path)
-{
-}
-
-void
-HTTPClientSender::set_property(const URI& subject, const URI& key, const Atom& value)
-{
-#if 0
- Sord::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world(), value);
- const string msg = string(
- "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
- "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n").append(
- subject.str()).append("> ingen:property [\n"
- "rdf:predicate ").append(key.str()).append(" ;\n"
- "rdf:value ").append(node.to_string()).append("\n] .\n");
- send_chunk(msg);
-#endif
-}
-
-void
-HTTPClientSender::move(const Path& old_path, const Path& new_path)
-{
- string msg = string(
- "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
- "@prefix ingen: <http://drobilla.net/ns/ingen#> .\n\n<").append(
- old_path.str()).append("> rdf:subject <").append(new_path.str()).append("> .\n");
- send_chunk(msg);
-}
-
-} // namespace Server
-} // namespace Ingen
diff --git a/src/http/HTTPClientSender.hpp b/src/http/HTTPClientSender.hpp
deleted file mode 100644
index cfe24001..00000000
--- a/src/http/HTTPClientSender.hpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_ENGINE_HTTPCLIENTSENDER_HPP
-#define INGEN_ENGINE_HTTPCLIENTSENDER_HPP
-
-#include <cassert>
-#include <string>
-
-#include "raul/Thread.hpp"
-
-#include "ingen/ClientInterface.hpp"
-
-#include "HTTPSender.hpp"
-
-namespace Ingen {
-
-class ServerInterface;
-
-namespace Server {
-
-class Engine;
-
-/** Implements ClientInterface for HTTP clients.
- * Sends changes as RDF deltas over an HTTP stream
- * (a single message with chunked encoding response).
- *
- * \ingroup engine
- */
-class HTTPClientSender
- : public ClientInterface
- , public Ingen::Shared::HTTPSender
-{
-public:
- explicit HTTPClientSender(Engine& engine)
- : _engine(engine)
- , _enabled(true)
- {}
-
- bool enabled() const { return _enabled; }
-
- void enable() { _enabled = true; }
- void disable() { _enabled = false; }
-
- void bundle_begin() { HTTPSender::bundle_begin(); }
- void bundle_end() { HTTPSender::bundle_end(); }
-
- Raul::URI uri() const { return "http://example.org/"; }
-
- /* *** ClientInterface Implementation Below *** */
-
- void response(int32_t id, Status status);
-
- void error(const std::string& msg);
-
- virtual void put(const Raul::URI& path,
- const Resource::Properties& properties,
- Resource::Graph ctx);
-
- virtual void delta(const Raul::URI& path,
- const Resource::Properties& remove,
- const Resource::Properties& add);
-
- virtual void del(const Raul::URI& uri);
-
- virtual void move(const Raul::Path& old_path,
- const Raul::Path& new_path);
-
- virtual void connect(const Raul::Path& src_port_path,
- const Raul::Path& dst_port_path);
-
- virtual void disconnect(const Raul::URI& src,
- const Raul::URI& dst);
-
- virtual void disconnect_all(const Raul::Path& parent_patch_path,
- const Raul::Path& path);
-
- virtual void set_property(const Raul::URI& subject_path,
- const Raul::URI& predicate,
- const Raul::Atom& value);
-
-private:
- Engine& _engine;
- std::string _url;
- bool _enabled;
-};
-
-} // namespace Server
-} // namespace Ingen
-
-#endif // INGEN_ENGINE_HTTPCLIENTSENDER_HPP
-
diff --git a/src/http/HTTPEngineReceiver.cpp b/src/http/HTTPEngineReceiver.cpp
deleted file mode 100644
index 4831ee4d..00000000
--- a/src/http/HTTPEngineReceiver.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <cstdio>
-#include <cstdlib>
-#include <string>
-
-#include <boost/format.hpp>
-
-#include <libsoup/soup.h>
-
-#include "raul/SharedPtr.hpp"
-#include "raul/log.hpp"
-
-#include "ingen/ClientInterface.hpp"
-#include "ingen/ServerInterface.hpp"
-#include "ingen/serialisation/Parser.hpp"
-#include "ingen/serialisation/Serialiser.hpp"
-#include "ingen/shared/Module.hpp"
-#include "ingen/shared/Store.hpp"
-
-#include "../server/ClientBroadcaster.hpp"
-#include "../server/Engine.hpp"
-
-#include "HTTPClientSender.hpp"
-#include "HTTPEngineReceiver.hpp"
-
-#define LOG(s) s << "[HTTPEngineReceiver] "
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-
-using namespace Serialisation;
-
-namespace Server {
-
-HTTPEngineReceiver::HTTPEngineReceiver(Engine& engine,
- SharedPtr<ServerInterface> interface,
- uint16_t port)
- : _engine(engine)
- , _interface(interface)
- , _server(soup_server_new(SOUP_SERVER_PORT, port, NULL))
-{
- _receive_thread = new ReceiveThread(*this);
-
- soup_server_add_handler(_server, NULL, message_callback, this, NULL);
-
- LOG(info) << "Started HTTP server on port " << soup_server_get_port(_server) << endl;
-
- if (!engine.world()->parser() || !engine.world()->serialiser())
- engine.world()->load_module("serialisation");
-
- _receive_thread->set_name("HTTPEngineReceiver Listener");
- _receive_thread->start();
-}
-
-HTTPEngineReceiver::~HTTPEngineReceiver()
-{
- _receive_thread->stop();
- delete _receive_thread;
-
- if (_server) {
- soup_server_quit(_server);
- _server = NULL;
- }
-}
-
-void
-HTTPEngineReceiver::message_callback(SoupServer* server,
- SoupMessage* msg,
- const char* path_str,
- GHashTable* query,
- SoupClientContext* client,
- void* data)
-{
- HTTPEngineReceiver* me = (HTTPEngineReceiver*)data;
- ServerInterface* interface = me->_interface.get();
-
- using namespace Ingen::Shared;
-
- SharedPtr<Store> store = me->_engine.world()->store();
- if (!store) {
- soup_message_set_status(msg, SOUP_STATUS_INTERNAL_SERVER_ERROR);
- return;
- }
-
- string path = path_str;
- if (path[path.length() - 1] == '/') {
- path = path.substr(0, path.length()-1);
- }
-
- SharedPtr<Serialiser> serialiser = me->_engine.world()->serialiser();
-
- const string base_uri = "path:/";
- const char* mime_type = "text/plain";
-
- // Special GET paths
- if (msg->method == SOUP_METHOD_GET) {
- if (path == Path::root().str() || path.empty()) {
- const string r = string("@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n")
- .append("\n<> rdfs:seeAlso <plugins> ;")
- .append("\n rdfs:seeAlso <stream> ;")
- .append("\n rdfs:seeAlso <patch> .");
- soup_message_set_status(msg, SOUP_STATUS_OK);
- soup_message_set_response(msg, mime_type, SOUP_MEMORY_COPY, r.c_str(), r.length());
- return;
-
- } else if (msg->method == SOUP_METHOD_GET && path.substr(0, 8) == "/plugins") {
- // FIXME: kludge
- #if 0
- interface->get("ingen:plugins");
- me->_receive_thread->whip();
-
- serialiser->start_to_string("/", base_uri);
- for (NodeFactory::Plugins::const_iterator p = me->_engine.node_factory()->plugins().begin();
- p != me->_engine.node_factory()->plugins().end(); ++p)
- serialiser->serialise_plugin(*(Shared::Plugin*)p->second);
- const string r = serialiser->finish();
- soup_message_set_status(msg, SOUP_STATUS_OK);
- soup_message_set_response(msg, mime_type, SOUP_MEMORY_COPY, r.c_str(), r.length());
- #endif
- return;
-
- } else if (path.substr(0, 6) == "/patch") {
- path = '/' + path.substr(6);
- if (path.substr(0, 2) == "//")
- path = path.substr(1);
-
- } else if (path.substr(0, 7) == "/stream") {
- HTTPClientSender* client = new HTTPClientSender(me->_engine);
- interface->register_client(client);
-
- // Respond with port number of stream for client
- const int port = client->listen_port();
- char buf[32];
- snprintf(buf, sizeof(buf), "%d", port);
- soup_message_set_status(msg, SOUP_STATUS_OK);
- soup_message_set_response(msg, mime_type, SOUP_MEMORY_COPY, buf, strlen(buf));
- return;
- }
- }
-
- if (!Path::is_valid(path)) {
- LOG(error) << "Bad HTTP path: " << path << endl;
- soup_message_set_status(msg, SOUP_STATUS_BAD_REQUEST);
- const string& err = (boost::format("Bad path: %1%") % path).str();
- soup_message_set_response(msg, "text/plain", SOUP_MEMORY_COPY,
- err.c_str(), err.length());
- return;
- }
-
- if (msg->method == SOUP_METHOD_GET) {
- Glib::RWLock::ReaderLock lock(store->lock());
-
- // Find object
- Store::const_iterator start = store->find(path);
- if (start == store->end()) {
- soup_message_set_status(msg, SOUP_STATUS_NOT_FOUND);
- const string& err = (boost::format("No such object: %1%") % path).str();
- soup_message_set_response(msg, "text/plain", SOUP_MEMORY_COPY,
- err.c_str(), err.length());
- return;
- }
-
- // Get serialiser
- SharedPtr<Serialiser> serialiser = me->_engine.world()->serialiser();
- if (!serialiser) {
- soup_message_set_status(msg, SOUP_STATUS_INTERNAL_SERVER_ERROR);
- soup_message_set_response(msg, "text/plain", SOUP_MEMORY_STATIC,
- "No serialiser available\n", 24);
- return;
- }
-
- // Serialise object
- const string response = serialiser->to_string(start->second,
- "http://localhost:16180/patch", GraphObject::Properties());
-
- soup_message_set_status(msg, SOUP_STATUS_OK);
- soup_message_set_response(msg, mime_type, SOUP_MEMORY_COPY,
- response.c_str(), response.length());
-
- } else if (msg->method == SOUP_METHOD_PUT) {
- Glib::RWLock::WriterLock lock(store->lock());
-
- // Get parser
- SharedPtr<Parser> parser = me->_engine.world()->parser();
- if (!parser) {
- soup_message_set_status(msg, SOUP_STATUS_INTERNAL_SERVER_ERROR);
- return;
- }
-
- parser->parse_string(me->_engine.world(), interface, msg->request_body->data, base_uri);
- soup_message_set_status(msg, SOUP_STATUS_OK);
-
- } else if (msg->method == SOUP_METHOD_DELETE) {
- interface->del(path);
- soup_message_set_status(msg, SOUP_STATUS_OK);
-
- } else {
- soup_message_set_status(msg, SOUP_STATUS_NOT_IMPLEMENTED);
- }
-}
-
-void
-HTTPEngineReceiver::ReceiveThread::_run()
-{
- soup_server_run(_receiver._server);
-}
-
-} // namespace Server
-} // namespace Ingen
-
diff --git a/src/http/HTTPEngineReceiver.hpp b/src/http/HTTPEngineReceiver.hpp
deleted file mode 100644
index d560a5f3..00000000
--- a/src/http/HTTPEngineReceiver.hpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_ENGINE_HTTPENGINERECEIVER_HPP
-#define INGEN_ENGINE_HTTPENGINERECEIVER_HPP
-
-#include <stdint.h>
-
-#include <string>
-
-#include "raul/Thread.hpp"
-
-typedef struct _SoupServer SoupServer;
-typedef struct _SoupMessage SoupMessage;
-typedef struct SoupClientContext SoupClientContext;
-
-namespace Ingen {
-
-class ServerInterface;
-
-namespace Server {
-
-class Engine;
-
-class HTTPEngineReceiver
-{
-public:
- HTTPEngineReceiver(Engine& engine,
- SharedPtr<ServerInterface> interface,
- uint16_t port);
-
- ~HTTPEngineReceiver();
-
-private:
- struct ReceiveThread : public Raul::Thread {
- explicit ReceiveThread(HTTPEngineReceiver& receiver)
- : _receiver(receiver)
- {}
- virtual void _run();
- private:
- HTTPEngineReceiver& _receiver;
- };
-
- friend class ReceiveThread;
-
- static void message_callback(SoupServer* server,
- SoupMessage* msg,
- const char* path,
- GHashTable *query,
- SoupClientContext* client,
- void* data);
-
- Engine& _engine;
- SharedPtr<ServerInterface> _interface;
- ReceiveThread* _receive_thread;
- SoupServer* _server;
-};
-
-} // namespace Server
-} // namespace Ingen
-
-#endif // INGEN_ENGINE_HTTPENGINERECEIVER_HPP
diff --git a/src/http/HTTPEngineSender.cpp b/src/http/HTTPEngineSender.cpp
deleted file mode 100644
index 39de6f41..00000000
--- a/src/http/HTTPEngineSender.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <libsoup/soup.h>
-
-#include "raul/AtomRDF.hpp"
-#include "raul/log.hpp"
-#include "sord/sordmm.hpp"
-
-#include "ingen/shared/World.hpp"
-#include "HTTPEngineSender.hpp"
-#include "HTTPClientReceiver.hpp"
-
-#define LOG(s) s << "[HTTPEngineSender] "
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-
-using namespace Shared;
-
-namespace Client {
-
-HTTPEngineSender::HTTPEngineSender(World* world,
- const URI& engine_url,
- SharedPtr<Raul::Deletable> receiver)
- : _receiver(PtrCast<HTTPClientReceiver>(receiver))
- , _world(*world->rdf_world())
- , _engine_url(engine_url)
- , _id(0)
- , _enabled(true)
-{
- assert(_receiver);
- _session = soup_session_sync_new();
-}
-
-HTTPEngineSender::~HTTPEngineSender()
-{
- soup_session_abort(_session);
-}
-
-void
-HTTPEngineSender::attach(int32_t ping_id, bool block)
-{
- LOG(debug) << "Attaching to " << _engine_url << endl;
- SoupMessage* msg = soup_message_new("GET", _engine_url.c_str());
- soup_session_queue_message(_session, msg,
- HTTPClientReceiver::message_callback, _receiver.get());
-}
-
-/* *** ServerInterface implementation below here *** */
-
-/** Register with the engine via HTTP.
- *
- * Note that this does not actually use 'key', since the engine creates
- * it's own key for HTTP clients (namely the incoming URL), for NAT
- * traversal. It is a parameter to remain compatible with ServerInterface.
- */
-void
-HTTPEngineSender::register_client(ClientInterface* client)
-{
- /*SoupMessage* msg = soup_message_new("GET", (_engine_url.str() + "/stream").c_str());
- HTTPClientReceiver::send(msg);*/
-}
-
-void
-HTTPEngineSender::unregister_client(const URI& uri)
-{
-}
-
-// Object commands
-
-void
-HTTPEngineSender::put(const URI& uri,
- const Resource::Properties& properties,
- Resource::Graph ctx)
-{
- const string path = (uri.substr(0, 6) == "path:/") ? uri.substr(6) : uri.str();
- const string full_uri = _engine_url.str() + "/" + path;
-
- Sord::Model model(_world);
- for (Resource::Properties::const_iterator i = properties.begin(); i != properties.end(); ++i)
- model.add_statement(Sord::URI(_world, path),
- AtomRDF::atom_to_node(model, i->first),
- AtomRDF::atom_to_node(model, i->second));
-
- const string str = model.write_to_string("");
- SoupMessage* msg = soup_message_new(SOUP_METHOD_PUT, full_uri.c_str());
- assert(msg);
- soup_message_set_request(msg, "application/x-turtle", SOUP_MEMORY_COPY, str.c_str(), str.length());
- soup_session_send_message(_session, msg);
-}
-
-void
-HTTPEngineSender::delta(const Raul::URI& path,
- const Resource::Properties& remove,
- const Resource::Properties& add)
-{
- LOG(warn) << "TODO: HTTP delta" << endl;
-}
-
-void
-HTTPEngineSender::move(const Path& old_path,
- const Path& new_path)
-{
- SoupMessage* msg = soup_message_new(SOUP_METHOD_MOVE,
- (_engine_url.str() + old_path.str()).c_str());
- soup_message_headers_append(msg->request_headers, "Destination",
- (_engine_url.str() + new_path.str()).c_str());
- soup_session_send_message(_session, msg);
-}
-
-void
-HTTPEngineSender::del(const URI& uri)
-{
- const string path = (uri.substr(0, 6) == "path:/") ? uri.substr(6) : uri.str();
- const string full_uri = _engine_url.str() + "/" + path;
- SoupMessage* msg = soup_message_new(SOUP_METHOD_DELETE, full_uri.c_str());
- soup_session_send_message(_session, msg);
-}
-
-void
-HTTPEngineSender::connect(const Path& src_port_path,
- const Path& dst_port_path)
-{
- LOG(warn) << "TODO: HTTP connect" << endl;
-}
-
-void
-HTTPEngineSender::disconnect(const URI& src,
- const URI& dst)
-{
- LOG(warn) << "TODO: HTTP disconnect" << endl;
-}
-
-void
-HTTPEngineSender::disconnect_all(const Path& parent_patch_path,
- const Path& path)
-{
- LOG(warn) << "TODO: HTTP disconnect_all" << endl;
-}
-
-void
-HTTPEngineSender::set_property(const URI& subject,
- const URI& predicate,
- const Atom& value)
-{
- Resource::Properties prop;
- prop.insert(make_pair(predicate, value));
- put(subject, prop);
-}
-
-// Requests //
-
-void
-HTTPEngineSender::ping()
-{
- LOG(debug) << "Ping " << _engine_url << endl;
- get(_engine_url);
-}
-
-void
-HTTPEngineSender::get(const URI& uri)
-{
- if (!Raul::Path::is_path(uri) && uri.scheme() != "http" && uri.scheme() != "ingen") {
- LOG(warn) << "Ignoring GET of non-HTTP URI " << uri << endl;
- return;
- }
-
- const std::string request_uri = (Raul::Path::is_path(uri))
- ?_engine_url.str() + "/patch" + uri.substr(uri.find("/"))
- : uri.str();
- cout << "Get " << request_uri << endl;
- LOG(debug) << "Get " << request_uri << endl;
- SoupMessage* msg = soup_message_new("GET", request_uri.c_str());
- soup_session_queue_message(_session, msg,
- HTTPClientReceiver::message_callback, _receiver.get());
-
-}
-
-} // namespace Client
-} // namespace Ingen
-
diff --git a/src/http/HTTPEngineSender.hpp b/src/http/HTTPEngineSender.hpp
deleted file mode 100644
index 6f1d9cc5..00000000
--- a/src/http/HTTPEngineSender.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_CLIENT_HTTPENGINESENDER_HPP
-#define INGEN_CLIENT_HTTPENGINESENDER_HPP
-
-#include <inttypes.h>
-
-#include <string>
-
-#include "raul/Deletable.hpp"
-#include "raul/Path.hpp"
-#include "sord/sordmm.hpp"
-
-#include "ingen/ServerInterface.hpp"
-
-typedef struct _SoupSession SoupSession;
-
-namespace Ingen {
-
-namespace Shared { class World; }
-
-namespace Client {
-
-class HTTPClientReceiver;
-
-/* HTTP (via libsoup) interface to the engine.
- *
- * Clients can use this opaquely as an ServerInterface to control the engine
- * over HTTP (whether over a network or not).
- *
- * \ingroup IngenClient
- */
-class HTTPEngineSender : public ServerInterface
-{
-public:
- HTTPEngineSender(Shared::World* world,
- const Raul::URI& engine_url,
- SharedPtr<Raul::Deletable> receiver);
-
- ~HTTPEngineSender();
-
- Raul::URI uri() const { return _engine_url; }
-
- inline int32_t next_id() { return (_id == -1) ? -1 : _id++; }
-
- void set_response_id(int32_t id) { _id = id; }
-
- void attach(int32_t ping_id, bool block);
-
- /* *** ServerInterface implementation below here *** */
-
- void enable() { _enabled = true; }
- void disable() { _enabled = false; }
-
- void bundle_begin() {}
- void bundle_end() {}
-
- // Client registration
- void register_client(ClientInterface* client);
- void unregister_client(const Raul::URI& uri);
-
- // Object commands
-
- virtual void put(const Raul::URI& path,
- const Resource::Properties& properties,
- Resource::Graph ctx=Resource::DEFAULT);
-
- virtual void delta(const Raul::URI& path,
- const Resource::Properties& remove,
- const Resource::Properties& add);
-
- virtual void del(const Raul::URI& uri);
-
- virtual void move(const Raul::Path& old_path,
- const Raul::Path& new_path);
-
- virtual void connect(const Raul::Path& src_port_path,
- const Raul::Path& dst_port_path);
-
- virtual void disconnect(const Raul::URI& src,
- const Raul::URI& dst);
-
- virtual void disconnect_all(const Raul::Path& parent_patch_path,
- const Raul::Path& path);
-
- virtual void set_property(const Raul::URI& subject,
- const Raul::URI& predicate,
- const Raul::Atom& value);
-
- // Requests //
- void ping();
- void get(const Raul::URI& uri);
-
-protected:
- SharedPtr<HTTPClientReceiver> _receiver;
-
- SoupSession* _session;
- Sord::World& _world;
- const Raul::URI _engine_url;
- int _client_port;
- int32_t _id;
- bool _enabled;
-};
-
-} // namespace Client
-} // namespace Ingen
-
-#endif // INGEN_CLIENT_HTTPENGINESENDER_HPP
-
diff --git a/src/http/HTTPSender.cpp b/src/http/HTTPSender.cpp
deleted file mode 100644
index 8436956f..00000000
--- a/src/http/HTTPSender.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <cassert>
-#include <cstdio>
-#include <cstring>
-#include <unistd.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <errno.h>
-#include "raul/log.hpp"
-#include "HTTPSender.hpp"
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-namespace Shared {
-
-HTTPSender::HTTPSender()
- : _listen_port(-1)
- , _listen_sock(-1)
- , _client_sock(-1)
- , _send_state(Immediate)
-{
- Thread::set_name("HTTPSender");
-
- struct sockaddr_in addr;
-
- // Create listen address
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl(INADDR_ANY);
-
- // Create listen socket
- if ((_listen_sock = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) {
- error << "Error creating listening socket (" << strerror(errno) << ")" << endl;
- exit(EXIT_FAILURE);
- }
-
- // Bind our socket addresss to the listening socket
- if (bind(_listen_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
- error << "Error calling bind (%s)\n" << strerror(errno) << ")" << endl;
- _listen_sock = -1;
- }
-
- // Find port number
- socklen_t length = sizeof(addr);
- if (getsockname(_listen_sock, (struct sockaddr*)&addr, &length) == -1) {
- error << "Error calling getsockname (" << strerror(errno) << ")" << endl;
- _listen_sock = -1;
- return;
- }
-
- if (listen(_listen_sock, 1) < 0 ) {
- error << "Error calling listen (" << strerror(errno) << ")" << endl;
- _listen_sock = -1;
- return;
- }
-
- _listen_port = ntohs(addr.sin_port);
- info << "Opening event stream on TCP port " << _listen_port << endl;
- start();
-}
-
-HTTPSender::~HTTPSender()
-{
- stop();
- if (_listen_sock != -1)
- close(_listen_sock);
- if (_client_sock != -1)
- close(_client_sock);
-}
-
-void
-HTTPSender::_run()
-{
- if (_listen_sock == -1) {
- error << "Unable to open socket, exiting sender thread" << endl;
- return;
- }
-
- // Accept connection
- if ((_client_sock = accept(_listen_sock, NULL, NULL) ) < 0) {
- error << "Error calling accept: " << strerror(errno) << endl;
- return;
- }
-
- // Hold connection open and write when signalled
- while (true) {
- _mutex.lock();
- _signal.wait(_mutex);
-
- write(_client_sock, _transfer.c_str(), _transfer.length());
- write(_client_sock, "\n\n\n", 3);
-
- _signal.broadcast();
- _mutex.unlock();
- }
-
- close(_listen_sock);
- _listen_sock = -1;
-}
-
-void
-HTTPSender::bundle_begin()
-{
- _mutex.lock();
- _send_state = SendingBundle;
- _transfer = "";
-}
-
-void
-HTTPSender::bundle_end()
-{
- assert(_send_state == SendingBundle);
- _signal.broadcast();
- _signal.wait(_mutex);
- _send_state = Immediate;
- _mutex.unlock();
-}
-
-void
-HTTPSender::send_chunk(const std::string& buf)
-{
- if (_send_state == Immediate) {
- _mutex.lock();
- _transfer = buf;
- _signal.broadcast();
- _signal.wait(_mutex);
- _mutex.unlock();
- } else {
- _transfer.append(buf);
- }
-}
-
-} // namespace Shared
-} // namespace Ingen
diff --git a/src/http/HTTPSender.hpp b/src/http/HTTPSender.hpp
deleted file mode 100644
index d0ea32e4..00000000
--- a/src/http/HTTPSender.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_SHARED_HTTPSENDER_HPP
-#define INGEN_SHARED_HTTPSENDER_HPP
-
-#include <string>
-
-#include <glibmm/thread.h>
-
-#include "raul/Thread.hpp"
-
-namespace Ingen {
-namespace Shared {
-
-class HTTPSender : public Raul::Thread {
-public:
- HTTPSender();
- virtual ~HTTPSender();
-
- void bundle_begin();
- void bundle_end();
-
- int listen_port() const { return _listen_port; }
-
-protected:
- void _run();
-
- void send_chunk(const std::string& buf);
-
- enum SendState { Immediate, SendingBundle };
-
- Glib::Mutex _mutex;
- Glib::Cond _signal;
-
- int _listen_port;
- int _listen_sock;
- int _client_sock;
- SendState _send_state;
- std::string _transfer;
-};
-
-} // namespace Shared
-} // namespace Ingen
-
-#endif // INGEN_SHARED_HTTPSENDER_HPP
-
diff --git a/src/http/ingen_http_client.cpp b/src/http/ingen_http_client.cpp
deleted file mode 100644
index e444e2e2..00000000
--- a/src/http/ingen_http_client.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "ingen/shared/Module.hpp"
-#include "ingen/shared/World.hpp"
-
-#include "HTTPClientReceiver.hpp"
-#include "HTTPEngineSender.hpp"
-
-using namespace std;
-using namespace Ingen;
-
-SharedPtr<Ingen::ServerInterface>
-new_http_interface(Ingen::Shared::World* world,
- const std::string& url,
- SharedPtr<ClientInterface> respond_to)
-{
- SharedPtr<Client::HTTPClientReceiver> receiver(
- new Client::HTTPClientReceiver(world, url, respond_to));
- Client::HTTPEngineSender* hes = new Client::HTTPEngineSender(
- world, url, receiver);
- hes->attach(rand(), true);
- return SharedPtr<ServerInterface>(hes);
-}
-
-struct IngenHTTPClientModule : public Ingen::Shared::Module {
- void load(Ingen::Shared::World* world) {
- world->add_interface_factory("http", &new_http_interface);
- }
-};
-
-extern "C" {
-
-Ingen::Shared::Module*
-ingen_module_load()
-{
- return new IngenHTTPClientModule();
-}
-
-} // extern "C"
diff --git a/src/http/ingen_http_server.cpp b/src/http/ingen_http_server.cpp
deleted file mode 100644
index 56fff6f5..00000000
--- a/src/http/ingen_http_server.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "ingen/shared/Module.hpp"
-#include "ingen/shared/World.hpp"
-
-#include "../server/Engine.hpp"
-#include "../server/ServerInterfaceImpl.hpp"
-
-#include "HTTPEngineReceiver.hpp"
-
-using namespace std;
-using namespace Ingen;
-
-struct IngenHTTPModule : public Ingen::Shared::Module {
- void load(Ingen::Shared::World* world) {
- Server::Engine* engine = (Server::Engine*)world->local_engine().get();
- SharedPtr<Server::ServerInterfaceImpl> interface(
- new Server::ServerInterfaceImpl(*engine));
-
- receiver = SharedPtr<Server::HTTPEngineReceiver>(
- new Server::HTTPEngineReceiver(
- *engine,
- interface,
- world->conf()->option("engine-port").get_int32()));
- engine->add_event_source(interface);
- }
-
- SharedPtr<Server::HTTPEngineReceiver> receiver;
-};
-
-extern "C" {
-
-Ingen::Shared::Module*
-ingen_module_load()
-{
- return new IngenHTTPModule();
-}
-
-} // extern "C"
diff --git a/src/http/wscript b/src/http/wscript
deleted file mode 100644
index dec805e3..00000000
--- a/src/http/wscript
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-from waflib.extras import autowaf as autowaf
-
-def build(bld):
- if bld.is_defined('HAVE_SOUP'):
- obj = bld(features = 'cxx cxxshlib',
- source = '''HTTPClientSender.cpp
- HTTPEngineReceiver.cpp
- HTTPSender.cpp
- ingen_http_server.cpp''',
- includes = ['../..'],
- name = 'libingen_http_server',
- target = 'ingen_http_server',
- install_path = '${LIBDIR}',
- use = 'libingen_server')
- autowaf.use_lib(bld, obj, 'RAUL SOUP')
-
- obj = bld(features = 'cxx cxxshlib',
- source = '''HTTPClientReceiver.cpp
- HTTPEngineSender.cpp
- HTTPSender.cpp
- ingen_http_client.cpp''',
- includes = ['../..'],
- name = 'libingen_http_client',
- target = 'ingen_http_client',
- install_path = '${LIBDIR}',
- use = 'libingen_client')
- autowaf.use_lib(bld, obj, 'RAUL SOUP')
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index c0ff6181..d78753c8 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -108,9 +108,6 @@ main(int argc, char** argv)
SharedPtr<Interface> engine_interface;
Glib::thread_init();
-#ifdef HAVE_SOUP
- g_type_init();
-#endif
world = new Ingen::Shared::World(&conf, argc, argv, NULL, NULL);
@@ -128,17 +125,6 @@ main(int argc, char** argv)
engine_interface = world->engine();
- // Not loading a GUI, load network engine interfaces
- if (!conf.option("gui").get_bool()) {
- #ifdef HAVE_LIBLO
- ingen_try(world->load_module("osc_server"),
- "Unable to load OSC server module");
- #endif
- #ifdef HAVE_SOUP
- ingen_try(world->load_module("http_server"),
- "Unable to load HTTP server module");
- #endif
- }
#ifdef HAVE_SOCKET
ingen_try(world->load_module("socket_server"),
"Unable to load socket server module");
@@ -149,14 +135,6 @@ main(int argc, char** argv)
if (!engine_interface) {
ingen_try(world->load_module("client"),
"Unable to load client module");
- #ifdef HAVE_LIBLO
- ingen_try(world->load_module("osc_client"),
- "Unable to load OSC client module");
- #endif
- #ifdef HAVE_SOUP
- ingen_try(world->load_module("http_client"),
- "Unable to load HTTP client module");
- #endif
const char* const uri = conf.option("connect").get_string();
SharedPtr<Interface> client(new Client::SigClientInterface());
ingen_try((engine_interface = world->interface(uri, client)),
diff --git a/src/osc/OSCClientReceiver.cpp b/src/osc/OSCClientReceiver.cpp
deleted file mode 100644
index 7cba4c40..00000000
--- a/src/osc/OSCClientReceiver.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "raul/log.hpp"
-#include "raul/AtomLiblo.hpp"
-#include "raul/Path.hpp"
-
-#include "ingen_config.h"
-#include "OSCClientReceiver.hpp"
-
-#define LOG(s) s << "[OSCClientReceiver] "
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-namespace Client {
-
-OSCClientReceiver::OSCClientReceiver(int listen_port,
- SharedPtr<ClientInterface> target)
- : _target(target)
- , _st(NULL)
- , _listen_port(listen_port)
-{
-#ifdef RAUL_LOG_DEBUG
- start(true);
-#else
- start(false); // true = dump, false = shutup
-#endif
-}
-
-OSCClientReceiver::~OSCClientReceiver()
-{
- stop();
-}
-
-void
-OSCClientReceiver::start(bool dump_osc)
-{
- if (_st != NULL)
- return;
-
- // Attempt preferred port
- if (_listen_port != 0) {
- char port_str[8];
- snprintf(port_str, sizeof(port_str), "%d", _listen_port);
- _st = lo_server_thread_new(port_str, lo_error_cb);
- }
-
- // Find a free port
- if (!_st) {
- _st = lo_server_thread_new(NULL, lo_error_cb);
- _listen_port = lo_server_thread_get_port(_st);
- }
-
- if (_st == NULL) {
- LOG(error) << "Could not start OSC listener. Aborting." << endl;
- exit(EXIT_FAILURE);
- } else {
- LOG(info) << "Started OSC listener on port " << lo_server_thread_get_port(_st) << endl;
- }
-
- // Print all incoming messages
- if (dump_osc)
- lo_server_thread_add_method(_st, NULL, NULL, generic_cb, NULL);
-
- setup_callbacks();
-
- // Display any uncaught messages to the console
- //lo_server_thread_add_method(_st, NULL, NULL, unknown_cb, NULL);
-
- lo_server_thread_start(_st);
-}
-
-void
-OSCClientReceiver::stop()
-{
- if (_st != NULL) {
- //unregister_client();
- lo_server_thread_free(_st);
- _st = NULL;
- }
-}
-
-int
-OSCClientReceiver::generic_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data)
-{
- printf("[OSCClientReceiver] %s (%s)\t", path, types);
-
- for (int i=0; i < argc; ++i) {
- lo_arg_pp(lo_type(types[i]), argv[i]);
- printf("\t");
- }
- printf("\n");
-
- return 1; // not handled
-}
-
-void
-OSCClientReceiver::lo_error_cb(int num, const char* msg, const char* path)
-{
- LOG(error) << "Got error from server: " << msg << endl;
-}
-
-int
-OSCClientReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data)
-{
- std::string msg = "Received unknown OSC message: ";
- msg += path;
-
- LOG(error) << msg << endl;
-
- return 0;
-}
-
-void
-OSCClientReceiver::setup_callbacks()
-{
- if (!_target)
- return;
-
- lo_server_thread_add_method(_st, "/response", "ii", response_cb, this);
- lo_server_thread_add_method(_st, "/plugin", "sss", plugin_cb, this);
- lo_server_thread_add_method(_st, "/put", NULL, put_cb, this);
- lo_server_thread_add_method(_st, "/delta_begin", NULL, delta_begin_cb, this);
- lo_server_thread_add_method(_st, "/delta_remove", NULL, delta_remove_cb, this);
- lo_server_thread_add_method(_st, "/delta_add", NULL, delta_add_cb, this);
- lo_server_thread_add_method(_st, "/delta_end", NULL, delta_end_cb, this);
- lo_server_thread_add_method(_st, "/move", "ss", move_cb, this);
- lo_server_thread_add_method(_st, "/delete", "s", del_cb, this);
- lo_server_thread_add_method(_st, "/connect", "ss", connection_cb, this);
- lo_server_thread_add_method(_st, "/disconnect", "ss", disconnection_cb, this);
- lo_server_thread_add_method(_st, "/set_property", NULL, set_property_cb, this);
-}
-
-/** Catches errors that aren't a direct result of a client request.
- */
-int
-OSCClientReceiver::_error_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _target->error((char*)argv[0]);
- return 0;
-}
-
-int
-OSCClientReceiver::_del_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _target->del((const char*)&argv[0]->s);
- return 0;
-}
-
-int
-OSCClientReceiver::_put_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* obj_path = &argv[0]->s;
- const char* ctx = &argv[1]->s;
- Resource::Properties prop;
- for (int i = 2; i < argc-1; i += 2)
- prop.insert(make_pair(&argv[i]->s,
- AtomLiblo::lo_arg_to_atom(types[i+1], argv[i+1])));
- _target->put(obj_path, prop, Resource::uri_to_graph(ctx));
- return 0;
-}
-
-int
-OSCClientReceiver::_delta_begin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* obj_path = &argv[0]->s;
- assert(_delta_remove.empty());
- assert(_delta_add.empty());
- _delta_uri = obj_path;
- return 0;
-}
-
-int
-OSCClientReceiver::_delta_remove_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _delta_remove.insert(make_pair(&argv[0]->s,
- AtomLiblo::lo_arg_to_atom(types[1], argv[1])));
- return 0;
-}
-
-int
-OSCClientReceiver::_delta_add_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _delta_add.insert(make_pair(&argv[0]->s,
- AtomLiblo::lo_arg_to_atom(types[1], argv[1])));
- return 0;
-}
-
-int
-OSCClientReceiver::_delta_end_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _target->delta(_delta_uri, _delta_remove, _delta_add);
- _delta_uri = Raul::URI();
- _delta_remove.clear();
- _delta_add.clear();
- return 0;
-}
-
-int
-OSCClientReceiver::_move_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* old_path = &argv[1]->s;
- const char* new_path = &argv[2]->s;
-
- _target->move(old_path, new_path);
- return 0;
-}
-
-int
-OSCClientReceiver::_connection_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* const src_port_path = &argv[0]->s;
- const char* const dst_port_path = &argv[1]->s;
-
- _target->connect(src_port_path, dst_port_path);
-
- return 0;
-}
-
-int
-OSCClientReceiver::_disconnection_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* src_uri = &argv[0]->s;
- const char* dst_uri = &argv[1]->s;
-
- _target->disconnect(src_uri, dst_uri);
-
- return 0;
-}
-
-/** Notification of a new or updated property.
- */
-int
-OSCClientReceiver::_set_property_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- if (argc != 3 || types[0] != 's' || types[1] != 's')
- return 1;
-
- const char* obj_uri = &argv[0]->s;
- const char* key = &argv[1]->s;
-
- Atom value = AtomLiblo::lo_arg_to_atom(types[2], argv[2]);
-
- _target->set_property(obj_uri, key, value);
-
- return 0;
-}
-
-int
-OSCClientReceiver::_response_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- assert(!strcmp(types, "ii"));
- _target->response(argv[0]->i, (Status)argv[1]->i);
- return 0;
-}
-
-} // namespace Client
-} // namespace Ingen
diff --git a/src/osc/OSCClientReceiver.hpp b/src/osc/OSCClientReceiver.hpp
deleted file mode 100644
index 62d02e3d..00000000
--- a/src/osc/OSCClientReceiver.hpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_CLIENT_OSCCLIENTRECEIVER_HPP
-#define INGEN_CLIENT_OSCCLIENTRECEIVER_HPP
-
-#include <cstdlib>
-
-#include <boost/utility.hpp>
-#include <lo/lo.h>
-
-#include "ingen/Interface.hpp"
-#include "raul/Deletable.hpp"
-#include "raul/SharedPtr.hpp"
-
-#include "macros.h"
-
-namespace Ingen {
-namespace Client {
-
-/** Client-side receiver for OSC messages from the engine.
- *
- * \ingroup IngenClient
- */
-class OSCClientReceiver : public boost::noncopyable, public Raul::Deletable
-{
-public:
- OSCClientReceiver(int listen_port, SharedPtr<ClientInterface> target);
- ~OSCClientReceiver();
-
- std::string uri() const { return lo_server_thread_get_url(_st); }
-
- void start(bool dump_osc);
- void stop();
-
- int listen_port() { return _listen_port; }
- std::string listen_url() { return lo_server_thread_get_url(_st); }
-
-private:
- void setup_callbacks();
-
- static void lo_error_cb(int num, const char* msg, const char* path);
-
- static int generic_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data);
- static int unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* osc_receiver);
-
- SharedPtr<ClientInterface> _target;
- lo_server_thread _st;
- Raul::URI _delta_uri;
- Resource::Properties _delta_remove;
- Resource::Properties _delta_add;
- int _listen_port;
-
- LO_HANDLER(OSCClientReceiver, error);
- LO_HANDLER(OSCClientReceiver, response);
- LO_HANDLER(OSCClientReceiver, plugin);
- LO_HANDLER(OSCClientReceiver, plugin_list_end);
- LO_HANDLER(OSCClientReceiver, new_patch);
- LO_HANDLER(OSCClientReceiver, del);
- LO_HANDLER(OSCClientReceiver, move);
- LO_HANDLER(OSCClientReceiver, connection);
- LO_HANDLER(OSCClientReceiver, disconnection);
- LO_HANDLER(OSCClientReceiver, put);
- LO_HANDLER(OSCClientReceiver, delta_begin);
- LO_HANDLER(OSCClientReceiver, delta_remove);
- LO_HANDLER(OSCClientReceiver, delta_add);
- LO_HANDLER(OSCClientReceiver, delta_end);
- LO_HANDLER(OSCClientReceiver, set_property);
-};
-
-} // namespace Client
-} // namespace Ingen
-
-#endif // INGEN_CLIENT_OSCCLIENTRECEIVER_HPP
diff --git a/src/osc/OSCClientSender.cpp b/src/osc/OSCClientSender.cpp
deleted file mode 100644
index b8d086ee..00000000
--- a/src/osc/OSCClientSender.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <cassert>
-#include <string>
-
-#include "raul/log.hpp"
-#include "raul/AtomLiblo.hpp"
-#include "raul/Path.hpp"
-
-#include "ingen/Interface.hpp"
-
-#include "OSCClientSender.hpp"
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-namespace Server {
-
-/** @page client_osc_namespace Client OSC Namespace Documentation
- *
- * <p>These are the commands the client recognizes. All monitoring of
- * changes in the engine happens via these commands.</p>
- */
-
-/** @page client_osc_namespace
- * <h2>/response</h2>
- * @arg @p response-id :: Integer
- * @arg @p status :: Integer
- *
- * @par
- * Response to some command.
- */
-void
-OSCClientSender::response(int32_t id, Status status)
-{
- if (!_enabled)
- return;
-
- if (lo_send(_address, "/response", "ii", id, status, LO_ARGS_END) < 0) {
- Raul::error << "Unable to send response " << id << "! ("
- << lo_address_errstr(_address) << ")" << endl;
- }
-}
-
-/** @page client_osc_namespace
- * <h2>/error</h2>
- * @arg @p message :: String
- *
- * @par
- * Notification that an error has occurred. This is for notification of errors
- * that aren't a direct response to a user command, i.e. "unexpected" errors.
- */
-void
-OSCClientSender::error(const std::string& msg)
-{
- send("/error", "s", msg.c_str(), LO_ARGS_END);
-}
-
-/** @page client_osc_namespace
- * <h2>/put</h2>
- * @arg @p path :: String
- * @arg @p predicate :: URI String
- * @arg @p value
- * @arg @p ...
- *
- * @par
- * PUT a set of properties to a path.
- */
-void
-OSCClientSender::put(const Raul::URI& path,
- const Resource::Properties& properties,
- Resource::Graph ctx)
-{
- typedef Resource::Properties::const_iterator iterator;
- lo_message m = lo_message_new();
- lo_message_add_string(m, path.c_str());
- lo_message_add_string(m, Resource::graph_to_uri(ctx).c_str());
- for (iterator i = properties.begin(); i != properties.end(); ++i) {
- lo_message_add_string(m, i->first.c_str());
- Raul::AtomLiblo::lo_message_add_atom(m, i->second);
- }
- send_message("/put", m);
-}
-
-void
-OSCClientSender::delta(const Raul::URI& path,
- const Resource::Properties& remove,
- const Resource::Properties& add)
-{
- typedef Resource::Properties::const_iterator iterator;
-
- const bool bundle = !_bundle;
- if (bundle)
- bundle_begin();
-
- send("/delta_begin", "s", path.c_str(), LO_ARGS_END);
-
- for (iterator i = remove.begin(); i != remove.end(); ++i) {
- lo_message m = lo_message_new();
- lo_message_add_string(m, i->first.c_str());
- Raul::AtomLiblo::lo_message_add_atom(m, i->second);
- send_message("/delta_remove", m);
- }
-
- for (iterator i = add.begin(); i != add.end(); ++i) {
- lo_message m = lo_message_new();
- lo_message_add_string(m, i->first.c_str());
- Raul::AtomLiblo::lo_message_add_atom(m, i->second);
- send_message("/delta_add", m);
- }
-
- send("/delta_end", "", LO_ARGS_END);
-
- if (bundle)
- bundle_end();
-}
-
-/** @page client_osc_namespace
- * <h2>/move</h2>
- * @arg @p old-path :: String
- * @arg @p new-path :: String
- *
- * @par
- * MOVE an object to a new path.
- * The new path will have the same parent as the old path.
- */
-void
-OSCClientSender::move(const Path& old_path, const Path& new_path)
-{
- send("/move", "ss", old_path.c_str(), new_path.c_str(), LO_ARGS_END);
-}
-
-/** @page client_osc_namespace
- * <h2>/delete</h2>
- * @arg @p path :: String
- *
- * @par
- * DELETE an object.
- */
-void
-OSCClientSender::del(const URI& uri)
-{
- send("/delete", "s", uri.c_str(), LO_ARGS_END);
-}
-
-/** @page client_osc_namespace
- * <h2>/connect</h2>
- * @arg @p src-path :: String
- * @arg @p dst-path :: String
- *
- * @par
- * Notification a new connection has been made.
- */
-void
-OSCClientSender::connect(const Path& src_port_path,
- const Path& dst_port_path)
-{
- send("/connect", "ss", src_port_path.c_str(), dst_port_path.c_str(), LO_ARGS_END);
-}
-
-/** @page client_osc_namespace
- * <h2>/disconnect</h2>
- * @arg @p src-path :: String
- * @arg @p dst-path :: String
- *
- * @par
- * Notification a connection has been unmade.
- */
-void
-OSCClientSender::disconnect(const URI& src,
- const URI& dst)
-{
- send("/disconnect", "ss", src.c_str(), dst.c_str(), LO_ARGS_END);
-}
-
-/** @page client_osc_namespace
- * <h2>/disconnect_all</h2>
- * @arg @p parent-patch-path :: String
- * @arg @p path :: String
- *
- * @par
- * Notification all connections to an object have been disconnected.
- */
-void
-OSCClientSender::disconnect_all(const Raul::Path& parent_patch_path,
- const Raul::Path& path)
-{
- send("/disconnect_all", "ss", parent_patch_path.c_str(), path.c_str(), LO_ARGS_END);
-}
-
-/** @page client_osc_namespace
- * <h2>/set_property</h2>
- * @arg @p path :: String
- * @arg @p key :: URI String
- * @arg @p value
- *
- * @par
- * Notification of a property.
- */
-void
-OSCClientSender::set_property(const URI& path,
- const URI& key,
- const Atom& value)
-{
- lo_message m = lo_message_new();
- lo_message_add_string(m, path.c_str());
- lo_message_add_string(m, key.c_str());
- AtomLiblo::lo_message_add_atom(m, value);
- send_message("/set_property", m);
-}
-
-} // namespace Server
-} // namespace Ingen
diff --git a/src/osc/OSCClientSender.hpp b/src/osc/OSCClientSender.hpp
deleted file mode 100644
index 68c706e4..00000000
--- a/src/osc/OSCClientSender.hpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_ENGINE_OSCCLIENTSENDER_HPP
-#define INGEN_ENGINE_OSCCLIENTSENDER_HPP
-
-#include <cassert>
-#include <string>
-
-#include <lo/lo.h>
-
-#include "ingen/Interface.hpp"
-#include "ingen/GraphObject.hpp"
-
-#include "OSCSender.hpp"
-
-namespace Ingen {
-
-class ServerInterface;
-
-namespace Server {
-
-/** Implements ClientInterface for OSC clients (sends OSC messages).
- *
- * \ingroup engine
- */
-class OSCClientSender : public ClientInterface,
- public Ingen::Shared::OSCSender
-{
-public:
- explicit OSCClientSender(const Raul::URI& url,
- size_t max_packet_size)
- : Shared::OSCSender(max_packet_size)
- , _url(url)
- {
- _address = lo_address_new_from_url(url.c_str());
- }
-
- virtual ~OSCClientSender()
- { lo_address_free(_address); }
-
- bool enabled() const { return _enabled; }
-
- void enable() { _enabled = true; }
- void disable() { _enabled = false; }
-
- void bundle_begin() { OSCSender::bundle_begin(); }
- void bundle_end() { OSCSender::bundle_end(); }
-
- Raul::URI uri() const { return _url; }
-
- /* *** ClientInterface Implementation Below *** */
-
- void response(int32_t id, Status status);
-
- void error(const std::string& msg);
-
- virtual void put(const Raul::URI& path,
- const Resource::Properties& properties,
- Resource::Graph ctx=Resource::DEFAULT);
-
- virtual void delta(const Raul::URI& path,
- const Resource::Properties& remove,
- const Resource::Properties& add);
-
- virtual void del(const Raul::URI& uri);
-
- virtual void move(const Raul::Path& old_path,
- const Raul::Path& new_path);
-
- virtual void connect(const Raul::Path& src_port_path,
- const Raul::Path& dst_port_path);
-
- virtual void disconnect(const Raul::URI& src,
- const Raul::URI& dst);
-
- virtual void disconnect_all(const Raul::Path& parent_patch_path,
- const Raul::Path& path);
-
- virtual void set_property(const Raul::URI& subject,
- const Raul::URI& predicate,
- const Raul::Atom& value);
-
-private:
- Raul::URI _url;
-};
-
-} // namespace Server
-} // namespace Ingen
-
-#endif // INGEN_ENGINE_OSCCLIENTSENDER_HPP
-
diff --git a/src/osc/OSCEngineReceiver.cpp b/src/osc/OSCEngineReceiver.cpp
deleted file mode 100644
index e529ac24..00000000
--- a/src/osc/OSCEngineReceiver.cpp
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <string>
-
-#include <lo/lo.h>
-
-#include "raul/AtomLiblo.hpp"
-#include "raul/Path.hpp"
-#include "raul/SharedPtr.hpp"
-#include "raul/log.hpp"
-
-#include "ingen_config.h"
-#include "ingen/Interface.hpp"
-
-#include "../server/ClientBroadcaster.hpp"
-#include "../server/Engine.hpp"
-
-#include "OSCClientSender.hpp"
-#include "OSCEngineReceiver.hpp"
-
-#define LOG(s) s << "[OSCEngineReceiver] "
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-namespace Server {
-
-/** @page engine_osc_namespace Server OSC Namespace Documentation
- *
- * <p>These are the commands the engine recognizes. A client can control every
- * aspect of the engine entirely with these commands.</p>
- *
- * <p>All commands on this page are in the "control band". If a client needs to
- * know about the state of the engine, it must listen to the "notification band".
- * See the "Client OSC Namespace Documentation" for details.</p>
- */
-
-OSCEngineReceiver::OSCEngineReceiver(Engine& engine,
- SharedPtr<ServerInterface> interface,
- uint16_t port)
- : _engine(engine)
- , _interface(interface)
- , _server(NULL)
-{
- _receive_thread = new ReceiveThread(*this);
-
- char port_str[6];
- snprintf(port_str, sizeof(port_str), "%u", port);
-
- _server = lo_server_new(port_str, error_cb);
-
- if (_server == NULL) {
- LOG(error) << "Could not start OSC server. Aborting." << endl;
- exit(EXIT_FAILURE);
- } else {
- char* lo_url = lo_server_get_url(_server);
- LOG(info) << "Started OSC server at " << lo_url << endl;
- free(lo_url);
- }
-
-#ifdef RAUL_LOG_DEBUG
- lo_server_add_method(_server, NULL, NULL, generic_cb, NULL);
-#endif
-
- // Set response address for this message.
- // It's important this is first and returns nonzero.
- lo_server_add_method(_server, NULL, NULL, set_response_address_cb, this);
-
-#ifdef LIBLO_BUNDLES
- lo_server_add_bundle_handlers(_server, bundle_start_cb, bundle_end_cb, this);
-#endif
-
- // Commands
- lo_server_add_method(_server, "/ping", "i", ping_cb, this);
- lo_server_add_method(_server, "/ping_queued", "i", ping_slow_cb, this);
- lo_server_add_method(_server, "/register_client", "i", register_client_cb, this);
- lo_server_add_method(_server, "/unregister_client", "i", unregister_client_cb, this);
- lo_server_add_method(_server, "/put", NULL, put_cb, this);
- lo_server_add_method(_server, "/delta_begin", NULL, delta_begin_cb, this);
- lo_server_add_method(_server, "/delta_remove", NULL, delta_remove_cb, this);
- lo_server_add_method(_server, "/delta_add", NULL, delta_add_cb, this);
- lo_server_add_method(_server, "/delta_end", NULL, delta_end_cb, this);
- lo_server_add_method(_server, "/move", "iss", move_cb, this);
- lo_server_add_method(_server, "/delete", "is", del_cb, this);
- lo_server_add_method(_server, "/connect", "iss", connect_cb, this);
- lo_server_add_method(_server, "/disconnect", "iss", disconnect_cb, this);
- lo_server_add_method(_server, "/disconnect_all", "iss", disconnect_all_cb, this);
- lo_server_add_method(_server, "/note_on", "isii", note_on_cb, this);
- lo_server_add_method(_server, "/note_off", "isi", note_off_cb, this);
- lo_server_add_method(_server, "/all_notes_off", "isi", all_notes_off_cb, this);
- lo_server_add_method(_server, "/learn", "is", learn_cb, this);
- lo_server_add_method(_server, "/set_property", NULL, set_property_cb, this);
-
- // Queries
- lo_server_add_method(_server, "/get", "is", get_cb, this);
-
- lo_server_add_method(_server, NULL, NULL, unknown_cb, NULL);
-
- _receive_thread->set_name("OSCEngineReceiver Listener");
- _receive_thread->start();
- _receive_thread->set_scheduling(SCHED_FIFO, 5);
-}
-
-OSCEngineReceiver::~OSCEngineReceiver()
-{
- _receive_thread->stop();
- delete _receive_thread;
-
- if (_server != NULL) {
- lo_server_free(_server);
- _server = NULL;
- }
-}
-
-/** Override the semaphore driven _run method of ServerInterfaceImpl
- * to wait on OSC messages and prepare them right away in the same thread.
- */
-void
-OSCEngineReceiver::ReceiveThread::_run()
-{
- /* get a timestamp here and stamp all the events with the same time so
- * they all get executed in the same cycle */
-
- while (true) {
- // Wait on a message and enqueue it
- lo_server_recv(_receiver._server);
-
- // Enqueue every other message that is here "now"
- // (would this provide truly atomic bundles?)
- while (lo_server_recv_noblock(_receiver._server, 0) > 0) {}
- }
-}
-
-/** Create a new request for this message, if necessary.
- *
- * This is based on the fact that the current request is stored in a ref
- * counted pointer, and events just take a reference to that. Thus, events
- * may delete their request if we've since switched to a new one, or the
- * same one can stay around and serve a series of events.
- * Hooray for reference counting.
- *
- * If this message came from the same source as the last message, no allocation
- * of requests or lo_addresses or any of it needs to be done. Unfortunately
- * the only way to check is by comparing URLs, because liblo addresses suck.
- * Lack of a fast liblo address comparison really sucks here, in any case.
- */
-int
-OSCEngineReceiver::set_response_address_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
-{
- OSCEngineReceiver* const me = reinterpret_cast<OSCEngineReceiver*>(user_data);
-
- if (argc < 1 || types[0] != 'i') // Not a valid Ingen message
- return 0; // Save liblo the trouble
-
- const int32_t id = argv[0]->i;
-
- const lo_address addr = lo_message_get_source(msg);
- char* const url = lo_address_get_url(addr);
-
- if (id != -1) {
- // TODO: Cache client
- ClientInterface* client = me->_engine.broadcaster()->client(url);
- me->_interface->set_response_id(id);
- } else {
- me->_interface->disable_responses();
- }
-
- free(url);
-
- // If this returns 0 no OSC commands will work
- return 1;
-}
-
-#ifdef LIBLO_BUNDLES
-int
-OSCEngineReceiver::_bundle_start_cb(lo_timetag time)
-{
- info << "BUNDLE START" << endl;
- return 0;
-}
-
-int
-OSCEngineReceiver::_bundle_end_cb()
-{
- info << "BUNDLE END" << endl;
- return 0;
-}
-#endif
-
-void
-OSCEngineReceiver::error_cb(int num, const char* msg, const char* path)
-{
- error << "liblo server error" << num;
- if (path) {
- error << " for path `" << path << "'";
- }
- error << " (" << msg << ")" << endl;
-}
-
-/** @page engine_osc_namespace
- * <h2>/ping</h2>
- * @arg @p response-id :: Integer
- */
-int
-OSCEngineReceiver::_ping_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const lo_address addr = lo_message_get_source(msg);
- if (lo_send(addr, "/ok", "i", argv[0]->i) < 0)
- warn << "Unable to send response (" << lo_address_errstr(addr) << ")" << endl;
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/ping_queued</h2>
- * @arg @p response-id :: Integer
- *
- * @par
- * Reply to sender with a successful response after going through the
- * event queue. This is useful for checking if the engine is actually active,
- * or for sending after several events as a sentinel and wait on it's response,
- * to know when all previous events have finished processing.
- */
-int
-OSCEngineReceiver::_ping_slow_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _interface->ping();
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/register_client</h2>
- * @arg @p response-id :: Integer
- *
- * @par
- * Register a new client with the engine. The incoming address will be
- * used for the new registered client.
- */
-int
-OSCEngineReceiver::_register_client_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- lo_address addr = lo_message_get_source(msg);
-
- char* const url = lo_address_get_url(addr);
- ClientInterface* client = new OSCClientSender(
- (const char*)url,
- _engine.world()->conf()->option("packet-size").get_int32());
- _interface->register_client(client);
- free(url);
-
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/unregister_client</h2>
- * @arg @p response-id :: Integer
- *
- * @par
- * Unregister a client.
- */
-int
-OSCEngineReceiver::_unregister_client_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- lo_address addr = lo_message_get_source(msg);
-
- char* url = lo_address_get_url(addr);
- _interface->unregister_client(url);
- free(url);
-
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/get</h2>
- * @arg @p response-id :: Integer
- * @arg @p uri :: URI String
- *
- * @par
- * Request all properties of an object.
- */
-int
-OSCEngineReceiver::_get_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _interface->get(&argv[1]->s);
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/put</h2>
- * @arg @p response-id :: Integer
- * @arg @p path :: String
- * @arg @p context :: URI String
- * @arg @p predicate :: URI String
- * @arg @p value
- * @arg @p ...
- *
- * @par
- * PUT a set of properties to a path.
- */
-int
-OSCEngineReceiver::_put_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* obj_path = &argv[1]->s;
- const char* ctx = &argv[2]->s;
- Resource::Properties prop;
- for (int i = 3; i < argc-1; i += 2)
- prop.insert(
- make_pair(&argv[i]->s,
- AtomLiblo::lo_arg_to_atom(_engine.world()->forge(), types[i+1], argv[i+1])));
- _interface->put(obj_path, prop, Resource::uri_to_graph(ctx));
- return 0;
-}
-
-int
-OSCEngineReceiver::_delta_begin_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* obj_path = &argv[1]->s;
- assert(_delta_remove.empty());
- assert(_delta_add.empty());
- _delta_uri = obj_path;
- return 0;
-}
-
-int
-OSCEngineReceiver::_delta_remove_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _delta_remove.insert(
- make_pair(&argv[1]->s,
- AtomLiblo::lo_arg_to_atom(_engine.world()->forge(), types[2], argv[2])));
- return 0;
-}
-
-int
-OSCEngineReceiver::_delta_add_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _delta_add.insert(
- make_pair(&argv[1]->s,
- AtomLiblo::lo_arg_to_atom(_engine.world()->forge(), types[2], argv[2])));
- return 0;
-}
-
-int
-OSCEngineReceiver::_delta_end_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- _interface->delta(_delta_uri, _delta_remove, _delta_add);
- _delta_uri = Raul::URI();
- _delta_remove.clear();
- _delta_add.clear();
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/move</h2>
- * @arg @p response-id :: Integer
- * @arg @p old-path :: String
- * @arg @p new-path :: String
- *
- * @par
- * MOVE an object to a new path.
- */
-int
-OSCEngineReceiver::_move_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* old_path = &argv[1]->s;
- const char* new_path = &argv[2]->s;
-
- _interface->move(old_path, new_path);
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/delete</h2>
- * @arg @p response-id :: Integer
- * @arg @p path :: String
- *
- * @par
- * DELETE an object.
- */
-int
-OSCEngineReceiver::_del_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* uri = &argv[1]->s;
-
- _interface->del(uri);
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/connect</h2>
- * @arg @p response-id :: Integer
- * @arg @p src-port-path :: String
- * @arg @p dst-port-path :: String
- *
- * @par
- * Connect two ports (which must be in the same patch).
- */
-int
-OSCEngineReceiver::_connect_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* src_port_path = &argv[1]->s;
- const char* dst_port_path = &argv[2]->s;
-
- _interface->connect(src_port_path, dst_port_path);
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/disconnect</h2>
- * @arg @p response-id :: Integer
- * @arg @p src-port-path :: String
- * @arg @p dst-port-path :: String
- *
- * @par
- * Disconnect two ports.
- */
-int
-OSCEngineReceiver::_disconnect_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* src_port_path = &argv[1]->s;
- const char* dst_port_path = &argv[2]->s;
-
- _interface->disconnect(src_port_path, dst_port_path);
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/disconnect_all</h2>
- * @arg @p response-id :: Integer
- * @arg @p patch-path :: String
- * @arg @p object-path :: String
- *
- * @par
- * Disconnect all connections to/from a node/port.
- */
-int
-OSCEngineReceiver::_disconnect_all_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- const char* patch_path = &argv[1]->s;
- const char* object_path = &argv[2]->s;
-
- _interface->disconnect_all(patch_path, object_path);
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/note_on</h2>
- * @arg @p response-id :: Integer
- * @arg @p node-path :: String
- * @arg @p note-num (int)
- * @arg @p velocity (int)
- *
- * @par
- * Trigger a note-on, just as if it came from MIDI.
- */
-int
-OSCEngineReceiver::_note_on_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- /*
- const char* node_path = &argv[1]->s;
- const uint8_t note_num = argv[2]->i;
- const uint8_t velocity = argv[3]->i;
- */
- warn << "TODO: OSC note on" << endl;
- //note_on(node_path, note_num, velocity);
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/note_off</h2>
- * @arg @p response-id :: Integer
- * @arg @p node-path :: String
- * @arg @p note-num :: Integer
- *
- * @par
- * Trigger a note-off, just as if it came from MIDI.
- */
-int
-OSCEngineReceiver::_note_off_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- /*
- const char* patch_path = &argv[1]->s;
- const uint8_t note_num = argv[2]->i;
- */
- warn << "TODO: OSC note off" << endl;
- //note_off(patch_path, note_num);
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/all_notes_off</h2>
- * @arg @p response-id :: Integer
- * @arg @p patch-path :: String
- *
- * @par
- * Trigger a note-off for all voices, just as if it came from MIDI.
- */
-int
-OSCEngineReceiver::_all_notes_off_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- /*
-
- const char* patch_path = &argv[1]->s;
- */
- warn << "TODO: OSC all notes off" << endl;
- //all_notes_off(patch_path);
- return 0;
-}
-
-/** @page engine_osc_namespace
- * <h2>/set_property</h2>
- * @arg @p response-id :: Integer
- * @arg @p uri :: URI String
- * @arg @p key :: URI String
- * @arg @p value :: String
- *
- * @par
- * Set a property on a graph object.
- */
-int
-OSCEngineReceiver::_set_property_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
-{
- if (argc != 4 || types[0] != 'i' || types[1] != 's' || types[2] != 's')
- return 1;
-
- const char* object_path = &argv[1]->s;
- const char* key = &argv[2]->s;
-
- Raul::Atom value = Raul::AtomLiblo::lo_arg_to_atom(_engine.world()->forge(), types[3], argv[3]);
-
- _interface->set_property(object_path, key, value);
- return 0;
-}
-
-// Static Callbacks //
-
-// Display incoming OSC messages (for debugging purposes)
-int
-OSCEngineReceiver::generic_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
-{
- printf("[OSCEngineReceiver] %s (%s)\t", path, types);
-
- for (int i=0; i < argc; ++i) {
- lo_arg_pp(lo_type(types[i]), argv[i]);
- printf("\t");
- }
- printf("\n");
-
- return 1; // not handled
-}
-
-int
-OSCEngineReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
-{
- const lo_address addr = lo_message_get_source(msg);
- char* const url = lo_address_get_url(addr);
-
- warn << "Unknown OSC command " << path << " (" << types << ") "
- << "received from " << url << endl;
-
- string error_msg = "Unknown command: ";
- error_msg.append(path).append(" ").append(types);
-
- lo_send(addr, "/error", "s", error_msg.c_str(), LO_ARGS_END);
- free(url);
-
- return 0;
-}
-
-} // namespace Server
-} // namespace Ingen
diff --git a/src/osc/OSCEngineReceiver.hpp b/src/osc/OSCEngineReceiver.hpp
deleted file mode 100644
index 5e83fe16..00000000
--- a/src/osc/OSCEngineReceiver.hpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_ENGINE_OSCENGINERECEIVER_HPP
-#define INGEN_ENGINE_OSCENGINERECEIVER_HPP
-
-#include <stdint.h>
-
-#include <lo/lo.h>
-
-#include "raul/Thread.hpp"
-#include "raul/URI.hpp"
-
-#include "ingen/Resource.hpp"
-
-#include "ingen_config.h"
-#include "macros.h"
-
-namespace Ingen {
-
-class ServerInterface;
-
-namespace Server {
-
-class Engine;
-
-/* FIXME: Make this receive and preprocess in the same thread? */
-
-/** Receive OSC messages and call interface functions.
- *
- * \ingroup engine
- */
-class OSCEngineReceiver
-{
-public:
- OSCEngineReceiver(Engine& engine,
- SharedPtr<ServerInterface> interface,
- uint16_t port);
-
- ~OSCEngineReceiver();
-
-private:
- struct ReceiveThread : public Raul::Thread {
- explicit ReceiveThread(OSCEngineReceiver& receiver) : _receiver(receiver) {}
- virtual void _run();
- private:
- OSCEngineReceiver& _receiver;
- };
-
- friend struct ReceiveThread;
-
- ReceiveThread* _receive_thread;
-
- Raul::URI _delta_uri;
- Resource::Properties _delta_remove;
- Resource::Properties _delta_add;
-
-#ifdef LIBLO_BUNDLES
- static int bundle_start_cb(lo_timetag time, void* myself) {
- return ((OSCEngineReceiver*)myself)->_bundle_start_cb(time);
- }
- static int bundle_end_cb(void* myself) {
- return ((OSCEngineReceiver*)myself)->_bundle_end_cb();
- }
-
- int _bundle_start_cb(lo_timetag time);
- int _bundle_end_cb();
-#endif
-
- static void error_cb(int num, const char* msg, const char* path);
- static int set_response_address_cb(LO_HANDLER_ARGS, void* myself);
- static int generic_cb(LO_HANDLER_ARGS, void* myself);
- static int unknown_cb(LO_HANDLER_ARGS, void* myself);
-
- LO_HANDLER(OSCEngineReceiver, quit);
- LO_HANDLER(OSCEngineReceiver, ping);
- LO_HANDLER(OSCEngineReceiver, ping_slow);
- LO_HANDLER(OSCEngineReceiver, register_client);
- LO_HANDLER(OSCEngineReceiver, unregister_client);
- LO_HANDLER(OSCEngineReceiver, get);
- LO_HANDLER(OSCEngineReceiver, put);
- LO_HANDLER(OSCEngineReceiver, delta_begin);
- LO_HANDLER(OSCEngineReceiver, delta_remove);
- LO_HANDLER(OSCEngineReceiver, delta_add);
- LO_HANDLER(OSCEngineReceiver, delta_end);
- LO_HANDLER(OSCEngineReceiver, move);
- LO_HANDLER(OSCEngineReceiver, del);
- LO_HANDLER(OSCEngineReceiver, connect);
- LO_HANDLER(OSCEngineReceiver, disconnect);
- LO_HANDLER(OSCEngineReceiver, disconnect_all);
- LO_HANDLER(OSCEngineReceiver, note_on);
- LO_HANDLER(OSCEngineReceiver, note_off);
- LO_HANDLER(OSCEngineReceiver, all_notes_off);
- LO_HANDLER(OSCEngineReceiver, learn);
- LO_HANDLER(OSCEngineReceiver, set_property);
- LO_HANDLER(OSCEngineReceiver, property_set);
-
- Engine& _engine;
- SharedPtr<ServerInterface> _interface;
- lo_server _server;
-};
-
-} // namespace Server
-} // namespace Ingen
-
-#endif // INGEN_ENGINE_OSCENGINERECEIVER_HPP
diff --git a/src/osc/OSCEngineSender.cpp b/src/osc/OSCEngineSender.cpp
deleted file mode 100644
index e7ec9dd9..00000000
--- a/src/osc/OSCEngineSender.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "raul/log.hpp"
-#include "raul/AtomLiblo.hpp"
-#include "raul/Path.hpp"
-
-#include "ingen/Patch.hpp"
-#include "ingen/Port.hpp"
-#include "ingen/Plugin.hpp"
-
-#include "OSCEngineSender.hpp"
-
-#define LOG(s) s << "[OSCEngineSender] "
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-namespace Client {
-
-/** Note the sending port is implicitly set by liblo, lo_send by default sends
- * from the most recently created server, so create the OSC listener before
- * this to have it all happen on the same port. Yeah, this is a big magic :/
- */
-OSCEngineSender::OSCEngineSender(const URI& engine_url,
- size_t max_packet_size,
- SharedPtr<Raul::Deletable> receiver)
- : Shared::OSCSender(max_packet_size)
- , _receiver(receiver)
- , _engine_url(engine_url)
- , _id(0)
-{
- _address = lo_address_new_from_url(engine_url.c_str());
-}
-
-OSCEngineSender::~OSCEngineSender()
-{
- lo_address_free(_address);
-}
-
-/** Attempt to connect to the engine (by pinging it).
- *
- * This doesn't register a client (or otherwise affect the client/engine state).
- * To check for success wait for the ping response with id @a ping_id (using the
- * relevant OSCClientReceiver).
- *
- * Passing a client_port of 0 will automatically choose a free port. If the
- * @a block parameter is true, this function will not return until a connection
- * has successfully been made.
- */
-void
-OSCEngineSender::attach(int32_t ping_id, bool block)
-{
- if (!_address)
- _address = lo_address_new_from_url(_engine_url.c_str());
-
- if (_address == NULL) {
- LOG(error) << "Unable to connect to " << _engine_url << endl;
- exit(EXIT_FAILURE);
- }
-
- LOG(info) << "Attempting to contact engine at " << _engine_url << " ..." << endl;
-
- _id = ping_id;
- this->ping();
-}
-
-/* *** ServerInterface implementation below here *** */
-
-/** Register with the engine via OSC.
- *
- * Note that this does not actually use 'client', since the engine creates
- * it's own key for OSC clients (namely the incoming URL), for NAT
- * traversal. It is a parameter to remain compatible with ServerInterface.
- */
-void
-OSCEngineSender::register_client(ClientInterface* client)
-{
- send("/register_client", "i", next_id(), LO_ARGS_END);
-}
-
-void
-OSCEngineSender::unregister_client(const URI& uri)
-{
- send("/unregister_client", "i", next_id(), LO_ARGS_END);
-}
-
-// Object commands
-
-void
-OSCEngineSender::put(const Raul::URI& path,
- const Resource::Properties& properties,
- Resource::Graph ctx)
-{
- typedef Resource::Properties::const_iterator iterator;
- lo_message m = lo_message_new();
- lo_message_add_int32(m, next_id());
- lo_message_add_string(m, path.c_str());
- lo_message_add_string(m, Resource::graph_to_uri(ctx).c_str());
- for (iterator i = properties.begin(); i != properties.end(); ++i) {
- lo_message_add_string(m, i->first.c_str());
- Raul::AtomLiblo::lo_message_add_atom(m, i->second);
- }
- send_message("/put", m);
-}
-
-void
-OSCEngineSender::delta(const Raul::URI& path,
- const Resource::Properties& remove,
- const Resource::Properties& add)
-{
- typedef Resource::Properties::const_iterator iterator;
-
- const bool bundle = !_bundle;
- if (bundle)
- bundle_begin();
-
- const int32_t id = next_id();
- send("/delta_begin", "is", id, path.c_str(), LO_ARGS_END);
-
- for (iterator i = remove.begin(); i != remove.end(); ++i) {
- lo_message m = lo_message_new();
- lo_message_add_string(m, i->first.c_str());
- Raul::AtomLiblo::lo_message_add_atom(m, i->second);
- send_message("/delta_remove", m);
- }
-
- for (iterator i = add.begin(); i != add.end(); ++i) {
- lo_message m = lo_message_new();
- lo_message_add_string(m, i->first.c_str());
- Raul::AtomLiblo::lo_message_add_atom(m, i->second);
- send_message("/delta_add", m);
- }
-
- send("/delta_end", "i", id, LO_ARGS_END);
-
- if (bundle)
- bundle_end();
-}
-
-void
-OSCEngineSender::move(const Path& old_path,
- const Path& new_path)
-{
- send("/move", "iss",
- next_id(),
- old_path.c_str(),
- new_path.c_str(),
- LO_ARGS_END);
-}
-
-void
-OSCEngineSender::del(const URI& uri)
-{
- send("/delete", "is",
- next_id(),
- uri.c_str(),
- LO_ARGS_END);
-}
-
-void
-OSCEngineSender::connect(const Path& src_port_path,
- const Path& dst_port_path)
-{
- send("/connect", "iss",
- next_id(),
- src_port_path.c_str(),
- dst_port_path.c_str(),
- LO_ARGS_END);
-}
-
-void
-OSCEngineSender::disconnect(const URI& src,
- const URI& dst)
-{
- send("/disconnect", "iss",
- next_id(),
- src.c_str(),
- dst.c_str(),
- LO_ARGS_END);
-}
-
-void
-OSCEngineSender::disconnect_all(const Path& parent_patch_path,
- const Path& path)
-{
- send("/disconnect_all", "iss",
- next_id(),
- parent_patch_path.c_str(),
- path.c_str(),
- LO_ARGS_END);
-}
-
-void
-OSCEngineSender::set_property(const URI& subject,
- const URI& predicate,
- const Atom& value)
-{
- lo_message m = lo_message_new();
- lo_message_add_int32(m, next_id());
- lo_message_add_string(m, subject.c_str());
- lo_message_add_string(m, predicate.c_str());
- Raul::AtomLiblo::lo_message_add_atom(m, value);
- send_message("/set_property", m);
-}
-
-// Requests //
-
-void
-OSCEngineSender::ping()
-{
- send("/ping", "i", next_id(), LO_ARGS_END);
-}
-
-void
-OSCEngineSender::get(const URI& uri)
-{
- send("/get", "is",
- next_id(),
- uri.c_str(),
- LO_ARGS_END);
-}
-
-} // namespace Client
-} // namespace Ingen
-
diff --git a/src/osc/OSCEngineSender.hpp b/src/osc/OSCEngineSender.hpp
deleted file mode 100644
index 9c1ef2f1..00000000
--- a/src/osc/OSCEngineSender.hpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_CLIENT_OSCENGINESENDER_HPP
-#define INGEN_CLIENT_OSCENGINESENDER_HPP
-
-#include <stddef.h>
-
-#include <string>
-
-#include <lo/lo.h>
-
-#include "raul/Deletable.hpp"
-
-#include "ingen/Interface.hpp"
-
-#include "OSCSender.hpp"
-
-namespace Ingen {
-
-namespace Client {
-
-/* OSC (via liblo) interface to the engine.
- *
- * Clients can use this opaquely as an Interface* to control the engine
- * over OSC (whether over a network or not, etc).
- *
- * \ingroup IngenClient
- */
-class OSCEngineSender : public Interface, public Shared::OSCSender {
-public:
- OSCEngineSender(const Raul::URI& engine_url,
- size_t max_packet_size,
- SharedPtr<Raul::Deletable> receiver);
-
- ~OSCEngineSender();
-
- Raul::URI uri() const { return _engine_url; }
-
- inline int32_t next_id() { return (_id == -1) ? -1 : _id++; }
-
- void set_response_id(int32_t id) { _id = id; }
-
- void attach(int32_t ping_id, bool block);
-
- /* *** ServerInterface implementation below here *** */
-
- void enable() { _enabled = true; }
- void disable() { _enabled = false; }
-
- void bundle_begin() { OSCSender::bundle_begin(); }
- void bundle_end() { OSCSender::bundle_end(); }
-
- // Client registration
- void register_client(ClientInterface* client);
- void unregister_client(const Raul::URI& uri);
-
- // Object commands
-
- virtual void put(const Raul::URI& path,
- const Resource::Properties& properties,
- Resource::Graph ctx=Resource::DEFAULT);
-
- virtual void delta(const Raul::URI& path,
- const Resource::Properties& remove,
- const Resource::Properties& add);
-
- virtual void del(const Raul::URI& uri);
-
- virtual void move(const Raul::Path& old_path,
- const Raul::Path& new_path);
-
- virtual void connect(const Raul::Path& src_port_path,
- const Raul::Path& dst_port_path);
-
- virtual void disconnect(const Raul::URI& src,
- const Raul::URI& dst);
-
- virtual void disconnect_all(const Raul::Path& parent_patch_path,
- const Raul::Path& path);
-
- virtual void set_property(const Raul::URI& subject_path,
- const Raul::URI& predicate,
- const Raul::Atom& value);
-
- // Requests //
- void ping();
- void get(const Raul::URI& uri);
-
-protected:
- SharedPtr<Raul::Deletable> _receiver;
-
- const Raul::URI _engine_url;
- int _client_port;
- int32_t _id;
-};
-
-} // namespace Client
-} // namespace Ingen
-
-#endif // INGEN_CLIENT_OSCENGINESENDER_HPP
-
diff --git a/src/osc/OSCSender.cpp b/src/osc/OSCSender.cpp
deleted file mode 100644
index f48d6a3e..00000000
--- a/src/osc/OSCSender.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <assert.h>
-#include <unistd.h>
-#include <stdarg.h>
-
-#include "raul/log.hpp"
-
-#include "OSCSender.hpp"
-#include "ingen_config.h"
-
-using namespace std;
-using namespace Raul;
-
-namespace Ingen {
-namespace Shared {
-
-OSCSender::OSCSender(size_t max_packet_size)
- : _bundle(NULL)
- , _address(NULL)
- , _max_packet_size(max_packet_size)
- , _enabled(true)
-{
-}
-
-void
-OSCSender::bundle_begin()
-{
- assert(!_bundle);
- lo_timetag t;
- lo_timetag_now(&t);
- _bundle = lo_bundle_new(t);
-}
-
-void
-OSCSender::bundle_end()
-{
- assert(_bundle);
- lo_send_bundle(_address, _bundle);
- lo_bundle_free_messages(_bundle);
- _bundle = NULL;
-}
-
-int
-OSCSender::send(const char *path, const char *types, ...)
-{
- if (!_enabled)
- return 0;
-
-#ifdef RAUL_LOG_DEBUG
- info << "[OSCSender] " << path << " (" << types << ")" << endl;
-#endif
-
- va_list args;
- va_start(args, types);
-
- lo_message msg = lo_message_new();
- int ret = lo_message_add_varargs(msg, types, args);
-
- if (!ret)
- send_message(path, msg);
- else
- lo_message_free(msg);
-
- va_end(args);
-
- return ret;
-}
-
-void
-OSCSender::send_message(const char* path, lo_message msg)
-{
- if (!_enabled) {
- lo_message_free(msg);
- return;
- }
-
- if (_bundle) {
- if (lo_bundle_length(_bundle) + lo_message_length(msg, path) > _max_packet_size) {
- warn << "Maximum bundle size reached, bundle split" << endl;
- lo_send_bundle(_address, _bundle);
- lo_bundle_free_messages(_bundle);
- lo_timetag t;
- lo_timetag_now(&t);
- _bundle = lo_bundle_new(t);
- }
- lo_bundle_add_message(_bundle, path, msg);
-
- } else {
- lo_send_message(_address, path, msg);
- lo_message_free(msg);
- }
-}
-
-} // namespace Shared
-} // namespace Ingen
diff --git a/src/osc/OSCSender.hpp b/src/osc/OSCSender.hpp
deleted file mode 100644
index 22a720c2..00000000
--- a/src/osc/OSCSender.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_SHARED_OSCSENDER_HPP
-#define INGEN_SHARED_OSCSENDER_HPP
-
-#include <stddef.h>
-
-#include <lo/lo.h>
-
-namespace Ingen {
-namespace Shared {
-
-class OSCSender {
-public:
- explicit OSCSender(size_t max_packet_size);
- virtual ~OSCSender() {}
-
- lo_address address() const { return _address; }
-
- void bundle_begin();
- void bundle_end();
-
-protected:
- int send(const char *path, const char *types, ...);
- void send_message(const char* path, lo_message m);
-
- lo_bundle _bundle;
- lo_address _address;
- size_t _max_packet_size;
- bool _enabled;
-};
-
-} // namespace Shared
-} // namespace Ingen
-
-#endif // INGEN_SHARED_OSCSENDER_HPP
-
diff --git a/src/osc/ingen_osc_client.cpp b/src/osc/ingen_osc_client.cpp
deleted file mode 100644
index 102e9be0..00000000
--- a/src/osc/ingen_osc_client.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "ingen/shared/Module.hpp"
-#include "ingen/shared/World.hpp"
-
-#include "OSCClientReceiver.hpp"
-#include "OSCEngineSender.hpp"
-
-using namespace std;
-using namespace Ingen;
-
-SharedPtr<Ingen::ServerInterface>
-new_osc_interface(Ingen::Shared::World* world,
- const std::string& url,
- SharedPtr<ClientInterface> respond_to)
-{
- SharedPtr<Client::OSCClientReceiver> receiver(
- new Client::OSCClientReceiver(16181, respond_to));
- Client::OSCEngineSender* oes = new Client::OSCEngineSender(
- url, world->conf()->option("packet-size").get_int32(), receiver);
- oes->attach(rand(), true);
- return SharedPtr<ServerInterface>(oes);
-}
-
-struct IngenOSCClientModule : public Ingen::Shared::Module {
- void load(Ingen::Shared::World* world) {
- world->add_interface_factory("osc.udp", &new_osc_interface);
- world->add_interface_factory("osc.tcp", &new_osc_interface);
- }
-};
-
-extern "C" {
-
-Ingen::Shared::Module*
-ingen_module_load()
-{
- return new IngenOSCClientModule();
-}
-
-} // extern "C"
diff --git a/src/osc/ingen_osc_server.cpp b/src/osc/ingen_osc_server.cpp
deleted file mode 100644
index d4934efd..00000000
--- a/src/osc/ingen_osc_server.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "ingen/shared/Module.hpp"
-#include "ingen/shared/World.hpp"
-
-#include "../server/Engine.hpp"
-#include "../server/ServerInterfaceImpl.hpp"
-
-#include "OSCEngineReceiver.hpp"
-
-using namespace std;
-using namespace Ingen;
-
-struct IngenOSCServerModule : public Ingen::Shared::Module {
- void load(Ingen::Shared::World* world) {
- Server::Engine* engine = (Server::Engine*)world->local_engine().get();
- SharedPtr<Server::ServerInterfaceImpl> interface(
- new Server::ServerInterfaceImpl(*engine));
- receiver = SharedPtr<Server::OSCEngineReceiver>(
- new Server::OSCEngineReceiver(
- *engine,
- interface,
- world->conf()->option("engine-port").get_int32()));
- engine->add_event_source(interface);
- }
-
- SharedPtr<Server::OSCEngineReceiver> receiver;
-};
-
-extern "C" {
-
-Ingen::Shared::Module*
-ingen_module_load()
-{
- return new IngenOSCServerModule();
-}
-
-} // extern "C"
diff --git a/src/osc/macros.h b/src/osc/macros.h
deleted file mode 100644
index c4c74995..00000000
--- a/src/osc/macros.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2012 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen 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 Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_OSC_MACROS_H
-#define INGEN_OSC_MACROS_H
-
-/* Some boilerplate killing macros... */
-#define LO_HANDLER_ARGS const char* path, const char* types, lo_arg** argv, int argc, lo_message msg
-
-/* Defines a static handler to be passed to lo_add_method, which is a trivial
- * wrapper around a non-static method that does the real work. Makes a whoole
- * lot of ugly boiler plate go away */
-#define LO_HANDLER(ObjType, name) \
-int _##name##_cb (LO_HANDLER_ARGS);\
-inline static int name##_cb(LO_HANDLER_ARGS, void* myself)\
-{ return ((ObjType*)myself)->_##name##_cb(path, types, argv, argc, msg); }
-
-#endif // INGEN_OSC_MACROS_H
diff --git a/src/osc/wscript b/src/osc/wscript
deleted file mode 100644
index ae0d6245..00000000
--- a/src/osc/wscript
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-from waflib.extras import autowaf as autowaf
-
-def build(bld):
- if bld.is_defined('HAVE_LIBLO'):
- obj = bld(features = 'cxx cxxshlib',
- source = '''OSCClientSender.cpp
- OSCEngineReceiver.cpp
- OSCSender.cpp
- ingen_osc_server.cpp''',
- includes = ['.', '../..'],
- name = 'libingen_osc_server',
- target = 'ingen_osc_server',
- install_path = '${LIBDIR}',
- use = 'libingen_server')
- autowaf.use_lib(bld, obj, 'RAUL LIBLO')
-
- obj = bld(features = 'cxx cxxshlib',
- source = '''OSCClientReceiver.cpp
- OSCEngineSender.cpp
- OSCSender.cpp
- ingen_osc_client.cpp''',
- includes = ['.', '../..'],
- name = 'libingen_osc_client',
- target = 'ingen_osc_client',
- install_path = '${LIBDIR}',
- use = 'libingen_client')
- autowaf.use_lib(bld, obj, 'RAUL LIBLO')
diff --git a/src/shared/Configuration.cpp b/src/shared/Configuration.cpp
index fafe7a49..f1eda529 100644
--- a/src/shared/Configuration.cpp
+++ b/src/shared/Configuration.cpp
@@ -25,18 +25,18 @@ Configuration::Configuration()
: Raul::Configuration(
"A realtime modular audio processor.",
"Ingen is a flexible modular system that be used in various ways.\n"
- "The engine can run as a stand-alone server controlled via a network protocol\n"
- "(e.g. OSC), or internal to another process (e.g. the GUI). The GUI, or other\n"
+ "The engine can run as a stand-alone server controlled via network protocol,\n"
+ "or internal to another process (e.g. the GUI). The GUI, or other\n"
"clients, can communicate with the engine via any supported protocol, or host the\n"
"engine in the same process. Many clients can connect to an engine at once.\n\n"
"Examples:\n"
- " ingen -e # Run an engine, listen for OSC\n"
- " ingen -g # Run a GUI, connect via OSC\n"
- " ingen -eg # Run an engine and a GUI in one process\n"
- " ingen -eg patch.ttl # Run an engine and a GUI and load a patch file\n"
- " ingen -eg patch.ingen # Run an engine and a GUI and load a patch bundle")
+ " ingen -e # Run an engine, listen for connections\n"
+ " ingen -g # Run a GUI, connect to running engine\n"
+ " ingen -eg # Run an engine and a GUI in one process\n"
+ " ingen -egl patch.ttl # Run an engine and a GUI and load a patch file\n"
+ " ingen -egl patch.ingen # Run an engine and a GUI and load a patch bundle")
{
- add("client-port", 'C', "Client OSC port", INT, Value());
+ add("client-port", 'C', "Client port", INT, Value());
add("connect", 'c', "Connect to engine URI", STRING, Value("osc.udp://localhost:16180"));
add("engine", 'e', "Run (JACK) engine", BOOL, Value(false));
add("engine-port", 'E', "Engine listen port", INT, Value(16180));