mirror of git://git.sysmocom.de/ofono
ppp: Add _from_io constructor
This commit is contained in:
parent
5ef90f934b
commit
c7ef06f91e
|
@ -396,7 +396,7 @@ void g_at_ppp_unref(GAtPPP *ppp)
|
|||
g_free(ppp);
|
||||
}
|
||||
|
||||
GAtPPP *g_at_ppp_new(GIOChannel *modem)
|
||||
static GAtPPP *ppp_init_common(GAtHDLC *hdlc)
|
||||
{
|
||||
GAtPPP *ppp;
|
||||
|
||||
|
@ -404,12 +404,7 @@ GAtPPP *g_at_ppp_new(GIOChannel *modem)
|
|||
if (!ppp)
|
||||
return NULL;
|
||||
|
||||
ppp->hdlc = g_at_hdlc_new(modem);
|
||||
|
||||
if (ppp->hdlc == NULL) {
|
||||
g_free(ppp);
|
||||
return NULL;
|
||||
}
|
||||
ppp->hdlc = g_at_hdlc_ref(hdlc);
|
||||
|
||||
ppp->ref_count = 1;
|
||||
|
||||
|
@ -429,3 +424,33 @@ GAtPPP *g_at_ppp_new(GIOChannel *modem)
|
|||
|
||||
return ppp;
|
||||
}
|
||||
|
||||
GAtPPP *g_at_ppp_new(GIOChannel *modem)
|
||||
{
|
||||
GAtHDLC *hdlc;
|
||||
GAtPPP *ppp;
|
||||
|
||||
hdlc = g_at_hdlc_new(modem);
|
||||
if (hdlc == NULL)
|
||||
return NULL;
|
||||
|
||||
ppp = ppp_init_common(hdlc);
|
||||
g_at_hdlc_unref(hdlc);
|
||||
|
||||
return ppp;
|
||||
}
|
||||
|
||||
GAtPPP *g_at_ppp_new_from_io(GAtIO *io)
|
||||
{
|
||||
GAtHDLC *hdlc;
|
||||
GAtPPP *ppp;
|
||||
|
||||
hdlc = g_at_hdlc_new_from_io(io);
|
||||
if (hdlc == NULL)
|
||||
return NULL;
|
||||
|
||||
ppp = ppp_init_common(hdlc);
|
||||
g_at_hdlc_unref(hdlc);
|
||||
|
||||
return ppp;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ typedef void (*GAtPPPConnectFunc)(GAtPPPConnectStatus success,
|
|||
const char *dns1, const char *dns2,
|
||||
gpointer user_data);
|
||||
|
||||
GAtPPP * g_at_ppp_new(GIOChannel *modem);
|
||||
GAtPPP *g_at_ppp_new(GIOChannel *modem);
|
||||
GAtPPP *g_at_ppp_new_from_io(GAtIO *io);
|
||||
void g_at_ppp_open(GAtPPP *ppp);
|
||||
void g_at_ppp_set_connect_function(GAtPPP *ppp, GAtPPPConnectFunc callback,
|
||||
gpointer user_data);
|
||||
|
|
Loading…
Reference in New Issue