forked from PurpleI2P/i2pd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40a4c3c
commit 69c9547
Showing
17 changed files
with
567 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,3 +237,4 @@ pip-log.txt | |
|
||
# Sphinx | ||
docs/_build | ||
/androidIdea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/gen/ | ||
/libs/ | ||
/tests/ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.purplei2p.i2pd" | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
<uses-sdk android:minSdkVersion="9" /> | ||
<application android:label="@string/app_name" android:allowBackup="true" android:icon="@drawable/icon"> | ||
<activity android:name=".I2PD" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := i2pd | ||
LOCAL_CPP_FEATURES := rtti exceptions | ||
LOCAL_C_INCLUDES += $(IFADDRS_PATH) ../.. | ||
LOCAL_STATIC_LIBRARIES := \ | ||
boost_system-gcc-mt-1_53 \ | ||
boost_date_time-gcc-mt-1_53 \ | ||
boost_filesystem-gcc-mt-1_53 \ | ||
boost_program_options-gcc-mt-1_53 \ | ||
crypto ssl \ | ||
miniupnpc | ||
LOCAL_LDLIBS := -lz | ||
|
||
#LOCAL_CFLAGS := | ||
LOCAL_SRC_FILES := DaemonAndroid.cpp i2pd_android.cpp \ | ||
$(IFADDRS_PATH)/ifaddrs.c \ | ||
../../HTTPServer.cpp ../../I2PControl.cpp ../../Daemon.cpp ../../Config.cpp \ | ||
../../AddressBook.cpp \ | ||
../../api.cpp \ | ||
../../Base.cpp \ | ||
../../BOB.cpp \ | ||
../../ClientContext.cpp \ | ||
../../Crypto.cpp \ | ||
../../Datagram.cpp \ | ||
../../Destination.cpp \ | ||
../../Family.cpp \ | ||
../../FS.cpp \ | ||
../../Garlic.cpp \ | ||
../../Gzip.cpp \ | ||
../../HTTP.cpp \ | ||
../../HTTPProxy.cpp \ | ||
../../I2CP.cpp \ | ||
../../I2NPProtocol.cpp \ | ||
../../I2PEndian.cpp \ | ||
../../I2PService.cpp \ | ||
../../I2PTunnel.cpp \ | ||
../../Identity.cpp \ | ||
../../LeaseSet.cpp \ | ||
../../Log.cpp \ | ||
../../NetDb.cpp \ | ||
../../NetDbRequests.cpp \ | ||
../../NTCPSession.cpp \ | ||
../../Profiling.cpp \ | ||
../../Reseed.cpp \ | ||
../../RouterContext.cpp \ | ||
../../RouterInfo.cpp \ | ||
../../SAM.cpp \ | ||
../../Signature.cpp \ | ||
../../SOCKS.cpp \ | ||
../../SSU.cpp \ | ||
../../SSUData.cpp \ | ||
../../SSUSession.cpp \ | ||
../../Streaming.cpp \ | ||
../../TransitTunnel.cpp \ | ||
../../Transports.cpp \ | ||
../../Tunnel.cpp \ | ||
../../TunnelEndpoint.cpp \ | ||
../../TunnelGateway.cpp \ | ||
../../TunnelPool.cpp \ | ||
../../UPnP.cpp \ | ||
../../util.cpp \ | ||
../../i2pd.cpp | ||
|
||
include $(BUILD_SHARED_LIBRARY) | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := boost_system-gcc-mt-1_53 | ||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_53_0/$(TARGET_ARCH_ABI)/lib/libboost_system-gcc-mt-1_53.a | ||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_53_0/include | ||
include $(PREBUILT_STATIC_LIBRARY) | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := boost_date_time-gcc-mt-1_53 | ||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_53_0/$(TARGET_ARCH_ABI)/lib/libboost_date_time-gcc-mt-1_53.a | ||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_53_0/include | ||
include $(PREBUILT_STATIC_LIBRARY) | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := boost_filesystem-gcc-mt-1_53 | ||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_53_0/$(TARGET_ARCH_ABI)/lib/libboost_filesystem-gcc-mt-1_53.a | ||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_53_0/include | ||
include $(PREBUILT_STATIC_LIBRARY) | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := boost_program_options-gcc-mt-1_53 | ||
LOCAL_SRC_FILES := $(BOOST_PATH)/boost_1_53_0/$(TARGET_ARCH_ABI)/lib/libboost_program_options-gcc-mt-1_53.a | ||
LOCAL_EXPORT_C_INCLUDES := $(BOOST_PATH)/boost_1_53_0/include | ||
include $(PREBUILT_STATIC_LIBRARY) | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := crypto | ||
LOCAL_SRC_FILES := $(OPENSSL_PATH)/openssl-1.0.2/$(TARGET_ARCH_ABI)/lib/libcrypto.a | ||
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/openssl-1.0.2/include | ||
include $(PREBUILT_STATIC_LIBRARY) | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := ssl | ||
LOCAL_SRC_FILES := $(OPENSSL_PATH)/openssl-1.0.2/$(TARGET_ARCH_ABI)/lib/libssl.a | ||
LOCAL_EXPORT_C_INCLUDES := $(OPENSSL_PATH)/openssl-1.0.2/include | ||
LOCAL_STATIC_LIBRARIES := crypto | ||
include $(PREBUILT_STATIC_LIBRARY) | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
LOCAL_MODULE := miniupnpc | ||
LOCAL_SRC_FILES := $(MINIUPNP_PATH)/miniupnp-2.0/$(TARGET_ARCH_ABI)/lib/libminiupnpc.a | ||
LOCAL_EXPORT_C_INCLUDES := $(MINIUPNP_PATH)/miniupnp-2.0/include | ||
include $(PREBUILT_STATIC_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#APP_ABI := all | ||
APP_ABI := armeabi-v7a x86 | ||
#can be android-3 but will fail for x86 since arch-x86 is not present at ndkroot/platforms/android-3/ . libz is taken from there. | ||
APP_PLATFORM := android-9 | ||
|
||
# http://stackoverflow.com/a/21386866/529442 http://stackoverflow.com/a/15616255/529442 to enable c++11 support in Eclipse | ||
NDK_TOOLCHAIN_VERSION := 4.9 | ||
# APP_STL := stlport_shared --> does not seem to contain C++11 features | ||
APP_STL := gnustl_shared | ||
|
||
# Enable c++11 extentions in source code | ||
APP_CPPFLAGS += -std=c++11 | ||
|
||
APP_CPPFLAGS += -DUSE_UPNP -DANDROID -D__ANDROID__ | ||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) | ||
APP_CPPFLAGS += -DANDROID_ARM7A | ||
endif | ||
|
||
APP_OPTIM := debug | ||
|
||
# git clone https://github.com/PurpleI2P/Boost-for-Android-Prebuilt.git | ||
# git clone https://github.com/PurpleI2P/OpenSSL-for-Android-Prebuilt.git | ||
# git clone https://github.com/PurpleI2P/MiniUPnP-for-Android-Prebuilt.git | ||
# git clone https://github.com/PurpleI2P/android-ifaddrs.git | ||
# change to your own | ||
I2PD_LIBS_PATH=/path/to/libraries | ||
BOOST_PATH = $(I2PD_LIBS_PATH)/Boost-for-Android-Prebuilt | ||
OPENSSL_PATH = $(I2PD_LIBS_PATH)/OpenSSL-for-Android-Prebuilt | ||
MINIUPNP_PATH = $(I2PD_LIBS_PATH)/MiniUPnP-for-Android-Prebuilt | ||
IFADDRS_PATH = $(I2PD_LIBS_PATH)/android-ifaddrs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
#include "DaemonAndroid.h" | ||
#include "../../Daemon.h" | ||
//#include "mainwindow.h" | ||
|
||
namespace i2p | ||
{ | ||
namespace android | ||
{ | ||
/* Worker::Worker (DaemonAndroidImpl& daemon): | ||
m_Daemon (daemon) | ||
{ | ||
} | ||
void Worker::startDaemon() | ||
{ | ||
Log.d(TAG"Performing daemon start..."); | ||
m_Daemon.start(); | ||
Log.d(TAG"Daemon started."); | ||
emit resultReady(); | ||
} | ||
void Worker::restartDaemon() | ||
{ | ||
Log.d(TAG"Performing daemon restart..."); | ||
m_Daemon.restart(); | ||
Log.d(TAG"Daemon restarted."); | ||
emit resultReady(); | ||
} | ||
void Worker::stopDaemon() { | ||
Log.d(TAG"Performing daemon stop..."); | ||
m_Daemon.stop(); | ||
Log.d(TAG"Daemon stopped."); | ||
emit resultReady(); | ||
} | ||
Controller::Controller(DaemonAndroidImpl& daemon): | ||
m_Daemon (daemon) | ||
{ | ||
Worker *worker = new Worker (m_Daemon); | ||
worker->moveToThread(&workerThread); | ||
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater); | ||
connect(this, &Controller::startDaemon, worker, &Worker::startDaemon); | ||
connect(this, &Controller::stopDaemon, worker, &Worker::stopDaemon); | ||
connect(this, &Controller::restartDaemon, worker, &Worker::restartDaemon); | ||
connect(worker, &Worker::resultReady, this, &Controller::handleResults); | ||
workerThread.start(); | ||
} | ||
Controller::~Controller() | ||
{ | ||
Log.d(TAG"Closing and waiting for daemon worker thread..."); | ||
workerThread.quit(); | ||
workerThread.wait(); | ||
Log.d(TAG"Waiting for daemon worker thread finished."); | ||
if(m_Daemon.isRunning()) | ||
{ | ||
Log.d(TAG"Stopping the daemon..."); | ||
m_Daemon.stop(); | ||
Log.d(TAG"Stopped the daemon."); | ||
} | ||
} | ||
*/ | ||
DaemonAndroidImpl::DaemonAndroidImpl (): | ||
/*mutex(nullptr), */ | ||
m_IsRunning(false), | ||
m_RunningChangedCallback(nullptr) | ||
{ | ||
} | ||
|
||
DaemonAndroidImpl::~DaemonAndroidImpl () | ||
{ | ||
//delete mutex; | ||
} | ||
|
||
bool DaemonAndroidImpl::init(int argc, char* argv[]) | ||
{ | ||
//mutex=new QMutex(QMutex::Recursive); | ||
setRunningCallback(0); | ||
m_IsRunning=false; | ||
return Daemon.init(argc,argv); | ||
} | ||
|
||
void DaemonAndroidImpl::start() | ||
{ | ||
//QMutexLocker locker(mutex); | ||
setRunning(true); | ||
Daemon.start(); | ||
} | ||
|
||
void DaemonAndroidImpl::stop() | ||
{ | ||
//QMutexLocker locker(mutex); | ||
Daemon.stop(); | ||
setRunning(false); | ||
} | ||
|
||
void DaemonAndroidImpl::restart() | ||
{ | ||
//QMutexLocker locker(mutex); | ||
stop(); | ||
start(); | ||
} | ||
|
||
void DaemonAndroidImpl::setRunningCallback(runningChangedCallback cb) | ||
{ | ||
m_RunningChangedCallback = cb; | ||
} | ||
|
||
bool DaemonAndroidImpl::isRunning() | ||
{ | ||
return m_IsRunning; | ||
} | ||
|
||
void DaemonAndroidImpl::setRunning(bool newValue) | ||
{ | ||
bool oldValue = m_IsRunning; | ||
if(oldValue!=newValue) | ||
{ | ||
m_IsRunning = newValue; | ||
if(m_RunningChangedCallback) | ||
m_RunningChangedCallback(); | ||
} | ||
} | ||
|
||
static DaemonAndroidImpl daemon; | ||
|
||
/** | ||
* returns 1 if daemon init failed | ||
* returns 0 if daemon initialized and started okay | ||
*/ | ||
int start(/*int argc, char* argv[]*/) | ||
{ | ||
int result; | ||
|
||
{ | ||
//Log.d(TAG"Initialising the daemon..."); | ||
bool daemonInitSuccess = daemon.init(0,0/*argc, argv*/); | ||
if(!daemonInitSuccess) | ||
{ | ||
//QMessageBox::critical(0, "Error", "Daemon init failed"); | ||
return 1; | ||
} | ||
//Log.d(TAG"Initialised, creating the main window..."); | ||
//MainWindow w; | ||
//Log.d(TAG"Before main window.show()..."); | ||
//w.show (); | ||
|
||
{ | ||
//i2p::qt::Controller daemonQtController(daemon); | ||
//Log.d(TAG"Starting the daemon..."); | ||
//emit daemonQtController.startDaemon(); | ||
//daemon.start (); | ||
//Log.d(TAG"Starting GUI event loop..."); | ||
//result = app.exec(); | ||
//daemon.stop (); | ||
daemon.start(); | ||
return 0; | ||
} | ||
} | ||
|
||
//QMessageBox::information(&w, "Debug", "demon stopped"); | ||
//Log.d(TAG"Exiting the application"); | ||
//return result; | ||
} | ||
|
||
void stop() | ||
{ | ||
daemon.stop(); | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.