gatppp: Add GAtPPP resume functionality

This commit is contained in:
Guillaume Zajac 2011-05-20 11:38:14 +02:00 committed by Denis Kenzior
parent 47f5887c29
commit 7617c492b8
2 changed files with 20 additions and 0 deletions

View File

@ -79,6 +79,7 @@ struct _GAtPPP {
GAtSuspendFunc suspend_func;
gpointer suspend_data;
int fd;
gboolean suspended;
};
void ppp_debug(GAtPPP *ppp, const char *str)
@ -480,6 +481,7 @@ static void ppp_proxy_suspend_net_interface(gpointer user_data)
{
GAtPPP *ppp = user_data;
ppp->suspended = TRUE;
ppp_net_suspend_interface(ppp->net);
if (ppp->suspend_func)
@ -507,6 +509,23 @@ void g_at_ppp_shutdown(GAtPPP *ppp)
pppcp_signal_close(ppp->lcp);
}
void g_at_ppp_resume(GAtPPP *ppp)
{
if (ppp == NULL)
return;
if (g_at_hdlc_get_io(ppp->hdlc) == NULL) {
io_disconnect(ppp);
return;
}
ppp->suspended = FALSE;
g_at_io_set_disconnect_function(g_at_hdlc_get_io(ppp->hdlc),
io_disconnect, ppp);
ppp_net_resume_interface(ppp->net);
g_at_hdlc_resume(ppp->hdlc);
}
void g_at_ppp_ref(GAtPPP *ppp)
{
g_atomic_int_inc(&ppp->ref_count);

View File

@ -65,6 +65,7 @@ void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func,
gpointer user_data);
void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data);
void g_at_ppp_shutdown(GAtPPP *ppp);
void g_at_ppp_resume(GAtPPP *ppp);
void g_at_ppp_ref(GAtPPP *ppp);
void g_at_ppp_unref(GAtPPP *ppp);