Commit Graph

642 Commits

Author SHA1 Message Date
Kristen Carlson Accardi 8cae71ef5c Add PPP option to gsmdial
Implement new options for gsmdial to use PPP and set the user name and
password for authentication if needed.
2010-03-22 17:28:23 -07:00
Kristen Carlson Accardi a84fc350b4 IP support for PPP
Adds IPCP support, and creates a TUN interface for sending/receiving IP
packets.
2010-03-22 17:28:23 -07:00
Kristen Carlson Accardi 6cb22fe096 CHAP with MD5 authentication support
Authentication support with CHAP and MD5
2010-03-22 17:28:23 -07:00
Kristen Carlson Accardi cd5ddc2bee PPP LCP support
Implement LCP support for the PPP protocol.
2010-03-22 17:28:23 -07:00
Kristen Carlson Accardi 31e99d9d78 Generic PPP control protocol support
Implement a generic protocol that can be shared by both the LCP and the
NCP implementation.
2010-03-22 17:28:23 -07:00
Kristen Carlson Accardi d38443482f Basic PPP protocol support
This patch implements the basic PPP protocol.  LCP, NCP etc. are handled in
a different patch.
2010-03-22 17:28:23 -07:00
Denis Kenzior a8a720d983 Fix: extract line should use S3, not hardcode CR 2010-03-22 12:59:04 -05:00
Denis Kenzior 2583ff626b Refactor: Command line extraction 2010-03-22 12:59:04 -05:00
Denis Kenzior c78805a91b Refactor: Extended command parsing
Make the code more bullet proof and easier to follow
2010-03-22 12:59:04 -05:00
Zhenhua Zhang f9991f929a Add G_AT_SERVER_RESULT_EXT_ERROR 2010-03-22 12:59:04 -05:00
Zhenhua Zhang 7633a54ffd Add g_at_server_register and unregister callback 2010-03-22 12:59:04 -05:00
Zhenhua Zhang 60cf097ffd Add notify at command callback 2010-03-22 12:59:04 -05:00
Zhenhua Zhang 8850d3dc9e Add server at command data structure 2010-03-22 12:59:04 -05:00
Zhenhua Zhang c7828602d4 Add extended command parsing 2010-03-22 12:59:04 -05:00
Zhenhua Zhang 3d4af3eee6 Add framework of server parser
a. The parser fetch and parse one command per loop. The prefix is
the command prefix without parameter. For example, the prefix of
"AT+CLIP=1" is "+CLIP".

b. Search registered notification node in command_list. Invoke the
callback if found.

c. Termiate the execution if the result is an error. Otherwise,
parse next command.
2010-03-22 12:59:04 -05:00
Denis Kenzior 12d97c18a0 Add support for IP based connections to gsmdial 2010-03-18 16:05:47 -05:00
Denis Kenzior 5d8bbb9e5f Fix: Echo everything as soon as received 2010-03-18 14:47:34 -05:00
Zhenhua Zhang 73d92263a6 Refactor add is_basic_command_prefix function 2010-03-18 13:25:56 -05:00
Zhenhua Zhang c57be559d6 Rename parse_v250_settings
To parse_basic_command
2010-03-18 13:24:56 -05:00
Zhenhua Zhang 05209cb701 Rename parse_at_command
To parse_extended_command
2010-03-18 13:24:36 -05:00
Zhenhua Zhang 171a4117fc Rename is_at_command_prefix
To is_extended_command_prefix
2010-03-18 13:24:24 -05:00
Zhenhua Zhang 074c7ff920 Rename g_at_server_send_result
To g_at_server_send_final
2010-03-18 13:24:06 -05:00
Denis Kenzior 8d9f7fda2e Fix: Use g_try_malloc in gatutil 2010-03-16 17:22:56 -05:00
Denis Kenzior 4cbb33fcbd Fix: Use the proper enum type 2010-03-03 13:07:24 -06:00
Zhenhua Zhang 72851607e1 Add command echo back if ATE=1 2010-03-03 13:01:34 -06:00
Denis Kenzior 7be80ef131 Fix: Simplify write-again logic 2010-02-26 16:17:57 -06:00
Denis Kenzior 988fed5951 Fix: Don't allocate buffers if we don't need to 2010-02-26 16:16:46 -06:00
Zhenhua Zhang c6f4d051b2 Add write server response into non-blocking IO
Write server response into non-blocking GIOChannel when we have
G_IO_OUT signal.
2010-02-26 16:10:19 -06:00
Zhenhua Zhang 534898f164 Add write buffer queue for non-blocking write
The head of the queue is the data to be written, the tail is the
free buffer to cache data into.

If the tail of queue is full, allocate a new free buffer and
append it at the tail.
2010-02-26 16:07:33 -06:00
Zhenhua Zhang e96293d5bb Add define for read and write buffer size 2010-02-26 16:04:52 -06:00
Zhenhua Zhang 79b480166c Do not trigger user disconnect at g_at_shutdown
Similar to gatchat, introduce read_watcher_destroy_notify and do
not trigger user disconnect at g_at_shutdown. Delay destroy of
gatserver until read_watcher is destroyed.
2010-02-26 16:04:36 -06:00
Zhenhua Zhang c4073fca00 Rename server_io to channel
To make it consistent with GAtChat.
2010-02-10 16:41:31 -06:00
Zhenhua Zhang c5f962cb18 Replace sprintf with snprintf 2010-02-10 16:41:31 -06:00
Zhenhua Zhang d80bba564e Rename buf to read_buf in GAtServer
Because we may introduce write_buf for sever response buffer.
2010-02-10 16:41:31 -06:00
Denis Kenzior 8d8f5d90a0 Fix: Dead Assignment 2010-02-04 00:00:00 -06:00
Gustavo F. Padovan ed4cf758b7 Remove dead assignments at gatchat 2010-02-03 00:12:49 -06:00
Zhenhua Zhang 2a58101807 Fix change state immediately when meet the slash
According to V.250 spec section 5.2.4 Repeating a command line, if
the prefix "A/" or "a/" is received, we should execute the last
command immediately. No need to meet \r.
2010-02-02 11:31:23 -06:00
Denis Kenzior a4b681f02f Fix: Remove unused label 2010-02-01 18:02:40 -06:00
Denis Kenzior 32e329e7d3 Fix: Don't leak memory 2010-02-01 17:59:29 -06:00
Denis Kenzior 321bb02ee3 Fix: Skip whitespace in AT command line 2010-02-01 17:59:29 -06:00
Denis Kenzior 57d62a0b42 Refactor: Use more flexible parser framework 2010-02-01 17:59:29 -06:00
Zhenhua Zhang de154c6897 Add test case for GAtServer
To implement PTY, TCP, Unix socket example to create GAtServer
instance.
2010-02-01 17:59:28 -06:00
Denis Kenzior 0767f1dbd8 Fix: Check if the command is still pending 2010-02-01 17:59:28 -06:00
Denis Kenzior e6ccc74504 Style: No need for the extra line 2010-02-01 17:59:28 -06:00
Denis Kenzior 263044721e Fix: Don't set variables to NULL/0
These were already set to 0 by g_try_new0
2010-02-01 17:59:28 -06:00
Denis Kenzior b6961b0d68 Refactor: Support max_read attempts like GAtChat 2010-02-01 17:59:28 -06:00
Denis Kenzior 1514997ff1 Fix: Use a function instead of a table 2010-02-01 17:59:28 -06:00
Denis Kenzior 49e0ff2aa6 Refactor: Make enums follow 27.007 Annex B 2010-02-01 17:59:28 -06:00
Denis Kenzior cd1845da6b Fix: Make compile 2010-02-01 17:59:28 -06:00
Zhenhua Zhang df7b1b30dc Add GAtServer basic parsing support
It's the basic skeleton of GAtServer, including new/shutdown, ref/
unref, received_data/parse_buffer and set_discuss/set_debug.

GAtServer is to emulate the server side of AT conversation. It
complies with V.250 and 27.007 spec to accept AT command like
ATV1, ATE0 and extended command like AT+CLCC. Upper layer could
create customize server to expose TTY, tcp or unix socket to
client side application.
2010-02-01 17:59:27 -06:00
Marcel Holtmann 4f3b99e189 Use 3 read attempts when in non-blocking mode 2010-01-28 22:24:04 +01:00
Marcel Holtmann c9a37e4a9a Add new constructor for fully blocking operation 2010-01-28 22:05:44 +01:00
Denis Kenzior fb918d39ba Fix: Take care of uninitialized variable condition
In some (impossible) circumstances rbytes and err might be used
uninitialized.  Here we make a check that a read was actually attempted
before checking those variables.
2010-01-28 14:38:59 -06:00
Marcel Holtmann 839988cfa3 Limit the number of continues read attempts 2010-01-28 12:41:31 +01:00
Denis Kenzior aebda1ac94 Refactor: Reorder argument order
The order of arguments was a bit confusing, reorder them to make more
logical sense.
2010-01-20 14:21:22 -06:00
Zhenhua Zhang 7145edd3a4 Add gatutil.c to share common APIs with GAtServer
Add gatutil.c/h gat.h and move shared typedef and APIs into it.
So that they can be shared by GAtServer and GAtChat.
2010-01-20 14:13:57 -06:00
Denis Kenzior e8d18946b9 Fix: One more fix for disconnect detection
In situations where lots of data is generated by the remote side (e.g.
phonebook is being read) we can get our ring buffer filled up.  In this
case setting rbytes to zero first and then breaking out of the loop
leads to an erroneous disconnect detection.  The fix is to move setting
of rbytes after we know we still have some space.
2010-01-15 10:24:01 -06:00
Denis Kenzior aec5b8a44f Fix: Make remote disconnect detection work 2010-01-14 10:26:12 -06:00
Denis Kenzior 687c84a1ff Style: Various issues 2010-01-12 17:54:37 -06:00
Marcel Holtmann 144080e749 Update copyright information 2010-01-01 17:00:10 -08:00
Marcel Holtmann 2876e1aa64 Unifiy all GAtChat error labels 2009-12-24 07:06:23 -08:00
Denis Kenzior 76e2eb1afc Add legacy mode to gsmdial
Use ATD*99 variety for modems that don't support CGDATA.
2009-12-10 18:14:11 -06:00
Denis Kenzior a41e856cfd Fix: wrong abbreviation for option 2009-12-10 17:49:33 -06:00
Denis Kenzior 7a456aaf7a Add offmode to gsmdial 2009-12-10 17:43:57 -06:00
Denis Kenzior 62d8cf7aa3 Fix: Fix gsmdial to handle MD300
MD300 never sends a CGREG indication, we must query it after CGATT
2009-12-10 17:41:42 -06:00
Denis Kenzior 51e090a283 Add the beginnings of a GSM GPRS dialing app 2009-12-10 17:11:27 -06:00
Denis Kenzior 1d98c226b5 Add g_at_chat_unregister_all function 2009-12-02 19:10:08 -06:00
Denis Kenzior cf98ebb653 Add: g_at_chat_cancel_all function
This will cancel all commands currently queued.
2009-12-02 19:10:04 -06:00
Denis Kenzior 9b5b1057e4 Fix: Sometimes it is possible to cancel first cmd
Commands on the head of the queue can be canceled if none of its bytes
have actually been written to the modem.  This is tracked by
cmd_bytes_written variable.
2009-12-02 15:27:26 -06:00
Denis Kenzior 0d022d3057 Fix: Don't allow cancelation of command id 0 2009-12-02 15:26:56 -06:00
Denis Kenzior 48a61b6d06 Fix: Retry the wakeup command until the modem OKs
The calypso is weird where it doesn't actually wakeup on the first try,
we need to bang its head a few times until it responds
2009-11-26 07:44:25 -06:00
Yang Gu d9acd12fae Framework to support non-standard terminator 2009-11-24 18:06:20 +01:00
Denis Kenzior d6f5ac3767 Fix: Make sure we don't gobble up unsolicited 2009-11-23 19:56:24 -06:00
Andrzej Zaborowski 19187a0ee7 Properly skip over quoted values
Otherwise a left paren in a string can bring an obscure segfault.
2009-11-10 12:59:30 -06:00
Denis Kenzior f83bb9d7b7 Cleanup previous patch and update docs 2009-10-28 16:38:55 -05:00
Ryan Raasch c630300c99 Refactor: Capitalize g_at_tty option names 2009-10-28 16:36:33 -05:00
Zhenhua Zhang 525ca751bd Handle right bracket in next_unquoted_string 2009-10-23 13:39:41 -05:00
Ryan Raasch d1db227d20 Enable / Disable CREAD functionality in gattty 2009-10-21 19:06:43 -05:00
Denis Kenzior feda620c94 Fix: Stop crashing when unrefing chat in callback 2009-10-16 17:46:28 -05:00
Denis Kenzior 43e5152934 Fix: Do not leak chat references in case of error 2009-10-15 16:15:17 -05:00
Denis Kenzior 20dc22a6c4 Fix: Cleanup debug formats 2009-10-15 16:15:17 -05:00
Denis Kenzior d4d1617684 Fix: Do not send shutdown more than once 2009-10-15 16:15:17 -05:00
Denis Kenzior a8af38d209 Fix: Be more paranoid in checking DLC validity 2009-10-15 16:15:17 -05:00
Denis Kenzior 112d07e14e Refactor: Add driver model to GAtMux
GAtMux can now be made to work with multiple multiplexing protocols.
Currently on the 27.010 (07.10) Advanced and Basic modes are supported.
However, further protocol support can be added by providing the
necessary driver functions for GAtMux
2009-10-15 16:15:17 -05:00
Denis Kenzior bcf962c79c Forgot to add void* to get_data 2009-10-15 16:15:17 -05:00
Denis Kenzior 6bfd76123b Forgot to add driverdata functions 2009-10-15 16:15:17 -05:00
Denis Kenzior a4a54f6625 Refactor: Enable multiplexer drivers for GAtMux 2009-10-15 16:15:17 -05:00
Denis Kenzior 1575f2dcd1 Fix: Notify sources upon shutdown 2009-10-15 16:15:16 -05:00
Denis Kenzior 5826fc9c15 Add ability to open/close multiple DLCs 2009-10-15 16:15:16 -05:00
Denis Kenzior 4734ebcb46 Refactor: Add convenience method to start 0710 MUX
Use an existing GAtChat that has been setup appropriately to conver the
channel into a MUX
2009-10-15 16:15:16 -05:00
Denis Kenzior 9aa2182261 Add ability to retrieve the atchat IOChannel 2009-10-15 16:15:16 -05:00
Denis Kenzior 556186eb35 Remove more unused code 2009-10-15 16:15:16 -05:00
Denis Kenzior 4c5cf38ddb Fix: Use DISC on dlc 0 instead of CLD
Some MUX implementations do not seem to support Multiplexer Closedown
(CLD) command.  The standard specifies that sending DISC on DLC 0 should
act exactly the same as CLD.
2009-10-08 12:53:25 -05:00
Denis Kenzior e2415161de Fix: Make compile on some obscure platforms 2009-10-08 12:53:25 -05:00
Denis Kenzior f9db94cd73 Cleanup: Remove more dead code 2009-10-08 12:53:25 -05:00
Denis Kenzior efadf058c3 Cleanup: Get rid of unused member
ctx->server is never set to anything but 0.  This was intended to handle
server side functionality of the GSM 07.10 multiplexer, but never fully
implemented.  Since GAtMux is only really meant for the client side, we
can safely remove this dead code.
2009-10-08 12:53:25 -05:00
Denis Kenzior 273c8b06a0 Get rid of from_tty variant, use gattty instead 2009-10-08 12:53:25 -05:00
Denis Kenzior 7e82686e70 Fix: Make next_hexstring handle optional quotes
Ericsson MBM devices send CRSM information as hex strings, yet enclose
them in quotes which is not according to the standard.
2009-10-02 18:25:56 -05:00
Marcel Holtmann cfbc902287 Add support for switching to a different GAtSyntax at runtime 2009-10-02 12:29:02 +02:00
Marcel Holtmann 729056cb2e Fix missing include for close() function call 2009-10-02 03:25:35 +02:00
Denis Kenzior 6a78e402d3 Replace g_at_chat_new_from_tty with g_at_tty_open 2009-10-01 16:43:19 -05:00
Marcel Holtmann a37f0dbad6 Add skeleton for gsmdial test application 2009-09-24 17:39:09 -07:00
Zhenhua Zhang 78244d6190 Unref GIOChannel in g_at_chat_new_from_tty 2009-09-24 10:01:07 -07:00
Marcel Holtmann c4a5f3a483 Fix trailing whitespace 2009-09-18 13:56:03 -07:00
Denis Kenzior a1e67482bb Simplify cleanup logic 2009-09-18 13:33:22 -05:00
Marcel Holtmann 47b1d09b6e Hook up GAtMux with GSM 07.10 implementation 2009-09-08 09:04:11 +02:00
Marcel Holtmann 8de68799a5 Remove AT command and re-init support from GSM 07.10 2009-09-08 08:51:46 +02:00
Marcel Holtmann abc7a934ee Use NULL for init of function callbacks 2009-09-08 08:39:51 +02:00
Marcel Holtmann 3a0518ec27 Export the GSM 07.10 status flags 2009-09-08 08:26:48 +02:00
Denis Kenzior 2ee7f4a6f8 Fix g_at_chat_unref from command callback
The resources were being used after being freed in this case
2009-09-07 23:21:50 -05:00
Marcel Holtmann 094fdd4e71 Add functions for disconnect and debug handling 2009-09-06 00:31:26 +02:00
Marcel Holtmann c9ba0e7df5 Integrate the multiplexer into the AT chat library 2009-09-06 00:25:16 +02:00
Denis Kenzior 740312f8fb Add GSM Permissive parser 2009-09-04 20:37:48 -05:00
Denis Kenzior 1a1f7d34d2 Add unquoted string capability
This is completely broken according to the standard, but some vendors
use this in their "special" commands.
2009-09-03 23:20:22 -05:00
Denis Kenzior c9d704955c Add PDU listing support 2009-08-31 23:03:35 -05:00
Denis Kenzior 789610389e Fix a problem with CtrlZ echo
When a PDU is submitted and echoed by the modem, the CtrlZ character
is also echoed back.  Fix the parser to handle this case appropriately.
2009-08-29 10:47:16 -05:00
Marcel Holtmann 70aab2a826 Convert to fully non-recursive build system 2009-08-24 23:49:40 -07:00
Denis Kenzior 5e4ff5ced9 Ensure g_timeout_add source can be removed safely 2009-08-07 16:20:59 -05:00
Denis Kenzior a53559e88f Fix trailing whitespace 2009-08-06 17:24:23 -05:00
Denis Kenzior d2c106b4db Be more lenient for PDU lines 2009-08-06 17:05:52 -05:00
Denis Kenzior e3466d9b92 Remove unneeded declarations 2009-08-06 17:05:31 -05:00
Denis Kenzior 88b327cff5 Cleanup the debug support patch 2009-08-06 16:38:46 -05:00
Andres Salomon d66fd48bf9 gatchat: add debugging infrastructure
This patch adds debugging support to GAtChat (specifically of what's going
across the serial line).  Callbacks can be set via g_at_chat_set_debugging,
and that callback is called after any channel reads or writes.
2009-08-06 16:38:45 -05:00
Denis Kenzior 1418c2aec1 Make overflow code a bit better 2009-08-06 16:38:45 -05:00
Denis Kenzior 83820c88b2 Refactor GAtChat to accept user-provided parsers
Intended for really broken modems.  A default 27.007 compliant
parser is provided.
2009-08-06 16:38:39 -05:00
Denis Kenzior 239ab461f7 Fix refcounting in GAtChat 2009-08-06 15:42:23 -05:00
Denis Kenzior d4536b3d2b Fix a crash with unsolicited notifications
When a line comes in from the modem, we check against prefixes
in outstanding commands and unsolicited notifications.  If the
outstanding command has not yet been sent (cmd_bytes_written == 0),
we still check it resulting in access violation.
2009-07-21 14:43:33 -05:00
Denis Kenzior 86864c819c Add extra_pdu_crlf quirk 2009-07-15 15:51:33 -05:00
Denis Kenzior 78a646797c Add set / get flags for GAtChat 2009-07-15 15:51:28 -05:00
Denis Kenzior 3dcf25807a Fix modem wakeup handling 2009-07-15 11:50:04 -05:00
Denis Kenzior 22ad7dc7c5 Fix range handling 2009-07-15 11:49:06 -05:00
Denis Kenzior c74ea2093f Fix case where CMGS returns an error before pdu
Commands like CMGS might return an error before the entire command
has been submitted.  This results in gatchat stalling completely.
2009-07-07 14:34:00 -05:00
Denis Kenzior 595407f65b Fix uninitialized use of bufpos 2009-07-01 10:48:51 -05:00
Marcel Holtmann 08b81f37a1 Add support for opening TTYs directly 2009-06-30 12:53:26 -07:00
Denis Kenzior c91ae28018 Fixes to parser state when command prompt is used 2009-06-19 21:14:00 -05:00
Denis Kenzior b648a112f2 Improve string parsing code
Currently next_string and next_hexstring functions use a static
buffer in the iterator to store the value.  This value is clobbered
as soon as next_string or next_hexstring is called.  Instead,
we copy the entire line in iter_next and use it as a scratch buffer.
The only limitation is that lines of max 2048 are possible, however
these are limited to around this size by parts of the standard.
2009-06-16 16:38:24 -05:00
Denis Kenzior 69372e642e Add g_at_send_listing function 2009-06-16 16:38:19 -05:00
Denis Kenzior 2222e1e38d Additional fixes to multiline responses
The previous fix did not take into account the logic in have_line
function, which takes care of certain modems that do not prefix
their responses by <cr><lf> at all.  This fix should take both
into consideration
2009-06-08 22:45:03 -05:00
Denis Kenzior fafdda30b9 Fix multiline responses in GAtChat
The standard is a bit fuzzy on how multiline responses are returned
GAtChat assumed that they will always start with <cr><lf>, however
this doesn't seem to be correct.  Add a new state which is entered
when a response is obtained.  If <cr> is encountered, then it
is processed regularly, otherwise the parser assumes that the
next line is part of the multiline response
2009-06-08 14:08:18 -05:00
Andrzej Zaborowski 41afb58bd7 Add hex-encoded character string getter to AtChat 2009-05-26 18:15:53 -05:00
Denis Kenzior 64c4276473 Add AT chat library implementation 2009-05-06 14:42:54 -07:00
Marcel Holtmann 4ea27466bf Add directory for AT chat library 2009-05-06 14:42:51 -07:00