How to add pppoe connection in NM plug-in



Hi dear Dan and all,
I've tried to find how to add pppoe connection in NM plug-in. But I
didn't find any example in existing plugin source code. Is there
anything I missed?
Then I tried to write code in the way similar as adding a
wired_connection_setting as following:

        NMSettingPPPOE *s_pppoe;
        gchar *value;
        s_pppoe = NM_SETTING_PPPOE(nm_setting_pppoe_new());
        //NM_SETTING_PPPOE_SERVICE NM_SETTING_PPPOE_USERNAME
NM_SETTING_PPPOE_PASSWORD
        value = ifnet_getdata(block, "username");
        if (!value) {
                g_set_error(error, ifnet_plugin_error_quark(), 0,
                            "ppp requires at lease a username");
                return;
        }
        g_object_set(s_pppoe, NM_SETTING_PPPOE_USERNAME, value, NULL);
        value = ifnet_getdata(block, "password");
        if (!value) {
                value="";
        }
        g_object_set(s_pppoe, NM_SETTING_PPPOE_PASSWORD, value, NULL);
        nm_connection_add_setting(connection, NM_SETTING(s_pppoe));

Am I doing in the right way? Is there any other thing I should take
care of? Could please give me some direction.
-- 
Best wishes,
Mu Qiao


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]