diff options
author | Guillaume Zajac <guillaume.zajac@linux.intel.com> | 2011-06-29 10:20:23 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-06-29 00:22:25 -0500 |
commit | 84ccc874dad70dfa4464ae5a1b295373211882ca (patch) | |
tree | b7e75460af0ec4fe028afc55bf9f9d346cdc6daf /gatchat/ppp_lcp.c | |
parent | 00bd7f8735d05e7965704b0679518c274a71e5bb (diff) | |
download | ofono-84ccc874dad70dfa4464ae5a1b295373211882ca.tar.bz2 |
GAtPPP: Add ACFC option support
Diffstat (limited to 'gatchat/ppp_lcp.c')
-rw-r--r-- | gatchat/ppp_lcp.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/gatchat/ppp_lcp.c b/gatchat/ppp_lcp.c index ce9dae29..c86a7d82 100644 --- a/gatchat/ppp_lcp.c +++ b/gatchat/ppp_lcp.c @@ -58,11 +58,12 @@ enum lcp_options { ACFC = 8, }; -/* Maximum size of all options, we only ever request ACCM and MRU */ -#define MAX_CONFIG_OPTION_SIZE 10 +/* Maximum size of all options, we only ever request ACCM, MRU and ACFC */ +#define MAX_CONFIG_OPTION_SIZE 12 #define REQ_OPTION_ACCM 0x1 #define REQ_OPTION_MRU 0x2 +#define REQ_OPTION_ACFC 0x4 struct lcp_data { guint8 options[MAX_CONFIG_OPTION_SIZE]; @@ -100,6 +101,13 @@ static void lcp_generate_config_options(struct lcp_data *lcp) len += 4; } + if (lcp->req_options & REQ_OPTION_ACFC) { + lcp->options[len] = ACFC; + lcp->options[len + 1] = 2; + + len += 2; + } + lcp->options_len = len; } @@ -286,9 +294,17 @@ static enum rcr_result lcp_rcr(struct pppcp_data *pppcp, break; case MAGIC_NUMBER: case PFC: - case ACFC: /* don't care */ break; + case ACFC: + { + struct lcp_data *lcp = pppcp_get_data(pppcp); + + if (lcp->req_options & REQ_OPTION_ACFC) + ppp_set_xmit_acfc(ppp, TRUE); + + break; + } } } @@ -338,3 +354,16 @@ struct pppcp_data *lcp_new(GAtPPP *ppp, gboolean is_server) return pppcp; } + +void lcp_set_acfc_enabled(struct pppcp_data *pppcp, gboolean enabled) +{ + struct lcp_data *lcp = pppcp_get_data(pppcp); + + if (enabled == TRUE) + lcp->req_options |= REQ_OPTION_ACFC; + else + lcp->req_options &= ~REQ_OPTION_ACFC; + + lcp_generate_config_options(lcp); + pppcp_set_local_options(pppcp, lcp->options, lcp->options_len); +} |