ppp: Tweak the set_server_info API

This commit is contained in:
Denis Kenzior 2010-06-28 17:38:54 -05:00
parent b6601bfeed
commit 90d240820b
3 changed files with 19 additions and 16 deletions

View File

@ -465,10 +465,21 @@ void g_at_ppp_unref(GAtPPP *ppp)
g_free(ppp);
}
void g_at_ppp_set_server_info(GAtPPP *ppp, guint32 local, guint32 peer,
guint32 dns1, guint32 dns2)
void g_at_ppp_set_server_info(GAtPPP *ppp,
const char *local, const char *remote,
const char *dns1, const char *dns2)
{
ipcp_set_server_info(ppp->ipcp, local, peer, dns1, dns2);
guint32 l = 0;
guint32 r = 0;
guint32 d1 = 0;
guint32 d2 = 0;
inet_pton(AF_INET, local, &l);
inet_pton(AF_INET, remote, &r);
inet_pton(AF_INET, dns1, &d1);
inet_pton(AF_INET, dns2, &d2);
ipcp_set_server_info(ppp->ipcp, l, r, d1, d2);
}
static GAtPPP *ppp_init_common(GAtHDLC *hdlc)

View File

@ -69,8 +69,9 @@ const char *g_at_ppp_get_password(GAtPPP *ppp);
void g_at_ppp_set_recording(GAtPPP *ppp, const char *filename);
void g_at_ppp_set_server_info(GAtPPP *ppp, guint32 local, guint32 peer,
guint32 dns1, guint32 dns2);
void g_at_ppp_set_server_info(GAtPPP *ppp,
const char *local_ip, const char *remote_ip,
const char *dns1, const char *dns2);
#ifdef __cplusplus
}

View File

@ -118,18 +118,9 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user)
static gboolean update_ppp(gpointer user)
{
GAtPPP *ppp = user;
char local_ip[INET_ADDRSTRLEN] = "192.168.1.1";
char remote_ip[INET_ADDRSTRLEN] = "192.168.1.2";
char dns1[INET_ADDRSTRLEN] = "10.10.10.10";
char dns2[INET_ADDRSTRLEN] = "10.10.10.11";
guint32 l, r, d1, d2;
inet_pton(AF_INET, local_ip, &l);
inet_pton(AF_INET, remote_ip, &r);
inet_pton(AF_INET, dns1, &d1);
inet_pton(AF_INET, dns2, &d2);
g_at_ppp_set_server_info(ppp, l, r, d1, d2);
g_at_ppp_set_server_info(ppp, "192.168.1.1", "192.168.1.2",
"10.10.10.10", "10.10.10.11");
return FALSE;
}