From c4378784ae2caec57634f9f04bcb3dcddc673f36 Mon Sep 17 00:00:00 2001 From: Rick Lei Date: Wed, 14 Jan 2015 22:11:43 +0800 Subject: Add Android 4.1+ support. See doc/README-Android.md for build HOWTO. * Update CMake files to work with android-cmake * Use unix domain socket for communicating with Android GUI * May also run standalone but requires rooted Android device --- src/fastd.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/fastd.h') diff --git a/src/fastd.h b/src/fastd.h index 6e4cda6..3d62053 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -2,6 +2,10 @@ Copyright (c) 2012-2014, Matthias Schiffer All rights reserved. + Android port contributor: + Copyright (c) 2014-2015, Haofeng "Rick" Lei + All rights reserved. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -239,6 +243,10 @@ struct fastd_config { char *status_socket; /**< The path of the status socket */ #endif +#ifdef __ANDROID__ + bool android_integration; /**< Enable Android GUI integration features */ +#endif + bool daemon; /**< Set to make fastd fork to the background after initialization */ char *pid_file; /**< A filename to write fastd's PID to */ @@ -296,6 +304,10 @@ struct fastd_context { int tunfd; /**< The file descriptor of the tunnel interface */ +#ifdef __ANDROID__ + int android_ctrl_sock_fd; /**< The unix domain socket for communicating with Android GUI */ +#endif + size_t n_socks; /**< The number of sockets in socks */ fastd_socket_t *socks; /**< Array of all sockets */ @@ -337,6 +349,12 @@ fastd_socket_t * fastd_socket_open(fastd_peer_t *peer, int af); void fastd_socket_close(fastd_socket_t *sock); void fastd_socket_error(fastd_socket_t *sock); +#ifdef __ANDROID__ +int fastd_android_receive_tunfd(void); +void fastd_android_send_pid(void); +bool fastd_android_protect_socket(int fd); +#endif + void fastd_resolve_peer(fastd_peer_t *peer, fastd_remote_t *remote); void fastd_tuntap_open(void); -- cgit v1.2.3