├── .gitignore ├── AUTHORS ├── AndroidClient ├── AUTHORS ├── AUTHORS~ ├── Project │ ├── .gitignore │ ├── .idea │ │ ├── .name │ │ ├── compiler.xml │ │ ├── copyright │ │ │ └── profiles_settings.xml │ │ ├── gradle.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ ├── runConfigurations.xml │ │ └── vcs.xml │ ├── MyApplication2.iml │ ├── Project.iml │ ├── VerusAndroidClient.iml │ ├── app │ │ ├── .gitignore │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── sam33 │ │ │ │ └── myapplication │ │ │ │ └── ApplicationTest.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── sam33 │ │ │ │ └── myapplication │ │ │ │ ├── MainActivity.java │ │ │ │ ├── Support.java │ │ │ │ └── Verus.java │ │ │ └── res │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── menu │ │ │ └── menu_main.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ │ └── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── README └── VerusAndroid.apk ├── ChangeLog ├── INSTALL ├── LICENSE.txt ├── Makefile.am ├── README.md ├── bootstrap.sh ├── configure.ac ├── lib └── alglib │ ├── gpl2.txt │ ├── gpl3.txt │ ├── manual.cpp.html │ ├── src │ ├── alglibinternal.cpp │ ├── alglibinternal.h │ ├── alglibmisc.cpp │ ├── alglibmisc.h │ ├── ap.cpp │ ├── ap.h │ ├── dataanalysis.cpp │ ├── dataanalysis.h │ ├── diffequations.cpp │ ├── diffequations.h │ ├── fasttransforms.cpp │ ├── fasttransforms.h │ ├── integration.cpp │ ├── integration.h │ ├── interpolation.cpp │ ├── interpolation.h │ ├── linalg.cpp │ ├── linalg.h │ ├── optimization.cpp │ ├── optimization.h │ ├── solvers.cpp │ ├── solvers.h │ ├── specialfunctions.cpp │ ├── specialfunctions.h │ ├── statistics.cpp │ ├── statistics.h │ └── stdafx.h │ └── tests │ ├── test_c.cpp │ ├── test_i.cpp │ └── test_x.cpp ├── m4 ├── ax_boost_base.m4 └── ax_boost_system.m4 ├── src ├── Makefile.am ├── verus.hpp ├── verus_client.cpp └── verus_server.cpp └── tools ├── bandwidth.sh └── plot.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.o 3 | .deps 4 | Makefile 5 | Makefile.in 6 | /aclocal.m4 7 | /autom4te.cache 8 | /config.h 9 | /config.h.in 10 | /config.h.in~ 11 | /config.log 12 | /config.status 13 | /configure 14 | /depcomp 15 | /stamp-h1 16 | /build-aux -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Yasir Zaki 2 | Thomas Pötsch 3 | Jay Chen 4 | Lakshmi Subramanian 5 | -------------------------------------------------------------------------------- /AndroidClient/AUTHORS: -------------------------------------------------------------------------------- 1 | Sam33 2 | National Central University, Taiwan 3 | sup3355@gmail.com 4 | 5 | Tako Tsai 6 | National Central University, Taiwan 7 | nfslatako@gmail.com 8 | -------------------------------------------------------------------------------- /AndroidClient/AUTHORS~: -------------------------------------------------------------------------------- 1 | Sam33 2 | National Central University, Taiwan 3 | sup3355@gmail.com 4 | 5 | Tako Tsai 6 | National Central University, Taiwan 7 | nfslatako@gmail.com 8 | -------------------------------------------------------------------------------- /AndroidClient/Project/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /AndroidClient/Project/.idea/.name: -------------------------------------------------------------------------------- 1 | Project -------------------------------------------------------------------------------- /AndroidClient/Project/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /AndroidClient/Project/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /AndroidClient/Project/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /AndroidClient/Project/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /AndroidClient/Project/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AndroidClient/Project/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /AndroidClient/Project/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AndroidClient/Project/MyApplication2.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /AndroidClient/Project/Project.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /AndroidClient/Project/VerusAndroidClient.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /AndroidClient/Project/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /AndroidClient/Project/app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /AndroidClient/Project/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.0" 6 | 7 | defaultConfig { 8 | applicationId "com.example.sam33.myapplication" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:23.0.0' 25 | } 26 | -------------------------------------------------------------------------------- /AndroidClient/Project/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\sam33\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /AndroidClient/Project/app/src/androidTest/java/com/example/sam33/myapplication/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.example.sam33.myapplication; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /AndroidClient/Project/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /AndroidClient/Project/app/src/main/java/com/example/sam33/myapplication/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.sam33.myapplication; 2 | 3 | import android.os.Environment; 4 | import android.os.Handler; 5 | import android.os.HandlerThread; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | import android.util.Log; 9 | import android.view.Menu; 10 | import android.view.MenuItem; 11 | import android.view.View; 12 | import android.widget.Button; 13 | import android.widget.EditText; 14 | import android.widget.ScrollView; 15 | import android.widget.Switch; 16 | import android.widget.TextView; 17 | 18 | import java.io.DataOutputStream; 19 | import java.io.File; 20 | import java.io.FileNotFoundException; 21 | import java.io.FileOutputStream; 22 | import java.io.IOException; 23 | import java.util.StringTokenizer; 24 | 25 | /** 26 | * Created by sam33 on 2016/2/23. 27 | * 28 | * This file is Android activity user interface to run Verus. 29 | * 30 | */ 31 | 32 | 33 | public class MainActivity extends AppCompatActivity{ 34 | 35 | Button StartButton; 36 | TextView LogView; 37 | EditText CmdLine; 38 | ScrollView Scroll; 39 | Handler BackgroundHandler; 40 | Handler UIHandler; 41 | HandlerThread BackgroundThread; 42 | Verus verus; 43 | 44 | 45 | 46 | //User define logger to process Logs from Verus core 47 | class LoggerCTL extends Logger 48 | { 49 | String clientLogString=""; 50 | DataOutputStream clientLog = null; 51 | String location; 52 | 53 | public LoggerCTL() 54 | { 55 | try { 56 | File sdCard = Environment.getExternalStorageDirectory(); 57 | File dir = new File(sdCard.getAbsolutePath()+"/verus"); 58 | location = sdCard.getAbsolutePath()+"/verus"+"/clientLog.txt"; 59 | dir.mkdirs();; 60 | File file1 = new File(dir, "clientLog.txt"); 61 | clientLog = new DataOutputStream(new FileOutputStream(file1)); 62 | } catch (FileNotFoundException ex) { 63 | UIHandler.post(new UIOutput("can't opem "+location,UIOutput.CLEARALL)); 64 | StartButton.setEnabled(true); 65 | } 66 | } 67 | 68 | void writeToFile() 69 | { 70 | char buf1[] = clientLogString.toCharArray(); 71 | for(int i=0 ; i sendingList; 145 | long delayms = 0; 146 | Logger output = null; 147 | 148 | public void setOutput(Logger output) 149 | { 150 | this.output = output; 151 | } 152 | 153 | int Delay = 0; 154 | 155 | public Verus() 156 | { 157 | sendingList = new ArrayList(); 158 | } 159 | 160 | class VerusExecption extends Exception 161 | { 162 | String VerusLog; 163 | public VerusExecption(String ExecptionLog) 164 | { 165 | VerusLog = ExecptionLog; 166 | } 167 | @Override 168 | public String toString() 169 | { 170 | return super.toString()+"\n"+VerusLog; 171 | } 172 | } 173 | 174 | 175 | public void VerusLog(String str) 176 | { 177 | if(output!=null) { 178 | Log.e("Log",str); 179 | output.logfile(str); 180 | } 181 | } 182 | 183 | public void Log(String str) 184 | { 185 | if(output!=null) { 186 | output.stdout(str); 187 | } 188 | } 189 | 190 | public void Error(String tag,String str) 191 | { 192 | if(output!=null) { 193 | 194 | try { 195 | if (s != null) 196 | s.close(); 197 | if (s1 != null) 198 | s1.close(); 199 | }catch (Exception e) { 200 | 201 | } 202 | output.stderr(tag, str); 203 | output.system(Logger.SYS_ERROROCCURE); 204 | } 205 | } 206 | 207 | public void Start(String args[]) { 208 | try { 209 | String data = "Start Verus for android with follow options : \n"; 210 | for(int i=0 ; i -p [-d ] \n"); 222 | } 223 | 224 | try { 225 | Srvr_addr = InetAddress.getByName(args[1]); 226 | Srvr2_addr = InetAddress.getByName(args[1]); 227 | } catch (UnknownHostException e) { 228 | throw new VerusExecption("bad address.\n"); 229 | } 230 | while (i != (args.length - 1)) { // Check that we haven't finished parsing already 231 | i = i + 1; 232 | if(args[i].equals("-p")) { 233 | i = i + 1; 234 | Port = args[i]; 235 | } else if (args[i].equals("-d")) { 236 | i = i + 1; 237 | Delay = Integer.parseInt(args[i]); 238 | } else { 239 | throw new VerusExecption("syntax should be ./verus_client -p [-d ]"); 240 | } 241 | } 242 | try { 243 | s = new DatagramSocket(Integer.parseInt(Port)); 244 | } catch (SocketException e) { 245 | throw new VerusExecption("socket() {#Start} port="+Port+" Srve_addr="+Srvr_addr.getHostAddress()+">>\n"+e.toString()); 246 | } 247 | Log("Sending request to server \n"); 248 | if(output!=null) 249 | output.system(Logger.SYS_CORRECTSTART); 250 | byte buffer[] = "Hallo".getBytes(); 251 | DatagramPacket packet = new DatagramPacket(buffer,buffer.length, Srvr_addr, Integer.parseInt(Port)); 252 | try { 253 | s.send(packet); 254 | }catch (IOException ex) { 255 | throw new VerusExecption("sendto(Hallo)"); 256 | } 257 | try{ 258 | sending_tid = new Thread(); 259 | sending_tid.start(); 260 | }catch (Exception threadex) 261 | { 262 | throw new VerusExecption("can't create thread"); 263 | } 264 | 265 | timeout_tid = new Timer(true); 266 | timeout_tid.schedule(new TimeoutThread(),0,SS_INIT_TIMEOUT); 267 | 268 | // starting to loop waiting to receive data and to ACK 269 | while (!terminate) { 270 | byte rcvbuf[] = new byte[4096]; 271 | DatagramPacket rcvpacket = new DatagramPacket(rcvbuf,rcvbuf.length); 272 | try { 273 | s.setSoTimeout(3000); 274 | s.receive(rcvpacket); 275 | } catch (SocketTimeoutException tx){ 276 | throw new VerusExecption("recvfrom(2) timeout after send Hallo"); 277 | } catch (IOException e) { 278 | throw new VerusExecption("recvfrom(2)"); 279 | } 280 | pdu = new udp_packet_t(); 281 | try { 282 | pdu.fromByteArray(rcvbuf); 283 | } catch (IOException e) { 284 | throw new VerusExecption("pdu.fromByteArray"); 285 | 286 | } 287 | if(pdu.ss_id < 0) 288 | { 289 | terminate = true; 290 | } 291 | // stopping the io timer for the timeout 292 | if (!receivedPkt) { 293 | receivedPkt = true; 294 | Log("Connected to server"); 295 | } 296 | Timestamp ts = new Timestamp(); 297 | VerusLog(ts.second+"."+ts.micro+", "+pdu.seq); 298 | pkt = new sendPkt(); 299 | pkt.pdu = pdu; 300 | pkt.seconds = ts.second; 301 | pkt.micro = ts.micro; 302 | 303 | try { 304 | lockSendingList.getInstance().getWriteLock(); 305 | } catch (InterruptedException e) { 306 | throw new VerusExecption("collision at lockSendingList"); 307 | } 308 | sendingList.add(pkt); 309 | lockSendingList.getInstance().releaseWriteLock(); 310 | 311 | } 312 | Log("Client exiting\n"); 313 | output.system(Logger.SYS_CORRECTFINISH); 314 | s.close(); 315 | }catch (VerusExecption verusex) 316 | { 317 | Error("VerusMain", verusex.toString()); 318 | } 319 | } 320 | 321 | class udp_packet_t{ 322 | int ss_id; 323 | long seq; 324 | long w; 325 | long seconds; 326 | long micro; 327 | public byte[] toByteArray() throws IOException { 328 | ByteArrayOutputStream bs = new ByteArrayOutputStream(); 329 | DataOutputStream ds = new DataOutputStream(bs); 330 | ds.writeInt(ss_id); 331 | ds.writeLong(seq); 332 | ds.writeLong(w); 333 | ds.writeLong(seconds); 334 | ds.writeLong(micro); 335 | return bs.toByteArray(); 336 | } 337 | public void fromByteArray(byte buf[]) throws IOException { 338 | ByteArrayInputStream bs = new ByteArrayInputStream(buf); 339 | DataInputStream ds = new DataInputStream(bs); 340 | ss_id = ds.readInt(); 341 | seq = ds.readLong(); 342 | w = ds.readLong(); 343 | seconds = ds.readLong(); 344 | micro = ds.readLong(); 345 | } 346 | 347 | } 348 | 349 | class sendPkt { 350 | udp_packet_t pdu; 351 | long seconds; 352 | long micro; 353 | public byte[] toByteArray() throws IOException { 354 | ByteArrayOutputStream bs = new ByteArrayOutputStream(); 355 | DataOutputStream ds = new DataOutputStream(bs); 356 | ds.write(pdu.toByteArray()); 357 | ds.writeLong(seconds); 358 | ds.writeLong(micro); 359 | return bs.toByteArray(); 360 | } 361 | } 362 | 363 | } 364 | -------------------------------------------------------------------------------- /AndroidClient/Project/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 14 | 15 | 20 | 21 | 27 | 28 | 33 | 34 | 35 | 39 | 40 | 46 | 47 |