#13795: Initial commit for sflphone-android

includes: libexpat libyaml libdbus-c++ commoncpp ccrtp
          libdbus (from android-4.0.4 sources)

TODO:
- git ignores "/jni/sflphone", sflphone repo should be cloned.
- sflphone-android only needs daemon directory. Ideally it should be possible
to clone it without cloning the whole sflphone project.
into sfl-android (commit 6a0fa7a "#13961: Fix cipher handling" has been used here)
- add pjsip-android project as a git submodule
- sflphone-android needs pjsip android project. Ideally daemon git repository
should not embed pjsip. Instead pjsip should be clone from official repositories.

Considering this, structure should have three distincts git repos:

sflphone-android/.git
sflphone-android/jni/ccrtp-1.8.0-android
sflphone-android/jni/commoncpp2-1.8.1-android
sflphone-android/jni/dbus
sflphone-android/jni/libdbus-c++-0.9.0-android
sflphone-android/jni/libexpat
sflphone-android/jni/libyaml

sflphone-android/jni/sflphone-daemon/.git
sflphone-android/jni/sflphone-daemon/src/audio
sflphone-android/jni/sflphone-daemon/src/config
sflphone-android/jni/sflphone-daemon/src/dbus
sflphone-android/jni/sflphone-daemon/src/history
sflphone-android/jni/sflphone-daemon/src/hooks
sflphone-android/jni/sflphone-daemon/src/iax
sflphone-android/jni/sflphone-daemon/src/sip
sflphone-android/jni/sflphone-daemon/src/video

sflphone-android/jni/pjsip-android/.git

Signed-off-by: Emeric Vigier <emeric.vigier@savoirfairelinux.com>
diff --git a/jni/libdbus-c++-0.9.0-android/examples/echo/echo-server.cpp b/jni/libdbus-c++-0.9.0-android/examples/echo/echo-server.cpp
new file mode 100644
index 0000000..4f17046
--- /dev/null
+++ b/jni/libdbus-c++-0.9.0-android/examples/echo/echo-server.cpp
@@ -0,0 +1,96 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "echo-server.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <stdio.h>
+#include <limits.h>
+
+static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
+static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
+
+EchoServer::EchoServer(DBus::Connection &connection)
+  : DBus::ObjectAdaptor(connection, ECHO_SERVER_PATH)
+{
+}
+
+int32_t EchoServer::Random()
+{
+  return rand();
+}
+
+std::string EchoServer::Hello(const std::string &name)
+{
+  return "Hello " + name + "!";
+}
+
+DBus::Variant EchoServer::Echo(const DBus::Variant &value)
+{
+  this->Echoed(value);
+
+  return value;
+}
+
+std::vector< uint8_t > EchoServer::Cat(const std::string &file)
+{
+  FILE *handle = fopen(file.c_str(), "rb");
+
+  if (!handle) throw DBus::Error("org.freedesktop.DBus.EchoDemo.ErrorFileNotFound", "file not found");
+
+  uint8_t buff[1024];
+
+  size_t nread = fread(buff, 1, sizeof(buff), handle);
+
+  fclose(handle);
+
+  return std::vector< uint8_t > (buff, buff + nread);
+}
+
+int32_t EchoServer::Sum(const std::vector<int32_t>& ints)
+{
+  int32_t sum = 0;
+
+  for (size_t i = 0; i < ints.size(); ++i) sum += ints[i];
+
+  return sum;
+}
+
+std::map< std::string, std::string > EchoServer::Info()
+{
+  std::map< std::string, std::string > info;
+  char hostname[HOST_NAME_MAX];
+
+  gethostname(hostname, sizeof(hostname));
+  info["hostname"] = hostname;
+  info["username"] = getlogin();
+
+  return info;
+}
+
+
+DBus::BusDispatcher dispatcher;
+
+void niam(int sig)
+{
+  dispatcher.leave();
+}
+
+int main()
+{
+  signal(SIGTERM, niam);
+  signal(SIGINT, niam);
+
+  DBus::default_dispatcher = &dispatcher;
+
+  DBus::Connection conn = DBus::Connection::SessionBus();
+  conn.request_name(ECHO_SERVER_NAME);
+
+  EchoServer server(conn);
+
+  dispatcher.enter();
+
+  return 0;
+}