summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gatchat/gatppp.c24
-rw-r--r--gatchat/gatppp.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
index 993b5ea2..c7768118 100644
--- a/gatchat/gatppp.c
+++ b/gatchat/gatppp.c
@@ -76,6 +76,8 @@ struct _GAtPPP {
gpointer debug_data;
gboolean sta_pending;
guint ppp_dead_source;
+ GAtSuspendFunc suspend_func;
+ gpointer suspend_data;
};
void ppp_debug(GAtPPP *ppp, const char *str)
@@ -467,6 +469,28 @@ void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data)
ppp->debug_data = user_data;
}
+static void ppp_proxy_suspend_net_interface(gpointer user_data)
+{
+ GAtPPP *ppp = user_data;
+
+ ppp_net_suspend_interface(ppp->net);
+
+ if (ppp->suspend_func)
+ ppp->suspend_func(ppp->suspend_data);
+}
+
+void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func,
+ gpointer user_data)
+{
+ if (ppp == NULL)
+ return;
+
+ ppp->suspend_func = func;
+ ppp->suspend_data = user_data;
+ g_at_hdlc_set_suspend_function(ppp->hdlc,
+ ppp_proxy_suspend_net_interface, ppp);
+}
+
void g_at_ppp_shutdown(GAtPPP *ppp)
{
if (ppp->phase == PPP_PHASE_DEAD || ppp->phase == PPP_PHASE_TERMINATION)
diff --git a/gatchat/gatppp.h b/gatchat/gatppp.h
index fb5de4c3..9464ffd3 100644
--- a/gatchat/gatppp.h
+++ b/gatchat/gatppp.h
@@ -60,6 +60,8 @@ void g_at_ppp_set_connect_function(GAtPPP *ppp, GAtPPPConnectFunc callback,
gpointer user_data);
void g_at_ppp_set_disconnect_function(GAtPPP *ppp, GAtPPPDisconnectFunc func,
gpointer user_data);
+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_ref(GAtPPP *ppp);