Commit Graph

259 Commits

Author SHA1 Message Date
Denis Kenzior 64ffcf1cfa Refactor: Move to a transition state table
It is much more compact to re-implement the transition states as a table
as opposed to functions with switch/case statements.  The logic is made
much easier to follow and much of the code duplication is eliminated
2010-04-05 12:36:43 -05:00
Denis Kenzior d6517e63fe Refactor: Make the enum assignments explicit
They will be used for certain magic later on
2010-04-05 10:13:10 -05:00
Denis Kenzior e56710e1da Refactor: Move the state definition to ppp_cp.c 2010-04-05 10:12:39 -05:00
Kristen Carlson Accardi 9905245e79 ppp: implement Max-Failure counter
put a cap on the number of Configure-Nak packets we send.
2010-04-05 09:45:14 -05:00
Marcel Holtmann c2fb0a1630 Move PPP constants where they are used 2010-04-03 22:32:27 -07:00
Marcel Holtmann 5772ad5d8b Make GAtPPP fields really private 2010-04-03 22:25:09 -07:00
Marcel Holtmann 352ea97f8f Hide internals of ring buffer structure 2010-04-02 21:51:19 -07:00
Marcel Holtmann 09f7be82a9 Remove circular inclusion protection from ring buffer header 2010-04-02 20:34:25 -07:00
Marcel Holtmann 764501482e Fix some cases where g_try_new should be used 2010-04-02 19:20:53 -07:00
Marcel Holtmann 4733ddaffa Move frame NULL checks into the unstuffing function 2010-04-02 19:06:31 -07:00
Marcel Holtmann 9d8e55d489 Fix coding style with callback structures 2010-04-02 19:01:38 -07:00
Kristen Carlson Accardi 3c3077f847 ppp: implement net close 2010-04-02 19:03:56 -05:00
Denis Kenzior ebc6e3b9dc Refactor: Get rid of (now) pointless comments 2010-04-02 19:03:56 -05:00
Marcel Holtmann ffa99a1ebb Also the default case should have a break statement 2010-04-02 13:48:44 -07:00
Denis Kenzior 349d4d8c5d Remove the PPP option from gsmdial
Pointless since we should always connect using PPP
2010-04-02 15:13:25 -05:00
Denis Kenzior 2c466c8baf Refactor: Get rid of packet handler registrations
There are only about 4 protocols that the current ppp code handles and
it is doubtful that it will grow much more.  There's no point in having
an extensive packet handler registration framework.
2010-04-02 15:11:48 -05:00
Marcel Holtmann 3c39543cd6 Fix tabs vs. whitespace coding style violation 2010-04-02 13:34:10 -07:00
Marcel Holtmann 76200165bb Add more missing break statements 2010-04-02 13:33:35 -07:00
Kristen Carlson Accardi 0766a67832 ppp: fix missing breaks in switch statements 2010-04-02 13:19:14 -07:00
Marcel Holtmann 8097a1ed52 Add missing break or fall through comments to switch statements 2010-04-02 12:40:45 -07:00
Marcel Holtmann 0e8b2815a8 Always reset option_rval for every option 2010-04-02 11:43:20 -07:00
Marcel Holtmann 843d3bd2a3 Add missing arpa/inet.h includes 2010-04-02 11:42:42 -07:00
Kristen Carlson Accardi 74e1abd353 ppp: use queue to transmit
Since we are using non buffered I/O, use a queue to transmit when buffer
space is available.
2010-04-02 13:05:47 -05:00
Denis Kenzior 1ed6966cb4 Split out ipcp protocol into ppp_ipcp.c 2010-04-02 12:53:45 -05:00
Kristen Carlson Accardi c2a589e732 ppp: fix event generation on close
Prevents too early transition to PPP_DEAD
2010-04-02 12:53:45 -05:00
Marcel Holtmann edba0296c5 Remove PPP CP event_queue handling and process events directly 2010-04-01 21:44:07 -07:00
Denis Kenzior a182034336 Fix: Stop infinite attempts to register
Sometimes if the modem firmware is particularly nutty we will see
frequent cell-reselections at startup, resulting in us attempting to
register multiple times.  Try to stop this behavior by keeping track of
what state we're in and hoping the hardware is at least somewhat sane.
2010-04-01 22:32:58 -05:00
Marcel Holtmann a845dc8da7 Remove obfuscation for some of the event handling 2010-04-01 20:40:39 -07:00
Marcel Holtmann 6607b5985e Move functions from ppp.c into gatppp.c 2010-04-01 20:33:03 -07:00
Marcel Holtmann 7d6649680f Remove PPP event_queue handling and process events directly 2010-04-01 20:26:24 -07:00
Marcel Holtmann cdc1e3c31b Check FCS while unstuffing the byte stream 2010-04-01 20:18:49 -07:00
Marcel Holtmann dabac98cb4 Remove PPP recv_queue handling and process frames directly 2010-04-01 20:11:43 -07:00
Marcel Holtmann cb791ceb78 Remove usage of AT+CGACT for now 2010-04-01 20:06:31 -07:00
Marcel Holtmann 847e7c7f14 Fix order of PPP frame recording and processing 2010-04-01 14:31:19 -07:00
Marcel Holtmann 544c02da49 Add support for recording PPP sessions in pppdump format 2010-04-01 13:47:25 -07:00
Marcel Holtmann ef82241deb Implement g_at_ppp_set_debug support 2010-04-01 13:11:11 -07:00
Marcel Holtmann dc55d14e9c Add some debugging information to PPP authentication handling 2010-04-01 09:56:18 -07:00
Marcel Holtmann 4f99859d37 Remove useless pppcp_protocol_data structure 2010-04-01 09:13:44 -07:00
Marcel Holtmann 5f0d8493e7 Remove forward declarations in PPP network handling 2010-04-01 00:17:10 -07:00
Marcel Holtmann eb9e7872a9 Add debugging for PPP LCP and IPCP options 2010-04-01 00:07:40 -07:00
Marcel Holtmann f081de4ea6 Use ppp%d as PPP interface name instead of tun%d 2010-03-31 22:29:43 -07:00
Denis Kenzior 988b24adb0 Fix: Introduce PPP data state
Some modems send PPP data introspersed along with the CONNECT final
response.  Fixup the parser so we can still detect the final response.
2010-03-31 18:48:52 -05:00
Denis Kenzior ee8084c0d0 Fix: Update gsm dial to the new GAtPPP API 2010-03-31 18:48:30 -05:00
Denis Kenzior cc1bb46ffa Refactor: Use GAtDisconnectFunc for ppp disconnect
The ppp argument to the current disconnect callback is useless as the
ppp structure is most likely stored in user data anyway.
2010-03-31 18:47:30 -05:00
Denis Kenzior d6093b819f Refactor: GAtPPP connect callback
The connect callback was not giving enough information and the
information it was providing was not in a convenient form.

- Provide the ppp interface name (e.g. tun0)
- Provide ip, dns1 & dns2 as strings
- Do not send the ppp structure in the callback, it is most likely
  present in the user data anyway
2010-03-31 18:45:17 -05:00
Denis Kenzior 0a98e1aef3 Style: Whitespace damage due to spaces, not tabs
Also use proper indentation style
2010-03-31 14:11:41 -05:00
Andrzej Zaborowski 27d0bc6ccf Fix ampersand commands check
Also remove a trailing tab.
2010-03-31 13:16:13 -05:00
Denis Kenzior a3eeb88511 Style: remove unneeded blank line 2010-03-31 13:04:57 -05:00
Marcel Holtmann f87537644b Fix whitespace damage in PPP implementation 2010-03-31 10:30:54 -07:00
Zhenhua Zhang 82687aa58b Add test implementation for CPBS 2010-03-31 08:39:47 -05:00