Denis Kenzior
19115e0a15
gatchat: Channel is now setup by GAtIO
2010-04-28 17:27:34 -05:00
Denis Kenzior
033b576593
gatchat: Better re-entrancy handling
2010-04-28 17:27:34 -05:00
Denis Kenzior
9c3ae4746e
gsmdial: Get rid of g_at_chat_shutdown usage
2010-04-28 17:27:34 -05:00
Denis Kenzior
d875298404
gsmdial: Unref the chat instead of using shutdown
2010-04-28 17:27:34 -05:00
Denis Kenzior
8645b05c4f
gatmux: Unref the chat instead of using shutdown
2010-04-28 17:27:34 -05:00
Denis Kenzior
f9b2e5cf5a
gatchat: Only set debug on IO if we have it
2010-04-28 17:27:33 -05:00
Denis Kenzior
3aa1faddef
gatchat: Replace shutdown by suspend/resume
...
Shutdown was actually pointless and according to Marcel he only had it
in mind for PPP useage.
2010-04-28 17:27:33 -05:00
Denis Kenzior
7b8f4f5dc8
gatchat: port gatchat to use gatio
2010-04-28 17:27:33 -05:00
Denis Kenzior
43c30e2292
gatio: Remove g_at_io_shutdown
2010-04-28 17:27:33 -05:00
Denis Kenzior
204814da05
gatio: Get re-entrancy correct
2010-04-28 17:27:32 -05:00
Denis Kenzior
c614254ae9
gatio: Style fix for gsource id comparisons
2010-04-28 17:27:32 -05:00
Denis Kenzior
2d2bc8b5b3
gatio: Kill the reader when no more space
2010-04-28 17:27:32 -05:00
Denis Kenzior
f09ce13ad7
gatchat: Remove g_at_chat_set_syntax
...
Never used and too unsafe in its current form
2010-04-28 17:27:32 -05:00
Denis Kenzior
5fc7c1e1d0
gatchat: Add initial GAtIO implementation
2010-04-28 17:27:32 -05:00
Kristen Carlson Accardi
a9c0be7339
ppp: use default ACCM when sending LCP codes 1-7
...
According to the spec, you must transmit all Link Configuration,
Termination, and Code-Reject packets as if no options had been
negotiated. This requires that when encoding we use the
default ACCM of 0xffffffff when sending these types of packets.
2010-04-26 15:31:17 -05:00
Kristen Carlson Accardi
fce78feb54
ppp: discard non-LCP packets in ESTABLISHMENT phase
2010-04-26 12:38:31 -05:00
Marcel Holtmann
cc1975270c
Fix broken HDLC flag handling
2010-04-24 19:12:30 +02:00
Marcel Holtmann
057bd9f0b3
Fix wrong escape character check in HDLC transmit
2010-04-24 19:02:04 +02:00
Marcel Holtmann
46839fbd15
Allow real wrapping around of HDLC transmit ring buffer
2010-04-24 19:00:54 +02:00
Marcel Holtmann
8f05535bb2
Add offset parameter to ring_buffer_write_ptr() function
2010-04-24 18:59:44 +02:00
Marcel Holtmann
9fd7d841c8
Add support for wrapping of HDLC transmit ring buffer
2010-04-24 18:54:34 +02:00
Marcel Holtmann
d2c8f124e6
Use HDLC_FCS helper where possible
2010-04-23 17:22:56 +02:00
Marcel Holtmann
2a609f9054
Use HDLC constants instead of magic numbers
2010-04-23 17:21:49 +02:00
Marcel Holtmann
a31870f542
Add support for wrapping of HDLC receive ring buffer
2010-04-23 17:18:30 +02:00
Denis Kenzior
fa5e8cf56b
ppp: Fix trivial style error
2010-04-22 17:58:29 -05:00
Kristen Carlson Accardi
e98fb9a6bd
ppp: change MTU on TUN device when MRU option received
2010-04-22 17:56:31 -05:00
Denis Kenzior
fde23f113a
ppp: Request MRU if we ever get NAKed with it
...
Huawei E160G hardware seems to NAK our configure request and suggest
that it will never send packets bigger than 1440 bytes. Since we don't
particularly care (our receive ring buffer is 4K, so it can handle 2048
byte packets), we just re-send the Configure Request with the preferred
value.
2010-04-22 15:08:05 -05:00
Denis Kenzior
07280e1bff
ppp: Fix trivial copy paste error
2010-04-22 15:07:42 -05:00
Denis Kenzior
226865272c
ppp: Shut off IPCP when entering TERMINATING phase
2010-04-22 15:05:18 -05:00
Kristen Carlson Accardi
71775550fe
ppp: implement MRU option
...
If the peer requests a MRU option, set the mtu for the network
phase. When we are in link establishment phase, we should
continue to behave as if no option has been set and the peer
should use the default MRU.
This option is required for the Huawei E160G modem.
2010-04-22 07:00:40 +02:00
Marcel Holtmann
123b87de2c
No to check for NULL pointers with g_free
2010-04-15 04:42:03 -07:00
Kristen Carlson Accardi
60643ee287
ppp: nak unknown auth protocol
...
If we are sent a Config-Request for an auth proto other than
CHAP with MD5, send a NAK.
2010-04-14 17:16:03 -05:00
Denis Kenzior
15d93ad0b9
Fix: GAtMux channels should return EAGAIN
...
GAtChat uses non-blocking semantics, so the GAtMux channels should
return the EAGAIN status to make GAtChat work properly.
2010-04-14 10:39:47 -05:00
Denis Kenzior
c8aa645973
ppp: Refing the channel is actually not necessary
...
The read_watch and write_watches both take a ref
2010-04-13 15:57:07 -05:00
Denis Kenzior
8e15816ac1
Fix: Don't try to set channel flags if they're 0
2010-04-13 15:37:05 -05:00
Denis Kenzior
c74e2ab189
ppp: TUN channel should not be opened NONBLOCKING
...
We don't handle it as a nonblocking channel and getting it right would
be a nightmare.
2010-04-13 15:35:55 -05:00
Denis Kenzior
7085818f23
ppp: Cleanup function definitions in ppp.h
2010-04-13 15:32:35 -05:00
Kristen Carlson Accardi
b74a9342d2
ppp: remove pfc and acfc
...
We will not support pfc or acfc
2010-04-13 15:32:35 -05:00
Kristen Carlson Accardi
9c3631f24e
ppp: remove references to magic number
...
We will not support loopback detection.
2010-04-13 15:32:35 -05:00
Denis Kenzior
0aaf98a354
ppp: Get rid of net_open and net_close
...
There really isn't a need for these now
2010-04-13 15:14:40 -05:00
Denis Kenzior
1d939052fc
ppp: Introduce ppp_net_down_notify
2010-04-13 14:59:13 -05:00
Denis Kenzior
d1d73a75fc
ppp: Introduce ppp_net_up_notify and use it
...
This is slightly cleaner way than defining a weird callback function.
2010-04-13 14:55:10 -05:00
Denis Kenzior
6525826455
ppp: Hide ppp_net definition in ppp_net.c
2010-04-13 14:42:59 -05:00
Denis Kenzior
71ddfca269
ppp: Use chap functions directly, instead of auth
2010-04-13 14:21:16 -05:00
Denis Kenzior
18e5e26acb
ppp: Remove auth_ functions from ppp_auth.c
...
These really serve no purpose right now as we use only CHAP. So they
only take up space and make the code harder to read. If we implement
1-3 auth protocols, then they're easier handled inside gatppp.c. If we
have more, then a proper auth driver framework is required.
2010-04-13 14:21:16 -05:00
Denis Kenzior
42f6e8ec6e
ppp: introduce ppp_auth_notify
...
This function will be notified whenever authentication has succeeded /
failed. This can happen in the authentication phase or during the
network phase. If auth fails, then we should proceed to the terminate
phase.
2010-04-13 14:21:16 -05:00
Denis Kenzior
e21bb72df0
ppp: Add set / get password & username
...
Also refactor the set credentials function, we will be removing the auth
object shortly
2010-04-13 14:21:16 -05:00
Denis Kenzior
fed99b9265
ppp: Transition the phase directly
...
Use of the generate event function, while more 'pure' with regard to how
the spec views transitions, actually makes code more difficult to read.
Instead use phase transitions directly inside gatppp. This still bleeds
through a little into lcp code, and probably should be fixed in a better
way eventually.
2010-04-13 14:21:12 -05:00
Denis Kenzior
552db428ef
ppp: Refactor how tls/tlu/tld/tlf are used
...
With the upper layer driving these, the special handling is no longer
required.
2010-04-13 14:00:01 -05:00
Denis Kenzior
9116b7e8f8
ppp: Let the upper layer handle open / up events
...
This removes the need for the layer_started functions in lcp and ipcp.
For LCP the link is always up unless the socket has been closed, and for
IPCP the link should be opened as soon as LCP is ready anyway.
2010-04-13 13:58:12 -05:00
Denis Kenzior
87939c2fcf
Merge: make link
2010-04-13 13:57:03 -05:00
Denis Kenzior
dbbaa3c416
ppp: Reset the options whenever the layer is down
...
So we can re-negotiate the options if the layer is opened again.
2010-04-13 13:34:12 -05:00
Denis Kenzior
8c1677713f
ppp: Rename data to pppcp
2010-04-13 13:27:23 -05:00
Denis Kenzior
843db6f9a5
ppp: unref should mean a hard shutdown
...
This can happen when e.g. the modem is physically removed from the
system and it is not feasible to wait for the nice shutdown state to be
reached.
2010-04-13 12:03:32 -05:00
Denis Kenzior
b916f189f5
ppp: Signal Down & Close when socket is closed
2010-04-13 12:03:32 -05:00
Denis Kenzior
a661dd1583
ppp: Add pppcp_signal_down
...
For use when the link is abruptly terminated by the remote side
2010-04-13 12:03:32 -05:00
Denis Kenzior
f5270cc9bd
ppp: Use pppcp_signal functions directly
...
No real need to wrap them behind lcp_ functions
2010-04-13 12:03:32 -05:00
Denis Kenzior
36d15b4366
ppp: Keep track when read watcher dies
2010-04-13 12:03:32 -05:00
Denis Kenzior
79d81af431
ppp: Remove unused define
2010-04-13 12:03:32 -05:00
Denis Kenzior
6ac0025767
Fix: busy loop in atserver
2010-04-12 22:33:42 -05:00
Marcel Holtmann
7a27cc42fc
Reindent the handler registration inside AT server
2010-04-12 18:13:02 -07:00
Marcel Holtmann
f319e65b99
Use ppp_debug() for PPP CP event debug statements
2010-04-12 18:02:11 -07:00
Marcel Holtmann
143d6db7c3
Remove useless debug in PPP transmit destroy callback
2010-04-12 17:53:29 -07:00
Marcel Holtmann
a977ecf260
Remove various GDestroyNotify function casting
2010-04-12 17:48:20 -07:00
Marcel Holtmann
5b229e60c9
The exit() function should always use positive exit values
2010-04-12 17:37:50 -07:00
Marcel Holtmann
0e178517ce
Fix file descriptor leakage when closing PPP recording
2010-04-12 17:34:24 -07:00
Marcel Holtmann
313eb4f285
The AT+CGDATA command should return CONNECT on success
2010-04-12 16:36:06 -07:00
Marcel Holtmann
9fe2d4c88c
Add fake support for AT+CGDATA and AT+CGDCONT inside AT server
2010-04-12 16:34:13 -07:00
Marcel Holtmann
a21499ca01
Add basic support for emulating AT+CGATT inside AT server
2010-04-12 16:28:59 -07:00
Marcel Holtmann
4add05f4f0
Add basic support for emulating AT+CGREG inside AT server
2010-04-12 16:22:57 -07:00
Marcel Holtmann
5c1da8f6fc
Add basic support for emulating AT+CREG inside AT server
2010-04-12 16:19:34 -07:00
Marcel Holtmann
156904535e
Check for PIN after activating the modem
2010-04-11 18:23:24 +02:00
Marcel Holtmann
3187e46799
Reduce fake CFUN delay to 1 second to make testing simpler
2010-04-11 18:18:01 +02:00
Marcel Holtmann
4e16e48b24
Make CPIN handling of AT server a bit more compliant
2010-04-11 18:14:12 +02:00
Marcel Holtmann
0cafc1646c
Add really simple COPS support to AT command server
2010-04-11 18:10:50 +02:00
Marcel Holtmann
2dab6bc3a6
The user data pointer variable should be called user_data
2010-04-11 17:42:40 +02:00
Marcel Holtmann
0b2014df05
Implement full CFUN handling for AT server
2010-04-11 17:36:34 +02:00
Marcel Holtmann
46e77907b3
Use a ring buffer for non-blocking HDLC output streams
2010-04-11 07:01:14 +02:00
Marcel Holtmann
6ddf874318
Add initial implementation for QCDM test utility
2010-04-10 15:13:23 +02:00
Marcel Holtmann
20b394e72b
Add abstraction for HDLC stream handling
2010-04-10 15:11:46 +02:00
Marcel Holtmann
a9c204effa
Add utility helper for debugging binary blobs
2010-04-10 11:56:11 +02:00
Marcel Holtmann
4c76be6c0d
Add generic receive function definition
2010-04-10 11:54:12 +02:00
Marcel Holtmann
017b4d3955
Check for PIN status to see details in debug output
2010-04-10 09:33:45 +02:00
Marcel Holtmann
8cd991b81f
Add skeleton for QCDM test program
2010-04-10 01:33:47 +02:00
Marcel Holtmann
455884d86e
Remove one empty line and add another one
2010-04-09 17:10:48 +02:00
Marcel Holtmann
df9723db02
Move CRC-CCITT table and helper into separate file
2010-04-09 17:08:30 +02:00
Denis Kenzior
a4921aef11
ppp: Trivial style fix
...
Be more explicit
2010-04-09 08:57:12 -05:00
Denis Kenzior
5a25fd6f11
ppp: Use flags not booleans for ipcp options
2010-04-09 08:55:16 -05:00
Denis Kenzior
c26447d922
ppp: Use flags instead of booleans for lcp options
2010-04-09 08:44:29 -05:00
Denis Kenzior
8f5459ffbc
ppp: Stop the timer when re-starting
...
In case we receive NAK/REJ we should stop and re-start the timer,
otherwise we end up generating multiple Conf-Reqs
2010-04-08 19:47:58 -05:00
Denis Kenzior
cad3223a94
ppp: Rip out the now unused option string stuff
...
Using wireshark is much easier
2010-04-08 16:47:05 -05:00
Denis Kenzior
4f31b6c3b2
ppp: Port LCP to the new option framework
2010-04-08 16:47:05 -05:00
Denis Kenzior
7c3e43be03
ppp: port IPCP to the new option framework
2010-04-08 16:47:05 -05:00
Denis Kenzior
06298becc1
ppp: Rip out the old option processing
...
Put in the new option processing
2010-04-08 16:47:05 -05:00
Denis Kenzior
b803ea8616
ppp: Fix make some functions const correct
2010-04-08 16:47:04 -05:00
Denis Kenzior
9d118c4666
ppp: Make iterators work all the time
2010-04-08 16:46:45 -05:00
Denis Kenzior
c5590d114e
ppp: Move some one-time setters to the proto
2010-04-08 10:40:12 -05:00
Denis Kenzior
4e01f9921e
ppp: Add rca callback
...
When the other side acks our options, then let us apply these options
locally and start using them
2010-04-07 16:41:49 -05:00
Denis Kenzior
5f361d7de9
ppp: Add pppcp option iterators
2010-04-07 16:41:49 -05:00
Denis Kenzior
4a6a381a1d
ppp: Remove lcp_protocol_reject
...
Use pppcp_send_reject_protocol
2010-04-07 16:41:49 -05:00
Denis Kenzior
892ee0a364
ppp: Move pppcp_timer_data private
2010-04-07 16:41:49 -05:00
Denis Kenzior
fc26e6e409
ppp: Cleanup ipcp.c
2010-04-07 16:41:49 -05:00
Denis Kenzior
340013c6ef
ppp: Hide away the magic_number in ppp_lcp.c
2010-04-07 16:41:40 -05:00
Denis Kenzior
1149210e16
ppp: Use auth->proto, not ppp->proto
...
Otherwise we move on to NCP stage prematurely
2010-04-06 23:11:26 -05:00
Denis Kenzior
97ff3d56f4
Fix: Allow setting of tx ACCM
...
Specification is explicit that ACCM defaults to ~0
2010-04-06 22:49:47 -05:00
Denis Kenzior
5e67ee2ff5
ppp: Remove OPTION_ERR, treat errors as reject
2010-04-06 22:49:47 -05:00
Denis Kenzior
e0c8704705
ppp: Verify magic number is not zero
2010-04-06 22:49:47 -05:00
Denis Kenzior
130ac43255
ppp: Move up the look up table definition
2010-04-06 22:49:47 -05:00
Denis Kenzior
f6d23e153e
ppp: Implement receive ACCM
2010-04-06 22:49:44 -05:00
Denis Kenzior
8bff9b6541
Refactor: Make struct pppcp declaration private
2010-04-05 16:55:28 -05:00
Denis Kenzior
04cfa990e2
Refactor: add pppcp_set/get_magic_number
2010-04-05 16:55:07 -05:00
Denis Kenzior
de83e99644
Refactor: add pppcp_set_prefix
2010-04-05 16:46:08 -05:00
Denis Kenzior
97b0aa590d
Refactor: add pppcp_get_ppp
2010-04-05 16:44:00 -05:00
Denis Kenzior
7739af4a26
Refactor: add pppcp_set_option_strings
2010-04-05 16:42:17 -05:00
Denis Kenzior
7b447dd0e2
Refactor: Move valid code selection to ipcp/lcp
...
We already have a set_valid_codes function, let us use it
2010-04-05 16:16:14 -05:00
Denis Kenzior
4f5de3426e
Refactor: Move packet_ops to a static look-up
...
No need to allocate space for this, as it is always the same for all
instances.
2010-04-05 16:14:39 -05:00
Denis Kenzior
48a012c810
Refactor: Make option_scan more type safe
2010-04-05 14:32:11 -05:00
Denis Kenzior
5e8a9c2941
Refactor: Make option_process more typesafe
...
option_process was declared with two gpointer arguments for the sole
reason of being used as a GFunc. Casting to a GFunc or re-writing the
foreach as a loop is preferable.
2010-04-05 14:25:14 -05:00
Denis Kenzior
60d96505dc
Refactor: Add pppcp_set_data & pppcp_get_data
...
Using these functions makes the code much cleaner than trying to pass
the priv pointer everywhere
2010-04-05 14:16:00 -05:00
Marcel Holtmann
331fcaea32
Make pppcp_code enum a private structure
2010-04-05 11:12:43 -07:00
Marcel Holtmann
12ffb2c772
Make pppcp_event_type enum a private structure
2010-04-05 11:05:08 -07:00
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
Zhenhua Zhang
ba35179687
Add test implementation to support SMS
2010-03-31 08:39:43 -05:00
Denis Kenzior
b421d0756b
Refactor: Simplify V250 setting command functions
2010-03-31 08:38:01 -05:00
Denis Kenzior
2ec19b67a2
Refactor: Simplify gatserver s-register functions
2010-03-31 08:22:40 -05:00
Zhenhua Zhang
86b0fa3194
Fix echo command back even if don't process it
2010-03-31 08:12:55 -05:00
Zhenhua Zhang
5819927a38
Add Repeat last command support
2010-03-31 08:10:33 -05:00
Zhenhua Zhang
1390a63933
Add implementation for ATE and other basic command
2010-03-31 08:10:27 -05:00
Zhenhua Zhang
d7eb09cc05
Add implementation for S3, S4, S5 command
2010-03-31 08:10:23 -05:00
Denis Kenzior
e63840ba11
Fix: Make sure we still increment read_count
2010-03-30 22:06:12 -05:00
Zhenhua Zhang
c288921bab
Fix ignore incoming bytes during parsing
...
Server processes one command line at one time, so ignore the rest
incoming bytes during the command parsing.
2010-03-30 21:59:34 -05:00
Denis Kenzior
1f5e785901
Update test-server to the new API
2010-03-30 20:29:25 -05:00
Denis Kenzior
250c0c1ef9
Simplify the send_info API
2010-03-30 20:29:10 -05:00
Denis Kenzior
d7e784d517
Fix: Treat garbage as echo
2010-03-30 19:16:47 -05:00
Denis Kenzior
46ebde6965
Fix: Properly handle async final responses
2010-03-30 19:15:55 -05:00
Denis Kenzior
94eeab3688
Fix: We need to preserve the original line
2010-03-30 17:12:43 -05:00
Denis Kenzior
437c2d8ccf
Fix: Use VERSION define to generate CGMR response
2010-03-30 16:40:44 -05:00
Denis Kenzior
40ca3cb3f5
Fix: Record last received command
2010-03-30 15:25:50 -05:00
Denis Kenzior
a2c4c8e7b6
Fix: Send an ERROR on A/
2010-03-30 15:18:34 -05:00
Denis Kenzior
a77037c099
Add test implementation for CFUN
2010-03-30 15:14:42 -05:00
Denis Kenzior
6b33c5c4e6
Fix: Make sure g_print is followed by a newline
2010-03-30 14:38:06 -05:00
Denis Kenzior
45e6f5cb39
Add initial implementation of cgmr/cgmi/cgmm/cgsn
2010-03-30 14:37:42 -05:00
Denis Kenzior
11a8ccad0a
Fix: SO_REUSEADDR should be set before bind
2010-03-30 14:37:20 -05:00
Denis Kenzior
0448392a91
Refactor: Simplify extended command parsing logic
2010-03-30 14:36:02 -05:00
Denis Kenzior
882b62b640
Refactor: Add a single-line response function
2010-03-30 14:35:29 -05:00
Zhenhua Zhang
cdc13c40b6
Add API stubs for unsolicited / final responses
2010-03-30 12:37:29 -05:00
Denis Kenzior
58e3d14651
Add stubs for test server commands
2010-03-30 12:23:11 -05:00
Denis Kenzior
d171a91ab3
Refactor: tty creation
2010-03-30 12:15:11 -05:00
Marcel Holtmann
cb26fc4a03
Fix use of g_checksum_get_digest() inout argument
2010-03-29 18:13:01 -07:00
Marcel Holtmann
6af6567004
Enable PPP session suport for AT+CGDATA command
2010-03-28 09:15:02 -07:00
Kristen Carlson Accardi
ee294d35b8
ppp: send PPP_FAIL when authentication fails
2010-03-26 23:00:28 -05:00
Marcel Holtmann
834f3af1dc
Fix some comments in dialer example
2010-03-26 19:41:06 -07:00
Marcel Holtmann
fb043af678
Allow empty secrets for CHAP authentication
2010-03-26 19:35:54 -07:00
Marcel Holtmann
95bceddba4
Add support for NBNS server options
2010-03-26 19:25:56 -07:00
Kristen Carlson Accardi
c31bee9fff
ppp: handle Config-Reject
...
if our peer sends us a Config-Reject packet, we must delete that
config item and not request that it be negotiated when we send our
next Config-Request.
2010-03-26 19:19:46 -07:00
Kristen Carlson Accardi
8777e778f3
ppp: use common code to get options from pppcp packet data
2010-03-26 19:19:46 -07:00
Kristen Carlson Accardi
5260379d98
ppp: send Protocol-Reject
...
change ppp_decode to store the length of the decoded frame, so that
if we have a packet with a protocol we don't understand, we can send
Protocol-Reject packets. Modify ppp_cp code to add support for sending
Protocol-Reject packet.
2010-03-26 19:19:46 -07:00
Kristen Carlson Accardi
3772a6401c
ppp: comment fix
...
Put some additional clarification in comment for receiving Code-Reject
and Protocol-Reject packets.
2010-03-26 19:19:46 -07:00
Kristen Carlson Accardi
909ab154a4
ppp: fix segfault in pppcp_send_code_reject()
...
fix memory corruption caused by misplaced paren when memcpying
rejected packet data into Code-Reject packet.
2010-03-26 19:19:46 -07:00
Kristen Carlson Accardi
af63a2b8ee
ppp: change debug output to include control protocol prefix
2010-03-25 12:38:57 -07:00
Marcel Holtmann
1e33e5339d
Fix some small copy-and-paste typos
2010-03-25 08:20:19 -07:00
Marcel Holtmann
c84cb16edd
Check network status to handle auto-registration
2010-03-25 07:33:41 -07:00
Marcel Holtmann
ada2c7f986
Check modem mode before tyring to change it
2010-03-25 07:20:03 -07:00
Kristen Carlson Accardi
5b656cdf34
gsmdial: shutdown ppp link if we have one
...
If we have created a ppp link, shut it down when the signal handler
is called.
2010-03-25 06:50:17 -07:00
Kristen Carlson Accardi
f720a27a1f
separate memory cleanup from PPP shutdown
...
don't free memory at PPP shutdown, because we need to be able to
send terminate traffic. Free memory when we have reached the
PPP_DEAD phase instead.
2010-03-25 06:50:10 -07:00
Kristen Carlson Accardi
06ae2b2c98
add tracing for PPP terminate path
...
Insert some calls to pppcp_trace() for future debugging needs.
2010-03-25 06:50:10 -07:00
Kristen Carlson Accardi
bde388e0d5
remove unneeded debug statement
...
cleanup old debug print statement
2010-03-25 06:50:10 -07:00
Kristen Carlson Accardi
060a195432
use separate timers for PPP config and terminate
...
Prevent conflicts between config timer information and terminate timer
information by providing a new data structure which keeps timer information
for config and terminate requests separate.
2010-03-24 23:04:45 -05:00
Kristen Carlson Accardi
fb40115bf2
switch to g_timeout_add_seconds()
...
we don't care that much about the exactness of our timer, so use
the more power efficient call.
2010-03-24 23:04:42 -05:00
Denis Kenzior
1905d4deda
Fix: Make CONNECT <baud> responses work
2010-03-24 19:42:16 -05:00
Denis Kenzior
9ed01bfecd
Refactor: Simplify parsing logic
...
It isn't actually necessary to check the basic command prefixes, if the
extended prefix doesn't match we try to parse it like a basic command.
That one does the same exact check anyway. If that fails, then this is
not a recognized command line anyway.
2010-03-24 19:41:19 -05:00
Denis Kenzior
a9c089ab34
Refactor basic command parsing
...
Make more bullet proof and efficient
2010-03-24 19:37:18 -05:00
Denis Kenzior
1f99435a42
Fix: Use SO_REUSEADDR in test_server
2010-03-24 19:34:33 -05:00
Denis Kenzior
644d5922b2
Style: foo[0] is preferable to *foo
2010-03-24 16:28:42 -05:00
Denis Kenzior
005ecd5dd9
Fix: Be more paranoid in basic command parsing
2010-03-24 16:28:19 -05:00
Zhenhua Zhang
7c8fa919fa
Add basic command parsing
2010-03-24 16:02:10 -05:00
Denis Kenzior
c1c3b5502e
Style: No point to write a function to wrap g_free
...
Using casting magic works well enough, and more consistent with the rest
of the library.
2010-03-24 15:24:06 -05:00
Kristen Carlson Accardi
efb95941be
fix memory leak in ppp_auth
...
Free packet after calling ppp_transmit()
2010-03-24 13:21:32 -07:00
Kristen Carlson Accardi
7dbd19e441
fix memory leaks after ppp_transmit
...
Free packets in ppp_cp after calling ppp_transmit()
2010-03-24 13:21:31 -07:00
Kristen Carlson Accardi
954e114507
fix memory leaks in option handling
...
free the data as well as the link when deleting options lists.
2010-03-24 13:21:31 -07:00
Marcel Holtmann
b4267dc624
Remove pointless optimization attempt with g_list_length()
2010-03-22 21:43:46 -07:00
Marcel Holtmann
39476a2b54
Use password instead of passwd as variable name
2010-03-22 20:13:55 -07:00
Marcel Holtmann
6cbfe5fa1e
The g_free() function checks for NULL pointers
...
And so does even the free() function from glibc ;)
2010-03-22 20:10:17 -07:00
Marcel Holtmann
e396b7d5af
Unnest some more functions in PPP CP implementation
2010-03-22 20:07:13 -07:00
Marcel Holtmann
91b742730a
Some additional whitespace cleanup for PPP code
2010-03-22 20:01:28 -07:00
Marcel Holtmann
8667c8694d
Fix the broken PPP CP debug trace function
2010-03-22 19:56:53 -07:00
Marcel Holtmann
a09d38643b
Remove some heavy nesting that is not needed at all
2010-03-22 19:32:47 -07:00
Marcel Holtmann
c59a93e6fb
Fix another pointer casting issue on 32-bit systems
2010-03-22 19:29:34 -07:00
Marcel Holtmann
abbd1640f4
Fix pointer casting with uint16 protocol variable
2010-03-22 19:13:22 -07:00
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