Commit Graph

640 Commits

Author SHA1 Message Date
Marcel Holtmann 6351cb1e4e gatchat: Fix extra empty line issue with hexdump helper 2011-08-09 19:23:33 -07:00
Marcel Holtmann e35a577f80 gatchat: Use hexdump format for HDLC debug messages 2011-08-09 19:18:14 -07:00
Marcel Holtmann 4b76ec7159 gatchat: Add utility function for hexdump debugs 2011-08-09 19:17:52 -07:00
Marcel Holtmann 5fea0c006a gatchat: Add support for sending HDLC frame start and end markers 2011-08-09 16:50:30 -07:00
Marcel Holtmann b996d34f2f gatchat: Fix minor whitespace mistake 2011-08-04 23:54:33 +02:00
Marcel Holtmann 73b711551c gatchat: Fix port settings and debugging for QCDM test tool 2011-07-26 16:02:24 +02:00
Marcel Holtmann 0f29c33c5b gatchat: Add helper for opening QCDM ports 2011-07-26 15:59:47 +02:00
Marcel Holtmann a58f01316b gatchat: Fix handling of HDLC debug output 2011-07-26 15:53:06 +02:00
Denis Kenzior 0471e3ec8d gatchat: Add terminator blacklisting 2011-07-25 03:44:56 +02:00
Denis Kenzior 329f2d724b gatserver: fix certain bad behavior
Due to the new GAtIO semantics, the receive function is called
immediately if the receive buffer is not empty.  This caused certain
funny behavior in non-command (e.g. empty, a/) processing.
2011-07-11 15:51:34 -05:00
Denis Kenzior 2eb4611de8 ppp: Add basic length sanity checks 2011-06-29 05:00:56 -05:00
Denis Kenzior e893deac59 gsmdial: Add pfc & acfc options to gsmdial 2011-06-29 04:03:57 -05:00
Denis Kenzior 078d621033 ppp: Don't regenerate options when unchanged 2011-06-29 04:03:25 -05:00
Denis Kenzior bc64df2d2a gatppp: Refactor tx path 2011-06-29 03:46:54 -05:00
Denis Kenzior bc37c74653 gatppp: Refactor rx path 2011-06-29 03:35:13 -05:00
Denis Kenzior 12338faabd gatppp: Re-format & re-word comments 2011-06-29 03:32:27 -05:00
Guillaume Zajac 3b2e579cf4 gsmdial: Use ACFC and PFC by default 2011-06-29 00:34:18 -05:00
Guillaume Zajac fed838f79f GAtPPP: Add PFC option support 2011-06-29 00:33:42 -05:00
Guillaume Zajac 84ccc874da GAtPPP: Add ACFC option support 2011-06-29 00:22:25 -05:00
Marcel Holtmann 3297a3e865 gatchat: Fix unused variable cases 2011-05-27 09:52:31 -07:00
Denis Kenzior bc52e40801 gsmdial: Send escape sequence followed by ATH/ATO
This functionality can be triggered by sending SIGUSR1 / SIGUSR2 to
gsmdial.  e.g. kill -10 <pid> and kill -12 <pid>
2011-05-25 05:32:05 -05:00
Denis Kenzior 92e0657eed ppp_net: Keep valgrind happy 2011-05-25 05:30:38 -05:00
Denis Kenzior afce582246 gathdlc: Fix memory leak 2011-05-25 05:30:17 -05:00
Denis Kenzior e244e2d42a gatppp: Set the suspend function in open / listen
In case it was set before calling these functions
2011-05-25 05:22:58 -05:00
Denis Kenzior 1bd4f75ac0 test-server: Update to the new GAtPPP API 2011-05-24 12:25:08 -05:00
Denis Kenzior 0c4a0e61b6 gsmdial: Update to new API 2011-05-24 12:25:07 -05:00
Denis Kenzior eeb3ccc321 gatppp: Refactor PPP API
Remove the series of constructors which take a GIOChannel directly.
These weren't used.

This change also allows the construction of the PPP object and filling
in various pertinent information without starting the HDLC processing.
The client must now use g_at_ppp_open() for the client side or
g_at_ppp_listen() for the server side to start the true PPP session.
The previous owner of the GAtIO object must be suspended beforehand.
2011-05-24 12:25:07 -05:00
Denis Kenzior 72dee45005 gatppp: Make sure to clean up guard_timeout_source 2011-05-24 12:25:07 -05:00
Denis Kenzior d82c5ce1fa gatppp: Rename guard_timeout_src to _source 2011-05-24 12:25:07 -05:00
Guillaume Zajac db430aaf1c gatppp: Do not call disconnect func if suspended 2011-05-24 12:25:07 -05:00
Guillaume Zajac ab027e9e9c gatppp: Add GAtPPP suspend API 2011-05-24 12:25:07 -05:00
Guillaume Zajac 7617c492b8 gatppp: Add GAtPPP resume functionality 2011-05-24 12:25:07 -05:00
Guillaume Zajac 47f5887c29 ppp_net: add ppp_net_resume_interface() API 2011-05-24 12:25:07 -05:00
Denis Kenzior 6f6a9747f8 gathdlc: Squash unneeded function 2011-05-24 12:25:07 -05:00
Guillaume Zajac ce71d75675 gathdlc: add g_at_hdlc_resume() API 2011-05-24 12:25:07 -05:00
Denis Kenzior 832cc3317b gatppp: Make ppp->fd handling a bit easier to grok 2011-05-24 12:10:22 -05:00
Denis Kenzior e8c7fc8a8a ppp_net: streamline ppp_net_new logic 2011-05-24 12:10:22 -05:00
Denis Kenzior 5405d0860f gatppp: Ensure created GAtPPP object is not null 2011-05-24 12:10:22 -05:00
Guillaume Zajac 7e5ccc18d7 gatppp: Add new contructor to use external fd 2011-05-24 12:10:22 -05:00
Denis Kenzior be7cce9cb3 gatppp: Don't go over 80 characters / line 2011-05-24 11:47:46 -05:00
Denis Kenzior cccf76cfdf test-server: Remove legacy code
The previous thinking was to use the PPP stack to send Conf-Naks with
some delay to client requests until the IP configuration was setup
correctly.  However, we now hide this by using the delay during the
processing of the ATD.  This code is no longer relevant.
2011-05-24 11:47:46 -05:00
Caiwen Zhang 65d65f4fbe gatppp: add name field when using chap auth
Some systems require name field, otherwise chap authentication will
fail.
2011-05-11 20:24:35 -05:00
Caiwen Zhang 37d04bee15 gatppp: fix ppp protocol-reject constructing error
In PPP Protocol-Reject package the 'rejected data field' should be a copy
of the rejected package, the copy starts from the data field. besides,
Protocol-Reject package include a 'rejected protocol field', it is the
same as the protocol field of the rejected package.

Protocol-Reject package structure is:

	| PPP_header | rejected protocol | rejected data

The rejected package structure is:
	| Addr | Control | protocol | data

So the Protocol-Reject package data field is copied from the 3rd byte of
the rejected package.
2011-05-11 13:29:30 -05:00
Guillaume Zajac f1cbb783fc gatppp: Add API for setting suspend callback
In situations where the PPP stream can be suspended by the peer, e.g. in
the server role using '+++'
2011-05-08 23:03:22 -05:00
Denis Kenzior d48c309151 ppp_net: Reset the watch to zero when removing 2011-05-08 23:02:19 -05:00
Guillaume Zajac 9fea153593 ppp_net: add ppp_net_suspend_interface() function 2011-05-08 23:00:12 -05:00
Guillaume Zajac badd5555ec gathdlc: delete read/write handler in hdlc_suspend 2011-05-08 22:59:03 -05:00
Guillaume Zajac 8a56acd549 gathdlc: Add public suspend function 2011-05-08 22:58:41 -05:00
Marcel Holtmann 6d426a19a6 gatchat: Fix memory leak with notify nodes list
The list itself needs to be freed as well and not only its elements.
2011-05-06 09:19:54 -07:00
Denis Kenzior dc86e86446 gathdlc: Make sure to set in_read_handler properly 2011-05-02 07:15:41 -05:00
Denis Kenzior 94d6d505ee gathdlc: Add support for detecting +++ escapes 2011-05-02 07:06:28 -05:00
Guillaume Zajac 70ae2f0028 gatio: add ability to drain GAtIO read buffer 2011-05-02 07:05:57 -05:00
Guillaume Zajac 6b3cfbba85 gat: add GAtSuspendFunc CB typedef 2011-04-29 08:30:22 -05:00
Martin Xu 0dc3d69c54 gatppp: Fix crash related to not stopping timers
In case of offline modem when GPRS data connection is connected, if gprs
atom is removed before PPP termination process is complete, the terminate_timer
will not be stop. It will cause ofonod crash when the timer times out.
2011-04-26 14:47:11 -05:00
Olivier Guiter bdb4c8d3db gatserver: add tone and pulse dialing AT commands 2011-03-29 13:54:46 -05:00
Denis Kenzior be5aadc16f gatchat: Add support for short prompt send variant 2011-03-28 18:06:59 -05:00
Denis Kenzior 2ed142de3c gatsyntax: support short prompt in v1 parser 2011-03-28 18:06:59 -05:00
Denis Kenzior b6d6282158 gatsyntax: support short prompt for permissive 2011-03-28 18:06:59 -05:00
Jarko Poutiainen 57faa0c931 gatchat: new hint to handle +CPOS 2011-03-28 18:06:59 -05:00
Jarko Poutiainen 17599580d8 gatchat: introduce send for +CPOS 2011-03-28 18:06:58 -05:00
Denis Kenzior 92a6b18ef4 gatsyntax: Support echo of empty lines 2011-03-28 18:06:57 -05:00
Denis Kenzior 54736c532c gatsyntax: Re-name enum a proper way 2011-03-28 18:06:57 -05:00
Olivier Guiter 6b03d7cdff gatserver: add v250 ATL and ATM commands 2011-03-25 12:37:25 -05:00
Olivier Guiter 155cf8f9c4 gatserver: add AT&F command 2011-03-24 13:27:13 -05:00
Olivier Guiter cc17e8fd8c gatserver: add ATZ command 2011-03-23 15:01:36 -05:00
Patrick Porlan 2f0485e757 ringbuffer: Switch ringbuffer to g_slice allocator
This should allow for more efficient handling of equally sized
buffers, in terms of alignment and recycling.
2011-03-16 21:34:54 -05:00
Patrick Porlan bb0e3e0a58 PPP: Optimize write buffer management
Extend the write buffer handling in gathdlc.c to minimize stalling and
process switching during large PPP transfers. The single write buffer
is replaced by a queue of buffers, allowing for much larger emission
windows without hugely impacting memory consumption. This reduces the
time required to send 50 MB between a couple of local PPP interfaces on
my laptop from ~53s to ~3s.
2011-03-15 14:15:26 -05:00
Patrick Porlan 992019cad4 gatchat: Optimize ringbuffer modulo operations
Replace modulo operations in ringbuffer.c by masking operations.  This
is possible because the size of the ring buffers is always a power of
two, and yields a small performance improvement.

The improvement should be mostly visible on processors that implement
division in microcode (Atom) or lack a division instruction (ARM).
2011-03-02 22:50:32 -06:00
Denis Kenzior ef49d65b70 gsmdial: Introduce data_mode
If we're in PPP mode, then don't send unsolicited notifications.  Only a
NO CARRIER is really allowed.
2011-02-28 16:13:56 -06:00
Denis Kenzior 51d950994d gatserver: Tweak use of g_at_server_suspend/resume 2011-02-28 16:13:56 -06:00
Denis Kenzior d3350d6662 test-server: Make sure to send CONNECT
Before starting the ppp session we should make sure that the CONNECT
response has been sent on the wire.
2011-02-28 16:13:56 -06:00
Denis Kenzior 4da1a9318c gatserver: Exit garbage state on HDLC frame end 2011-02-28 16:13:56 -06:00
Denis Kenzior 6f8675d7fa gatppp: Try to detect no carrier conditions 2011-02-28 16:13:56 -06:00
Denis Kenzior ea56a71067 gatppp: Delay signaling ppp_down
Delay signaling of ppp_down until we exit the GAtHDLC read handler.
Otherwise exchanging the read handler on GAtIO might lead to funny
double consumption problems.
2011-02-28 16:13:56 -06:00
Denis Kenzior 0dc8e5e588 gathdlc: Try to detect no carrier conditions
Sometimes we receive the no carrier embedded in a stream following the
PPP packets.  This might be due to write scheduling on the remote side
or read scheduling locally.  Try not to consume the no carrier condition
and assume the previous hdlc frames will result in closing of the ppp
stack.
2011-02-28 16:13:56 -06:00
Denis Kenzior 703271e629 gatio: Remove stray empty line 2011-02-28 16:13:56 -06:00
Denis Kenzior 78eb4ee59c gatio: update comment 2011-02-28 16:13:56 -06:00
Denis Kenzior 09ca5aaef0 gathdlc: Unregister read / write handlers
When GAtHDLC is being unregistered make sure to unregister read / write
handlers so as not to crash.
2011-02-28 16:13:56 -06:00
Denis Kenzior 1cbe91090d gathdlc: drain the last hdlc frame processed
If we're being destroyed, we should drain the last HDLC frame
2011-02-28 16:13:56 -06:00
Denis Kenzior 2446d1aa43 gsmdial: register notification before resuming 2011-02-28 16:13:56 -06:00
Denis Kenzior 57f32ff899 ppp: Remove some g_prints 2011-02-28 16:13:56 -06:00
Denis Kenzior 75730bbaac ppp_cp: Replace some left over g_prints with DBG 2011-02-28 16:13:56 -06:00
Denis Kenzior e880aab120 gatppp: Replace some left-over g_prints with DBG 2011-02-28 16:13:55 -06:00
Denis Kenzior b6bc221bc8 gatppp: Send the final terminate ack
In the case where we're going down, but have a pending terminate ack,
delay signaling the upper layers until the ack has been put on the wire.
2011-02-28 16:13:55 -06:00
Denis Kenzior 802962adbc gatppp: Add a debug macro 2011-02-28 16:13:55 -06:00
Denis Kenzior 5ffe6f7beb gatio: Add write 'done' notifier
This allows external clients to get notified when GAtIO no longer has a
registered write watcher.  E.g. no more data is currently pending.
2011-02-28 16:13:55 -06:00
Denis Kenzior 3f2f11fe8f test-server: Remove root user check 2011-02-28 16:13:55 -06:00
Denis Kenzior 92404672fc gatserver: Update the internal command parsers
commit 61b30c025d changed the way the
command callbacks are being called (namely the contents of the GAtResult
object).  Most command callbacks were updated, but the internal ones
were forgotten.  This patch fixes this issue.
2011-02-28 16:13:51 -06:00
Denis Kenzior d841fc868a gatchat: Fix minor style issues 2011-02-25 10:55:08 -06:00
Frédéric Danis 8f8559edf6 gatchat: add g_at_result_iter_next_number_default API 2011-02-24 14:01:23 -06:00
Frédéric Dalleau 42224e2bbe gatserver: Add function to enable/disable echo 2011-02-23 09:31:07 -06:00
Olivier Guiter 4ae645d7e6 gatserver: Add various ATSx handlers 2011-02-22 09:45:59 -06:00
Guillaume Zajac 205d40db82 test-server: Fix crash when remote disconnects
If the remote side kills the connection when PPP is established, we
should not try to resume the AT server.
2011-02-17 11:30:47 -06:00
Denis Kenzior 36056ddb38 gsmdial: Fix minor style quirk 2011-02-16 15:45:39 -06:00
Gustavo F. Padovan c57c78062e gsmdial: add option for Bluetooth DUN dialing 2011-02-16 15:45:34 -06:00
Martin Xu 694589f51d PPP: Use default ACCM (0xffffffff) to trasmit
Using my Huawei EM770W modem, if set ACCM as 0x00000000, RXJ-
event breaks PPP link, after IP package transmit for a while.
Using default ACCM, the issue can be fixed.
I tested it at China Unicom networks.
2011-02-16 12:01:39 -06:00
Denis Kenzior 6eeaacc706 gatserver: Be more const correct 2011-02-16 00:23:44 -06:00
Denis Kenzior 55d54e377a test-server: Fix a few more occurrences 2011-02-15 16:05:02 -06:00
Denis Kenzior a6f910e27c gatserver: Change callback signature
Provide the originating GAtServer to the callback
2011-02-15 15:47:32 -06:00
Denis Kenzior a0cca0a970 gatserver: extend D with GSM/UMTS specifics 2011-02-15 15:47:32 -06:00