cjdelisle/cjdns — pull request #460 by lgierth (2014-02-20 07:46:51+00:00)
Title: [RFC/WIP] Android NDK compatibility

My goal is to run cjdns on Android with a nice GUI, and most important, without root. Since version 4.0, the Android SDK provides [VpnService](http://developer.android.com/reference/android/net/VpnService.html), which creates a configurable TUN device (and sets up routes), and passes a read/write file descriptor to the application code. One example of this is the [de.blinkt.openvpn](https://play.google.com/store/apps/details?id=de.blinkt.openvpn) app. So my plan is to get cjdns to compile against the NDK, have an app create the TUN device, and spawn the cjdns process, which inherits the file descriptor.

What I have achieved so far:

- NaCl builds against the NDK
- The libuv version currently vendored doesn't, so I updated it to the most recent 0.11.19
- With a few adjustments to the build script, libuv builds against the NDK
- cjdns doesn't build yet
- `uv_last_error` has been removed (done, joyent/libuv@3ee4d3f183331a123ce35edd0d32268a2bb22aa5)
- IPv4/6 methods have been merged (wip, joyent/libuv#917)
- callback arguments have changed (wip)
- possibly more incompatibilities

Right now I'm working through the compile errors one by one, and I'm opening this PR to get feedback on the plan and the code. It's the first time I seriously work with C, so some of my code changes might be problematic. But if you don't have a good idea where to start, squashing errors until the build is green, is the way to go :)

I'd be happy about comments! I'll update this PR as I progress with the code.