static gboolean setup_ppp(struct ofono_gprs_context *gc) { struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); GAtIO *io; DBG(""); io = g_at_chat_get_io(gcd->chat); g_at_chat_suspend(gcd->chat); /* open ppp */ gcd->ppp = g_at_ppp_new(); if (gcd->ppp == NULL) { g_at_chat_resume(gcd->chat); return FALSE; } if (getenv("OFONO_PPP_DEBUG")) g_at_ppp_set_debug(gcd->ppp, ppp_debug, "PPP"); g_at_ppp_set_auth_method(gcd->ppp, gcd->auth_method); g_at_ppp_set_credentials(gcd->ppp, gcd->username, gcd->password); /* set connect and disconnect callbacks */ g_at_ppp_set_connect_function(gcd->ppp, ppp_connect, gc); g_at_ppp_set_disconnect_function(gcd->ppp, ppp_disconnect, gc); /* open the ppp connection */ g_at_ppp_open(gcd->ppp, io); return TRUE; }
static gboolean setup_ppp(struct ofono_gprs_context *gc) { struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); GAtIO *io; io = g_at_chat_get_io(gcd->chat); g_at_chat_suspend(gcd->chat); /* open ppp */ gcd->ppp = g_at_ppp_new_from_io(io); if (gcd->ppp == NULL) { g_at_chat_resume(gcd->chat); return FALSE; } g_at_ppp_set_credentials(gcd->ppp, gcd->username, gcd->password); /* set connect and disconnect callbacks */ g_at_ppp_set_connect_function(gcd->ppp, ppp_connect, gc); g_at_ppp_set_disconnect_function(gcd->ppp, ppp_disconnect, gc); /* open the ppp connection */ g_at_ppp_open(gcd->ppp); return TRUE; }
static gboolean setup_ppp(GAtServer *server) { /* open ppp */ ppp = g_at_ppp_server_new("192.168.1.1"); if (ppp == NULL) return FALSE; g_at_ppp_set_debug(ppp, server_debug, "PPP"); g_at_ppp_set_credentials(ppp, "", ""); /* set connect and disconnect callbacks */ g_at_ppp_set_connect_function(ppp, ppp_connect, server); g_at_ppp_set_disconnect_function(ppp, ppp_disconnect, server); g_at_ppp_set_server_info(ppp, "192.168.1.2", "10.10.10.10", "10.10.10.11"); return TRUE; }
static void connect_cb(gboolean ok, GAtResult *result, gpointer user_data) { GAtIO *io; if (!ok) { g_print("Unable to define context\n"); exit(1); } /* get the data IO channel */ io = g_at_chat_get_io(modem); /* * shutdown gatchat or else it tries to take all the input * from the modem and does not let PPP get it. */ g_at_chat_suspend(modem); /* open ppp */ ppp = g_at_ppp_new(); if (ppp == NULL) { g_print("Unable to create PPP object\n"); exit(1); } g_at_ppp_set_debug(ppp, gsmdial_debug, "PPP"); g_at_ppp_set_credentials(ppp, option_username, option_password); g_at_ppp_set_acfc_enabled(ppp, option_acfc); g_at_ppp_set_pfc_enabled(ppp, option_pfc); /* set connect and disconnect callbacks */ g_at_ppp_set_connect_function(ppp, ppp_connect, NULL); g_at_ppp_set_disconnect_function(ppp, ppp_disconnect, NULL); /* open the ppp connection */ g_at_ppp_open(ppp, io); if (option_pppdump) g_at_ppp_set_recording(ppp, option_pppdump); }