summaryrefslogtreecommitdiff
Diffstat
-rwxr-xr-xjni/pppoe_jni.cpp18
-rwxr-xr-xjni/src/pppoe_status.c60
-rwxr-xr-xjni/src/pppoe_status.h1
-rwxr-xr-xjni/src/pppoe_wrapper.c107
4 files changed, 119 insertions, 67 deletions
diff --git a/jni/pppoe_jni.cpp b/jni/pppoe_jni.cpp
index 385c100..6757a31 100755
--- a/jni/pppoe_jni.cpp
+++ b/jni/pppoe_jni.cpp
@@ -44,13 +44,12 @@ struct fields_t {
static struct fields_t fields;
-extern int get_eth0_updown();
-extern int get_pppoe_status( const char *phy_if_name);
static char pppoe_connect_cmd[PPPOE_CONNECT_CMD_LEN_MAX];
static char pppoe_disconnect_cmd[512] = "ppp-stop";
static char pppoe_terminate_cmd[512] = "ppp-terminate";
+static char pppoe_status_cmd[512] = "ppp-status";
static char pppoe_plugin_cmd[PPPOE_PLUGIN_CMD_LEN_MAX];
@@ -248,15 +247,20 @@ jint com_amlogic_PppoeOperation_isNetAdded
jint com_amlogic_PppoeOperation_status
(JNIEnv *env, jobject obj, jstring jstr_if_name)
{
- char *p_ifname;
int status;
+ struct netwrapper_ctrl * ctrl;
__android_log_print(ANDROID_LOG_ERROR, LOCAL_TAG,"ppp.status\n");
- p_ifname = (char *)env->GetStringUTFChars(jstr_if_name, NULL);
- status = get_pppoe_status(p_ifname);
-
- env->ReleaseStringUTFChars(jstr_if_name, p_ifname);
+ ctrl = netwrapper_ctrl_open(PPPOE_WRAPPER_CLIENT_PATH, PPPOE_WRAPPER_SERVER_PATH);
+ if (ctrl == NULL) {
+ __android_log_print(ANDROID_LOG_ERROR, LOCAL_TAG, "Failed to connect to pppd\n");
+ return -1;
+ }
+
+ status = netwrapper_ctrl_request(ctrl, pppoe_status_cmd, strlen(pppoe_status_cmd));
+
+ netwrapper_ctrl_close(ctrl);
return status;
}