├── AndroidManetManager
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── AndroidManifest.xml
├── docs
│ └── license
│ │ ├── copyright.txt
│ │ └── gpl-3.0.txt
├── jni
│ ├── Android.mk
│ ├── README.txt
│ ├── adhoc-edify
│ │ ├── Android.mk
│ │ ├── adhoc.c
│ │ ├── adhoc.h
│ │ ├── edify
│ │ │ ├── Android.mk
│ │ │ ├── README.txt
│ │ │ ├── expr.c
│ │ │ ├── expr.h
│ │ │ ├── lex.yy.c
│ │ │ ├── lexer.l
│ │ │ ├── main.c
│ │ │ ├── parser.c
│ │ │ ├── parser.h
│ │ │ ├── parser.y
│ │ │ └── yydefs.h
│ │ ├── install.c
│ │ └── install.h
│ ├── ifconfig
│ │ ├── Android.mk
│ │ └── ifconfig.c
│ └── wireless-tools
│ │ ├── Android.mk
│ │ ├── CHANGELOG.h
│ │ ├── Makefile
│ │ ├── NOTICE
│ │ ├── changes.log
│ │ ├── ethernet.h
│ │ ├── getdelim.c
│ │ ├── getdelim.h
│ │ ├── getline.c
│ │ ├── getline.h
│ │ ├── ifrename.c
│ │ ├── iwconfig.c
│ │ ├── iwevent.c
│ │ ├── iwgetid.c
│ │ ├── iwlib.c
│ │ ├── iwlib.h
│ │ ├── iwlist.c
│ │ ├── iwmulticall.c
│ │ ├── iwpriv.c
│ │ ├── iwspy.c
│ │ ├── macaddr.c
│ │ ├── sample_enc.c
│ │ ├── sample_pm.c
│ │ ├── sample_priv_addr.c
│ │ ├── wireless.10.h
│ │ ├── wireless.11.h
│ │ ├── wireless.12.h
│ │ ├── wireless.13.h
│ │ ├── wireless.14.h
│ │ ├── wireless.15.h
│ │ ├── wireless.16.h
│ │ ├── wireless.17.h
│ │ ├── wireless.18.h
│ │ ├── wireless.19.h
│ │ ├── wireless.20.h
│ │ ├── wireless.21.h
│ │ ├── wireless.22.h
│ │ └── wireless.h
├── libmanet.jar
├── libs
│ ├── armeabi
│ │ ├── adhoc
│ │ ├── gdb.setup
│ │ ├── gdbserver
│ │ ├── ifconfig
│ │ ├── ifrename
│ │ ├── iwconfig
│ │ ├── iwevent
│ │ ├── iwgetid
│ │ ├── iwlist
│ │ ├── iwpriv
│ │ ├── iwspy
│ │ ├── libbinder.so
│ │ ├── libc.so
│ │ ├── libcutils.so
│ │ ├── libhardware_legacy.so
│ │ ├── liblog.so
│ │ ├── libnetutils.so
│ │ ├── libutils.so
│ │ ├── libwpa_client.so
│ │ └── libz.so
│ └── commons-collections-3.2.1.jar
├── lint.xml
├── obj
│ └── local
│ │ └── armeabi
│ │ ├── adhoc
│ │ ├── ifconfig
│ │ ├── ifrename
│ │ ├── iwconfig
│ │ ├── iwevent
│ │ ├── iwgetid
│ │ ├── iwlist
│ │ ├── iwpriv
│ │ ├── iwspy
│ │ ├── libbinder.so
│ │ ├── libc.so
│ │ ├── libcutils.so
│ │ ├── libedify.a
│ │ ├── libhardware_legacy.so
│ │ ├── libiwlib.a
│ │ ├── liblog.so
│ │ ├── libnetutils.so
│ │ ├── libutils.so
│ │ ├── libwpa_client.so
│ │ ├── libz.so
│ │ └── objs-debug
│ │ ├── adhoc
│ │ ├── adhoc.o
│ │ ├── adhoc.o.d
│ │ ├── install.o
│ │ └── install.o.d
│ │ ├── edify
│ │ ├── expr.o
│ │ ├── expr.o.d
│ │ ├── lex.yy.o
│ │ ├── lex.yy.o.d
│ │ ├── parser.o
│ │ └── parser.o.d
│ │ ├── ifconfig
│ │ ├── ifconfig.o
│ │ └── ifconfig.o.d
│ │ ├── ifrename
│ │ ├── getdelim.o
│ │ ├── getdelim.o.d
│ │ ├── ifrename.o
│ │ └── ifrename.o.d
│ │ ├── iwconfig
│ │ ├── iwconfig.o
│ │ └── iwconfig.o.d
│ │ ├── iwevent
│ │ ├── iwevent.o
│ │ └── iwevent.o.d
│ │ ├── iwgetid
│ │ ├── iwgetid.o
│ │ └── iwgetid.o.d
│ │ ├── iwlib
│ │ ├── iwlib.o
│ │ └── iwlib.o.d
│ │ ├── iwlist
│ │ ├── iwlist.o
│ │ └── iwlist.o.d
│ │ ├── iwpriv
│ │ ├── iwpriv.o
│ │ └── iwpriv.o.d
│ │ └── iwspy
│ │ ├── iwspy.o
│ │ └── iwspy.o.d
├── project.properties
├── res
│ ├── drawable
│ │ ├── adhoc_off.png
│ │ ├── adhoc_off_notification.png
│ │ ├── adhoc_on.png
│ │ ├── adhoc_on_notification.png
│ │ ├── background.jpg
│ │ ├── battery.png
│ │ ├── bluetooth.png
│ │ ├── exclamation.png
│ │ ├── gear_icon_48.png
│ │ ├── lock.png
│ │ ├── lock_open.png
│ │ ├── master_off.png
│ │ ├── master_on.png
│ │ ├── sechigh.png
│ │ ├── seclow.png
│ │ ├── secmedium.png
│ │ ├── service_icon_64.png
│ │ └── wifi.png
│ ├── layout
│ │ ├── aboutview.xml
│ │ ├── btwarningview.xml
│ │ ├── clientrow.xml
│ │ ├── ignoreviewwrapper.xml
│ │ ├── logview.xml
│ │ ├── main.xml
│ │ ├── messageview.xml
│ │ ├── nonetfilterview.xml
│ │ ├── norootview.xml
│ │ ├── routinginfoview.xml
│ │ ├── sendmessageview.xml
│ │ ├── settingsview.xml
│ │ ├── settingsviewwrapper.xml
│ │ ├── share.xml
│ │ └── txpowerwarningview.xml
│ ├── raw
│ │ ├── adhoc
│ │ ├── adhoc_edify
│ │ ├── adhoc_edify_old
│ │ ├── asus_forward_sh
│ │ ├── blue_down_sh
│ │ ├── blue_up_sh
│ │ ├── dnsmasq
│ │ ├── dnsmasq_conf
│ │ ├── fixpersist_sh
│ │ ├── fixroute_sh
│ │ ├── hostapd_conf_blade
│ │ ├── hostapd_conf_droidx
│ │ ├── ifconfig
│ │ ├── iperf
│ │ ├── iptables
│ │ ├── iwconfig
│ │ ├── manet_conf
│ │ ├── nc
│ │ ├── olsrd
│ │ ├── olsrd_conf_tpl
│ │ ├── olsrd_txtinfo_so_0_1
│ │ ├── pand
│ │ ├── routing_ignore_list_conf
│ │ ├── tcpdump
│ │ ├── tiwlan_ini
│ │ ├── ultra_bcm_config
│ │ └── wpa_supplicant_conf
│ └── values
│ │ └── strings.xml
├── scripts
│ ├── bin
│ │ └── unzip
│ ├── build-native.sh
│ ├── create-lib.sh
│ ├── extract-all.sh
│ ├── extract.sh
│ ├── install-all.sh
│ ├── push-all.sh
│ └── push.sh
└── src
│ └── org
│ ├── servalproject
│ ├── RequestThread.java
│ ├── SimpleWebServer.java
│ └── system
│ │ ├── WiFiRadio.java
│ │ └── WifiApControl.java
│ └── span
│ ├── manager
│ ├── ChangeSettingsActivity.java
│ ├── EditIgnoreListActivity.java
│ ├── MainActivity.java
│ ├── ManetManagerApp.java
│ ├── MessageService.java
│ ├── SendMessageActivity.java
│ ├── ShareActivity.java
│ ├── Validation.java
│ ├── ViewLogActivity.java
│ ├── ViewLogActivityHelper.java
│ ├── ViewMessageActivity.java
│ └── ViewRoutingInfoActivity.java
│ └── service
│ ├── CircularStringBuffer.java
│ ├── LogObserver.java
│ ├── ManetHelper.java
│ ├── ManetObserver.java
│ ├── ManetParser.java
│ ├── core
│ ├── ManetBootBroadcastReceiver.java
│ ├── ManetCustomBroadcastReceiver.java
│ ├── ManetService.java
│ └── ManetServiceHelper.java
│ ├── legal
│ ├── EulaHelper.java
│ └── EulaObserver.java
│ ├── routing
│ ├── Dijkstra.java
│ ├── Edge.java
│ ├── HelloMessage.java
│ ├── Node.java
│ ├── OlsrProtocol.java
│ ├── Route.java
│ ├── RoutingProtocol.java
│ ├── SimpleProactiveProtocol.java
│ └── SimpleReactiveProtocol.java
│ └── system
│ ├── BluetoothConfig.java
│ ├── BluetoothService.java
│ ├── BluetoothService_cupcake.java
│ ├── BluetoothService_eclair.java
│ ├── CoreTask.java
│ ├── DeviceConfig.java
│ ├── DnsmasqConfig.java
│ ├── HostapdConfig.java
│ ├── ManetConfig.java
│ ├── ManetConfigHelper.java
│ ├── RoutingIgnoreListConfig.java
│ ├── TiWlanConf.java
│ └── WpaSupplicant.java
└── README.md
/AndroidManetManager/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/AndroidManetManager/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /gen
3 |
--------------------------------------------------------------------------------
/AndroidManetManager/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | AndroidManetManager
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndroidManetManager/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | #Tue May 29 18:00:53 EDT 2012
2 | eclipse.preferences.version=1
3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.6
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.source=1.6
13 |
--------------------------------------------------------------------------------
/AndroidManetManager/docs/license/copyright.txt:
--------------------------------------------------------------------------------
1 | SPAN - Smart Phone Ad-Hoc Networking project
2 | Copyright (c) 2012 The MITRE Corporation.
3 |
4 | Portions of the code, images, and other resources are
5 | copyright (c) 2009 WiFi Tether for Root Users.
6 |
7 | Portions of the code, images, and other resources are
8 | copyright (c) 2012 The Serval Project.
--------------------------------------------------------------------------------
/AndroidManetManager/jni/Android.mk:
--------------------------------------------------------------------------------
1 | AOSP_PATH := /home/dev/Desktop/PROJECTS/ANDROID_PLATFORM_GINGERBREAD
2 | AOSP_SHARED_LIBRARIES_PATH := $(AOSP_PATH)/out/target/product/generic/obj/SHARED_LIBRARIES
3 |
4 | LOCAL_PATH := $(my-dir)
5 |
6 | PROJECT_PATH := $(call parent-dir, $(LOCAL_PATH))
7 | PROJECT_LIBS_PATH := $(PROJECT_PATH)/libs/armeabi
8 | PROJECT_RAW_PATH := $(PROJECT_PATH)/res/raw
9 |
10 | include $(call all-makefiles-under, $(LOCAL_PATH))
11 |
12 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/README.txt:
--------------------------------------------------------------------------------
1 | NOTE: Rebuild the native executables and libraries by executing "./scripts/build-native.sh".
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/Android.mk:
--------------------------------------------------------------------------------
1 | WORKING_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 |
6 | # build libedify.a
7 | include $(WORKING_PATH)/edify/Android.mk
8 |
9 |
10 | # set local path set that NDK will pull libraries from the Android source code
11 | LOCAL_PATH := $(AOSP_SHARED_LIBRARIES_PATH)
12 |
13 |
14 | include $(CLEAR_VARS)
15 |
16 | LOCAL_MODULE := cutils
17 | LOCAL_SRC_FILES := /libcutils_intermediates/LINKED/libcutils.so
18 |
19 | include $(PREBUILT_SHARED_LIBRARY)
20 |
21 |
22 | include $(CLEAR_VARS)
23 |
24 | LOCAL_MODULE := hardware_legacy
25 | LOCAL_SRC_FILES := /libhardware_legacy_intermediates/LINKED/libhardware_legacy.so
26 |
27 | include $(PREBUILT_SHARED_LIBRARY)
28 |
29 |
30 | include $(CLEAR_VARS)
31 |
32 | LOCAL_MODULE := libutils
33 | LOCAL_SRC_FILES := /libutils_intermediates/LINKED/libutils.so
34 |
35 | include $(PREBUILT_SHARED_LIBRARY)
36 |
37 |
38 | include $(CLEAR_VARS)
39 |
40 | LOCAL_MODULE := libbinder
41 | LOCAL_SRC_FILES := /libbinder_intermediates/LINKED/libbinder.so
42 |
43 | include $(PREBUILT_SHARED_LIBRARY)
44 |
45 |
46 | include $(CLEAR_VARS)
47 |
48 | LOCAL_MODULE := libwpa_client
49 | LOCAL_SRC_FILES := /libwpa_client_intermediates/LINKED/libwpa_client.so
50 |
51 | include $(PREBUILT_SHARED_LIBRARY)
52 |
53 |
54 | include $(CLEAR_VARS)
55 |
56 | LOCAL_MODULE := libnetutils
57 | LOCAL_SRC_FILES := /libnetutils_intermediates/LINKED/libnetutils.so
58 |
59 | include $(PREBUILT_SHARED_LIBRARY)
60 |
61 |
62 | include $(CLEAR_VARS)
63 |
64 | LOCAL_MODULE := libc
65 | LOCAL_SRC_FILES := /libc_intermediates/LINKED/libc.so
66 |
67 | include $(PREBUILT_SHARED_LIBRARY)
68 |
69 |
70 | include $(CLEAR_VARS)
71 |
72 | LOCAL_MODULE := liblog
73 | LOCAL_SRC_FILES := /liblog_intermediates/LINKED/liblog.so
74 |
75 | include $(PREBUILT_SHARED_LIBRARY)
76 |
77 |
78 | include $(CLEAR_VARS)
79 |
80 | LOCAL_MODULE := libz
81 | LOCAL_SRC_FILES := /libz_intermediates/LINKED/libz.so
82 |
83 | include $(PREBUILT_SHARED_LIBRARY)
84 |
85 |
86 | # revert back to working path to build adhoc binary
87 | LOCAL_PATH := $(WORKING_PATH)
88 |
89 | updater_src_files := \
90 | install.c \
91 | adhoc.c
92 |
93 | include $(CLEAR_VARS)
94 |
95 | LOCAL_SRC_FILES += $(updater_src_files)
96 |
97 | LOCAL_C_INCLUDES += $(dir $(inc))
98 | LOCAL_C_INCLUDES += $(AOSP_PATH)/system/core/include
99 | LOCAL_C_INCLUDES += $(AOSP_PATH)/hardware/libhardware_legacy/include
100 |
101 | LOCAL_STATIC_LIBRARIES := edify
102 |
103 | LOCAL_SHARED_LIBRARIES := hardware_legacy cutils utils binder libwpa_client libnetutils libc liblog libz
104 |
105 | LOCAL_MODULE := adhoc
106 |
107 | include $(BUILD_EXECUTABLE)
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/adhoc.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Ben Buxton
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 |
24 | #include "edify/expr.h"
25 | #include "adhoc.h"
26 | #include "install.h"
27 |
28 | // Where in the package we expect to find the edify script to execute.
29 | #define SCRIPT_NAME "/data/data/org.span/conf/adhoc.edify"
30 |
31 | int main(int argc, char** argv) {
32 | FILE *f;
33 | /*
34 | if (argc != 4) {
35 | fprintf(stderr, "unexpected number of arguments (%d)\n", argc);
36 | return 1;
37 | }
38 |
39 | */
40 | // Set up the pipe for sending commands back to the parent process.
41 | int fd = atoi(argv[2]);
42 | FILE* cmd_pipe = fdopen(fd, "wb");
43 | setlinebuf(cmd_pipe);
44 |
45 | struct stat st;
46 | if (stat(SCRIPT_NAME, &st) < 0) {
47 | fprintf(stderr, "Could not stat %s: %s", SCRIPT_NAME, strerror(errno));
48 | return 1;
49 | }
50 | if (st.st_size > 128000) {
51 | fprintf(stderr, "%s too large (max 128k)", SCRIPT_NAME);
52 | return 1;
53 | }
54 | char *script = malloc(st.st_size+1);
55 |
56 | f = fopen(SCRIPT_NAME, "rb");
57 | if (f == NULL) {
58 | fprintf(stderr, "Cannot read %s\n", SCRIPT_NAME);
59 | return 1;
60 | }
61 | if (fread(script, 1, st.st_size, f) != st.st_size) {
62 | fprintf(stderr, "Failed to read %d bytes from %s", st.st_size+1, SCRIPT_NAME);
63 | return 1;
64 | }
65 | script[st.st_size] = '\0';
66 | fclose(f);
67 |
68 | // Configure edify's functions.
69 |
70 | RegisterBuiltins();
71 | RegisterInstallFunctions();
72 | FinishRegistration();
73 |
74 | // Parse the script.
75 |
76 | Expr* root;
77 | int error_count = 0;
78 | yy_scan_string(script);
79 | int error = yyparse(&root, &error_count);
80 | if (error != 0 || error_count > 0) {
81 | fprintf(stderr, "%d parse errors\n", error_count);
82 | return 6;
83 | }
84 |
85 | // Evaluate the parsed script.
86 |
87 | UpdaterInfo updater_info;
88 | updater_info.cmd_pipe = cmd_pipe;
89 | updater_info.log_fd = fopen ("/data/data/org.span/var/adhoc.log","w");
90 |
91 | updater_info.action = strdup(argv[1]);
92 |
93 | State state;
94 | state.cookie = &updater_info;
95 | state.script = script;
96 | state.errmsg = NULL;
97 |
98 | char* result = Evaluate(&state, root);
99 | if (result == NULL) {
100 | if (state.errmsg == NULL) {
101 | fprintf(stderr, "script aborted (no error message)\n");
102 | fprintf(cmd_pipe, "ui_print script aborted (no error message)\n");
103 | } else {
104 | fprintf(stderr, "script aborted: %s\n", state.errmsg);
105 | char* line = strtok(state.errmsg, "\n");
106 | while (line) {
107 | fprintf(cmd_pipe, "ui_print %s\n", line);
108 | line = strtok(NULL, "\n");
109 | }
110 | fprintf(cmd_pipe, "ui_print\n");
111 | }
112 | free(state.errmsg);
113 | return 7;
114 | } else {
115 | fprintf(stderr, "script result was [%s]\n", result);
116 | free(result);
117 | }
118 |
119 | free(script);
120 |
121 | return 0;
122 | }
123 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/adhoc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef _UPDATER_UPDATER_H_
18 | #define _UPDATER_UPDATER_H_
19 |
20 | #include
21 |
22 | typedef struct {
23 | FILE* cmd_pipe;
24 | FILE* log_fd;
25 | char *action;
26 | } UpdaterInfo;
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/edify/Android.mk:
--------------------------------------------------------------------------------
1 | # NOTE: Android NDK will not build a static library unless some other build process
2 | # in the Android.mk makes use of it (i.e. NDK attempts to "optimize out" the need to
3 | # build the static library).
4 |
5 | LOCAL_PATH := $(call my-dir)
6 |
7 | edify_src_files := \
8 | expr.c \
9 | lex.yy.c \
10 | parser.c
11 |
12 | # "-x c" forces the lex/yacc files to be compiled as c;
13 | # the build system otherwise forces them to be c++.
14 | edify_cflags := -x c
15 |
16 | #
17 | # Build the device-side library
18 | #
19 | include $(CLEAR_VARS)
20 |
21 | LOCAL_MODULE := libedify
22 |
23 | LOCAL_CFLAGS := $(edify_cflags)
24 |
25 | LOCAL_SRC_FILES := $(edify_src_files)
26 |
27 | include $(BUILD_STATIC_LIBRARY)
28 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/edify/README.txt:
--------------------------------------------------------------------------------
1 | Update scripts (from donut onwards) are written in a new little
2 | scripting language ("edify") that is superficially somewhat similar to
3 | the old one ("amend"). This is a brief overview of the new language.
4 |
5 | - The entire script is a single expression.
6 |
7 | - All expressions are string-valued.
8 |
9 | - String literals appear in double quotes. \n, \t, \", and \\ are
10 | understood, as are hexadecimal escapes like \x4a.
11 |
12 | - String literals consisting of only letters, numbers, colons,
13 | underscores, slashes, and periods don't need to be in double quotes.
14 |
15 | - The following words are reserved:
16 |
17 | if then else endif
18 |
19 | They have special meaning when unquoted. (In quotes, they are just
20 | string literals.)
21 |
22 | - When used as a boolean, the empty string is "false" and all other
23 | strings are "true".
24 |
25 | - All functions are actually macros (in the Lisp sense); the body of
26 | the function can control which (if any) of the arguments are
27 | evaluated. This means that functions can act as control
28 | structures.
29 |
30 | - Operators (like "&&" and "||") are just syntactic sugar for builtin
31 | functions, so they can act as control structures as well.
32 |
33 | - ";" is a binary operator; evaluating it just means to first evaluate
34 | the left side, then the right. It can also appear after any
35 | expression.
36 |
37 | - Comments start with "#" and run to the end of the line.
38 |
39 |
40 |
41 | Some examples:
42 |
43 | - There's no distinction between quoted and unquoted strings; the
44 | quotes are only needed if you want characters like whitespace to
45 | appear in the string. The following expressions all evaluate to the
46 | same string.
47 |
48 | "a b"
49 | a + " " + b
50 | "a" + " " + "b"
51 | "a\x20b"
52 | a + "\x20b"
53 | concat(a, " ", "b")
54 | "concat"(a, " ", "b")
55 |
56 | As shown in the last example, function names are just strings,
57 | too. They must be string *literals*, however. This is not legal:
58 |
59 | ("con" + "cat")(a, " ", b) # syntax error!
60 |
61 |
62 | - The ifelse() builtin takes three arguments: it evaluates exactly
63 | one of the second and third, depending on whether the first one is
64 | true. There is also some syntactic sugar to make expressions that
65 | look like if/else statements:
66 |
67 | # these are all equivalent
68 | ifelse(something(), "yes", "no")
69 | if something() then yes else no endif
70 | if something() then "yes" else "no" endif
71 |
72 | The else part is optional.
73 |
74 | if something() then "yes" endif # if something() is false,
75 | # evaluates to false
76 |
77 | ifelse(condition(), "", abort()) # abort() only called if
78 | # condition() is false
79 |
80 | The last example is equivalent to:
81 |
82 | assert(condition())
83 |
84 |
85 | - The && and || operators can be used similarly; they evaluate their
86 | second argument only if it's needed to determine the truth of the
87 | expression. Their value is the value of the last-evaluated
88 | argument:
89 |
90 | file_exists("/data/system/bad") && delete("/data/system/bad")
91 |
92 | file_exists("/data/system/missing") || create("/data/system/missing")
93 |
94 | get_it() || "xxx" # returns value of get_it() if that value is
95 | # true, otherwise returns "xxx"
96 |
97 |
98 | - The purpose of ";" is to simulate imperative statements, of course,
99 | but the operator can be used anywhere. Its value is the value of
100 | its right side:
101 |
102 | concat(a;b;c, d, e;f) # evaluates to "cdf"
103 |
104 | A more useful example might be something like:
105 |
106 | ifelse(condition(),
107 | (first_step(); second_step();), # second ; is optional
108 | alternative_procedure())
109 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/edify/expr.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef _EXPRESSION_H
18 | #define _EXPRESSION_H
19 |
20 | #include "yydefs.h"
21 |
22 | #define MAX_STRING_LEN 1024
23 |
24 | typedef struct Expr Expr;
25 |
26 | typedef struct {
27 | // Optional pointer to app-specific data; the core of edify never
28 | // uses this value.
29 | void* cookie;
30 |
31 | // The source of the original script. Must be NULL-terminated,
32 | // and in writable memory (Evaluate may make temporary changes to
33 | // it but will restore it when done).
34 | char* script;
35 |
36 | // The error message (if any) returned if the evaluation aborts.
37 | // Should be NULL initially, will be either NULL or a malloc'd
38 | // pointer after Evaluate() returns.
39 | char* errmsg;
40 | } State;
41 |
42 | typedef char* (*Function)(const char* name, State* state,
43 | int argc, Expr* argv[]);
44 |
45 | struct Expr {
46 | Function fn;
47 | char* name;
48 | int argc;
49 | Expr** argv;
50 | int start, end;
51 | };
52 |
53 | char* Evaluate(State* state, Expr* expr);
54 |
55 | // Glue to make an Expr out of a literal.
56 | char* Literal(const char* name, State* state, int argc, Expr* argv[]);
57 |
58 | // Functions corresponding to various syntactic sugar operators.
59 | // ("concat" is also available as a builtin function, to concatenate
60 | // more than two strings.)
61 | char* ConcatFn(const char* name, State* state, int argc, Expr* argv[]);
62 | char* LogicalAndFn(const char* name, State* state, int argc, Expr* argv[]);
63 | char* LogicalOrFn(const char* name, State* state, int argc, Expr* argv[]);
64 | char* LogicalNotFn(const char* name, State* state, int argc, Expr* argv[]);
65 | char* SubstringFn(const char* name, State* state, int argc, Expr* argv[]);
66 | char* EqualityFn(const char* name, State* state, int argc, Expr* argv[]);
67 | char* InequalityFn(const char* name, State* state, int argc, Expr* argv[]);
68 | char* SequenceFn(const char* name, State* state, int argc, Expr* argv[]);
69 |
70 | // Convenience function for building expressions with a fixed number
71 | // of arguments.
72 | Expr* Build(Function fn, YYLTYPE loc, int count, ...);
73 |
74 | // Global builtins, registered by RegisterBuiltins().
75 | char* IfElseFn(const char* name, State* state, int argc, Expr* argv[]);
76 | char* AssertFn(const char* name, State* state, int argc, Expr* argv[]);
77 | char* AbortFn(const char* name, State* state, int argc, Expr* argv[]);
78 |
79 |
80 | // For setting and getting the global error string (when returning
81 | // NULL from a function).
82 | void SetError(const char* message); // makes a copy
83 | const char* GetError(); // retains ownership
84 | void ClearError();
85 |
86 |
87 | typedef struct {
88 | const char* name;
89 | Function fn;
90 | } NamedFunction;
91 |
92 | // Register a new function. The same Function may be registered under
93 | // multiple names, but a given name should only be used once.
94 | void RegisterFunction(const char* name, Function fn);
95 |
96 | // Register all the builtins.
97 | void RegisterBuiltins();
98 |
99 | // Call this after all calls to RegisterFunction() but before parsing
100 | // any scripts to finish building the function table.
101 | void FinishRegistration();
102 |
103 | // Find the Function for a given name; return NULL if no such function
104 | // exists.
105 | Function FindFunction(const char* name);
106 |
107 |
108 | // --- convenience functions for use in functions ---
109 |
110 | // Evaluate the expressions in argv, giving 'count' char* (the ... is
111 | // zero or more char** to put them in). If any expression evaluates
112 | // to NULL, free the rest and return -1. Return 0 on success.
113 | int ReadArgs(State* state, Expr* argv[], int count, ...);
114 |
115 | // Evaluate the expressions in argv, returning an array of char*
116 | // results. If any evaluate to NULL, free the rest and return NULL.
117 | // The caller is responsible for freeing the returned array and the
118 | // strings it contains.
119 | char** ReadVarArgs(State* state, int argc, Expr* argv[]);
120 |
121 | // Use printf-style arguments to compose an error message to put into
122 | // *state. Returns NULL.
123 | char* ErrorAbort(State* state, char* format, ...);
124 |
125 |
126 | #endif // _EXPRESSION_H
127 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/edify/lexer.l:
--------------------------------------------------------------------------------
1 | %{
2 | /*
3 | * Copyright (C) 2009 The Android Open Source Project
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | #include "expr.h"
19 | #include "yydefs.h"
20 | #include "parser.h"
21 |
22 | int gLine = 1;
23 | int gColumn = 1;
24 | int gPos = 0;
25 |
26 | // TODO: enforce MAX_STRING_LEN during lexing
27 | char string_buffer[MAX_STRING_LEN];
28 | char* string_pos;
29 |
30 | #define ADVANCE do {yylloc.start=gPos; yylloc.end=gPos+yyleng; \
31 | gColumn+=yyleng; gPos+=yyleng;} while(0)
32 |
33 | %}
34 |
35 | %x STR
36 |
37 | %option noyywrap
38 |
39 | %%
40 |
41 |
42 | \" {
43 | BEGIN(STR);
44 | string_pos = string_buffer;
45 | yylloc.start = gPos;
46 | ++gColumn;
47 | ++gPos;
48 | }
49 |
50 | {
51 | \" {
52 | ++gColumn;
53 | ++gPos;
54 | BEGIN(INITIAL);
55 | *string_pos = '\0';
56 | yylval.str = strdup(string_buffer);
57 | yylloc.end = gPos;
58 | return STRING;
59 | }
60 |
61 | \\n { gColumn += yyleng; gPos += yyleng; *string_pos++ = '\n'; }
62 | \\t { gColumn += yyleng; gPos += yyleng; *string_pos++ = '\t'; }
63 | \\\" { gColumn += yyleng; gPos += yyleng; *string_pos++ = '\"'; }
64 | \\\\ { gColumn += yyleng; gPos += yyleng; *string_pos++ = '\\'; }
65 |
66 | \\x[0-9a-fA-F]{2} {
67 | gColumn += yyleng;
68 | gPos += yyleng;
69 | int val;
70 | sscanf(yytext+2, "%x", &val);
71 | *string_pos++ = val;
72 | }
73 |
74 | \n {
75 | ++gLine;
76 | ++gPos;
77 | gColumn = 1;
78 | *string_pos++ = yytext[0];
79 | }
80 |
81 | . {
82 | ++gColumn;
83 | ++gPos;
84 | *string_pos++ = yytext[0];
85 | }
86 | }
87 |
88 | if ADVANCE; return IF;
89 | then ADVANCE; return THEN;
90 | else ADVANCE; return ELSE;
91 | endif ADVANCE; return ENDIF;
92 |
93 | [a-zA-Z0-9_:/.]+ {
94 | ADVANCE;
95 | yylval.str = strdup(yytext);
96 | return STRING;
97 | }
98 |
99 | \&\& ADVANCE; return AND;
100 | \|\| ADVANCE; return OR;
101 | == ADVANCE; return EQ;
102 | != ADVANCE; return NE;
103 |
104 | [+(),!;] ADVANCE; return yytext[0];
105 |
106 | [ \t]+ ADVANCE;
107 |
108 | (#.*)?\n gPos += yyleng; ++gLine; gColumn = 1;
109 |
110 | . return BAD;
111 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/edify/parser.h:
--------------------------------------------------------------------------------
1 |
2 | /* A Bison parser, made by GNU Bison 2.4.1. */
3 |
4 | /* Skeleton interface for Bison's Yacc-like parsers in C
5 |
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 | Free Software Foundation, Inc.
8 |
9 | This program is free software: you can redistribute it and/or modify
10 | it under the terms of the GNU General Public License as published by
11 | the Free Software Foundation, either version 3 of the License, or
12 | (at your option) any later version.
13 |
14 | This program is distributed in the hope that it will be useful,
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | GNU General Public License for more details.
18 |
19 | You should have received a copy of the GNU General Public License
20 | along with this program. If not, see . */
21 |
22 | /* As a special exception, you may create a larger work that contains
23 | part or all of the Bison parser skeleton and distribute that work
24 | under terms of your choice, so long as that work isn't itself a
25 | parser generator using the skeleton or a modified version thereof
26 | as a parser skeleton. Alternatively, if you modify or redistribute
27 | the parser skeleton itself, you may (at your option) remove this
28 | special exception, which will cause the skeleton and the resulting
29 | Bison output files to be licensed under the GNU General Public
30 | License without this special exception.
31 |
32 | This special exception was added by the Free Software Foundation in
33 | version 2.2 of Bison. */
34 |
35 |
36 | /* Tokens. */
37 | #ifndef YYTOKENTYPE
38 | # define YYTOKENTYPE
39 | /* Put the tokens into the symbol table, so that GDB and other debuggers
40 | know about them. */
41 | enum yytokentype {
42 | AND = 258,
43 | OR = 259,
44 | SUBSTR = 260,
45 | SUPERSTR = 261,
46 | EQ = 262,
47 | NE = 263,
48 | IF = 264,
49 | THEN = 265,
50 | ELSE = 266,
51 | ENDIF = 267,
52 | STRING = 268,
53 | BAD = 269
54 | };
55 | #endif
56 |
57 |
58 |
59 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
60 | typedef union YYSTYPE
61 | {
62 |
63 | /* Line 1676 of yacc.c */
64 | #line 36 "parser.y"
65 |
66 | char* str;
67 | Expr* expr;
68 | struct {
69 | int argc;
70 | Expr** argv;
71 | } args;
72 |
73 |
74 |
75 | /* Line 1676 of yacc.c */
76 | #line 77 "parser.h"
77 | } YYSTYPE;
78 | # define YYSTYPE_IS_TRIVIAL 1
79 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */
80 | # define YYSTYPE_IS_DECLARED 1
81 | #endif
82 |
83 | extern YYSTYPE yylval;
84 |
85 | #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
86 | typedef struct YYLTYPE
87 | {
88 | int first_line;
89 | int first_column;
90 | int last_line;
91 | int last_column;
92 | } YYLTYPE;
93 | # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
94 | # define YYLTYPE_IS_DECLARED 1
95 | # define YYLTYPE_IS_TRIVIAL 1
96 | #endif
97 |
98 | extern YYLTYPE yylloc;
99 |
100 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/edify/parser.y:
--------------------------------------------------------------------------------
1 | %{
2 | /*
3 | * Copyright (C) 2009 The Android Open Source Project
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 |
22 | #include "expr.h"
23 | #include "yydefs.h"
24 | #include "parser.h"
25 |
26 | extern int gLine;
27 | extern int gColumn;
28 |
29 | void yyerror(Expr** root, int* error_count, const char* s);
30 | int yyparse(Expr** root, int* error_count);
31 |
32 | %}
33 |
34 | %locations
35 |
36 | %union {
37 | char* str;
38 | Expr* expr;
39 | struct {
40 | int argc;
41 | Expr** argv;
42 | } args;
43 | }
44 |
45 | %token AND OR SUBSTR SUPERSTR EQ NE IF THEN ELSE ENDIF
46 | %token STRING BAD
47 | %type expr
48 | %type arglist
49 |
50 | %parse-param {Expr** root}
51 | %parse-param {int* error_count}
52 | %error-verbose
53 |
54 | /* declarations in increasing order of precedence */
55 | %left ';'
56 | %left ','
57 | %left OR
58 | %left AND
59 | %left EQ NE
60 | %left '+'
61 | %right '!'
62 |
63 | %%
64 |
65 | input: expr { *root = $1; }
66 | ;
67 |
68 | expr: STRING {
69 | $$ = malloc(sizeof(Expr));
70 | $$->fn = Literal;
71 | $$->name = $1;
72 | $$->argc = 0;
73 | $$->argv = NULL;
74 | $$->start = @$.start;
75 | $$->end = @$.end;
76 | }
77 | | '(' expr ')' { $$ = $2; $$->start=@$.start; $$->end=@$.end; }
78 | | expr ';' { $$ = $1; $$->start=@1.start; $$->end=@1.end; }
79 | | expr ';' expr { $$ = Build(SequenceFn, @$, 2, $1, $3); }
80 | | error ';' expr { $$ = $3; $$->start=@$.start; $$->end=@$.end; }
81 | | expr '+' expr { $$ = Build(ConcatFn, @$, 2, $1, $3); }
82 | | expr EQ expr { $$ = Build(EqualityFn, @$, 2, $1, $3); }
83 | | expr NE expr { $$ = Build(InequalityFn, @$, 2, $1, $3); }
84 | | expr AND expr { $$ = Build(LogicalAndFn, @$, 2, $1, $3); }
85 | | expr OR expr { $$ = Build(LogicalOrFn, @$, 2, $1, $3); }
86 | | '!' expr { $$ = Build(LogicalNotFn, @$, 1, $2); }
87 | | IF expr THEN expr ENDIF { $$ = Build(IfElseFn, @$, 2, $2, $4); }
88 | | IF expr THEN expr ELSE expr ENDIF { $$ = Build(IfElseFn, @$, 3, $2, $4, $6); }
89 | | STRING '(' arglist ')' {
90 | $$ = malloc(sizeof(Expr));
91 | $$->fn = FindFunction($1);
92 | if ($$->fn == NULL) {
93 | char buffer[256];
94 | snprintf(buffer, sizeof(buffer), "unknown function \"%s\"", $1);
95 | yyerror(root, error_count, buffer);
96 | YYERROR;
97 | }
98 | $$->name = $1;
99 | $$->argc = $3.argc;
100 | $$->argv = $3.argv;
101 | $$->start = @$.start;
102 | $$->end = @$.end;
103 | }
104 | ;
105 |
106 | arglist: /* empty */ {
107 | $$.argc = 0;
108 | $$.argv = NULL;
109 | }
110 | | expr {
111 | $$.argc = 1;
112 | $$.argv = malloc(sizeof(Expr*));
113 | $$.argv[0] = $1;
114 | }
115 | | arglist ',' expr {
116 | $$.argc = $1.argc + 1;
117 | $$.argv = realloc($$.argv, $$.argc * sizeof(Expr*));
118 | $$.argv[$$.argc-1] = $3;
119 | }
120 | ;
121 |
122 | %%
123 |
124 | void yyerror(Expr** root, int* error_count, const char* s) {
125 | if (strlen(s) == 0) {
126 | s = "syntax error";
127 | }
128 | printf("line %d col %d: %s\n", gLine, gColumn, s);
129 | ++*error_count;
130 | }
131 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/edify/yydefs.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef _YYDEFS_H_
18 | #define _YYDEFS_H_
19 |
20 | #define YYLTYPE YYLTYPE
21 | typedef struct {
22 | int start, end;
23 | } YYLTYPE;
24 |
25 | #define YYLLOC_DEFAULT(Current, Rhs, N) \
26 | do { \
27 | if (N) { \
28 | (Current).start = YYRHSLOC(Rhs, 1).start; \
29 | (Current).end = YYRHSLOC(Rhs, N).end; \
30 | } else { \
31 | (Current).start = YYRHSLOC(Rhs, 0).start; \
32 | (Current).end = YYRHSLOC(Rhs, 0).end; \
33 | } \
34 | } while (0)
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/adhoc-edify/install.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef _UPDATER_INSTALL_H_
18 | #define _UPDATER_INSTALL_H_
19 |
20 | void RegisterInstallFunctions();
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/ifconfig/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH:= $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_SRC_FILES:= ifconfig.c
6 |
7 | LOCAL_MODULE := ifconfig
8 |
9 | include $(BUILD_EXECUTABLE)
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 | include $(CLEAR_VARS)
3 |
4 | WT_INCS := -I$(LOCAL_PATH)
5 | WT_DEFS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -g
6 | WT_DEFS += -DWT_NOLIMB=y
7 |
8 | #####################
9 | LOCAL_SRC_FILES := iwlib.c
10 | LOCAL_MODULE := iwlib
11 | LOCAL_CFLAGS := $(WT_INCS) $(WT_DEFS)
12 | include $(BUILD_STATIC_LIBRARY)
13 | #####################
14 | include $(CLEAR_VARS)
15 | LOCAL_SRC_FILES := iwspy.c
16 | LOCAL_MODULE := iwspy
17 | LOCAL_STATIC_LIBRARIES := iwlib
18 | LOCAL_CFLAGS := $(WT_INCS) $(WT_DEFS)
19 | include $(BUILD_EXECUTABLE)
20 | #####################
21 | include $(CLEAR_VARS)
22 | LOCAL_SRC_FILES := iwconfig.c
23 | LOCAL_MODULE := iwconfig
24 | LOCAL_STATIC_LIBRARIES := iwlib
25 | LOCAL_CFLAGS := $(WT_INCS) $(WT_DEFS)
26 | include $(BUILD_EXECUTABLE)
27 | #####################
28 | include $(CLEAR_VARS)
29 | LOCAL_SRC_FILES := iwlist.c
30 | LOCAL_MODULE := iwlist
31 | LOCAL_STATIC_LIBRARIES := iwlib
32 | LOCAL_CFLAGS := $(WT_INCS) $(WT_DEFS)
33 | include $(BUILD_EXECUTABLE)
34 | #####################
35 | include $(CLEAR_VARS)
36 | LOCAL_SRC_FILES := iwpriv.c
37 | LOCAL_MODULE := iwpriv
38 | LOCAL_STATIC_LIBRARIES := iwlib
39 | LOCAL_CFLAGS := $(WT_INCS) $(WT_DEFS)
40 | include $(BUILD_EXECUTABLE)
41 | #####################
42 | include $(CLEAR_VARS)
43 | LOCAL_SRC_FILES := iwevent.c
44 | LOCAL_MODULE := iwevent
45 | LOCAL_STATIC_LIBRARIES := iwlib
46 | LOCAL_CFLAGS := $(WT_INCS) $(WT_DEFS)
47 | include $(BUILD_EXECUTABLE)
48 | #####################
49 | include $(CLEAR_VARS)
50 | LOCAL_SRC_FILES := iwgetid.c
51 | LOCAL_MODULE := iwgetid
52 | LOCAL_STATIC_LIBRARIES := iwlib
53 | LOCAL_CFLAGS := $(WT_INCS) $(WT_DEFS)
54 | include $(BUILD_EXECUTABLE)
55 | #####################
56 | include $(CLEAR_VARS)
57 | LOCAL_SRC_FILES := ifrename.c \
58 | getdelim.c
59 | LOCAL_MODULE := ifrename
60 | LOCAL_STATIC_LIBRARIES := iwlib
61 | LOCAL_CFLAGS := $(WT_INCS) $(WT_DEFS)
62 | include $(BUILD_EXECUTABLE)
63 |
64 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/CHANGELOG.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/jni/wireless-tools/CHANGELOG.h
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/changes.log:
--------------------------------------------------------------------------------
1 | commit d9d43b9b14972c650210012e54e24372584199de
2 | Merge: 95cc23e... 0a2633e...
3 | Author: Fenwick Peng
4 | Date: Thu Nov 19 11:23:54 2009 -0600
5 |
6 | Merge commit 'arsenal-qcom/sv-master' into ssw-stable
7 |
8 | commit 0a2633e30c5cec1e595332af65401c6da6cf554e
9 | Author: Yukitomi Fujinaga
10 | Date: Wed Nov 18 15:48:39 2009 -0800
11 |
12 | Removed NOTICE_FR files from master branch
13 |
14 | commit 95cc23e8dcef98ad4df035d9a966ee6283b64785
15 | Author: Yukitomi Fujinaga
16 | Date: Fri Sep 25 16:34:55 2009 -0700
17 |
18 | L10N: Added French NOTICE files
19 |
20 | commit c7c96535eaea7e3c14da91fc933b15e05e21fe69
21 | Author: Fenwick Peng
22 | Date: Thu Jul 9 14:51:59 2009 -0500
23 |
24 | Notice file update
25 |
26 | commit d5e90c33eefe8d8b9cc7eeec9fd4cec4d9f4c8fa
27 | Merge: ed654db... b7ab547...
28 | Author: Mani Varadarajan
29 | Date: Sat May 2 19:02:46 2009 -0700
30 |
31 | Merge commit 'repo-blurdev/all-cupcake-integration' into aci-cleanup-2
32 |
33 | commit b7ab547f78b23ef3fca24cecb51d2ed43832d5f2
34 | Merge: 82ed472... ed654db...
35 | Author: Wang Qi
36 | Date: Thu Apr 30 10:40:32 2009 -0700
37 |
38 | Merge commit 'repo-blurdev/syssw-cupcake-integration' into aci-ssw-merge
39 |
40 | commit ed654db7d639c44f6d00c9f30343367c5122da0c
41 | Author: Andrew Wheeler
42 | Date: Mon Apr 27 18:37:26 2009 -0500
43 |
44 | initial commit from 6365-ohd-mot-built-4.tgz
45 |
46 | commit 82ed472b5618ddc647dc0e08df29745997632e23
47 | Merge: 3b3956a... f517d5c...
48 | Author: Maulik Desai
49 | Date: Fri Apr 10 00:12:24 2009 -0700
50 |
51 | Merge syssw 6355 changes to all-cupcake-integration (copymerge)
52 |
53 | Merge branch 'all-cupcake-integration' into syssw-6355-merge
54 |
55 | commit 3b3956a1b2851980b844765ba5eebb6fe4d37d08
56 | Author: Andrew Wheeler
57 | Date: Wed Apr 1 06:14:39 2009 -0500
58 |
59 | initial commit
60 |
61 | commit f517d5ca1ad1cfa05577d662ea577a5a8a8d1dd7
62 | Author: ejm121
63 | Date: Mon Jan 26 13:59:16 2009 -0800
64 |
65 | Add a small set of filters through .gitignore
66 |
67 | commit f14748561573cfb08ebd253d73a86932b5890d7e
68 | Author: Repo Man
69 | Date: Mon Jan 12 06:59:23 2009 -0600
70 |
71 | morrison-oxmas patch
72 |
73 | commit 3034e2bfc8fd9e6c351dc413204118a5427df64e
74 | Author: Repo Man
75 | Date: Mon Jan 12 06:53:55 2009 -0600
76 |
77 | release 29 from http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html
78 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/ethernet.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
2 | This file is part of the GNU C Library.
3 |
4 | The GNU C Library is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU Lesser General Public
6 | License as published by the Free Software Foundation; either
7 | version 2.1 of the License, or (at your option) any later version.
8 |
9 | The GNU C Library is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | Lesser General Public License for more details.
13 |
14 | You should have received a copy of the GNU Lesser General Public
15 | License along with the GNU C Library; if not, write to the Free
16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 | 02111-1307 USA. */
18 |
19 | /* Based on the FreeBSD version of this file. Curiously, that file
20 | lacks a copyright in the header. */
21 |
22 | #ifndef __NET_ETHERNET_H
23 | #define __NET_ETHERNET_H 1
24 |
25 | #include
26 | #include
27 | #include /* IEEE 802.3 Ethernet constants */
28 |
29 | __BEGIN_DECLS
30 |
31 | /* This is a name for the 48 bit ethernet address available on many
32 | systems. */
33 | struct ether_addr
34 | {
35 | u_int8_t ether_addr_octet[ETH_ALEN];
36 | } __attribute__ ((__packed__));
37 |
38 | /* 10Mb/s ethernet header */
39 | struct ether_header
40 | {
41 | u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
42 | u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */
43 | u_int16_t ether_type; /* packet type ID field */
44 | } __attribute__ ((__packed__));
45 |
46 | /* Ethernet protocol ID's */
47 | #define ETHERTYPE_PUP 0x0200 /* Xerox PUP */
48 | #define ETHERTYPE_IP 0x0800 /* IP */
49 | #define ETHERTYPE_ARP 0x0806 /* Address resolution */
50 | #define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */
51 |
52 | #define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */
53 | #define ETHER_TYPE_LEN 2 /* bytes in type field */
54 | #define ETHER_CRC_LEN 4 /* bytes in CRC field */
55 | #define ETHER_HDR_LEN ETH_HLEN /* total octets in header */
56 | #define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) /* min packet length */
57 | #define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) /* max packet length */
58 |
59 | /* make sure ethenet length is valid */
60 | #define ETHER_IS_VALID_LEN(foo) \
61 | ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
62 |
63 | /*
64 | * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
65 | * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
66 | * by an ETHER type (as given above) and then the (variable-length) header.
67 | */
68 | #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
69 | #define ETHERTYPE_NTRAILER 16
70 |
71 | #define ETHERMTU ETH_DATA_LEN
72 | #define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
73 |
74 | __END_DECLS
75 |
76 | #endif /* net/ethernet.h */
77 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/getdelim.c:
--------------------------------------------------------------------------------
1 | /* getdelim.c --- Implementation of replacement getdelim function.
2 | Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005 Free
3 | Software Foundation, Inc.
4 |
5 | This program is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU General Public License as
7 | published by the Free Software Foundation; either version 2, or (at
8 | your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful, but
11 | WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 | 02110-1301, USA. */
19 |
20 | /* Ported from glibc by Simon Josefsson. */
21 |
22 | #ifdef HAVE_CONFIG_H
23 | # include
24 | #endif
25 |
26 | #include "getdelim.h"
27 |
28 | #include
29 | #include
30 | #include
31 |
32 | #ifndef SIZE_MAX
33 | # define SIZE_MAX ((size_t) -1)
34 | #endif
35 | #ifndef SSIZE_MAX
36 | # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
37 | #endif
38 | #if !HAVE_FLOCKFILE
39 | # undef flockfile
40 | # define flockfile(x) ((void) 0)
41 | #endif
42 | #if !HAVE_FUNLOCKFILE
43 | # undef funlockfile
44 | # define funlockfile(x) ((void) 0)
45 | #endif
46 |
47 | /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
48 | NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
49 | NULL), pointing to *N characters of space. It is realloc'ed as
50 | necessary. Returns the number of characters read (not including
51 | the null terminator), or -1 on error or EOF. */
52 |
53 | ssize_t
54 | getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
55 | {
56 | ssize_t result;
57 | size_t cur_len = 0;
58 |
59 | if (lineptr == NULL || n == NULL || fp == NULL)
60 | {
61 | errno = EINVAL;
62 | return -1;
63 | }
64 |
65 | flockfile (fp);
66 |
67 | if (*lineptr == NULL || *n == 0)
68 | {
69 | *n = 120;
70 | *lineptr = (char *) malloc (*n);
71 | if (*lineptr == NULL)
72 | {
73 | result = -1;
74 | goto unlock_return;
75 | }
76 | }
77 |
78 | for (;;)
79 | {
80 | int i;
81 |
82 | i = getc (fp);
83 | if (i == EOF)
84 | {
85 | result = -1;
86 | break;
87 | }
88 |
89 | /* Make enough space for len+1 (for final NUL) bytes. */
90 | if (cur_len + 1 >= *n)
91 | {
92 | size_t needed_max =
93 | SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
94 | size_t needed = 2 * *n + 1; /* Be generous. */
95 | char *new_lineptr;
96 |
97 | if (needed_max < needed)
98 | needed = needed_max;
99 | if (cur_len + 1 >= needed)
100 | {
101 | result = -1;
102 | goto unlock_return;
103 | }
104 |
105 | new_lineptr = (char *) realloc (*lineptr, needed);
106 | if (new_lineptr == NULL)
107 | {
108 | result = -1;
109 | goto unlock_return;
110 | }
111 |
112 | *lineptr = new_lineptr;
113 | *n = needed;
114 | }
115 |
116 | (*lineptr)[cur_len] = i;
117 | cur_len++;
118 |
119 | if (i == delimiter)
120 | break;
121 | }
122 | (*lineptr)[cur_len] = '\0';
123 | result = cur_len ? cur_len : result;
124 |
125 | unlock_return:
126 | funlockfile (fp);
127 | return result;
128 | }
129 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/getdelim.h:
--------------------------------------------------------------------------------
1 | /* getdelim.h --- Prototype for replacement getdelim function.
2 | Copyright (C) 2005 Free Software Foundation, Inc.
3 |
4 | This program is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU General Public License as
6 | published by the Free Software Foundation; either version 2, or (at
7 | your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful, but
10 | WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 | 02110-1301, USA. */
18 |
19 | /* Written by Simon Josefsson. */
20 |
21 | /* Get size_t, FILE, ssize_t. And getdelim, if available. */
22 | # include
23 | # include
24 | # include
25 |
26 | #if !HAVE_DECL_GETDELIM
27 | ssize_t getdelim (char **lineptr, size_t *n, int delimiter, FILE *stream);
28 | #endif /* !HAVE_GETDELIM */
29 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/getline.c:
--------------------------------------------------------------------------------
1 | /* getline.c --- Implementation of replacement getline function.
2 | Copyright (C) 2005 Free Software Foundation, Inc.
3 |
4 | This program is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU General Public License as
6 | published by the Free Software Foundation; either version 2, or (at
7 | your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful, but
10 | WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 | 02110-1301, USA. */
18 |
19 | /* Written by Simon Josefsson. */
20 |
21 | #ifdef HAVE_CONFIG_H
22 | # include
23 | #endif
24 |
25 | #include "getdelim.h"
26 | #include "getline.h"
27 |
28 | ssize_t
29 | getline (char **lineptr, size_t *n, FILE *stream)
30 | {
31 | return getdelim (lineptr, n, '\n', stream);
32 | }
33 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/getline.h:
--------------------------------------------------------------------------------
1 | /* getline.h --- Prototype for replacement getline function.
2 | Copyright (C) 2005 Free Software Foundation, Inc.
3 |
4 | This program is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU General Public License as
6 | published by the Free Software Foundation; either version 2, or (at
7 | your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful, but
10 | WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program; if not, write to the Free Software
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 | 02110-1301, USA. */
18 |
19 | /* Written by Simon Josefsson. */
20 |
21 | /* Get size_t, FILE, ssize_t. And getline, if available. */
22 | # include
23 | # include
24 | # include
25 |
26 | #if !HAVE_DECL_GETLINE
27 | ssize_t getline (char **lineptr, size_t *n, FILE *stream);
28 | #endif /* !HAVE_GETLINE */
29 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/iwmulticall.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Wireless Tools
3 | *
4 | * Jean II - HPL 04
5 | *
6 | * Main code for "iwmulticall". This is a wrapper for the multicall version
7 | * of the wireless tools.
8 | * You need to link this code against "-lm".
9 | * Thanks to Ned Ludd for the inspiration...
10 | *
11 | * This file is released under the GPL license.
12 | * Copyright (c) 1997-2004 Jean Tourrilhes
13 | */
14 |
15 | /***************************** INCLUDES *****************************/
16 |
17 | #include /* Basename */
18 |
19 | /**************************** PROTOTYPES ****************************/
20 |
21 | /* Prototypes of the main of each tool */
22 | extern int
23 | main_iwconfig(int argc,
24 | char ** argv);
25 | extern int
26 | main_iwlist(int argc,
27 | char ** argv);
28 | extern int
29 | main_iwspy(int argc,
30 | char ** argv);
31 | extern int
32 | main_iwpriv(int argc,
33 | char ** argv);
34 | extern int
35 | main_iwgetid(int argc,
36 | char ** argv);
37 |
38 | /************************** MULTICALL HACK **************************/
39 | /*
40 | * The idea for multicall is to put all the tools and the library in
41 | * the same binary. This way, you can save the overhead of the library,
42 | * of each tool, can better optimise the code and throw away the stuff
43 | * you don't need from the library.
44 | * This almost divide the size of the tools by two (without stripping).
45 | * On the down side, you no longer have the libiw for other tools to
46 | * use, but for the target systems (embedded), this doesn't matter
47 | * much, as they just need to configure the card...
48 | * Note that splitting the lib and the multicall tools would not
49 | * make sense, as most gains are found in the inclusion of the lib...
50 | *
51 | * Our strategy is to include directly the *.c, rather than compile
52 | * them separatly. This allow to simplify compilation and hide the
53 | * multicall tweaks from the other tools.
54 | * Yeah, this leads to a bit a preprocessor abuse...
55 | * Jean II
56 | */
57 |
58 | /* We need the library */
59 | #include "iwlib.c"
60 |
61 | /* Get iwconfig in there. Mandatory. */
62 | #define main(args...) main_iwconfig(args)
63 | #define iw_usage(args...) iwconfig_usage(args)
64 | #define find_command(args...) iwconfig_find_command(args)
65 | #include "iwconfig.c"
66 | #undef find_command
67 | #undef iw_usage
68 | #undef main
69 |
70 | /* Get iwlist in there. Scanning support is pretty sweet. */
71 | #define main(args...) main_iwlist(args)
72 | #define iw_usage(args...) iwlist_usage(args)
73 | #define find_command(args...) iwlist_find_command(args)
74 | #include "iwlist.c"
75 | #undef find_command
76 | #undef iw_usage
77 | #undef main
78 |
79 | #ifndef WE_ESSENTIAL
80 | /* Get iwspy in there, it's not that big. */
81 | #define main(args...) main_iwspy(args)
82 | #include "iwspy.c"
83 | #undef main
84 | #endif /* WE_ESSENTIAL */
85 |
86 | /* Get iwpriv in there. Mandatory for HostAP and some other drivers. */
87 | #define main(args...) main_iwpriv(args)
88 | #define iw_usage(args...) iwpriv_usage(args)
89 | #include "iwpriv.c"
90 | #undef iw_usage
91 | #undef main
92 |
93 | /* Do we really need iwgetid ? Well, it's not like it's a big one */
94 | #define main(args...) main_iwgetid(args)
95 | #define iw_usage(args...) iwgetid_usage(args)
96 | #include "iwgetid.c"
97 | #undef iw_usage
98 | #undef main
99 |
100 | /* iwevent is useless for most people, don't grab it ? */
101 |
102 | /* ifrename is big and useless for those systems */
103 |
104 |
105 | /******************************* MAIN ********************************/
106 |
107 | /*------------------------------------------------------------------*/
108 | /*
109 | * The main !
110 | */
111 | int
112 | main(int argc,
113 | char ** argv)
114 | {
115 | char * call_name = basename(argv[0]); /* Strip path */
116 |
117 | /* This is a testing hack */
118 | if(!strcmp(call_name, "iwmulticall") && (argc > 0))
119 | {
120 | argv++;
121 | argc--;
122 | call_name = basename(argv[0]);
123 | }
124 |
125 | /* Just check the name under which we were called... */
126 |
127 | if(!strcmp(call_name, "iwconfig"))
128 | return(main_iwconfig(argc, argv));
129 | if(!strcmp(call_name, "iwlist"))
130 | return(main_iwlist(argc, argv));
131 | #ifndef WE_ESSENTIAL
132 | if(!strcmp(call_name, "iwspy"))
133 | return(main_iwspy(argc, argv));
134 | #endif /* WE_ESSENTIAL */
135 | if(!strcmp(call_name, "iwpriv"))
136 | return(main_iwpriv(argc, argv));
137 | if(!strcmp(call_name, "iwgetid"))
138 | return(main_iwgetid(argc, argv));
139 |
140 | /* Uh oh... Not supposed to come here. */
141 | printf("iwmulticall : you are not supposed to call me this way...\n");
142 | return(0);
143 | }
144 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/macaddr.c:
--------------------------------------------------------------------------------
1 | /*
2 | * macaddr
3 | *
4 | * Program to return the MAC address of an Ethernet
5 | * adapter. This was written to help configure the
6 | * adapter based on the MAC address rather than the
7 | * name.
8 | *
9 | * Version 1.0 Eric Dittman 2001-10-19
10 | *
11 | * This is released unther the GPL license.
12 | */
13 |
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 |
22 | #include "iwlib.h"
23 |
24 | int main(int argc, char** argv)
25 | {
26 |
27 | int devsock;
28 | struct ifreq ifbuffer;
29 | char buf[20];
30 |
31 | if ((argc != 2) || (argv[1][0] == '-')) {
32 | printf("Usage: macaddr interface\n");
33 | exit(1);
34 | }
35 |
36 | devsock = socket(AF_INET, SOCK_STREAM, 0);
37 |
38 | if (devsock == -1) {
39 | perror("Failed opening socket");
40 | exit (1);
41 | }
42 |
43 | memset(&ifbuffer, 0, sizeof(ifbuffer));
44 | strncpy(ifbuffer.ifr_name, argv[1], sizeof(ifbuffer.ifr_name));
45 | if (ioctl(devsock, SIOCGIFHWADDR, &ifbuffer) == -1) {
46 | fprintf(stderr, "There is no MACADDR for %s\n", argv[1]);
47 | exit(1);
48 | }
49 | close(devsock);
50 |
51 | puts(iw_saether_ntop(&ifbuffer.ifr_ifru.ifru_hwaddr, buf));
52 |
53 | exit(0);
54 | }
55 |
--------------------------------------------------------------------------------
/AndroidManetManager/jni/wireless-tools/sample_enc.c:
--------------------------------------------------------------------------------
1 | /* Note : this particular snipset of code is available under
2 | * the LGPL, MPL or BSD license (at your choice).
3 | * Jean II
4 | */
5 |
6 | /* --------------------------- INCLUDE --------------------------- */
7 |
8 | #define MAX_KEY_SIZE 16
9 | #define MAX_KEYS 8
10 | int key_on = 0;
11 | int key_open = 1;
12 | int key_current = 0;
13 | char key_table[MAX_KEYS][MAX_KEY_SIZE];
14 | int key_size[MAX_KEYS];
15 |
16 | /* --------------------------- HANDLERS --------------------------- */
17 |
18 | static int ioctl_set_encode(struct net_device *dev,
19 | struct iw_request_info *info,
20 | struct iw_point *erq,
21 | char *key)
22 | {
23 | int index = (erq->flags & IW_ENCODE_INDEX) - 1;
24 |
25 | if (erq->length > 0)
26 | {
27 | /* Check the size of the key */
28 | if(erq->length > MAX_KEY_SIZE)
29 | return(-EINVAL);
30 |
31 | /* Check the index */
32 | if((index < 0) || (index >= MAX_KEYS))
33 | index = key_current;
34 |
35 | /* Copy the key in the driver */
36 | memcpy(key_table[index], key, erq->length);
37 | key_size[index] = erq->length;
38 | key_on = 1;
39 | }
40 | else
41 | {
42 | /* Do we want to just set the current key ? */
43 | if((index >= 0) && (index < MAX_KEYS))
44 | {
45 | if(key_size[index] > 0)
46 | {
47 | key_current = index;
48 | key_on = 1;
49 | }
50 | else
51 | return(-EINVAL);
52 | }
53 | }
54 |
55 | /* Read the flags */
56 | if(erq->flags & IW_ENCODE_DISABLED)
57 | key_on = 0; /* disable encryption */
58 | if(erq->flags & IW_ENCODE_RESTRICTED)
59 | key_open = 0; /* disable open mode */
60 | if(erq->flags & IW_ENCODE_OPEN)
61 | key_open = 1; /* enable open mode */
62 |
63 | return(0);
64 | }
65 |
66 | static int ioctl_get_encode(struct net_device *dev,
67 | struct iw_request_info *info,
68 | struct iw_point *erq,
69 | char *key)
70 | {
71 | int index = (erq->flags & IW_ENCODE_INDEX) - 1;
72 |
73 | /* Set the flags */
74 | erq->flags = 0;
75 | if(key_on == 0)
76 | erq->flags |= IW_ENCODE_DISABLED;
77 | if(key_open == 0)
78 | erq->flags |= IW_ENCODE_RESTRICTED;
79 | else
80 | erq->flags |= IW_ENCODE_OPEN;
81 |
82 | /* Which key do we want */
83 | if((index < 0) || (index >= MAX_KEYS))
84 | index = key_current;
85 | erq->flags |= index + 1;
86 |
87 | /* Copy the key to the user buffer */
88 | erq->length = key_size[index];
89 | memcpy(key, key_table[index], key_size[index]);
90 |
91 | return(0);
92 | }
93 |
94 | static int ioctl_get_range(struct net_device *dev,
95 | struct iw_request_info *info,
96 | struct iw_point *rrq,
97 | char *extra)
98 | {
99 | struct iw_range *range = (struct iw_range *) extra;
100 |
101 | rrq->length = sizeof(struct iw_range);
102 |
103 | memset(range, 0, sizeof(struct iw_range));
104 |
105 | #if WIRELESS_EXT > 10
106 | /* Version we are compiled with */
107 | range->we_version_compiled = WIRELESS_EXT;
108 | /* Minimum version we recommend */
109 | range->we_version_source = 8;
110 | #endif /* WIRELESS_EXT > 10 */
111 |
112 | #if WIRELESS_EXT > 8
113 | range->encoding_size[0] = 8; /* DES = 64 bits key */
114 | range->encoding_size[1] = 16;
115 | range->num_encoding_sizes = 2;
116 | range->max_encoding_tokens = 8;
117 | #endif /* WIRELESS_EXT > 8 */
118 | return(0);
119 | }
120 |
121 | /* --------------------------- BINDING --------------------------- */
122 |
123 | #if WIRELESS_EXT > 12
124 | static const iw_handler handler_table[] =
125 | {
126 | ...
127 | (iw_handler) ioctl_set_encode, /* SIOCSIWENCODE */
128 | (iw_handler) ioctl_get_encode, /* SIOCGIWENCODE */
129 | };
130 | #else /* WIRELESS_EXT < 12 */
131 | static int
132 | do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
133 | {
134 | struct iwreq *wrq = (struct iwreq *) ifr;
135 | int err = 0;
136 |
137 | switch (cmd)
138 | {
139 | #if WIRELESS_EXT > 8
140 | case SIOCSIWENCODE:
141 | {
142 | char keybuf[MAX_KEY_SIZE];
143 | if(wrq->u.encoding.pointer)
144 | {
145 | /* We actually have a key to set */
146 | if(wrq->u.encoding.length > MAX_KEY_SIZE)
147 | {
148 | err = -E2BIG;
149 | break;
150 | }
151 | if(copy_from_user(keybuf, wrq->u.encoding.pointer,
152 | wrq->u.encoding.length))
153 | {
154 | err = -EFAULT;
155 | break;
156 | }
157 | }
158 | else
159 | if(wrq->u.encoding.length != 0)
160 | {
161 | err = -EINVAL;
162 | break;
163 | }
164 | err = ioctl_set_encode(dev, NULL, &(wrq->u.encoding), keybuf);
165 | }
166 | break;
167 |
168 | case SIOCGIWENCODE:
169 | /* only super-user can see encryption key */
170 | if(! capable(CAP_NET_ADMIN))
171 | {
172 | err = -EPERM;
173 | break;
174 | }
175 | {
176 | char keybuf[MAX_KEY_SIZE];
177 | err = ioctl_get_encode(dev, NULL, &(wrq->u.encoding), keybuf);
178 | if(wrq->u.encoding.pointer)
179 | {
180 | if (copy_to_user(wrq->u.encoding.pointer, keybuf,
181 | wrq->u.encoding.length))
182 | err= -EFAULT;
183 | }
184 | }
185 | break;
186 | #endif /* WIRELESS_EXT > 8 */
187 | }
188 | return(err);
189 | }
190 | #endif /* WIRELESS_EXT < 12 */
191 |
192 |
--------------------------------------------------------------------------------
/AndroidManetManager/libmanet.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libmanet.jar
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/adhoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/adhoc
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/gdb.setup:
--------------------------------------------------------------------------------
1 | set solib-search-path ./obj/local/armeabi
2 | directory /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include ./ /home/dev/Desktop/PROJECTS/ANDROID_PLATFORM_GINGERBREAD/system/core/include /home/dev/Desktop/PROJECTS/ANDROID_PLATFORM_GINGERBREAD/hardware/libhardware_legacy/include jni/adhoc-edify /home/dev/Desktop/PROJECTS/ANDROID_PLATFORM_GINGERBREAD/out/target/product/generic/obj/SHARED_LIBRARIES jni/adhoc-edify/edify jni/ifconfig jni/wireless-tools /home/dev/Desktop/android-ndk-r8b/sources/cxx-stl/system
3 |
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/gdbserver:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/gdbserver
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/ifconfig:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/ifconfig
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/ifrename:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/ifrename
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/iwconfig:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/iwconfig
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/iwevent:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/iwevent
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/iwgetid:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/iwgetid
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/iwlist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/iwlist
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/iwpriv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/iwpriv
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/iwspy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/iwspy
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/libbinder.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/libbinder.so
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/libc.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/libc.so
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/libcutils.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/libcutils.so
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/libhardware_legacy.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/libhardware_legacy.so
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/liblog.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/liblog.so
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/libnetutils.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/libnetutils.so
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/libutils.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/libutils.so
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/libwpa_client.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/libwpa_client.so
--------------------------------------------------------------------------------
/AndroidManetManager/libs/armeabi/libz.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/armeabi/libz.so
--------------------------------------------------------------------------------
/AndroidManetManager/libs/commons-collections-3.2.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/libs/commons-collections-3.2.1.jar
--------------------------------------------------------------------------------
/AndroidManetManager/lint.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/adhoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/adhoc
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/ifconfig:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/ifconfig
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/ifrename:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/ifrename
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/iwconfig:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/iwconfig
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/iwevent:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/iwevent
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/iwgetid:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/iwgetid
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/iwlist:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/iwlist
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/iwpriv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/iwpriv
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/iwspy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/iwspy
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libbinder.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libbinder.so
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libc.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libc.so
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libcutils.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libcutils.so
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libedify.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libedify.a
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libhardware_legacy.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libhardware_legacy.so
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libiwlib.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libiwlib.a
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/liblog.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/liblog.so
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libnetutils.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libnetutils.so
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libutils.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libutils.so
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libwpa_client.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libwpa_client.so
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/libz.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/libz.so
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/adhoc/adhoc.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/adhoc/adhoc.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/adhoc/install.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/adhoc/install.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/edify/expr.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/edify/expr.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/edify/lex.yy.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/edify/lex.yy.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/edify/parser.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/edify/parser.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/edify/parser.o.d:
--------------------------------------------------------------------------------
1 | obj/local/armeabi/objs-debug/edify/parser.o: \
2 | jni/adhoc-edify/edify/parser.c \
3 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/stdio.h \
4 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/cdefs.h \
5 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/cdefs_elf.h \
6 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/_types.h \
7 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/machine/_types.h \
8 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/types.h \
9 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/stdint.h \
10 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/linux/posix_types.h \
11 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/linux/stddef.h \
12 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/linux/compiler.h \
13 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/asm/posix_types.h \
14 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/asm/types.h \
15 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/linux/types.h \
16 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/machine/kernel.h \
17 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/sysmacros.h \
18 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/stdlib.h \
19 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/string.h \
20 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/malloc.h \
21 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/alloca.h \
22 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/strings.h \
23 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/memory.h \
24 | jni/adhoc-edify/edify/expr.h jni/adhoc-edify/edify/yydefs.h \
25 | jni/adhoc-edify/edify/parser.h
26 |
27 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/stdio.h:
28 |
29 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/cdefs.h:
30 |
31 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/cdefs_elf.h:
32 |
33 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/_types.h:
34 |
35 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/machine/_types.h:
36 |
37 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/types.h:
38 |
39 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/stdint.h:
40 |
41 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/linux/posix_types.h:
42 |
43 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/linux/stddef.h:
44 |
45 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/linux/compiler.h:
46 |
47 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/asm/posix_types.h:
48 |
49 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/asm/types.h:
50 |
51 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/linux/types.h:
52 |
53 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/machine/kernel.h:
54 |
55 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/sys/sysmacros.h:
56 |
57 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/stdlib.h:
58 |
59 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/string.h:
60 |
61 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/malloc.h:
62 |
63 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/alloca.h:
64 |
65 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/strings.h:
66 |
67 | /home/dev/Desktop/android-ndk-r8b/platforms/android-9/arch-arm/usr/include/memory.h:
68 |
69 | jni/adhoc-edify/edify/expr.h:
70 |
71 | jni/adhoc-edify/edify/yydefs.h:
72 |
73 | jni/adhoc-edify/edify/parser.h:
74 |
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/ifconfig/ifconfig.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/ifconfig/ifconfig.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/ifrename/getdelim.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/ifrename/getdelim.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/ifrename/ifrename.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/ifrename/ifrename.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/iwconfig/iwconfig.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/iwconfig/iwconfig.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/iwevent/iwevent.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/iwevent/iwevent.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/iwgetid/iwgetid.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/iwgetid/iwgetid.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/iwlib/iwlib.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/iwlib/iwlib.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/iwlist/iwlist.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/iwlist/iwlist.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/iwpriv/iwpriv.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/iwpriv/iwpriv.o
--------------------------------------------------------------------------------
/AndroidManetManager/obj/local/armeabi/objs-debug/iwspy/iwspy.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/obj/local/armeabi/objs-debug/iwspy/iwspy.o
--------------------------------------------------------------------------------
/AndroidManetManager/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-9
12 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/adhoc_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/adhoc_off.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/adhoc_off_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/adhoc_off_notification.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/adhoc_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/adhoc_on.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/adhoc_on_notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/adhoc_on_notification.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/background.jpg
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/battery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/battery.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/bluetooth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/bluetooth.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/exclamation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/exclamation.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/gear_icon_48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/gear_icon_48.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/lock.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/lock_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/lock_open.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/master_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/master_off.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/master_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/master_on.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/sechigh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/sechigh.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/seclow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/seclow.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/secmedium.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/secmedium.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/service_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/service_icon_64.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/drawable/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/drawable/wifi.png
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/aboutview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
14 |
22 |
28 |
34 |
42 |
51 |
60 |
68 |
74 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/btwarningview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
14 |
23 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/clientrow.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
13 |
14 |
20 |
21 |
26 |
27 |
31 |
36 |
37 |
38 |
42 |
48 |
49 |
50 |
54 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/ignoreviewwrapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
16 |
17 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/logview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
16 |
17 |
23 |
24 |
25 |
26 |
31 |
32 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/messageview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
15 |
16 |
19 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
32 |
33 |
36 |
37 |
41 |
42 |
43 |
44 |
47 |
48 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/nonetfilterview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
14 |
23 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/norootview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
14 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/routinginfoview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
26 |
27 |
28 |
29 |
33 |
34 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/sendmessageview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
17 |
21 |
22 |
27 |
28 |
32 |
33 |
40 |
41 |
42 |
43 |
46 |
47 |
52 |
53 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/settingsviewwrapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
16 |
17 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/share.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
14 |
16 |
20 |
21 |
26 |
27 |
28 |
33 |
34 |
35 |
36 |
38 |
42 |
43 |
48 |
49 |
50 |
55 |
56 |
57 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/layout/txpowerwarningview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
14 |
23 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/adhoc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/adhoc
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/asus_forward_sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | # usage:
4 | # su -c "asus-forward.sh"
5 |
6 | # turn on Wi-Fi first
7 |
8 | # insmod modules for ALFA
9 | insmod /system/lib/modules/mac80211.ko
10 | insmod /system/lib/modules/eeprom_93cx6.ko
11 | insmod /system/lib/modules/rtl8187.ko
12 |
13 | # insmod modules for iptables raw TRACE
14 | insmod /system/lib/modules/iptable_raw.ko
15 | insmod /system/lib/modules/xt_TRACE.ko
16 |
17 | # enable ALFA ad-hoc mode
18 | /data/data/org.span/bin/ifconfig wlan1 down
19 | /data/data/org.span/bin/iwconfig wlan1 mode ad-hoc
20 |
21 | # setup raw TRACE tables
22 | /data/data/com.googlecode.droidwall.free/app_bin/iptables_armv5 -t raw -A OUTPUT -p icmp -j TRACE
23 | # /data/data/com.googlecode.droidwall.free/app_bin/iptables_armv5 -t raw -A PREROUTING -p icmp -j TRACE
24 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/blue_down_sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # blue-down.sh
3 | /data/data/org.span/bin/ifconfig bnep0 down
4 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/blue_up_sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # blue-up.sh
3 | adhocpath=/data/data/org.span
4 | adhoclog=$adhocpath/var/adhoc.log
5 |
6 | $adhocpath/bin/ifconfig bnep0 192.168.2.254 netmask 255.255.255.0 up >> $adhoclog 2>> $adhoclog
7 | $adhocpath/bin/dnsmasq --resolv-file=$adhocpath/conf/resolv.conf --conf-file=$adhocpath/conf/dnsmasq.conf -i bnep0 >> $adhoclog 2>> $adhoclog
8 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/dnsmasq:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/dnsmasq
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/dnsmasq_conf:
--------------------------------------------------------------------------------
1 | dhcp-authoritative
2 | dhcp-range=192.168.2.100,192.168.2.105,12h
3 | dhcp-leasefile=/data/data/org.span/var/dnsmasq.leases
4 | pid-file=/data/data/org.span/var/dnsmasq.pid
5 | user=root
6 | no-negcache
7 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/fixpersist_sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | while true; do
3 | sleep 2
4 | /data/data/org.span/bin/iwconfig $1 | while read l; do
5 | case "$l" in *ESSID*)
6 | case "$l" in *\"$2\"*)
7 | break;
8 | esac;
9 | /data/data/org.span/bin/iwconfig $1 mode Ad-Hoc
10 | /data/data/org.span/bin/iwconfig $1 essid $2
11 | /data/data/org.span/bin/iwconfig $1 channel $3
12 | break;
13 | esac;
14 | break;
15 | done
16 | done
17 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/fixroute_sh:
--------------------------------------------------------------------------------
1 | while true; do
2 | r=0
3 | w=0
4 | while read l; do
5 | case "$l" in *rmnet*)
6 | r=1
7 | esac;
8 | case "$l" in *$1*)
9 | case "$l" in *$2*)
10 | case "$l" in *$3*)
11 | w=1
12 | esac;
13 | esac;
14 | esac;
15 | done << EOF
16 | $(/system/bin/ip route show table gprs)
17 | EOF
18 |
19 | case "$r" in *1*)
20 | case "$w" in *0*)
21 | /system/bin/ip route add table gprs $2 dev $1 proto kernel scope link src $3
22 | esac;
23 | esac;
24 | sleep 2
25 | done
26 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/hostapd_conf_blade:
--------------------------------------------------------------------------------
1 | interface=wlan0
2 | ssid=AndroidAdhoc
3 | auth_algs=1
4 | max_num_sta=8
5 | beacon_int=100
6 | dtim_period=1
7 | channel_num=1
8 | preamble=0
9 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/hostapd_conf_droidx:
--------------------------------------------------------------------------------
1 | interface=tiwlan0
2 | driver=wilink
3 | logger_syslog=-1
4 | logger_syslog_level=2
5 | logger_stdout=-1
6 | logger_stdout_level=2
7 | dump_file=/tmp/hostapd.dump
8 | hw_mode=g
9 | beacon_int=100
10 | dtim_period=2
11 | max_num_sta=5
12 | rts_threshold=2347
13 | fragm_threshold=2346
14 | supported_rates=10 20 55 110 60 90 120 180 240 360 480 540
15 | macaddr_acl=0
16 | auth_algs=1
17 | ignore_broadcast_ssid=0
18 | wme_enabled=0
19 | wme_ac_bk_cwmin=4
20 | wme_ac_bk_cwmax=10
21 | wme_ac_bk_aifs=7
22 | wme_ac_bk_txop_limit=0
23 | wme_ac_bk_acm=0
24 | wme_ac_be_aifs=3
25 | wme_ac_be_cwmin=4
26 | wme_ac_be_cwmax=10
27 | wme_ac_be_txop_limit=0
28 | wme_ac_be_acm=0
29 | wme_ac_vi_aifs=2
30 | wme_ac_vi_cwmin=3
31 | wme_ac_vi_cwmax=4
32 | wme_ac_vi_txop_limit=94
33 | wme_ac_vi_acm=0
34 | wme_ac_vo_aifs=2
35 | wme_ac_vo_cwmin=2
36 | wme_ac_vo_cwmax=3
37 | wme_ac_vo_txop_limit=47
38 | wme_ac_vo_acm=0
39 | ap_max_inactivity=30
40 | wep_rekey_period=0
41 | eap_server=0
42 | own_ip_addr=127.0.0.1
43 | wpa_group_rekey=0
44 | wpa_gmk_rekey=0
45 | wpa_ptk_rekey=0
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/ifconfig:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/ifconfig
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/iperf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/iperf
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/iptables:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/iptables
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/iwconfig:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/iwconfig
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/manet_conf:
--------------------------------------------------------------------------------
1 | adhoc.fix.persist=false
2 | adhoc.fix.route=false
3 | adhoc.mode=wifi
4 | bluetooth.disable.wifi=false
5 | bluetooth.make.discoverable=false
6 | device.type=generic
7 | dns.server=208.67.222.222
8 | gateway.interface=none
9 | ip.address=192.168.11.100
10 | ip.gateway=192.168.11.254
11 | ip.netmask=255.255.255.0
12 | ip.network=192.168.11.0
13 | routing.ignore.list=[]
14 | routing.protocol=Optimized Link State Routing
15 | screen.on=true
16 | userid=Anonymous
17 | wifi.channel=1
18 | wifi.driver=wext
19 | wifi.encryption.algorithm=none
20 | wifi.encryption.password=abcdefghijklm
21 | wifi.encryption.setup=wpa_supplicant
22 | wifi.essid=AndroidAdhoc
23 | wifi.interface=eth0
24 | wifi.txpower=auto
25 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/nc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/nc
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/olsrd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/olsrd
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/olsrd_txtinfo_so_0_1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/olsrd_txtinfo_so_0_1
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/pand:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/pand
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/routing_ignore_list_conf:
--------------------------------------------------------------------------------
1 | # enter ipv4 addresses below, one per line
2 | 192.168.1.200
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/tcpdump:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/tcpdump
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/tiwlan_ini:
--------------------------------------------------------------------------------
1 | EEPROMlessModeSupported = 1
2 | WME_Enable = 1
3 | dot11NetworkType = 3
4 | RecoveryEnable = 1
5 | TriggerFcs = 0
6 | dot11FragmentationThreshold = 4096
7 | dot11RTSThreshold = 4096
8 | WPAMixedMode = 1
9 | RSNPreAuthentication = 1
10 | CalibrationChannel24 = 1
11 | CalibrationChannel5 = 36
12 | AllowedChannelsTable24 = FFFFFFFFFFFFFFFFFFFFFFFFFFFF
13 | AllowedChannelsTable5 = FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000000000000000000000000000000000000000000000000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000FF000000FF000000FF000000FF00000000000000000000000000000000000000
14 | SpectrumManagement = 0
15 | RxBroadcastInPs = 1
16 | FirstConnScanEnabled = 1
17 | ArpIp_Addr = c0 a8 00 5e
18 | ArpIp_Filter_ena = 0
19 | Mac_Filter_Enabled = 0
20 | numGroupAddrs = 4
21 | Group_addr0 = 10 01 02 03 04 05
22 | Group_addr1 = 11 11 12 13 14 15
23 | Group_addr2 = 12 21 22 23 24 25
24 | Group_addr3 = 13 31 32 33 34 35
25 | Group_addr4 = 14 41 42 43 44 45
26 | Group_addr5 = 15 51 52 53 54 55
27 | Group_addr6 = 16 61 62 63 64 65
28 | Group_addr7 = 17 71 72 73 74 75
29 | Beacon_Filter_Desired_State = 1
30 | Beacon_Filter_Stored = 1
31 | Beacon_IE_Num_Of_Elem = 15
32 | Beacon_IE_Table_Size = 35
33 | Beacon_IE_Table = 00 01 01 01 32 01 2a 01 03 01 06 01 07 01 20 01 25 01 23 01 30 01 28 01 2e 01 85 01 dd 00 52 f2 02 00 01
34 | RateContThreshold = 10
35 | RateStepUpThreshold = 2
36 | FBShortInterval = 40
37 | FBLongInterval = 200
38 | RateAdaptationTimeout = 300
39 | RatePolicyUserShortRetryLimit = 10
40 | RatePolicyUserLongRetryLimit = 10
41 | RatePolicyUserRetriesPerRateCck = 1,1,1,1,1,1,1,1,1,1,1,1,1
42 | RatePolicyUserRetriesPerRatePbcc = 1,1,1,1,1,1,1,1,1,1,1,1,1
43 | RatePolicyUserRetriesPerRateOfdm = 0,0,0,1,0,0,0,1,0,0,1,1,1
44 | RatePolicyUserRetriesPerRateOfdmA = 0,0,0,1,0,0,1,0,0,1,0,0,0
45 | RatePolicySGRetriesPerRateCck = 1,1,1,1,1,1,1,5,1,1,1,1,1
46 | RatePolicySGRetriesPerRatePbcc = 1,1,1,1,1,1,1,5,1,1,1,1,1
47 | RatePolicySGRetriesPerRateOfdm = 1,1,1,1,1,1,1,5,1,1,1,1,1
48 | RatePolicySGRetriesPerRateOfdmA = 1,1,1,1,1,1,1,5,1,1,1,1,1
49 | BeaconListenInterval = 1
50 | DtimListenInterval = 1
51 | dot11PowerMode = 1
52 | PowerMgmtHangOverPeriod = 5
53 | AutoPowerModeDozeMode = 2
54 | AutoPowerModeActiveTh = 15
55 | AutoPowerModeDozeTh = 8
56 | defaultPowerLevel = 0
57 | PowerSavePowerLevel = 0
58 | OsDbgState = 0x01e9003c
59 | ReportSeverityTable = "00011010000"
60 | BeaconReceiveTime = 50
61 | FirstConnScanBandB_ChannelList = 1,2,3,4,5,6,7,8,9,10,11,12,13,14
62 | FirstConnScanBandB_MinDwellTime = 30000
63 | FirstConnScanBandB_MaxDwellTime = 60000
64 | FirstConnScanBandB_NumOfProbReqs = 3
65 | FirstConnScanBandB_ProbReqRate = 2
66 | FirstConnScanBandB_TxPowerLevel = 255
67 | FirstConnScanBandA_ChannelList = 36,40,44,48,52,56,60,64,100,104,108,112,149,153,157,161
68 | FirstConnScanBandA_MinDwellTime = 30000
69 | FirstConnScanBandA_MaxDwellTime = 60000
70 | FirstConnScanBandA_NumOfProbReqs = 3
71 | FirstConnScanBandA_ProbReqRate = 32
72 | FirstConnScanBandA_TxPowerLevel = 255
73 | desiredPsMode = 0
74 | QOS_wmePsModeBE = 0
75 | QOS_wmePsModeBK = 0
76 | QOS_wmePsModeVI = 0
77 | QOS_wmePsModeVO = 0
78 | Clsfr_Type = 1
79 | NumOfDstIPPortClassifiers = 3
80 | IPPortClassifier00_IPAddress = 0a 03 89 02
81 | IPPortClassifier00_Port = 5001
82 | IPPortClassifier00_DTag = 1
83 | IPPortClassifier01_IPAddress = 0a 03 89 02
84 | IPPortClassifier01_Port = 5002
85 | IPPortClassifier01_DTag = 4
86 | IPPortClassifier02_IPAddress = 0a 03 89 02
87 | IPPortClassifier02_Port = 5003
88 | IPPortClassifier02_DTag = 6
89 | NumOfCodePoints = 4
90 | DSCPClassifier00_CodePoint = 0
91 | DSCPClassifier00_DTag = 0
92 | DSCPClassifier01_CodePoint = 8
93 | DSCPClassifier01_DTag = 1
94 | DSCPClassifier02_CodePoint = 40
95 | DSCPClassifier02_DTag = 5
96 | DSCPClassifier03_CodePoint = 56
97 | DSCPClassifier03_DTag = 7
98 | dot11MaxReceiveLifetime=512000
99 | FracOfLifeTimeToDrop = 50
100 | WiFiAdhoc = 1
101 | dot11DesiredChannel = 6
102 | dot11DesiredSSID = AndroidAdhoc
103 | dot11DesiredBSSType = 0
104 | WiFiWmmPS = 0
105 | EarlyWakeUp = 1
106 | TxEnergyDetection = 0
107 | TriggeredScanTimeOut = 50000
108 | PsPollDeliveryFailureRecoveryPeriod = 20
109 | ConsecutivePsPollDeliveryFailureThreshold = 4
110 | BThWlanCoexistEnable = 2
111 |
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/ultra_bcm_config:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/res/raw/ultra_bcm_config
--------------------------------------------------------------------------------
/AndroidManetManager/res/raw/wpa_supplicant_conf:
--------------------------------------------------------------------------------
1 | update_config=0
2 | ctrl_interface=/data/local/tmp/wpa_supplicant
3 | eapol_version=1
4 | ap_scan=2
5 | fast_reauth=0
6 | network={
7 | ssid="AndroidAdhoc"
8 | scan_ssid=1
9 | mode=1
10 | key_mgmt=NONE
11 | group=WEP104
12 | auth_alg=SHARED
13 | wep_key0="abcdefghijklm"
14 | }
15 |
--------------------------------------------------------------------------------
/AndroidManetManager/scripts/bin/unzip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectSPAN/android-manet-manager/8a5eb384e2a2bb5e401c18ca530a94dcf333b44c/AndroidManetManager/scripts/bin/unzip
--------------------------------------------------------------------------------
/AndroidManetManager/scripts/build-native.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # usage:
4 | # ./scripts/build-native.sh
5 |
6 | # variables
7 | # aosp_path='/home/dev/Desktop/PROJECTS/ANDROID'
8 |
9 |
10 | # prepare to build "adhoc" binary
11 |
12 | # generate "lex.yy.c":
13 |
14 | cd ./jni/adhoc-edify/edify
15 |
16 | flex lexer.l
17 |
18 | # generate "parser.h" and "parser.c"
19 |
20 | # export BISON_PKGDATADIR="$aosp_path/external/bison/data"
21 |
22 | bison --defines=parser.h --output=parser.c parser.y
23 |
24 | cd ../../..
25 |
26 |
27 | # execute NDK build script
28 |
29 | ndk-build
30 |
31 |
32 | # copy binaries
33 |
34 | cp ./libs/armeabi/adhoc ./res/raw/adhoc
35 |
36 | cp ./libs/armeabi/ifconfig ./res/raw/ifconfig
37 |
38 | cp ./libs/armeabi/iwconfig ./res/raw/iwconfig
39 |
40 |
41 |
--------------------------------------------------------------------------------
/AndroidManetManager/scripts/create-lib.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # usage:
4 | # ./scripts/create-lib.sh
5 |
6 |
7 | # archive all classes
8 |
9 | # jar cvf libmanet.jar -C ./bin/classes .
10 |
11 |
12 | # selectively archive classes
13 |
14 | cd ./bin/classes
15 |
16 | jar cvf libmanet.jar \
17 | './org/span/service/CircularStringBuffer.class' \
18 | './org/span/service/LogObserver.class' \
19 | './org/span/service/ManetObserver.class' \
20 | './org/span/service/ManetHelper.class' \
21 | './org/span/service/ManetParser.class' \
22 | './org/span/service/ManetHelper$IncomingHandler.class' \
23 | './org/span/service/ManetHelper$ManetBroadcastReceiver.class' \
24 | './org/span/service/ManetHelper$ManetServiceConnection.class' \
25 | './org/span/service/routing/Edge.class' \
26 | './org/span/service/routing/Node.class' \
27 | './org/span/service/routing/Node$UpdatableHashSet.class' \
28 | './org/span/service/routing/OlsrProtocol.class' \
29 | './org/span/service/routing/SimpleProactiveProtocol.class' \
30 | './org/span/service/system/ManetConfig.class' \
31 | './org/span/service/system/ManetConfig$'* \
32 | './org/span/service/system/DeviceConfig.class' \
33 | './org/span/service/system/CoreTask.class' \
34 | './org/span/service/system/CoreTask$'* \
35 | './org/span/service/core/ManetService.class' \
36 | './org/span/service/core/ManetService$AdhocStateEnum.class' \
37 | './org/span/service/legal/EulaHelper.class' \
38 | './org/span/service/legal/EulaHelper$'* \
39 | './org/span/service/legal/EulaObserver.class'
40 |
41 | mv libmanet.jar ../..
42 |
43 | cd ../..
44 |
45 |
46 | # copy jar into other project(s)
47 | # copy will fail if destination dir does not exist
48 |
49 | # cp libmanet.jar ../../android-manet-logger/AndroidManetLogger/libs
50 |
51 |
--------------------------------------------------------------------------------
/AndroidManetManager/scripts/extract-all.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # usage:
4 | # ./scripts/extract-all.sh
5 | # ./scripts/extract-all.sh /sdcard/mitremaps/kc_maps.zip /sdcard/mitremaps
6 |
7 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8 |
9 | # extract zip on each device
10 | adb devices | awk '$2 == "device" { print "gnome-terminal -t "$1" -x bash -c \" '"$DIR"'/extract.sh "$1" '"$1"' '"$2"' ; echo ; read -p '"'Done! Press [enter] to exit ...'"' \" " }' | sh -x
11 |
--------------------------------------------------------------------------------
/AndroidManetManager/scripts/extract.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # usage:
4 | # ./scripts/extract.sh
5 |
6 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7 |
8 | echo "Accept SuperUser prompts on device ..."
9 | echo
10 | adb -s $1 push $DIR/bin/unzip /data/local/tmp/unzip
11 | adb -s $1 shell mkdir -p $3
12 | adb -s $1 shell su -c "chmod 777 /data/local/tmp/unzip"
13 | adb -s $1 shell su -c "./data/local/tmp/unzip -o $2 -d $3"
14 | adb -s $1 shell rm /data/local/tmp/unzip
15 |
--------------------------------------------------------------------------------
/AndroidManetManager/scripts/install-all.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # usage:
4 | # ./scripts/install-all.sh [manager] [logger]
5 |
6 | #http://www.cs.utah.edu/dept/old/texinfo/gawk/gawk_4.html#SEC9
7 | #http://www.tek-tips.com/faqs.cfm?fid=1281
8 |
9 | # PREBUILT ANDROID SDK [has valid targets]
10 | # export PATH=$PATH:~/Desktop/android-sdk-linux_x86/tools
11 | # export PATH=$PATH:~/Desktop/android-sdk-linux_x86/platform-tools
12 |
13 | # create build.xml
14 | #
15 | # android list targets
16 | #
17 | # id: 9 or "android-10"
18 | # Name: Android 2.3.3
19 | # Type: Platform
20 | # API level: 10
21 | # Revision: 2
22 | # Skins: WQVGA432, QVGA, WQVGA400, HVGA, WVGA800 (default), WVGA854
23 | #
24 | # android update project --path . --target 9
25 |
26 | # build apk
27 | # ant debug
28 |
29 | if [ "$1" == "-c" ] || [ "$2" == "-c" ] || [ "$3" == "-c" ] || [ "$4" == "-c" ]; then
30 | # copy each device's config file to sdcard
31 | adb devices | awk '$2 == "device" { print "adb -s "$1" shell \"su -c \\\"cp data/data/org.span/conf/manet.conf /sdcard/manet.conf\\\"\"" }' | sh -x
32 | fi
33 |
34 | if [ "$1" == "manager" ] || [ "$2" == "manager" ] || [ "$3" == "manager" ] || [ "$4" == "manager" ]; then
35 | # variables
36 | package='org.span'
37 | apk='../../android-manet-manager/AndroidManetManager/bin/AndroidManetManager.apk'
38 |
39 | # unload each device
40 | adb devices | awk '$2 == "device" { print "adb -s "$1" uninstall '"$package"'" }' | sh -x
41 |
42 | # load each device
43 | adb devices | awk '$2 == "device" { print "adb -s "$1" install -r '"$apk"'" }' | sh -x
44 | fi
45 |
46 | if [ "$1" == "logger" ] || [ "$2" == "logger" ] || [ "$3" == "logger" ] || [ "$4" == "logger" ]; then
47 | # variables
48 | package='org.span.logger'
49 | apk='../../android-manet-logger/AndroidManetLogger/bin/AndroidManetLogger.apk'
50 |
51 | # unload each device
52 | adb devices | awk '$2 == "device" { print "adb -s "$1" uninstall '"$package"'" }' | sh -x
53 |
54 | # load each device
55 | adb devices | awk '$2 == "device" { print "adb -s "$1" install -r '"$apk"'" }' | sh -x
56 | fi
57 |
--------------------------------------------------------------------------------
/AndroidManetManager/scripts/push-all.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # usage:
4 | # ./scripts/push-all.sh
5 | # ./scripts/push-all.sh ~/Desktop/APPS/mitremaps/kc_maps.zip /sdcard/mitremaps/kc_maps.zip
6 |
7 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8 |
9 | # multiple files (takes much longer than a zip)
10 | # adb devices | awk '$2 == "device" { print "gnome-terminal -t "$1" -x bash -c \" \
11 | # (adb -s "$1" push '"$1"' '"$2"') ; (exec /bin/bash -i) \"" }' | sh -x
12 |
13 | # large file
14 | adb devices | awk '$2 == "device" { print "gnome-terminal -t "$1" -x bash -c \" '"$DIR"'/push.sh "$1" '"$1"' '"$2"' ; read -p '"'Done! Press [enter] to exit ...'"' \" " }' | sh -x
15 |
--------------------------------------------------------------------------------
/AndroidManetManager/scripts/push.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # usage:
4 | # ./scripts/push.sh
5 |
6 | watch -n 1 adb -s $1 shell ls -l $3 &
7 | echo $! > $1.pid
8 | adb -s $1 push $2 $3 > /dev/null 2>&1
9 | cat $1.pid | xargs kill
10 | rm $1.pid
11 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/servalproject/SimpleWebServer.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2011 The Serval Project
3 | *
4 | * This file is part of Serval Software (http://www.servalproject.org)
5 | *
6 | * Serval Software is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This source code is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this source code; if not, write to the Free Software
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 | */
20 |
21 | /*
22 | Copyright Paul James Mutton, 2001-2004, http://www.jibble.org/
23 |
24 | This file is part of Mini Wegb Server / SimpleWebServer.
25 |
26 | This software is dual-licensed, allowing you to choose between the GNU
27 | General Public License (GPL) and the www.jibble.org Commercial License.
28 | Since the GPL may be too restrictive for use in a proprietary application,
29 | a commercial license is also provided. Full license information can be
30 | found at http://www.jibble.org/licenses/
31 |
32 | $Author: pjm2 $
33 | $Id: ServerSideScriptEngine.java,v 1.4 2004/02/01 13:37:35 pjm2 Exp $
34 |
35 | */
36 |
37 | package org.servalproject;
38 |
39 | import java.io.File;
40 | import java.io.IOException;
41 | import java.net.ServerSocket;
42 | import java.net.Socket;
43 | import java.util.Hashtable;
44 |
45 | import android.util.Log;
46 |
47 | /**
48 | * Copyright Paul Mutton
49 | * http://www.jibble.org/
50 | *
51 | */
52 | public class SimpleWebServer extends Thread {
53 |
54 | public static final String VERSION = "SimpleWebServer http://www.jibble.org/";
55 | public static final Hashtable MIME_TYPES = new Hashtable();
56 |
57 | static {
58 | String image = "image/";
59 | MIME_TYPES.put(".gif", image + "gif");
60 | MIME_TYPES.put(".jpg", image + "jpeg");
61 | MIME_TYPES.put(".jpeg", image + "jpeg");
62 | MIME_TYPES.put(".png", image + "png");
63 | String text = "text/";
64 | MIME_TYPES.put(".html", text + "html");
65 | MIME_TYPES.put(".htm", text + "html");
66 | MIME_TYPES.put(".txt", text + "plain");
67 | MIME_TYPES.put(".apk", "application/vnd.android.package-archive");
68 | }
69 |
70 | public SimpleWebServer(File rootDir, int port) throws IOException {
71 | _rootDir = rootDir.getCanonicalFile();
72 | if (!_rootDir.isDirectory()) {
73 | throw new IOException("Not a directory.");
74 | }
75 | _serverSocket = new ServerSocket(port);
76 | start();
77 | }
78 |
79 | @Override
80 | public void interrupt() {
81 | _running=false;
82 | try {
83 | _serverSocket.close();
84 | } catch (IOException e) {
85 | Log.e("ManetManager WebServer", e.toString(), e);
86 | }
87 | super.interrupt();
88 | }
89 |
90 | @Override
91 | public void run() {
92 | while (_running) {
93 | try {
94 | Socket socket = _serverSocket.accept();
95 | RequestThread requestThread = new RequestThread(socket, _rootDir);
96 | requestThread.start();
97 | }catch (IOException e) {
98 | Log.e("ManetManager WebServer",e.toString(),e);
99 | }
100 | }
101 | try {
102 | _serverSocket.close();
103 | } catch (IOException e) {
104 | Log.e("ManetManager WebServer", e.toString(), e);
105 | }
106 | _serverSocket = null;
107 | }
108 |
109 | // Work out the filename extension. If there isn't one, we keep
110 | // it as the empty string ("").
111 | public static String getExtension(java.io.File file) {
112 | String extension = "";
113 | String filename = file.getName();
114 | int dotPos = filename.lastIndexOf(".");
115 | if (dotPos >= 0) {
116 | extension = filename.substring(dotPos);
117 | }
118 | return extension.toLowerCase();
119 | }
120 |
121 | public static void main(String[] args) {
122 | try {
123 | @SuppressWarnings("unused")
124 | SimpleWebServer server = new SimpleWebServer(new File("./"), 80);
125 | }
126 | catch (IOException e) {
127 | System.out.println(e);
128 | }
129 | }
130 |
131 | private File _rootDir;
132 | private ServerSocket _serverSocket;
133 | private boolean _running = true;
134 |
135 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/servalproject/system/WiFiRadio.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2011 The Serval Project
3 | *
4 | * This file is part of Serval Software (http://www.servalproject.org)
5 | *
6 | * Serval Software is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This source code is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this source code; if not, write to the Free Software
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 | */
20 | package org.servalproject.system;
21 |
22 | import java.io.IOException;
23 |
24 | import android.content.Context;
25 | import android.net.wifi.WifiConfiguration;
26 | import android.net.wifi.WifiManager;
27 | import android.util.Log;
28 |
29 | public class WiFiRadio {
30 |
31 | // WifiManager
32 | private WifiManager wifiManager = null;
33 | private WifiApControl wifiApManager = null;
34 |
35 | public WiFiRadio(Context context) {
36 | // init wifiManager
37 | wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
38 | wifiApManager = WifiApControl.getApControl(wifiManager);
39 | }
40 |
41 | private void waitForApState(int newState) throws IOException {
42 | for (int i = 0; i < 50; i++) {
43 |
44 | int state = wifiApManager.getWifiApState();
45 | if (state >= 10)
46 | state -= 10;
47 |
48 | if (state == newState)
49 | return;
50 |
51 | if (state == WifiApControl.WIFI_AP_STATE_FAILED
52 | || state == WifiApControl.WIFI_AP_STATE_DISABLED)
53 | break;
54 | try {
55 | Thread.sleep(100);
56 | } catch (InterruptedException e) {
57 | }
58 | }
59 | throw new IOException("Failed to control access point mode");
60 | }
61 |
62 | private void waitForApEnabled(boolean enabled) throws IOException {
63 | for (int i = 0; i < 50; i++) {
64 | if (enabled == this.wifiApManager.isWifiApEnabled())
65 | return;
66 | try {
67 | Thread.sleep(100);
68 | } catch (InterruptedException e) {
69 | }
70 | }
71 | throw new IOException("Failed to control access point mode");
72 | }
73 |
74 | public void startAp(String ssid) throws IOException {
75 | int tries = 0;
76 |
77 | WifiConfiguration netConfig = new WifiConfiguration();
78 | netConfig.SSID = ssid;
79 | netConfig.allowedAuthAlgorithms
80 | .set(WifiConfiguration.AuthAlgorithm.OPEN);
81 |
82 | while (true) {
83 | try {
84 | if (this.wifiManager.isWifiEnabled())
85 | this.wifiManager.setWifiEnabled(false);
86 |
87 | if (!this.wifiApManager.setWifiApEnabled(netConfig, true))
88 | throw new IOException("Failed to control access point mode");
89 |
90 | waitForApState(WifiApControl.WIFI_AP_STATE_ENABLED);
91 |
92 | waitForApEnabled(true);
93 |
94 | break;
95 | } catch (IOException e) {
96 | if (++tries >= 5) {
97 | throw e;
98 | }
99 | Log.e("BatPhone", "Failed", e);
100 | try {
101 | Thread.sleep(100);
102 | } catch (InterruptedException e1) {
103 | }
104 | }
105 | }
106 | }
107 |
108 | public void stopAp() throws IOException {
109 | if (!this.wifiApManager.setWifiApEnabled(null, false))
110 | throw new IOException("Failed to control access point mode");
111 | waitForApState(WifiApControl.WIFI_AP_STATE_DISABLED);
112 | waitForApEnabled(false);
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/servalproject/system/WifiApControl.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2011 The Serval Project
3 | *
4 | * This file is part of Serval Software (http://www.servalproject.org)
5 | *
6 | * Serval Software is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This source code is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this source code; if not, write to the Free Software
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 | */
20 |
21 | package org.servalproject.system;
22 |
23 | import java.lang.reflect.Method;
24 |
25 | import android.net.wifi.WifiConfiguration;
26 | import android.net.wifi.WifiManager;
27 | import android.util.Log;
28 |
29 | public class WifiApControl {
30 | private static Method getWifiApState;
31 | private static Method isWifiApEnabled;
32 | private static Method setWifiApEnabled;
33 | private static Method getWifiApConfiguration;
34 |
35 | public static final String WIFI_AP_STATE_CHANGED_ACTION="android.net.wifi.WIFI_AP_STATE_CHANGED";
36 |
37 | public static final int WIFI_AP_STATE_DISABLED = WifiManager.WIFI_STATE_DISABLED;
38 | public static final int WIFI_AP_STATE_DISABLING = WifiManager.WIFI_STATE_DISABLING;
39 | public static final int WIFI_AP_STATE_ENABLED = WifiManager.WIFI_STATE_ENABLED;
40 | public static final int WIFI_AP_STATE_ENABLING = WifiManager.WIFI_STATE_ENABLING;
41 | public static final int WIFI_AP_STATE_FAILED = WifiManager.WIFI_STATE_UNKNOWN;
42 |
43 | public static final String EXTRA_PREVIOUS_WIFI_AP_STATE = WifiManager.EXTRA_PREVIOUS_WIFI_STATE;
44 | public static final String EXTRA_WIFI_AP_STATE = WifiManager.EXTRA_WIFI_STATE;
45 |
46 | static{
47 | // lookup methods and fields not defined publicly in the SDK.
48 | Class> cls=WifiManager.class;
49 | for (Method method:cls.getDeclaredMethods()){
50 | String methodName=method.getName();
51 | if (methodName.equals("getWifiApState")){
52 | getWifiApState=method;
53 | }else if (methodName.equals("isWifiApEnabled")){
54 | isWifiApEnabled=method;
55 | }else if (methodName.equals("setWifiApEnabled")){
56 | setWifiApEnabled=method;
57 | }else if (methodName.equals("getWifiApConfiguration")){
58 | getWifiApConfiguration=method;
59 | }
60 | }
61 | }
62 |
63 | public static boolean isApSupported(){
64 | return (getWifiApState!=null && isWifiApEnabled!=null && setWifiApEnabled!=null && getWifiApConfiguration!=null);
65 | }
66 |
67 | private WifiManager mgr;
68 | private WifiApControl(WifiManager mgr){
69 | this.mgr=mgr;
70 | }
71 |
72 | public static WifiApControl getApControl(WifiManager mgr){
73 | if (!isApSupported())
74 | return null;
75 | return new WifiApControl(mgr);
76 | }
77 |
78 | public boolean isWifiApEnabled(){
79 | try {
80 | return (Boolean) isWifiApEnabled.invoke(mgr);
81 | } catch (Exception e) {
82 | Log.v("BatPhone",e.toString(),e); // shouldn't happen
83 | return false;
84 | }
85 | }
86 |
87 | public int getWifiApState(){
88 | try {
89 | return (Integer) getWifiApState.invoke(mgr);
90 | } catch (Exception e) {
91 | Log.v("BatPhone",e.toString(),e); // shouldn't happen
92 | return -1;
93 | }
94 | }
95 |
96 | public WifiConfiguration getWifiApConfiguration(){
97 | try {
98 | return (WifiConfiguration) getWifiApConfiguration.invoke(mgr);
99 | } catch (Exception e) {
100 | Log.v("BatPhone",e.toString(),e); // shouldn't happen
101 | return null;
102 | }
103 | }
104 |
105 | public boolean setWifiApEnabled(WifiConfiguration config, boolean enabled){
106 | try {
107 | return (Boolean) setWifiApEnabled.invoke(mgr, config, enabled);
108 | } catch (Exception e) {
109 | Log.v("BatPhone",e.toString(),e); // shouldn't happen
110 | return false;
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/manager/EditIgnoreListActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.manager;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | import org.json.JSONArray;
11 | import org.json.JSONException;
12 | import org.span.R;
13 |
14 | import android.app.Activity;
15 | import android.app.AlertDialog;
16 | import android.content.DialogInterface;
17 | import android.content.Intent;
18 | import android.content.SharedPreferences;
19 | import android.os.Bundle;
20 | import android.preference.PreferenceActivity;
21 | import android.text.InputType;
22 | import android.view.View;
23 | import android.widget.ArrayAdapter;
24 | import android.widget.Button;
25 | import android.widget.EditText;
26 | import android.widget.ListView;
27 |
28 | public class EditIgnoreListActivity extends PreferenceActivity {
29 |
30 | private ManetManagerApp app = null;
31 |
32 | private Button btnAdd = null;
33 |
34 | private Button btnDone = null;
35 |
36 | private List ignoreList = new ArrayList();
37 |
38 | private SharedPreferences prefs = null;
39 |
40 | /** Called when the activity is first created. */
41 | @Override
42 | public void onCreate(Bundle bundle) {
43 | super.onCreate(bundle);
44 |
45 | // init application
46 | app = (ManetManagerApp)getApplication();
47 |
48 | setContentView(R.layout.ignoreviewwrapper);
49 |
50 | btnAdd = (Button) findViewById(R.id.btnAdd);
51 | btnAdd.setOnClickListener(new View.OnClickListener() {
52 | public void onClick(View v) {
53 | openAddDialog();
54 | }
55 | });
56 |
57 | btnDone = (Button) findViewById(R.id.btnDone);
58 | btnDone.setOnClickListener(new View.OnClickListener() {
59 | public void onClick(View v) {
60 | finish();
61 | }
62 | });
63 |
64 | prefs = this.getPreferenceManager().getSharedPreferences();
65 |
66 | try {
67 | JSONArray array = new JSONArray(prefs.getString("ignorepref", "[]"));
68 | for (int i = 0 ; i < array.length(); i++){
69 | ignoreList.add(array.get(i).toString());
70 | }
71 | } catch (JSONException e) {
72 | e.printStackTrace();
73 | }
74 |
75 | updateView();
76 | }
77 |
78 | private void updateView() {
79 | // update view
80 | String[] values = new String[ignoreList.size()];
81 | ignoreList.toArray(values);
82 |
83 | ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, values);
84 | setListAdapter(adapter);
85 | }
86 |
87 | private void updateConfig() {
88 | // update preferences
89 | JSONArray array = new JSONArray(ignoreList);
90 | prefs.edit().putString("ignorepref", array.toString()).commit();
91 | }
92 |
93 | @Override
94 | public void onStart() {
95 | super.onStart();
96 | }
97 |
98 | @Override
99 | public void onResume() {
100 | super.onResume();
101 | }
102 |
103 | @Override
104 | public void onStop() {
105 | super.onStop();
106 | }
107 |
108 | public static void open(Activity parentActivity) {
109 | Intent it = new Intent("android.intent.action.EDIT_IGNORE_LIST_ACTION");
110 | parentActivity.startActivity(it);
111 | }
112 |
113 | @Override
114 | protected void onListItemClick(ListView lv, View v, int position, long id) {
115 | openDeleteDialog(position);
116 | }
117 |
118 | private void openDeleteDialog(final int position) {
119 | new AlertDialog.Builder(this)
120 | .setTitle("Delete entry?")
121 | .setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
122 | public void onClick(DialogInterface dialog, int whichButton) {
123 | ignoreList.remove(position);
124 | updateView();
125 | updateConfig();
126 | dialog.cancel();
127 | }
128 | })
129 | .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
130 | public void onClick(DialogInterface dialog, int whichButton) {
131 | dialog.cancel();
132 | }
133 | })
134 | .show();
135 | }
136 |
137 | private void openAddDialog() {
138 |
139 | final EditText etAddress = new EditText(this.getBaseContext());
140 | etAddress.setInputType(InputType.TYPE_CLASS_PHONE);
141 | etAddress.setText(app.manetcfg.getIpNetwork());
142 | app.focusAndshowKeyboard(etAddress);
143 |
144 | new AlertDialog.Builder(this)
145 | .setTitle("Add entry")
146 | .setView(etAddress)
147 | .setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
148 | public void onClick(DialogInterface dialog, int whichButton) {
149 | String addr = etAddress.getText().toString();
150 | if (Validation.isValidIpAddress(addr)) {
151 | if (!ignoreList.contains(addr)) {
152 | ignoreList.add(addr);
153 | updateView();
154 | updateConfig();
155 | }
156 | }
157 | dialog.cancel();
158 | }
159 | })
160 | .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
161 | public void onClick(DialogInterface dialog, int whichButton) {
162 | dialog.cancel();
163 | }
164 | })
165 | .show();
166 | }
167 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/manager/MessageService.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.manager;
6 |
7 | import java.net.DatagramPacket;
8 | import java.net.DatagramSocket;
9 |
10 | import org.span.R;
11 |
12 | import android.app.Notification;
13 | import android.app.NotificationManager;
14 | import android.app.PendingIntent;
15 | import android.app.Service;
16 | import android.content.Intent;
17 | import android.os.Bundle;
18 | import android.os.IBinder;
19 |
20 | public class MessageService extends Service {
21 |
22 | public static final int MESSAGE_PORT = 9000;
23 | public static final int MAX_MESSAGE_LENGTH = 256; // 10;
24 |
25 | public static final String MESSAGE_FROM_KEY = "message_from";
26 | public static final String MESSAGE_CONTENT_KEY = "message_content";
27 |
28 | private NotificationManager notifier = null;
29 |
30 | private Notification notification = null;
31 |
32 | private PendingIntent pendingIntent = null;
33 |
34 | // one thread for all activities
35 | private static Thread msgListenerThread = null;
36 |
37 | private int notificationId = 0;
38 |
39 | @Override
40 | public void onCreate() {
41 | // do nothing until prompted by startup activity
42 | }
43 |
44 | @Override
45 | public int onStartCommand(Intent intent, int flags, int startId) {
46 |
47 | if (msgListenerThread == null) {
48 | msgListenerThread = new MessageListenerThread();
49 | msgListenerThread.start();
50 | }
51 |
52 | return START_STICKY; // run until explicitly stopped
53 | }
54 |
55 | @Override
56 | public void onDestroy() {
57 | // TODO Auto-generated method stub
58 | }
59 |
60 | @Override
61 | public IBinder onBind(Intent intent) {
62 | // TODO Auto-generated method stub
63 | return null;
64 | }
65 |
66 | /**
67 | * Show a notification while this service is running.
68 | */
69 | private void showNotification(String tickerStr, Bundle extras) {
70 |
71 | if (notifier == null) {
72 | // get reference to notifier
73 | notifier = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
74 | }
75 |
76 | // unique notification id
77 | notificationId++;
78 |
79 | // set the icon, ticker text, and timestamp
80 | notification =
81 | new Notification(R.drawable.exclamation, tickerStr, System.currentTimeMillis());
82 |
83 | Intent intent = new Intent(this, ViewMessageActivity.class);
84 | if (extras != null) {
85 | intent.putExtras(extras);
86 | }
87 |
88 | // NOTE: Use a unique notification id to ensure a new pending intent is created.
89 |
90 | // pending intent to launch main activity if the user selects notification
91 | pendingIntent =
92 | PendingIntent.getActivity(this, notificationId, intent, 0);
93 |
94 | // cancel the notification after it is checked by the user
95 | notification.flags |= Notification.FLAG_AUTO_CANCEL;
96 |
97 | // vibrate
98 | // notification.defaults |= Notification.DEFAULT_VIBRATE; // DEBUG
99 |
100 | // set the info for the views that show in the notification panel
101 | notification.setLatestEventInfo(this, "Wireless AdHoc", tickerStr, pendingIntent);
102 |
103 | // NOTE: Use a unique notification id, otherwise an existing notification with the same id will be replaced.
104 |
105 | // send the notification
106 | notifier.notify(notificationId, notification);
107 | }
108 |
109 | private class MessageListenerThread extends Thread {
110 |
111 | public void run() {
112 |
113 | try {
114 | // bind to local machine; will receive broadcasts and directed messages
115 | // will most likely bind to 127.0.0.1 (localhost)
116 | DatagramSocket socket = new DatagramSocket(MESSAGE_PORT);
117 |
118 | byte[] buff = new byte[MAX_MESSAGE_LENGTH];
119 | DatagramPacket packet = new DatagramPacket(buff, buff.length);
120 |
121 | while (true) {
122 | try {
123 | // address Android issue where old packet lengths are erroneously
124 | // carried over between packet reuse
125 | packet.setLength(buff.length);
126 |
127 | socket.receive(packet); // blocking
128 |
129 | String msg = new String(packet.getData(), 0, packet.getLength());
130 | String from = msg.substring(0, msg.indexOf("\n"));
131 | String content = msg.substring(msg.indexOf("\n")+1);
132 |
133 | String tickerStr = "New message";
134 |
135 | Bundle extras = new Bundle();
136 | extras.putString(MESSAGE_FROM_KEY, from);
137 | extras.putString(MESSAGE_CONTENT_KEY, content);
138 |
139 | showNotification(tickerStr, extras);
140 | } catch (Exception e) {
141 | e.printStackTrace();
142 | }
143 | }
144 | } catch (Exception e) {
145 | e.printStackTrace();
146 | }
147 | }
148 | }
149 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/manager/ViewLogActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.manager;
6 |
7 | import java.sql.Timestamp;
8 | import java.util.Calendar;
9 |
10 | import org.span.R;
11 |
12 | import android.app.Activity;
13 | import android.content.Intent;
14 | import android.os.Bundle;
15 | import android.os.Handler;
16 | import android.view.View;
17 | import android.view.WindowManager;
18 | import android.widget.Button;
19 | import android.widget.CheckBox;
20 | import android.widget.ScrollView;
21 | import android.widget.TextView;
22 |
23 | public class ViewLogActivity extends Activity {
24 |
25 | private ManetManagerApp app = null;
26 |
27 | private ViewLogActivityHelper helper = null;
28 |
29 | private Handler handler = new Handler();
30 |
31 | private TextView tvMessage = null;
32 | private Button btnClear = null;
33 | private CheckBox cbMessageScrollLock = null;
34 | private ScrollView svMessage = null;
35 |
36 | /** Called when the activity is first created. */
37 | @Override
38 | public void onCreate(Bundle bundle) {
39 | super.onCreate(bundle);
40 |
41 | // requestWindowFeature(Window.FEATURE_NO_TITLE);
42 | // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
43 | // WindowManager.LayoutParams.FLAG_FULLSCREEN);
44 |
45 | setContentView(R.layout.logview);
46 |
47 | app = (ManetManagerApp)getApplication();
48 | helper = ViewLogActivityHelper.getInstance(this);
49 |
50 | tvMessage = (TextView) findViewById(R.id.tvMessage);
51 | svMessage = (ScrollView) findViewById(R.id.svMessage);
52 |
53 | // clear button
54 | btnClear = (Button)findViewById(R.id.btnClear);
55 | btnClear.setOnClickListener(new View.OnClickListener() {
56 | public void onClick(View v) {
57 | synchronized (helper.buff) {
58 | helper.buff.clear();
59 | }
60 | setMessage("Nothing logged ...");
61 | }
62 | });
63 |
64 | // scroll lock
65 | cbMessageScrollLock = (CheckBox)findViewById(R.id.cbMessageScrollLock);
66 | cbMessageScrollLock.setChecked(helper.messageScrollLock);
67 | cbMessageScrollLock.setOnClickListener(new View.OnClickListener() {
68 | public void onClick(View v) {
69 | helper.messageScrollLock = !helper.messageScrollLock;
70 | }
71 | });
72 | }
73 |
74 | @Override
75 | public void onStart() {
76 | super.onStart();
77 |
78 | // scroll to previous position
79 | svMessage.post(new Runnable() {
80 | @Override
81 | public void run() {
82 | String content = null;
83 |
84 | synchronized (helper.buff) {
85 | if (helper.buff.isEmpty()) {
86 | content = "Nothing logged ...";
87 | } else {
88 | content = helper.buff.toString();
89 | }
90 | }
91 |
92 | setMessage(content);
93 | }
94 | });
95 | }
96 |
97 | @Override
98 | public void onResume() {
99 | super.onResume();
100 | }
101 |
102 | @Override
103 | public void onStop() {
104 | super.onStop();
105 | }
106 |
107 | @Override
108 | public void onDestroy() {
109 | super.onDestroy();
110 | }
111 |
112 | public static void open(Activity parentActivity) {
113 | Intent it = new Intent("android.intent.action.VIEW_LOG_ACTION");
114 | parentActivity.startActivity(it);
115 | }
116 |
117 | private class ScrollRunnable implements Runnable {
118 | @Override
119 | public void run() {
120 | if (helper.messageScrollLock) {
121 | // svMessage.setSmoothScrollingEnabled(true);
122 | // svMessage.smoothScrollTo(0, tvMessage.getBottom());
123 | svMessage.fullScroll(ScrollView.FOCUS_DOWN);
124 | // svMessage.invalidate(); // redraw when main thread idle
125 | }
126 | }
127 | };
128 |
129 | private class AppendMessageRunnable implements Runnable {
130 | private String msg = null;
131 |
132 | public AppendMessageRunnable(String msg) {
133 | Timestamp timestamp = new Timestamp(Calendar.getInstance().getTimeInMillis());
134 | this.msg = "+ [" + timestamp + "]\n" + msg;
135 | }
136 |
137 | @Override
138 | public void run() {
139 | synchronized (helper.buff) {
140 | if (helper.buff.isEmpty()) {
141 | tvMessage.setText(msg); // wipe initial string
142 | helper.buff.append(msg);
143 | } else {
144 | tvMessage.append("\n\n" + msg);
145 | helper.buff.append("\n\n" + msg);
146 | }
147 | }
148 |
149 | // NOTE: must execute a separate post to scroll, or else
150 | // the text view won't scroll all the way to the bottom
151 | handler.post(new ScrollRunnable());
152 | }
153 | };
154 |
155 | private class SetMessageRunnable implements Runnable {
156 | private String msg = null;
157 |
158 | public SetMessageRunnable(String msg) {
159 | this.msg = msg;
160 | }
161 |
162 | @Override
163 | public void run() {
164 | tvMessage.setText(msg);
165 |
166 | // NOTE: must execute a separate post to scroll, or else
167 | // the text view won't scroll all the way to the bottom
168 | handler.post(new ScrollRunnable());
169 | }
170 | };
171 |
172 |
173 | public void appendMessage(final String msg) {
174 | handler.post(new AppendMessageRunnable(msg));
175 | }
176 |
177 | public void setMessage(final String msg) {
178 | handler.post(new SetMessageRunnable(msg));
179 | }
180 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/manager/ViewLogActivityHelper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.manager;
6 |
7 | import org.span.service.CircularStringBuffer;
8 | import org.span.service.LogObserver;
9 |
10 | // helper class to help maintain state between activity instances
11 | public class ViewLogActivityHelper implements LogObserver {
12 |
13 | private ViewLogActivity activity = null;
14 |
15 | public boolean messageScrollLock = true;
16 | public CircularStringBuffer buff = new CircularStringBuffer();
17 |
18 | // singleton
19 | private static ViewLogActivityHelper instance = null;
20 |
21 | private ViewLogActivityHelper() {}
22 |
23 | public static void setApplication(ManetManagerApp app) {
24 | if (instance == null) {
25 | instance = new ViewLogActivityHelper();
26 | }
27 | app.manet.registerLogger(instance);
28 | }
29 |
30 | public static ViewLogActivityHelper getInstance(ViewLogActivity activity) {
31 | if (instance == null) {
32 | instance = new ViewLogActivityHelper();
33 | }
34 |
35 | // can only be associated with one activity at a time
36 | instance.activity = activity;
37 |
38 | return instance;
39 | }
40 |
41 | // callback method
42 | @Override
43 | public void onLogUpdated(String content) {
44 | if (activity != null) {
45 | activity.appendMessage(content);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/manager/ViewMessageActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.manager;
6 |
7 | import org.span.R;
8 |
9 | import android.app.Activity;
10 | import android.content.Intent;
11 | import android.os.Bundle;
12 | import android.os.Handler;
13 | import android.view.View;
14 | import android.widget.Button;
15 | import android.widget.TextView;
16 |
17 | public class ViewMessageActivity extends Activity {
18 |
19 | private Handler handler = new Handler();
20 |
21 | private TextView tvFrom = null;
22 | private TextView tvMessage = null;
23 | private Button btnDone = null;
24 |
25 | /** Called when the activity is first created. */
26 | @Override
27 | public void onCreate(Bundle bundle) {
28 | super.onCreate(bundle);
29 | setContentView(R.layout.messageview);
30 |
31 | tvFrom = (TextView) findViewById(R.id.etFrom);
32 | tvMessage = (TextView) findViewById(R.id.etMessage);
33 |
34 | // populate fields
35 | Bundle extras = getIntent().getExtras();
36 | String from = extras.getString(MessageService.MESSAGE_FROM_KEY);
37 | String content = extras.getString(MessageService.MESSAGE_CONTENT_KEY);
38 |
39 | tvFrom.setText(from);
40 | tvMessage.setText(content);
41 |
42 | btnDone = (Button) findViewById(R.id.btnDone);
43 | btnDone.setOnClickListener(new View.OnClickListener() {
44 | public void onClick(View v) {
45 | finish();
46 | }
47 | });
48 | }
49 |
50 |
51 | @Override
52 | public void onStart() {
53 | super.onStart();
54 | }
55 |
56 | @Override
57 | public void onResume() {
58 | super.onResume();
59 | }
60 |
61 | @Override
62 | public void onStop() {
63 | super.onStop();
64 | }
65 |
66 | public static void open(Activity parentActivity) {
67 | Intent it = new Intent("android.intent.action.VIEW_MESSAGE_ACTION");
68 | parentActivity.startActivity(it);
69 | }
70 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/manager/ViewRoutingInfoActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.manager;
6 |
7 | import java.util.HashSet;
8 | import java.util.TreeSet;
9 |
10 | import org.span.R;
11 | import org.span.service.ManetObserver;
12 | import org.span.service.core.ManetService.AdhocStateEnum;
13 | import org.span.service.routing.Node;
14 | import org.span.service.system.ManetConfig;
15 |
16 | import android.app.Activity;
17 | import android.content.Intent;
18 | import android.os.Bundle;
19 | import android.os.Handler;
20 | import android.util.Log;
21 | import android.view.View;
22 | import android.view.View.OnClickListener;
23 | import android.widget.Button;
24 | import android.widget.TextView;
25 |
26 | public class ViewRoutingInfoActivity extends Activity implements ManetObserver {
27 |
28 | public static final String TAG = "ViewRoutingInfoActivity";
29 |
30 | private static final int UPDATE_WAIT_TIME_MILLISEC = 1000;
31 |
32 | private ManetManagerApp app = null;
33 |
34 | private Handler handler = new Handler();
35 |
36 | private TextView tvInfo = null;
37 | private Button btnGetInfo = null;
38 |
39 | private UpdateThread updateThread = null;
40 |
41 | /** Called when the activity is first created. */
42 | @Override
43 | public void onCreate(Bundle bundle) {
44 | super.onCreate(bundle);
45 |
46 | setContentView(R.layout.routinginfoview);
47 |
48 | app = (ManetManagerApp)getApplication();
49 | app.manet.registerObserver(this);
50 |
51 | tvInfo = (TextView) findViewById(R.id.tvInfo);
52 |
53 | btnGetInfo = (Button) findViewById(R.id.btnGetInfo);
54 | btnGetInfo.setOnClickListener(new OnClickListener() {
55 | public void onClick(View v) {
56 | app.manet.sendRoutingInfoQuery();
57 | }
58 | });
59 |
60 | // hide button since we're auto-updating
61 | // TODO: give user choice between auto-updating and manual (button press) updating
62 | btnGetInfo.setVisibility(View.GONE);
63 | }
64 |
65 | @Override
66 | public void onStart() {
67 | super.onStart();
68 |
69 | updateThread = new UpdateThread();
70 | updateThread.start();
71 | }
72 |
73 | @Override
74 | public void onResume() {
75 | super.onResume();
76 | }
77 |
78 | @Override
79 | public void onStop() {
80 | super.onStop();
81 |
82 | try {
83 | if (updateThread != null) {
84 | updateThread.terminate();
85 | updateThread.join();
86 | }
87 | } catch (Exception e) {
88 | e.printStackTrace();
89 | }
90 | }
91 |
92 | @Override
93 | public void onDestroy() {
94 | super.onDestroy();
95 | app.manet.unregisterObserver(this);
96 | }
97 |
98 | public static void open(Activity parentActivity) {
99 | Intent it = new Intent("android.intent.action.GET_ROUTING_INFO_ACTION");
100 | parentActivity.startActivity(it);
101 | }
102 |
103 | public void update(final String info) {
104 | handler.post(new Runnable() {
105 | @Override
106 | public void run() {
107 | tvInfo.setText(info);
108 | // app.displayToastMessage("Info Updated");
109 | }
110 | });
111 | }
112 |
113 | private class UpdateThread extends Thread {
114 |
115 | private boolean alive = true;
116 |
117 | @Override
118 | public void run() {
119 |
120 | try {
121 | while (alive) {
122 | app.manet.sendRoutingInfoQuery();
123 | Thread.sleep(UPDATE_WAIT_TIME_MILLISEC);
124 | }
125 | } catch (Exception e) {
126 | if (alive) {
127 | e.printStackTrace();
128 | }
129 | }
130 | }
131 |
132 | public void terminate() {
133 | alive = false;
134 | interrupt(); // interrupt if sleeping
135 | }
136 | }
137 |
138 | // callback methods
139 |
140 | @Override
141 | public void onAdhocStateUpdated(AdhocStateEnum arg0, String arg1) {
142 | // TODO Auto-generated method stub
143 |
144 | }
145 |
146 | @Override
147 | public void onConfigUpdated(ManetConfig arg0) {
148 | // TODO Auto-generated method stub
149 |
150 | }
151 |
152 | @Override
153 | public void onError(String arg0) {
154 | // TODO Auto-generated method stub
155 | }
156 |
157 | @Override
158 | public void onPeersUpdated(HashSet arg0) {
159 | // TODO Auto-generated method stub
160 | }
161 |
162 | @Override
163 | public void onRoutingInfoUpdated(String info) {
164 | Log.d(TAG, "onRoutingInfoUpdated()"); // DEBUG
165 | update(info);
166 | }
167 |
168 | @Override
169 | public void onServiceConnected() {
170 | // TODO Auto-generated method stub
171 | }
172 |
173 | @Override
174 | public void onServiceDisconnected() {
175 | // TODO Auto-generated method stub
176 | }
177 |
178 | @Override
179 | public void onServiceStarted() {
180 | // TODO Auto-generated method stub
181 | }
182 |
183 | @Override
184 | public void onServiceStopped() {
185 | // TODO Auto-generated method stub
186 | }
187 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/CircularStringBuffer.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service;
6 |
7 | import java.lang.StringBuffer;
8 |
9 | // BASED ON: http://stackoverflow.com/questions/7461448/fixed-length-stringbuffer-in-java
10 | public class CircularStringBuffer {
11 |
12 | private static final int MAX_LENGTH = 10000;
13 |
14 | // NOTE: StringBuffer is a final class and cannot be extended
15 | private StringBuffer buffer = new StringBuffer();
16 |
17 | @Override
18 | public String toString() {
19 | return buffer.toString();
20 | }
21 |
22 | public int length() {
23 | return buffer.length();
24 | }
25 |
26 | public boolean isEmpty() {
27 | return buffer.length() == 0;
28 | }
29 |
30 | public CircularStringBuffer append(String s) {
31 | if (buffer.length() + s.length() > MAX_LENGTH) {
32 | buffer.delete(0, buffer.length() + s.length() - MAX_LENGTH);
33 | }
34 | buffer.append(s, Math.max(0, s.length() - MAX_LENGTH), s.length());
35 | return this;
36 | }
37 |
38 | public void clear() {
39 | buffer.delete(0, buffer.length());
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/LogObserver.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service;
6 |
7 | public interface LogObserver {
8 |
9 | // callback methods
10 |
11 | public void onLogUpdated(String content);
12 | }
13 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/ManetObserver.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service;
6 |
7 | import java.util.HashSet;
8 |
9 | import org.span.service.core.ManetService.AdhocStateEnum;
10 | import org.span.service.routing.Node;
11 | import org.span.service.system.ManetConfig;
12 |
13 |
14 |
15 | public interface ManetObserver {
16 |
17 | // callback methods
18 |
19 | public void onServiceConnected();
20 |
21 | public void onServiceDisconnected();
22 |
23 | public void onServiceStarted();
24 |
25 | public void onServiceStopped();
26 |
27 | public void onAdhocStateUpdated(AdhocStateEnum state, String info);
28 |
29 | public void onConfigUpdated(ManetConfig manetcfg);
30 |
31 | public void onPeersUpdated(HashSet peers);
32 |
33 | public void onRoutingInfoUpdated(String info);
34 |
35 | public void onError(String error);
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/ManetParser.java:
--------------------------------------------------------------------------------
1 | package org.span.service;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class ManetParser {
6 |
7 | public static ArrayList parseOLSR(String data){
8 | if (data==null){
9 | System.err.println("Data String is null!");
10 | return null;
11 | }
12 | ArrayList edges = new ArrayList();
13 | String lines[] = data.split("\\r?\\n");
14 | int index=-1;
15 |
16 | for (int i=0; i 16) {
23 | int wsIndex = lines[index].indexOf(' ');
24 | int dsIndex = lines[index].indexOf(' ', wsIndex+6);
25 | String dst = lines[index].substring(0, wsIndex);
26 | String src = lines[index].substring(wsIndex+5, dsIndex);
27 | edges.add(src +">" + dst);
28 | index++;
29 | }
30 | return edges;
31 | }
32 |
33 | public static ArrayList parseRoutingInfo(String data){
34 | if (data==null){
35 | System.err.println("Data String is null!");
36 | return null;
37 | }
38 | ArrayList edges = new ArrayList();
39 | String lines[] = data.split("\\r?\\n");
40 | int index=-1;
41 |
42 | for (int i=0; i" + dst);
56 | index++;
57 | }
58 | return edges;
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/core/ManetBootBroadcastReceiver.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.core;
6 |
7 | import android.content.BroadcastReceiver;
8 | import android.content.Context;
9 | import android.content.Intent;
10 | import android.util.Log;
11 |
12 | public class ManetBootBroadcastReceiver extends BroadcastReceiver {
13 |
14 | public static final String TAG = "ManetBootBroadcastReceiver";
15 |
16 | @Override
17 | public void onReceive(Context context, Intent intent) {
18 | /*
19 | * NOTE: In general, a service is usually started manually by a "parent" application
20 | * or activity by calling startService(). Although the service's lifetime is not
21 | * necessarily bound to that of its "parent", its performance can be affected by that
22 | * of its parent and vice-versa.
23 | *
24 | * To avoid potential issues, we start this service at boot time by listening for
25 | * the right intent.
26 | */
27 | if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
28 | Log.i(TAG, "Starting service");
29 | context.startService(new Intent(context, ManetService.class));
30 | } else {
31 | Log.e(TAG, "Received unexpected intent " + intent.toString());
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/core/ManetCustomBroadcastReceiver.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.core;
6 |
7 | import android.content.BroadcastReceiver;
8 | import android.content.Context;
9 | import android.content.Intent;
10 | import android.util.Log;
11 |
12 | public class ManetCustomBroadcastReceiver extends BroadcastReceiver {
13 |
14 | public static final String TAG = "ManetCustomBroadcastReceiver";
15 |
16 | // custom intent
17 | public static final String START_SERVICE_INTENT = "org.span.service.intent.action.START_SERVICE_ACTION";
18 |
19 | @Override
20 | public void onReceive(Context context, Intent intent) {
21 | /*
22 | * NOTE: Allow the service to be started by applications with the proper
23 | * permissions.
24 | */
25 | if (START_SERVICE_INTENT.equals(intent.getAction())) {
26 | Log.i(TAG, "Starting service");
27 | context.startService(new Intent(context, ManetService.class));
28 | } else {
29 | Log.e(TAG, "Received unexpected intent " + intent.toString());
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/legal/EulaHelper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.legal;
6 |
7 | import android.app.AlertDialog;
8 | import android.content.Context;
9 | import android.content.DialogInterface;
10 | import android.content.SharedPreferences;
11 | import android.preference.PreferenceManager;
12 |
13 | public class EulaHelper {
14 |
15 | private static final String EULA_TEXT =
16 | "MITRE IS PROVIDING THE SOFTWARE \"AS IS\" AND MAKES NO WARRANTY, " +
17 | "EXPRESS OR IMPLIED, AS TO THE ACCURACY, CAPABILITY, EFFICIENCY, " +
18 | "MERCHANTABILITY, OR FUNCTIONING OF THE SOFTWARE. IN NO EVENT " +
19 | "WILL MITRE BE LIABLE FOR ANY GENERAL, CONSEQUENTIAL, INDIRECT, " +
20 | "INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES, RELATED TO THE " +
21 | "SOFTWARE OR ANY DERIVATIVE OF THE SOFTWARE.";
22 |
23 | public static final String EULA_ACCEPTED = "eula_accepted";
24 |
25 | private Context context = null;
26 | private EulaObserver observer = null;
27 | private SharedPreferences settings = null;
28 |
29 | public EulaHelper(Context context, EulaObserver observer) {
30 | this.context = context;
31 | this.observer = observer;
32 | settings = PreferenceManager.getDefaultSharedPreferences(context);
33 | }
34 |
35 | private boolean isAccepted() {
36 | return settings.getBoolean(EULA_ACCEPTED, false);
37 | }
38 |
39 | public void showDialog() {
40 | showDialog(false);
41 | }
42 |
43 | public void showDialog(boolean force) {
44 | if (!force && isAccepted()) {
45 | observer.onEulaAccepted();
46 | return;
47 | }
48 |
49 | AlertDialog.Builder builder = new AlertDialog.Builder(context);
50 | builder.setMessage(EULA_TEXT)
51 | .setCancelable(false)
52 | .setPositiveButton("Agree", new DialogInterface.OnClickListener() {
53 | public void onClick(DialogInterface dialog, int id) {
54 | SharedPreferences.Editor editor = settings.edit();
55 | editor.putBoolean(EULA_ACCEPTED, true);
56 | editor.commit();
57 | observer.onEulaAccepted();
58 | }
59 | })
60 | .setNegativeButton("Disagree", new DialogInterface.OnClickListener() {
61 | public void onClick(DialogInterface dialog, int id) {
62 | System.exit(0);
63 | }
64 | });
65 | AlertDialog alert = builder.create();
66 | alert.show();
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/legal/EulaObserver.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.legal;
6 |
7 | public interface EulaObserver {
8 |
9 | // callback methods
10 |
11 | public void onEulaAccepted();
12 |
13 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/routing/Dijkstra.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.routing;
6 |
7 | import java.sql.Timestamp;
8 | import java.util.ArrayList;
9 | import java.util.Collections;
10 | import java.util.HashMap;
11 | import java.util.HashSet;
12 | import java.util.List;
13 | import java.util.Map;
14 | import java.util.Set;
15 |
16 | public class Dijkstra {
17 |
18 | public static final String MSG_TAG = "ADHOC -> Dijkstra";
19 |
20 | public static Route findShortestRoute(Node startNode, Node endNode, Map nodes) {
21 |
22 | // System.out.println("Dijkstra.findShortestRoute() nodes: " + nodes); // DEBUG
23 |
24 | // node queue
25 | Set queue = new HashSet();
26 | queue.addAll(nodes.keySet());
27 |
28 | // initialize
29 | Map dist = new HashMap(); // total distance (cost) from start node to another node
30 | Map prev = new HashMap(); // previous node (hop) routing backwards to start node
31 | Map expire = new HashMap();
32 |
33 | for (String addr : queue) {
34 | dist.put(addr, Integer.MAX_VALUE);
35 | }
36 |
37 | dist.put(startNode.addr, 0);
38 |
39 | while (!queue.isEmpty()) {
40 |
41 | String nearestNeighborAddr = findNearestNeighbor(queue, dist);
42 | if (nearestNeighborAddr == null) {
43 | return null;
44 | }
45 |
46 | if (endNode.addr.equals(nearestNeighborAddr)) {
47 | return createRoute(startNode, endNode, prev, expire);
48 | }
49 |
50 | queue.remove(nearestNeighborAddr);
51 | // System.out.println("Dijkstra.findShortestRoute() nearestNeighborAddr: " + nearestNeighborAddr); // DEBUG
52 | // System.out.println("Dijkstra.findShortestRoute() edges: " + nodes.get(nearestNeighborAddr).edges); // DEBUG
53 |
54 | // relax
55 | for (Edge edge : nodes.get(nearestNeighborAddr).edges) {
56 | // System.out.println("Dijkstra.findShortestRoute() edge: " + edge); // DEBUG
57 |
58 | // we may not know enough about the node yet
59 | if (!nodes.containsKey(edge.toAddr)) {
60 | continue;
61 | }
62 |
63 | int alt = dist.get(nearestNeighborAddr) + edge.cost;
64 | if (alt < dist.get(edge.toAddr)) { // TODO: problem
65 | dist.put(edge.toAddr, alt);
66 | prev.put(edge.toAddr, nearestNeighborAddr);
67 | expire.put(edge.toAddr, edge.expireTimestamp);
68 | }
69 | }
70 | }
71 |
72 | return null;
73 | }
74 |
75 | private static String findNearestNeighbor(Set nodes, Map dist) {
76 | int shortestCost = Integer.MAX_VALUE; // positive infinity
77 | String nearestNeighborAddr = null;
78 |
79 | for (String addr : dist.keySet()) {
80 | if (!nodes.contains(addr)) {
81 | continue;
82 | }
83 | if (dist.get(addr) < shortestCost) {
84 | shortestCost = dist.get(addr);
85 | nearestNeighborAddr = addr;
86 | }
87 | }
88 |
89 | return nearestNeighborAddr;
90 | }
91 |
92 | // don't include the starting node in the route
93 | private static Route createRoute(Node startNode, Node endNode,
94 | Map prev, Map expire) {
95 |
96 | List hops = new ArrayList();
97 |
98 | Timestamp expireTimestamp = null;
99 | Timestamp edgeTimestamp = null;
100 | String addr = endNode.addr;
101 |
102 | while (!addr.equals(startNode.addr)) {
103 | hops.add(addr);
104 | edgeTimestamp = expire.get(addr);
105 | addr = prev.get(addr);
106 |
107 | if (edgeTimestamp != null) {
108 | if (expireTimestamp == null ||
109 | expireTimestamp.after(edgeTimestamp)) {
110 | expireTimestamp = edgeTimestamp;
111 | }
112 | }
113 | }
114 |
115 | // forward order
116 | Collections.reverse(hops);
117 |
118 | // create route
119 | Route route = new Route(hops, expireTimestamp);
120 |
121 | return route;
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/routing/Edge.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.routing;
6 |
7 | import java.io.Serializable;
8 | import java.sql.Timestamp;
9 |
10 | public class Edge implements Serializable, Comparable {
11 |
12 | private static final long serialVersionUID = 2859504103725492935L;
13 |
14 | public String toAddr = null;
15 | public Timestamp expireTimestamp = null;
16 | public int cost = Integer.MAX_VALUE; // infinity
17 |
18 | public Edge(String toAddr, int cost, Timestamp expireTimestamp) {
19 | this.toAddr = toAddr;
20 | this.cost = cost;
21 | this.expireTimestamp = expireTimestamp;
22 | }
23 |
24 | @Override
25 | public int compareTo(Edge other) {
26 | return toAddr.compareTo(other.toAddr);
27 | }
28 |
29 | @Override
30 | public boolean equals(Object obj) {
31 | if (obj instanceof Edge) {
32 | Edge other = (Edge)obj;
33 | return compareTo(other) == 0;
34 | }
35 | return false;
36 | }
37 |
38 | @Override
39 | public int hashCode() {
40 | return toAddr.hashCode();
41 | }
42 |
43 | @Override
44 | public String toString() {
45 | return toAddr;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/routing/HelloMessage.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.routing;
6 |
7 | import java.io.Serializable;
8 |
9 | public class HelloMessage implements Serializable {
10 |
11 | private static final long serialVersionUID = 862304425447243742L;
12 |
13 | public Node node = null;
14 | public int numHops = -1;
15 |
16 | public HelloMessage(Node node) {
17 | this.node = node;
18 | this.numHops = 1;
19 | }
20 |
21 | @Override
22 | public int hashCode() {
23 | // don't use number of hops to compare hello messages
24 | // node's expire timestamp will help ensure unique hashes between hello messages for the same node
25 | return node.addr.hashCode() + node.expireTimestamp.hashCode();
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return node.addr;
31 | }
32 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/routing/Node.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.routing;
6 |
7 | import java.io.Serializable;
8 | import java.sql.Timestamp;
9 | import java.util.HashSet;
10 | import java.util.Set;
11 |
12 | public class Node implements Serializable {
13 |
14 | private static final long serialVersionUID = -430256718263829916L;
15 |
16 | // TODO
17 | // gps location
18 | // battery level
19 | // etc.
20 |
21 | public String addr = null;
22 | public Set edges = null;
23 |
24 | public Timestamp expireTimestamp = null;
25 |
26 | public boolean isGateway = false;
27 | public String dnsAddr = null;
28 |
29 | public String userId = null;
30 |
31 | public Node(String addr, String userId) {
32 | this.addr = addr;
33 | this.userId = userId;
34 | edges = new UpdatableHashSet();
35 | }
36 |
37 | public Node(String addr) {
38 | this(addr, null);
39 | }
40 |
41 | @Override
42 | public String toString() {
43 | return addr;
44 | }
45 |
46 | @Override
47 | public boolean equals(Object obj) {
48 | if (obj == null) {
49 | return false;
50 | }
51 | if (obj instanceof Node) {
52 | Node other = (Node)obj;
53 | return addr.equals(other.addr);
54 | } else {
55 | return false;
56 | }
57 | }
58 |
59 | @Override
60 | public int hashCode() {
61 | return addr.hashCode();
62 | }
63 |
64 | // custom set that will update existing elements upon adding them;
65 | // normally sets will do nothing when attempting to add() an element that equals() an existing one
66 | private class UpdatableHashSet extends HashSet {
67 |
68 | private static final long serialVersionUID = 8477606970943344081L;
69 |
70 | @Override
71 | public boolean add(E element) {
72 | super.remove(element);
73 | return super.add(element);
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/routing/Route.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.routing;
6 |
7 | import java.sql.Timestamp;
8 | import java.util.List;
9 |
10 | public class Route {
11 |
12 | public List hops = null;
13 | public Timestamp expireTimestamp = null;
14 |
15 | public Route(List hops, Timestamp expireTimestamp) {
16 | this.hops = hops;
17 | this.expireTimestamp = expireTimestamp;
18 | }
19 |
20 | @Override
21 | public boolean equals(Object obj) {
22 | if (obj == null) {
23 | return false;
24 | }
25 | if (obj instanceof Route) {
26 | Route otherRoute = (Route)obj;
27 | return hops.equals(otherRoute.hops);
28 | } else {
29 | return false;
30 | }
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return hops.toString();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/routing/RoutingProtocol.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.routing;
6 |
7 | import java.util.HashSet;
8 |
9 | import org.span.service.system.ManetConfig;
10 |
11 |
12 |
13 | public abstract class RoutingProtocol {
14 |
15 | protected String error = null;
16 |
17 | public abstract String getName();
18 |
19 | public abstract boolean start(ManetConfig manetcfg);
20 |
21 | public abstract boolean stop();
22 |
23 | public abstract boolean isRunning();
24 |
25 | public abstract HashSet getPeers();
26 |
27 | public abstract String getInfo();
28 |
29 | public abstract String getError();
30 | }
31 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/routing/SimpleReactiveProtocol.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.routing;
6 |
7 | import java.util.HashSet;
8 | import java.util.Set;
9 |
10 | import org.span.service.system.ManetConfig;
11 |
12 |
13 |
14 | public class SimpleReactiveProtocol extends RoutingProtocol {
15 |
16 | public static final String MSG_TAG = "ADHOC -> SimpleReactiveProtocol";
17 |
18 | public static final String NAME = "Simple Reactive Routing";
19 |
20 | private ManetConfig manetcfg = null;
21 |
22 | @Override
23 | public String getName() {
24 | return NAME;
25 | }
26 |
27 | @Override
28 | public boolean start(ManetConfig manetcfg) {
29 | this.manetcfg = manetcfg;
30 | return true;
31 | }
32 |
33 | @Override
34 | public boolean stop() {
35 | return true;
36 | }
37 |
38 | @Override
39 | public boolean isRunning() {
40 | return false;
41 | }
42 |
43 | @Override
44 | public HashSet getPeers() {
45 | return null;
46 | }
47 |
48 | @Override
49 | public String getInfo() {
50 | return null;
51 | }
52 |
53 | @Override
54 | public String getError() {
55 | return this.error;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/system/BluetoothConfig.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | /**
6 | * Portions of this code are copyright (c) 2009 Harald Mueller and Sofia Lemons.
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License as published by the Free Software
10 | * Foundation; either version 3 of the License, or (at your option) any later
11 | * version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program; if not, see .
20 | * Use this application at your own risk.
21 | */
22 | package org.span.service.system;
23 |
24 | import java.util.ArrayList;
25 |
26 | import android.util.Log;
27 |
28 | public class BluetoothConfig {
29 |
30 | public static final String TAG = "BluetoothConfig";
31 |
32 | private static final long serialVersionUID = 1L;
33 |
34 | private String ipGateway = null;
35 |
36 | public void set(String ipGateway) {
37 | this.ipGateway = ipGateway;
38 | }
39 |
40 | public boolean write() {
41 | StringBuffer buffer = new StringBuffer();;
42 | ArrayList inputLines = CoreTask.readLinesFromFile(CoreTask.DATA_FILE_PATH + "/bin/blue-up.sh");
43 | for (String line : inputLines) {
44 | if (line.contains("ifconfig bnep0") && line.endsWith("netmask 255.255.255.0 up >> $adhoclog 2>> $adhoclog")) {
45 | line = CoreTask.reassembleLine(line, " ", "bnep0", ipGateway);
46 | }
47 | buffer.append(line+"\n");
48 | }
49 | if (CoreTask.writeLinesToFile(CoreTask.DATA_FILE_PATH + "/bin/blue-up.sh", buffer.toString()) == false) {
50 | Log.e(TAG, "Unable to update bin/adhoc with new lan-configuration.");
51 | return false;
52 | }
53 | return true;
54 | }
55 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/system/BluetoothService.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | /**
6 | * Portions of this code are copyright (c) 2009 Harald Mueller and Sofia Lemons.
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License as published by the Free Software
10 | * Foundation; either version 3 of the License, or (at your option) any later
11 | * version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program; if not, see .
20 | * Use this application at your own risk.
21 | */
22 | package org.span.service.system;
23 |
24 | import android.app.Application;
25 | import android.os.Build;
26 |
27 | public abstract class BluetoothService {
28 |
29 | public abstract boolean startBluetooth();
30 | public abstract boolean stopBluetooth();
31 | public abstract boolean isBluetoothEnabled();
32 | public abstract void setApplication(Application application);
33 |
34 | private static BluetoothService bluetoothService;
35 |
36 | public static BluetoothService getInstance() {
37 | if (bluetoothService == null) {
38 | String className;
39 |
40 | int sdkVersion = Integer.parseInt(Build.VERSION.SDK);
41 | if (sdkVersion < Build.VERSION_CODES.ECLAIR) {
42 | className = "org.span.service.system.BluetoothService_cupcake";
43 | } else {
44 | className = "org.span.service.system.BluetoothService_eclair";
45 | }
46 |
47 | try {
48 | Class extends BluetoothService> clazz = Class.forName(className).asSubclass(BluetoothService.class);
49 | bluetoothService = clazz.newInstance();
50 | } catch (Exception e) {
51 | throw new IllegalStateException(e);
52 | }
53 | }
54 | return bluetoothService;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/system/BluetoothService_cupcake.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | /**
6 | * Portions of this code are copyright (c) 2009 Harald Mueller and Sofia Lemons.
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License as published by the Free Software
10 | * Foundation; either version 3 of the License, or (at your option) any later
11 | * version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program; if not, see .
20 | * Use this application at your own risk.
21 | */
22 | package org.span.service.system;
23 |
24 | import java.lang.reflect.Method;
25 |
26 | import android.app.Application;
27 |
28 | public class BluetoothService_cupcake extends BluetoothService {
29 |
30 | Application application = null;
31 |
32 | /*
33 | * Bluetooth API is not exposed publicly, so we need to use reflection
34 | * to query and set the configuration.
35 | */
36 | @SuppressWarnings("unchecked")
37 | private Object callBluetoothMethod(String methodName) {
38 | Object manager = this.application.getSystemService("bluetooth");
39 | Class c = manager.getClass();
40 | Object returnValue = null;
41 | if (c == null) {
42 | // Nothing
43 | } else {
44 | try {
45 | Method enable = c.getMethod(methodName);
46 | enable.setAccessible(true);
47 | returnValue = enable.invoke(manager);
48 | } catch (Exception e){
49 | e.printStackTrace();
50 | }
51 | }
52 | return returnValue;
53 | }
54 |
55 | @Override
56 | public boolean isBluetoothEnabled() {
57 | return (Boolean) callBluetoothMethod("isEnabled");
58 | }
59 |
60 | @Override
61 | public boolean startBluetooth() {
62 | boolean connected = false;
63 | callBluetoothMethod("enable");
64 | int checkcounter = 0;
65 | while (connected == false && checkcounter <= 60) {
66 | // Wait up to 60s for bluetooth to come up.
67 | // pand does not behave unless started after BT is enabled.
68 | connected = (Boolean) callBluetoothMethod("isEnabled");
69 | if (connected == false) {
70 | checkcounter++;
71 | try {
72 | Thread.sleep(1000);
73 | } catch (InterruptedException e) {
74 | // Nothing
75 | }
76 | } else {
77 | break;
78 | }
79 | }
80 | return connected;
81 | }
82 |
83 | @Override
84 | public boolean stopBluetooth() {
85 | callBluetoothMethod("disable");
86 | return true;
87 | }
88 |
89 | @Override
90 | public void setApplication(Application application) {
91 | this.application = application;
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/system/BluetoothService_eclair.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | /**
6 | * Portions of this code are copyright (c) 2009 Harald Mueller and Sofia Lemons.
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License as published by the Free Software
10 | * Foundation; either version 3 of the License, or (at your option) any later
11 | * version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program; if not, see .
20 | * Use this application at your own risk.
21 | */
22 | package org.span.service.system;
23 |
24 | import android.app.Application;
25 | import android.bluetooth.BluetoothAdapter;
26 |
27 | public class BluetoothService_eclair extends BluetoothService {
28 |
29 | BluetoothAdapter btAdapter = null;
30 |
31 | public BluetoothService_eclair() {
32 | super();
33 | btAdapter = BluetoothAdapter.getDefaultAdapter();
34 | }
35 |
36 | @Override
37 | public boolean startBluetooth() {
38 | boolean connected = false;
39 | this.btAdapter.enable();
40 | /**
41 | * TODO: Not sure if that loop is needed anymore.
42 | * Looks like that bt is coming-up more reliable with Android 2.0
43 | */
44 | int checkcounter = 0;
45 | while (connected == false && checkcounter <= 60) {
46 | // Wait up to 60s for bluetooth to come up.
47 | // does not behave unless started after BT is enabled.
48 | connected = this.btAdapter.isEnabled();
49 | if (connected == false) {
50 | checkcounter++;
51 | try {
52 | Thread.sleep(1000);
53 | } catch (InterruptedException e) {
54 | // Nothing
55 | }
56 | } else {
57 | break;
58 | }
59 | }
60 | return connected;
61 | }
62 |
63 | @Override
64 | public boolean stopBluetooth() {
65 | return this.btAdapter.disable();
66 | }
67 |
68 | @Override
69 | public boolean isBluetoothEnabled() {
70 | return this.btAdapter.isEnabled();
71 | }
72 |
73 | @Override
74 | public void setApplication(Application application) {
75 | // unneeded - not implemented
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/system/DnsmasqConfig.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | /**
6 | * Portions of this code are copyright (c) 2009 Harald Mueller and Sofia Lemons.
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License as published by the Free Software
10 | * Foundation; either version 3 of the License, or (at your option) any later
11 | * version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program; if not, see .
20 | * Use this application at your own risk.
21 | */
22 | package org.span.service.system;
23 |
24 | import java.util.ArrayList;
25 |
26 | import android.util.Log;
27 |
28 | public class DnsmasqConfig {
29 |
30 | public static final String TAG = "DnsmasqConfig";
31 |
32 | private static final long serialVersionUID = 1L;
33 |
34 | private String ipNetwork = null;
35 |
36 | public void set(String ipNetwork) {
37 | this.ipNetwork = ipNetwork;
38 | }
39 |
40 | public boolean write() {
41 | String[] lanparts = ipNetwork.split("\\.");
42 | String iprange = lanparts[0]+"."+lanparts[1]+"."+lanparts[2]+".100,"+lanparts[0]+"."+lanparts[1]+"."+lanparts[2]+".105,12h";
43 | StringBuffer buffer = new StringBuffer();;
44 | ArrayList inputLines = CoreTask.readLinesFromFile(CoreTask.DATA_FILE_PATH + "/conf/dnsmasq.conf");
45 | for (String line : inputLines) {
46 | if (line.contains("dhcp-range")) {
47 | line = "dhcp-range="+iprange;
48 | }
49 | buffer.append(line+"\n");
50 | }
51 | if (CoreTask.writeLinesToFile(CoreTask.DATA_FILE_PATH + "/conf/dnsmasq.conf", buffer.toString()) == false) {
52 | Log.e(TAG, "Unable to update conf/dnsmasq.conf.");
53 | return false;
54 | }
55 | return true;
56 | }
57 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/system/HostapdConfig.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | /**
6 | * Portions of this code are copyright (c) 2009 Harald Mueller and Sofia Lemons.
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License as published by the Free Software
10 | * Foundation; either version 3 of the License, or (at your option) any later
11 | * version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program; if not, see .
20 | * Use this application at your own risk.
21 | */
22 | package org.span.service.system;
23 |
24 | import java.util.HashMap;
25 |
26 | import android.util.Log;
27 |
28 | public class HostapdConfig extends HashMap {
29 |
30 | public static final String TAG = "HostapdConfig";
31 |
32 | private static final long serialVersionUID = 1L;
33 |
34 | public HashMap read() {
35 | String filename = CoreTask.DATA_FILE_PATH + "/conf/hostapd.conf";
36 | this.clear();
37 | for (String line : CoreTask.readLinesFromFile(filename)) {
38 | if (line.startsWith("#"))
39 | continue;
40 | if (!line.contains("="))
41 | continue;
42 | String[] data = line.split("=");
43 | if (data.length > 1) {
44 | this.put(data[0], data[1]);
45 | }
46 | else {
47 | this.put(data[0], "");
48 | }
49 | }
50 | return this;
51 | }
52 |
53 | public boolean write() {
54 | String lines = new String();
55 | for (String key : this.keySet()) {
56 | lines += key + "=" + this.get(key) + "\n";
57 | }
58 | if (CoreTask.writeLinesToFile(CoreTask.DATA_FILE_PATH + "/conf/hostapd.conf", lines) == false) {
59 | Log.e(TAG, "Unable to update conf/hostapd.conf.");
60 | return false;
61 | }
62 | return true;
63 | }
64 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/system/RoutingIgnoreListConfig.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | package org.span.service.system;
6 |
7 | import java.util.HashMap;
8 | import java.util.List;
9 |
10 | import android.util.Log;
11 |
12 | public class RoutingIgnoreListConfig extends HashMap {
13 |
14 | public static final String TAG = "RoutingIgnoreListsConfig";
15 |
16 | private static final long serialVersionUID = 1L;
17 |
18 | private List routingIgnoreList = null;
19 |
20 | public void set(List routingIgnoreList) {
21 | this.routingIgnoreList = routingIgnoreList;
22 | }
23 |
24 | public boolean write() {
25 | StringBuffer buffer = new StringBuffer();;
26 | for (String addr : routingIgnoreList) {
27 | buffer.append(addr+"\n");
28 | }
29 | if (CoreTask.writeLinesToFile(CoreTask.DATA_FILE_PATH + "/conf/routing_ignore_list.conf", buffer.toString()) == false) {
30 | Log.e(TAG, "Unable to update conf/routing_ignore_list.conf.");
31 | return false;
32 | }
33 | return true;
34 | }
35 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/system/TiWlanConf.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | /**
6 | * Portions of this code are copyright (c) 2009 Harald Mueller and Sofia Lemons.
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License as published by the Free Software
10 | * Foundation; either version 3 of the License, or (at your option) any later
11 | * version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program; if not, see .
20 | * Use this application at your own risk.
21 | */
22 | package org.span.service.system;
23 |
24 | import java.util.ArrayList;
25 | import java.util.Collections;
26 | import java.util.Hashtable;
27 |
28 | public class TiWlanConf {
29 | /*
30 | * Handle operations on the TiWlan.conf file.
31 | */
32 | public Hashtable get() {
33 | Hashtable tiWlanConf = new Hashtable();
34 | ArrayList lines = CoreTask.readLinesFromFile(CoreTask.DATA_FILE_PATH + "/conf/tiwlan.ini");
35 |
36 | for (String line : lines) {
37 | String[] pair = line.split("=");
38 | if (pair[0] != null && pair[1] != null && pair[0].length() > 0 && pair[1].length() > 0) {
39 | tiWlanConf.put(pair[0].trim(), pair[1].trim());
40 | }
41 | }
42 | return tiWlanConf;
43 | }
44 |
45 | public synchronized boolean write(String name, String value) {
46 | Hashtable table = new Hashtable();
47 | table.put(name, value);
48 | return write(table);
49 | }
50 |
51 | public synchronized boolean write(Hashtable values) {
52 | String filename = CoreTask.DATA_FILE_PATH + "/conf/tiwlan.ini";
53 | ArrayList valueNames = Collections.list(values.keys());
54 |
55 | String fileString = "";
56 |
57 | ArrayList inputLines = CoreTask.readLinesFromFile(filename);
58 | for (String line : inputLines) {
59 | for (String name : valueNames) {
60 | if (line.contains(name)){
61 | line = name+" = "+values.get(name);
62 | break;
63 | }
64 | }
65 | line+="\n";
66 | fileString += line;
67 | }
68 | return CoreTask.writeLinesToFile(filename, fileString);
69 | }
70 | }
--------------------------------------------------------------------------------
/AndroidManetManager/src/org/span/service/system/WpaSupplicant.java:
--------------------------------------------------------------------------------
1 | /**
2 | * SPAN - Smart Phone Ad-Hoc Networking project
3 | * Copyright (c) 2012 The MITRE Corporation.
4 | */
5 | /**
6 | * Portions of this code are copyright (c) 2009 Harald Mueller and Sofia Lemons.
7 | *
8 | * This program is free software; you can redistribute it and/or modify it under
9 | * the terms of the GNU General Public License as published by the Free Software
10 | * Foundation; either version 3 of the License, or (at your option) any later
11 | * version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with
19 | * this program; if not, see .
20 | * Use this application at your own risk.
21 | */
22 | package org.span.service.system;
23 |
24 | import java.io.File;
25 | import java.util.ArrayList;
26 | import java.util.Hashtable;
27 |
28 | /*
29 | * A class to handle the wpa supplicant config file.
30 | */
31 | public class WpaSupplicant {
32 |
33 | public boolean exists() {
34 | File file = new File(CoreTask.DATA_FILE_PATH + "/conf/wpa_supplicant.conf");
35 | return (file.exists() && file.canRead());
36 | }
37 |
38 | public boolean remove() {
39 | File file = new File(CoreTask.DATA_FILE_PATH + "/conf/wpa_supplicant.conf");
40 | if (file.exists()) {
41 | return file.delete();
42 | }
43 | return false;
44 | }
45 |
46 | public Hashtable get() {
47 | File inFile = new File(CoreTask.DATA_FILE_PATH + "/conf/wpa_supplicant.conf");
48 | if (inFile.exists() == false) {
49 | return null;
50 | }
51 | Hashtable SuppConf = new Hashtable();
52 | ArrayList lines = CoreTask.readLinesFromFile(CoreTask.DATA_FILE_PATH + "/conf/wpa_supplicant.conf");
53 |
54 | for (String line : lines) {
55 | if (line.contains("=")) {
56 | String[] pair = line.split("=");
57 | if (pair[0] != null && pair[1] != null && pair[0].length() > 0 && pair[1].length() > 0) {
58 | SuppConf.put(pair[0].trim(), pair[1].trim());
59 | }
60 | }
61 | }
62 | return SuppConf;
63 | }
64 |
65 | public synchronized boolean write(Hashtable values) {
66 | String filename = CoreTask.DATA_FILE_PATH + "/conf/wpa_supplicant.conf";
67 | String fileString = "";
68 |
69 | ArrayListinputLines = CoreTask.readLinesFromFile(filename);
70 | for (String line : inputLines) {
71 | if (line.contains("=")) {
72 | String key = line.split("=")[0];
73 | if (values.containsKey(key)) {
74 | line = key+"="+values.get(key);
75 | }
76 | }
77 | line+="\n";
78 | fileString += line;
79 | }
80 | if (CoreTask.writeLinesToFile(filename, fileString)) {
81 | CoreTask.chmod(filename, "0644");
82 | return true;
83 | }
84 | return false;
85 | }
86 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | android-manet-manager
2 | =====================
3 |
4 | SPAN - Android Manet Manager
5 |
6 | Google Play:
7 | https://play.google.com/store/apps/details?id=org.span
8 |
9 | Obtaining Custom Kernels
10 | ========================
11 | For many devices, the kernel must be modified to allow ad-hoc mode before android-manet-manager will work. There are
12 | kernels available for several devices at this repository:
13 |
14 | https://github.com/monk-dot/SPAN/tree/master/kernels
15 |
16 | How to create a JAR to include MANET Manager in your project
17 | ============================================================
18 | - Import android-manet-manager into Eclipse
19 | - Right click on 'AndroidManetManager' in the Package Explorer and click 'Export'
20 | - Select 'JAR file' under 'Java' and click 'Next'
21 | - Uncheck 'libmanet.jar' and 'AndroidManifest.xml' in the right pane, and uncheck the 'bin/', 'libs/', and 'obj/'folders in the left pane
22 | - Set the exported file destination to be the libs/ folder of your project
23 | - Click 'Finish'
24 |
--------------------------------------------------------------------------------