-rwxr-xr-x | jni/pppoe_jni.cpp | 23 | ||||
-rwxr-xr-x | jni/src/pppoe_status.c | 37 | ||||
-rwxr-xr-x | jni/src/pppoe_status.h | 4 | ||||
-rwxr-xr-x | src/com/amlogic/pppoe/LooperThread.java | 97 | ||||
-rwxr-xr-x | src/com/amlogic/pppoe/PppoeOperation.java | 108 | ||||
-rwxr-xr-x | src/com/amlogic/pppoe/RunnableImpl.java | 8 |
6 files changed, 255 insertions, 22 deletions
diff --git a/jni/src/pppoe_status.c b/jni/src/pppoe_status.c index f542921..6417d22 100755 --- a/jni/src/pppoe_status.c +++ b/jni/src/pppoe_status.c @@ -54,14 +54,35 @@ done: #define PPP_IF_NAME "ppp0" -int get_pppoe_status( const char *phy_if_name) +int get_net_updown(const char *phy_if_name) +{ + int ret; + + ret = if_is_up(phy_if_name); + if(ret < 0){ + if(ENODEV == -ret) + __android_log_print(ANDROID_LOG_ERROR, LOCAL_TAG, "No such device(%s)\n", phy_if_name); + return 0; + } + + if(0 == ret) { + __android_log_print(ANDROID_LOG_ERROR, LOCAL_TAG, "%s is DOWN\n", phy_if_name); + return 0; + } + else { + __android_log_print(ANDROID_LOG_ERROR, LOCAL_TAG, "%s is UP\n", phy_if_name); + return 1; + } +} + +int get_pppoe_status(const char *phy_if_name) { int ret; ret = if_is_up(phy_if_name); if (ret < 0){ - if ( ENODEV == -ret ) - PRINTF( "No such device(%s)\n", phy_if_name ); + if (ENODEV == -ret) + PRINTF("No such device(%s)\n", phy_if_name); PRINTF("ppp_status: DISCONNECTED\n"); __android_log_print(ANDROID_LOG_ERROR, LOCAL_TAG, @@ -70,8 +91,8 @@ int get_pppoe_status( const char *phy_if_name) return PPP_STATUS_DISCONNECTED; } - if (0 == ret ) { - PRINTF( "%s is DOWN\n", phy_if_name ); + if (0 == ret) { + PRINTF("%s is DOWN\n", phy_if_name); PRINTF("ppp_status: DISCONNECTED\n"); __android_log_print(ANDROID_LOG_ERROR, LOCAL_TAG, @@ -81,8 +102,8 @@ int get_pppoe_status( const char *phy_if_name) ret = if_is_up(PPP_IF_NAME); if (ret < 0){ - if ( ENODEV == -ret ) - PRINTF( "No such device(%s)\n", PPP_IF_NAME ); + if (ENODEV == -ret) + PRINTF("No such device(%s)\n", PPP_IF_NAME); PRINTF("ppp_status: DISCONNECTED\n"); __android_log_print(ANDROID_LOG_ERROR, LOCAL_TAG, @@ -90,7 +111,7 @@ int get_pppoe_status( const char *phy_if_name) return PPP_STATUS_DISCONNECTED; } - if (0 == ret ) { + if (0 == ret) { PRINTF("ppp_status: CONNECTING\n"); __android_log_print(ANDROID_LOG_ERROR, LOCAL_TAG, |