diff options
author | Denis Kenzior <denkenz@gmail.com> | 2011-06-29 03:46:54 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-06-29 03:46:54 -0500 |
commit | bc64df2d2abde6b4045231f6db31bc7976bd7772 (patch) | |
tree | 43bf970d79af55a44a5b5bf984bbdcc208ef74c2 /gatchat/gatppp.c | |
parent | bc37c7465320e6f64693dbc1aec5cf4b250cb723 (diff) | |
download | ofono-bc64df2d2abde6b4045231f6db31bc7976bd7772.tar.bz2 |
gatppp: Refactor tx path
Diffstat (limited to 'gatchat/gatppp.c')
-rw-r--r-- | gatchat/gatppp.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c index 787f6a53..84b43388 100644 --- a/gatchat/gatppp.c +++ b/gatchat/gatppp.c @@ -329,23 +329,19 @@ void ppp_transmit(GAtPPP *ppp, guint8 *packet, guint infolen) { guint16 proto = ppp_proto(packet); - switch (proto) { - case LCP_PROTOCOL: + if (proto == LCP_PROTOCOL) { ppp_send_lcp_frame(ppp, packet, infolen); - break; - case CHAP_PROTOCOL: - case IPCP_PROTO: - /* - * We can't use PFC option because first byte of CHAP_PROTOCOL - * and IPCP_PROTO is not equal to 0x00 - */ - ppp_send_acfc_frame(ppp, packet, infolen); - break; - case PPP_IP_PROTO: - /* We can use both ACFC & PFC if they are negotiated */ - ppp_send_acfc_pfc_frame(ppp, packet, infolen); - break; + return; } + + /* + * If the upper 8 bits of the protocol are 0, then send + * with PFC if enabled + */ + if ((proto & 0xff00) == 0) + ppp_send_acfc_pfc_frame(ppp, packet, infolen); + else + ppp_send_acfc_frame(ppp, packet, infolen); } static inline void ppp_enter_phase(GAtPPP *ppp, enum ppp_phase phase) |