Permalink
Browse files

Adding Max Kastanas's fwknop client app code for Android

git-svn-id: file:///home/mbr/svn/fwknop/trunk@309 510a4753-2344-4c79-9c09-4d669213fbeb
  • Loading branch information...
1 parent d8f2821 commit a24a2eed8f4b75bdfae65d3c9eb7797b87f863e1 Damien Stuart committed Jan 2, 2011
Showing with 3,384 additions and 0 deletions.
  1. +33 −0 Makefile.am
  2. +2 −0 android/Application.mk
  3. +674 −0 android/COPYING
  4. +142 −0 android/README
  5. +19 −0 android/project/AndroidManifest.xml
  6. +16 −0 android/project/build.properties
  7. +67 −0 android/project/build.xml
  8. +11 −0 android/project/default.properties
  9. +36 −0 android/project/jni/Android.mk
  10. +350 −0 android/project/jni/config.h
  11. +186 −0 android/project/jni/fwknop/fwknop_client.c
  12. +56 −0 android/project/jni/fwknop/fwknop_client.h
  13. +94 −0 android/project/jni/fwknop/send_spa_packet.c
  14. +10 −0 android/project/jni/libfwknop/README
  15. +37 −0 android/project/jni/libfwknop/get_libfko_files.sh
  16. +38 −0 android/project/jni/logutils.h
  17. +744 −0 android/project/nbproject/build-impl.xml
  18. +8 −0 android/project/nbproject/genfiles.properties
  19. 0 android/project/nbproject/private/config.properties
  20. +5 −0 android/project/nbproject/private/private.properties
  21. +4 −0 android/project/nbproject/private/private.xml
  22. +67 −0 android/project/nbproject/project.properties
  23. +17 −0 android/project/nbproject/project.xml
  24. BIN android/project/res/drawable-hdpi/icon.png
  25. BIN android/project/res/drawable-ldpi/icon.png
  26. BIN android/project/res/drawable-mdpi/icon.png
  27. BIN android/project/res/drawable/lock_128x128.png
  28. BIN android/project/res/drawable/lock_32x32.png
  29. BIN android/project/res/drawable/lock_64x64.png
  30. +180 −0 android/project/res/layout/main.xml
  31. +5 −0 android/project/res/values/strings.xml
  32. +531 −0 android/project/src/com/max2idea/android/fwknop/Fwknop.java
  33. +52 −0 android/project/src/com/max2idea/android/fwknop/R.java
View
@@ -15,6 +15,39 @@ SUBDIRS = \
doc
EXTRA_DIST = \
+ android/COPYING \
+ android/Application.mk \
+ android/README \
+ android/project/src/com/max2idea/android/fwknop/R.java \
+ android/project/src/com/max2idea/android/fwknop/Fwknop.java \
+ android/project/build.xml \
+ android/project/default.properties \
+ android/project/res/values/strings.xml \
+ android/project/res/drawable-hdpi/icon.png \
+ android/project/res/drawable-mdpi/icon.png \
+ android/project/res/drawable-ldpi/icon.png \
+ android/project/res/drawable/lock_64x64.png \
+ android/project/res/drawable/lock_32x32.png \
+ android/project/res/drawable/lock_128x128.png \
+ android/project/res/layout/main.xml \
+ android/project/nbproject/project.properties \
+ android/project/nbproject/project.xml \
+ android/project/nbproject/build-impl.xml \
+ android/project/nbproject/private/private.properties \
+ android/project/nbproject/private/private.xml \
+ android/project/nbproject/private/config.properties \
+ android/project/nbproject/genfiles.properties \
+ android/project/build.properties \
+ android/project/assets \
+ android/project/AndroidManifest.xml \
+ android/project/jni/fwknop/fwknop_client.c \
+ android/project/jni/fwknop/fwknop_client.h \
+ android/project/jni/fwknop/send_spa_packet.c \
+ android/project/jni/config.h \
+ android/project/jni/libfwknop/README \
+ android/project/jni/libfwknop/get_libfko_files.sh \
+ android/project/jni/logutils.h \
+ android/project/jni/Android.mk \
extras/fwknop.init.debian \
extras/fwknop.init.openwrt \
extras/fwknop.init.redhat \
View
@@ -0,0 +1,2 @@
+APP_PROJECT_PATH := $(call my-dir)/project
+APP_MODULES := libfwknop
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,142 @@
+===============================================================================
+FWKNOP for Android
+
+Max Kastanas <max2idea@users.sourceforge.net>
+
+Based on fwknop C implementation by Damien Stuart
+===============================================================================
+
+1. Requirements:
+
+ a. Apache Ant (1.7.1)
+ http://ant.apache.org/bindownload.cgi
+
+ b. Android NDK (Android r5-linux)
+ http://developer.android.com/sdk/ndk/index.html
+ Unzip the contents under a directory ie:
+ /home/yourname/tools/android-sdk-linux_86
+
+ c. Android SDK (Android r08-linux)
+ http://developer.android.com/sdk/index.html
+ Unzip the contents under a directory ie:
+ /home/yourname/tools/android-ndk-r5
+
+ d. Include the Android SDK tools directory in your user PATH variable:
+ export PATH=$PATH:/home/dev/tools/android-sdk-linux_86/tools:/home/yourname/tools/android-ndk-r5
+
+ e. Download an SDK Android platform, in a command shell type: "android &"
+ to start up the "Android SDK and AVD Manager". Download an SDK
+ platform (Android 2.1 and above is recommended) under the
+ "Available Packages" section.
+
+ f. Java SDK (1.6 and above)
+ http://www.oracle.com/technetwork/java/javase/downloads/index.html
+
+ g. Netbeans (6.9 and above) - Optional if you want to use Netbeans as
+ the IDE:
+ http://netbeans.org/downloads/
+
+ h. Netbeans Android plugin (0.11 and above) - Optional if you are using
+ the Netbeans IDE:
+ http://kenai.com/projects/nbandroid/pages/Install
+
+===============================================================================
+2. Setup
+
+ a. Untar the tar.gz file:
+ tar -zxf Fwknop-0.9.tar.gz
+
+ b. Update the properties files with the path to the sdk and ndk tools:
+ .../fwknop-android/project/build.properties
+ sdk.dir=/home/yourname/tools/android-sdk-linux_86
+ ndk.dir=/home/yourname/tools/android-ndk-r5
+
+ c. Include the Android SDK platform directory in your user PATH variable
+ export PATH=$PATH:/home/dev/tools/android-sdk-linux_86/platforms-tools
+
+ d. Create a new Android device, in a command shell type: "android".
+ This will start the android SDK and AVD Manager
+ Under Virtual Devices create an AVD device and name it as "Android2.1"
+
+ e. Update (if needed) project file with the right virtual device as above:
+ .../fwknop-android/project/nbproject/project.properties
+ platform.active=Android2.1
+
+ f. The relevant fwknop android C code can be found under the
+ ".../project/jni" directory:
+ 1. The ".../project/jni/libfwknop" directory should contain all of
+ the .c and .h files from the main fwknop/lib/ directory (the
+ libfko source files. You can copy all of the *.[ch] files from
+ .../fwknop.../lib manually, or use the "get_libfko_files.sh"
+ script.
+
+ 2. The ".../project/jni/fwknop" directory contains the code for
+ the android-specific client code (with the Java Native Interface
+ hooks).
+
+===============================================================================
+3. Build
+
+ a. To build the app make sure you're under the project directory:
+ $> cd /home/yourname/.../fwknop-android/project
+
+ b. To build the application type:
+ $> ant jar
+
+===============================================================================
+4. Run
+
+ a. Now search under the .../fwknop-android/dist directory for a .apk
+ file. You can copy the .apk file to your SD card by typing (make
+ sure the Android Emulator is on):
+ $> adb push Fwknop.apk /sdcard/
+
+ Then you can open it and install it from within your Android device
+ using a Filemanager like Astro. Make sure that you have turned on the
+ "Unknown Sources" Option under Application settings.
+
+===============================================================================
+5. Android Emulator
+
+ If you don't have a device you can install and run Fwknop in the Android
+ emulator. To do so follow these steps:
+ $> android
+
+ Under the virtual devices find your device "Android2.1" and start it up
+
+ In a command line type:
+ $> adb install Fwknop.apk
+
+ You can now find the Firewall Knock Operator app under the menu tap on
+ the icon to get started.
+
+===============================================================================
+6. Developing with Netbeans
+
+To develop and build with Netbeans make sure you have installed the nbandroid
+plugin (see requirements. Once you have that install a new Java platform under
+the Tool -> Java Platforms and choose a Google Android platform, navigate
+under the SDK platform directory you downloaded under step 1e. Finally, just
+open the .../fwknop-android/project directory as a Netbeans project.
+
+===============================================================================
+7. Debugging
+
+You can use gdb to debug the app. Before you do so make sure you have the
+following attribute in your AndroidManifest.xml file:
+ android:debuggable="true"
+Now rebuild the application and start the Android Emulator, then in a command
+shell type:
+ $> ndk-gdb --project=<path-to>/android/project
+
+This will start gdb in remote debugging, similarly you can follow the same
+steps to debug a physical device
+
+===============================================================================
+Changelog
+v0.9 Dec 28 2010
+1) Rijndael client support
+2) Local and External IP resolution
+2) Automatically start ConnectBot
+
+
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.max2idea.android.fwknop"
+ android:versionCode="2"
+ android:versionName="1.0">
+ <application android:label="@string/app_name" android:icon="@drawable/lock_64x64"
+ android:debuggable="true">
+ <activity android:name=".Fwknop"
+ android:label="@string/app_name"
+ android:screenOrientation="portrait" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ </application>
+ <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="8"/>
+ <uses-permission android:name="android.permission.INTERNET" />
+</manifest>
@@ -0,0 +1,16 @@
+# SDK paths
+sdk.dir=/home/dstuart/android-sdk-linux_86
+ndk.dir=/home/dstuart/android-ndk-r5
+
+# if you want to deploy to a website#
+#deploy.dir=/home/yourname/public_html
+
+# Currently platform supported is Android 7 (2.1)
+platforms.Android2.1.aapt=${platforms.Android2.1.home}/tools/aapt
+platforms.Android2.1.adb=${sdk.dir}/tools/adb
+platforms.Android2.1.apkbuilder=${sdk.dir}/tools/apkbuilder
+platforms.Android2.1.bootclasspath=${platforms.Android2.1.home}/android.jar
+platforms.Android2.1.bootclasspath0=${platforms.Android2.1.home}/android.jar
+platforms.Android2.1.dx=${platforms.Android2.1.home}/tools/dx
+platforms.Android2.1.emulator=${sdk.dir}/tools/emulator
+platforms.Android2.1.home=${sdk.dir}/platforms/android-7
View
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="fwknop-android" default="jar">
+ <import file="nbproject/build-impl.xml"/>
+ <!-- The local.properties file is created and updated by the 'android' tool.
+ It contains the path to the SDK. It should *NOT* be checked in in Version
+ Control Systems. -->
+ <property file="local.properties" />
+
+ <!-- The build.properties file can be created by you and is never touched
+ by the 'android' tool. This is the place to change some of the default property values
+ used by the Ant rules.
+ Here are some properties you may want to change/update:
+
+ application.package
+ the name of your application package as defined in the manifest. Used by the
+ 'uninstall' rule.
+ source.dir
+ the name of the source directory. Default is 'src'.
+ out.dir
+ the name of the output directory. Default is 'bin'.
+
+ Properties related to the SDK location or the project target should be updated
+ using the 'android' tool with the 'update' action.
+
+ This file is an integral part of the build system for your application and
+ should be checked in in Version Control Systems.
+
+ -->
+ <property file="build.properties" />
+
+ <!-- The default.properties file is created and updated by the 'android' tool, as well
+ as ADT.
+ This file is an integral part of the build system for your application and
+ should be checked in in Version Control Systems. -->
+ <property file="default.properties" />
+
+ <!-- Custom Android task to deal with the project target, and import the proper rules.
+ This requires ant 1.6.0 or above. -->
+ <path id="android.antlibs">
+ <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" />
+ <pathelement path="${sdk.dir}/tools/lib/jarutils.jar" />
+ </path>
+
+<!-- <taskdef name="setup"
+ classname="com.android.ant.SetupTask"
+ classpathref="android.antlibs" />-->
+
+ <!-- Execute the Android Setup task that will setup some properties specific to the target,
+ and import the build rules files.
+
+ The rules file is imported from
+ <SDK>/platforms/<target_platform>/templates/android_rules.xml
+
+ To customize some build steps for your project:
+ - copy the content of the main node <project> from android_rules.xml
+ - paste it in this build.xml below the <setup /> task.
+ - disable the import by changing the setup task below to <setup import="false" />
+
+ This will ensure that the properties are setup correctly but that your customized
+ build steps are used.
+ -->
+ <!--<setup />-->
+
+</project>
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=Google Inc.:Google APIs:7
@@ -0,0 +1,36 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+LOCAL_PATH:= $(call my-dir)
+
+# libfwknop module
+#
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libfwknop
+LOCAL_CFLAGS := -W -g -DHAVE_CONFIG_H \
+ -I$(LOCAL_PATH) \
+ -I$(LOCAL_PATH)/fwknop \
+ -I$(LOCAL_PATH)/libfwknop
+
+LOCAL_SRC_FILES := $(shell cd $(LOCAL_PATH); \
+ find ./fwknop/ -type f -name '*.c'; \
+ find ./libfwknop/ -type f -name '*.c'; \
+ )
+
+LOCAL_LDLIBS := \
+ -L$(LOCAL_PATH)/libs \
+ -llog
+
+include $(BUILD_SHARED_LIBRARY)
Oops, something went wrong.

0 comments on commit a24a2ee

Please sign in to comment.