Esempio n. 1
0
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;
}
Esempio n. 2
0
static gboolean setup_ppp(struct ofono_cdma_connman *cm)
{
	struct connman_data *cd = ofono_cdma_connman_get_data(cm);
	GAtIO *io;

	DBG("");

	io = g_at_chat_get_io(cd->chat);

	g_at_chat_suspend(cd->chat);

	/* open ppp */
	cd->ppp = g_at_ppp_new();

	if (cd->ppp == NULL) {
		g_at_chat_resume(cd->chat);
		return FALSE;
	}

	if (getenv("OFONO_PPP_DEBUG"))
		g_at_ppp_set_debug(cd->ppp, ppp_debug, "PPP");

	/* set connect and disconnect callbacks */
	g_at_ppp_set_connect_function(cd->ppp, ppp_connect, cm);
	g_at_ppp_set_disconnect_function(cd->ppp, ppp_disconnect, cm);

	/* open the ppp connection */
	g_at_ppp_open(cd->ppp, io);

	return TRUE;
}
Esempio n. 3
0
static void dial_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
    struct dundee_device *device = user_data;
    GAtIO *io;

    if (!ok) {
        DBG("Unable to define context\n");
        goto err;
    }

    /* get the data IO channel */
    io = g_at_chat_get_io(device->chat);

    /*
     * 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(device->chat);

    /* open ppp */
    device->ppp = g_at_ppp_new();
    if (device->ppp == NULL) {
        DBG("Unable to create PPP object\n");
        goto err;
    }
    g_at_ppp_set_debug(device->ppp, debug, "PPP");

    device->connect_timeout = g_timeout_add_seconds(PPP_TIMEOUT,
                              ppp_connect_timeout, device);

    /* set connect and disconnect callbacks */
    g_at_ppp_set_connect_function(device->ppp, ppp_connect, device);
    g_at_ppp_set_disconnect_function(device->ppp, ppp_disconnect, device);

    /* open the ppp connection */
    g_at_ppp_open(device->ppp, io);

    return;

err:
    __ofono_dbus_pending_reply(&device->pending,
                               __dundee_error_failed(device->pending));
    device->pending = NULL;

    device->driver->disconnect(device, disconnect_callback, device);
}
Esempio n. 4
0
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);
}