From 04cfa990e289cd3c600f878e28f62709e860e292 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Mon, 5 Apr 2010 16:55:07 -0500 Subject: Refactor: add pppcp_set/get_magic_number --- gatchat/ppp_cp.c | 10 ++++++++++ gatchat/ppp_cp.h | 3 +++ gatchat/ppp_lcp.c | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c index 5e80317f..7eac46fe 100644 --- a/gatchat/ppp_cp.c +++ b/gatchat/ppp_cp.c @@ -1299,6 +1299,16 @@ void pppcp_set_prefix(struct pppcp_data *pppcp, const char *prefix) pppcp->prefix = prefix; } +void pppcp_set_magic_number(struct pppcp_data *pppcp, guint32 magic) +{ + pppcp->magic_number = magic; +} + +guint32 pppcp_get_magic_number(struct pppcp_data *pppcp) +{ + return pppcp->magic_number; +} + struct pppcp_data *pppcp_new(GAtPPP *ppp, guint16 proto) { struct pppcp_data *data; diff --git a/gatchat/ppp_cp.h b/gatchat/ppp_cp.h index 60ea0eff..f1a590f4 100644 --- a/gatchat/ppp_cp.h +++ b/gatchat/ppp_cp.h @@ -111,6 +111,9 @@ GAtPPP *pppcp_get_ppp(struct pppcp_data *pppcp); void pppcp_set_option_strings(struct pppcp_data *pppcp, const char **opts); void pppcp_set_prefix(struct pppcp_data *pppcp, const char *prefix); +void pppcp_set_magic_number(struct pppcp_data *pppcp, guint32 magic); +guint32 pppcp_get_magic_number(struct pppcp_data *pppcp); + void pppcp_add_config_option(struct pppcp_data *data, struct ppp_option *option); void pppcp_set_valid_codes(struct pppcp_data *data, guint16 codes); diff --git a/gatchat/ppp_lcp.c b/gatchat/ppp_lcp.c index 085a9c85..090e290c 100644 --- a/gatchat/ppp_lcp.c +++ b/gatchat/ppp_lcp.c @@ -136,8 +136,8 @@ static void lcp_option_process(struct pppcp_data *pppcp, case MAGIC_NUMBER: /* XXX handle loopback */ magic = get_host_long(option->data); - if (magic != pppcp->magic_number) - pppcp->magic_number = magic; + if (magic != pppcp_get_magic_number(pppcp)) + pppcp_set_magic_number(pppcp, magic); else g_print("looped back? I should do something\n"); break; -- cgit v1.2.3