Bug Summary

File:libs/spandsp/src/at_interpreter.c
Location:line 224, column 9
Description:Dereference of null pointer

Annotated Source Code

1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * at_interpreter.c - AT command interpreter to V.251, V.252, V.253, T.31 and the 3GPP specs.
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Special thanks to Lee Howard <faxguy@howardsilvan.com>
9 * for his great work debugging and polishing this code.
10 *
11 * Copyright (C) 2004, 2005, 2006 Steve Underwood
12 *
13 * All rights reserved.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 2.1,
17 * as published by the Free Software Foundation.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29/*! \file */
30
31#if defined(HAVE_CONFIG_H1)
32#include "config.h"
33#endif
34
35#if defined(__sun)
36#define __EXTENSIONS__
37#endif
38
39#include <inttypes.h>
40#include <stdlib.h>
41#include <stdio.h>
42#include <fcntl.h>
43#include <memory.h>
44#include <string.h>
45#include <ctype.h>
46#if defined(HAVE_STDBOOL_H1)
47#include <stdbool.h>
48#else
49#include "spandsp/stdbool.h"
50#endif
51#include <assert.h>
52
53#include "spandsp/telephony.h"
54#include "spandsp/alloc.h"
55#include "spandsp/logging.h"
56#include "spandsp/queue.h"
57#include "spandsp/power_meter.h"
58#include "spandsp/complex.h"
59#include "spandsp/tone_generate.h"
60#include "spandsp/async.h"
61#include "spandsp/hdlc.h"
62#include "spandsp/fsk.h"
63#include "spandsp/super_tone_rx.h"
64#include "spandsp/fax_modems.h"
65
66#include "spandsp/at_interpreter.h"
67
68#include "spandsp/private/logging.h"
69#include "spandsp/private/at_interpreter.h"
70
71#define MANUFACTURER"www.soft-switch.org" "www.soft-switch.org"
72#define SERIAL_NUMBER"42" "42"
73#define GLOBAL_OBJECT_IDENTITY"42" "42"
74
75enum
76{
77 ASCII_RESULT_CODES = 1,
78 NUMERIC_RESULT_CODES,
79 NO_RESULT_CODES
80};
81
82static at_profile_t profiles[3] =
83{
84 {
85#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) || defined(__sun)
86 /*.echo =*/ true1,
87 /*.verbose =*/ true1,
88 /*.result_code_format =*/ ASCII_RESULT_CODES,
89 /*.pulse_dial =*/ false0,
90 /*.double_escape =*/ false0,
91 /*.adaptive_receive =*/ false0,
92 /*.s_regs[100] =*/ {0, 0, 0, '\r', '\n', '\b', 1, 60, 5, 0, 0}
93#else
94 .echo = true1,
95 .verbose = true1,
96 .result_code_format = ASCII_RESULT_CODES,
97 .pulse_dial = false0,
98 .double_escape = false0,
99 .adaptive_receive = false0,
100 .s_regs[0] = 0,
101 .s_regs[3] = '\r',
102 .s_regs[4] = '\n',
103 .s_regs[5] = '\b',
104 .s_regs[6] = 1,
105 .s_regs[7] = 60,
106 .s_regs[8] = 5,
107 .s_regs[10] = 0
108#endif
109 }
110};
111
112typedef const char *(*at_cmd_service_t)(at_state_t *s, const char *cmd);
113
114static const char *manufacturer = MANUFACTURER"www.soft-switch.org";
115static const char *model = PACKAGE"spandsp";
116static const char *revision = VERSION"1.99.0";
117
118#define ETX0x03 0x03
119#define DLE0x10 0x10
120#define SUB0x1A 0x1A
121
122static const char *at_response_codes[] =
123{
124 "OK",
125 "CONNECT",
126 "RING",
127 "NO CARRIER",
128 "ERROR",
129 "???",
130 "NO DIALTONE",
131 "BUSY",
132 "NO ANSWER",
133 "+FCERROR",
134 "+FRH:3"
135};
136
137SPAN_DECLARE(const char *)__attribute__((visibility("default"))) const char * at_call_state_to_str(int state)
138{
139 switch (state)
140 {
141 case AT_CALL_EVENT_ALERTING:
142 return "Alerting";
143 case AT_CALL_EVENT_CONNECTED:
144 return "Connected";
145 case AT_CALL_EVENT_ANSWERED:
146 return "Answered";
147 case AT_CALL_EVENT_BUSY:
148 return "Busy";
149 case AT_CALL_EVENT_NO_DIALTONE:
150 return "No dialtone";
151 case AT_CALL_EVENT_NO_ANSWER:
152 return "No answer";
153 case AT_CALL_EVENT_HANGUP:
154 return "Hangup";
155 }
156 /*endswitch*/
157 return "???";
158}
159/*- End of function --------------------------------------------------------*/
160
161SPAN_DECLARE(const char *)__attribute__((visibility("default"))) const char * at_modem_control_to_str(int state)
162{
163 switch (state)
164 {
165 case AT_MODEM_CONTROL_CALL:
166 return "Call";
167 case AT_MODEM_CONTROL_ANSWER:
168 return "Answer";
169 case AT_MODEM_CONTROL_HANGUP:
170 return "Hangup";
171 case AT_MODEM_CONTROL_OFFHOOK:
172 return "Off hook";
173 case AT_MODEM_CONTROL_ONHOOK:
174 return "On hook";
175 case AT_MODEM_CONTROL_DTR:
176 return "DTR";
177 case AT_MODEM_CONTROL_RTS:
178 return "RTS";
179 case AT_MODEM_CONTROL_CTS:
180 return "CTS";
181 case AT_MODEM_CONTROL_CAR:
182 return "CAR";
183 case AT_MODEM_CONTROL_RNG:
184 return "RNG";
185 case AT_MODEM_CONTROL_DSR:
186 return "DSR";
187 case AT_MODEM_CONTROL_SETID:
188 return "Set ID";
189 case AT_MODEM_CONTROL_RESTART:
190 return "Restart";
191 case AT_MODEM_CONTROL_DTE_TIMEOUT:
192 return "DTE timeout";
193 }
194 /*endswitch*/
195 return "???";
196}
197/*- End of function --------------------------------------------------------*/
198
199SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_set_at_rx_mode(at_state_t *s, int new_mode)
200{
201 /* The use of a DTE timeout is mode dependent. Set the timeout appropriately in
202 the modem. */
203 switch (new_mode)
204 {
205 case AT_MODE_HDLC:
206 case AT_MODE_STUFFED:
207 at_modem_control(s, s->dte_inactivity_timeout*1000, (void *) (intptr_t) s->dte_inactivity_timeout);
208 break;
209 default:
210 at_modem_control(s, AT_MODEM_CONTROL_DTE_TIMEOUT, NULL((void*)0));
211 break;
212 }
213 s->at_rx_mode = new_mode;
214}
215/*- End of function --------------------------------------------------------*/
216
217SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_put_response(at_state_t *s, const char *t)
218{
219 uint8_t buf[3];
220
221 buf[0] = s->p.s_regs[3];
222 buf[1] = s->p.s_regs[4];
223 buf[2] = '\0';
224 if (s->p.result_code_format == ASCII_RESULT_CODES)
9
Dereference of null pointer
225 s->at_tx_handler(s->at_tx_user_data, buf, 2);
226 s->at_tx_handler(s->at_tx_user_data, (uint8_t *) t, strlen(t));
227 s->at_tx_handler(s->at_tx_user_data, buf, 2);
228}
229/*- End of function --------------------------------------------------------*/
230
231SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_put_numeric_response(at_state_t *s, int val)
232{
233 char buf[20];
234
235 snprintf(buf, sizeof(buf), "%d", val);
236 at_put_response(s, buf);
237}
238/*- End of function --------------------------------------------------------*/
239
240SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_put_response_code(at_state_t *s, int code)
241{
242 uint8_t buf[20];
243
244 span_log(&s->logging, SPAN_LOG_FLOW, "Sending AT response code %s\n", at_response_codes[code]);
245 switch (s->p.result_code_format)
246 {
247 case ASCII_RESULT_CODES:
248 at_put_response(s, at_response_codes[code]);
249 break;
250 case NUMERIC_RESULT_CODES:
251 snprintf((char *) buf, sizeof(buf), "%d%c", code, s->p.s_regs[3]);
252 s->at_tx_handler(s->at_tx_user_data, buf, strlen((char *) buf));
253 break;
254 default:
255 /* No result codes */
256 break;
257 }
258}
259/*- End of function --------------------------------------------------------*/
260
261static int answer_call(at_state_t *s)
262{
263 if (at_modem_control(s, AT_MODEM_CONTROL_ANSWER, NULL((void*)0)) < 0)
264 return false0;
265 /* Answering should now be in progress. No AT response should be
266 issued at this point. */
267 s->do_hangup = false0;
268 return true1;
269}
270/*- End of function --------------------------------------------------------*/
271
272SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_call_event(at_state_t *s, int event)
273{
274 span_log(&s->logging, SPAN_LOG_FLOW, "Call event %d received\n", event);
275 switch (event)
276 {
277 case AT_CALL_EVENT_ALERTING:
278 at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 1);
279 if (s->display_call_info && !s->call_info_displayed)
280 at_display_call_info(s);
281 at_put_response_code(s, AT_RESPONSE_CODE_RING);
282 if ((++s->rings_indicated) >= s->p.s_regs[0] && s->p.s_regs[0])
283 {
284 /* The modem is set to auto-answer now */
285 answer_call(s);
286 }
287 break;
288 case AT_CALL_EVENT_ANSWERED:
289 at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
290 if (s->fclass_mode == 0)
291 {
292 /* Normal data modem connection */
293 at_set_at_rx_mode(s, AT_MODE_CONNECTED);
294 /* TODO: */
295 }
296 else
297 {
298 /* FAX modem connection */
299 at_set_at_rx_mode(s, AT_MODE_DELIVERY);
300 at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CED_TONE_TX);
301 }
302 break;
303 case AT_CALL_EVENT_CONNECTED:
304 span_log(&s->logging, SPAN_LOG_FLOW, "Dial call - connected. FCLASS=%d\n", s->fclass_mode);
305 at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
306 if (s->fclass_mode == 0)
307 {
308 /* Normal data modem connection */
309 at_set_at_rx_mode(s, AT_MODE_CONNECTED);
310 /* TODO: */
311 }
312 else
313 {
314 if (s->command_dial)
315 {
316 at_put_response_code(s, AT_RESPONSE_CODE_OK);
317 at_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
318 }
319 else
320 {
321 /* FAX modem connection */
322 at_set_at_rx_mode(s, AT_MODE_DELIVERY);
323 if (s->silent_dial)
324 at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE_TX);
325 else
326 at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE_TX);
327 s->dte_is_waiting = true1;
328 }
329 }
330 break;
331 case AT_CALL_EVENT_BUSY:
332 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
333 at_put_response_code(s, AT_RESPONSE_CODE_BUSY);
334 break;
335 case AT_CALL_EVENT_NO_DIALTONE:
336 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
337 at_put_response_code(s, AT_RESPONSE_CODE_NO_DIALTONE);
338 break;
339 case AT_CALL_EVENT_NO_ANSWER:
340 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
341 at_put_response_code(s, AT_RESPONSE_CODE_NO_ANSWER);
342 break;
343 case AT_CALL_EVENT_HANGUP:
344 span_log(&s->logging, SPAN_LOG_FLOW, "Hangup... at_rx_mode %d\n", s->at_rx_mode);
345 at_modem_control(s, AT_MODEM_CONTROL_ONHOOK, NULL((void*)0));
346 if (s->dte_is_waiting)
347 {
348 if (s->ok_is_pending)
349 {
350 at_put_response_code(s, AT_RESPONSE_CODE_OK);
351 s->ok_is_pending = false0;
352 }
353 else
354 {
355 at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
356 }
357 s->dte_is_waiting = false0;
358 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
359 }
360 else if (s->fclass_mode && s->rx_signal_present)
361 {
362 s->rx_data[s->rx_data_bytes++] = DLE0x10;
363 s->rx_data[s->rx_data_bytes++] = ETX0x03;
364 s->at_tx_handler(s->at_tx_user_data, s->rx_data, s->rx_data_bytes);
365 s->rx_data_bytes = 0;
366 }
367 if (s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND && s->at_rx_mode != AT_MODE_ONHOOK_COMMAND)
368 at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
369 s->rx_signal_present = false0;
370 at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
371 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
372 break;
373 default:
374 span_log(&s->logging, SPAN_LOG_WARNING, "Invalid call event %d received.\n", event);
375 break;
376 }
377}
378/*- End of function --------------------------------------------------------*/
379
380SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_reset_call_info(at_state_t *s)
381{
382 at_call_id_t *call_id;
383 at_call_id_t *next;
384
385 for (call_id = s->call_id; call_id; call_id = next)
386 {
387 next = call_id->next;
388 span_free(call_id);
389 }
390 s->call_id = NULL((void*)0);
391 s->rings_indicated = 0;
392 s->call_info_displayed = false0;
393}
394/*- End of function --------------------------------------------------------*/
395
396SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_set_call_info(at_state_t *s, char const *id, char const *value)
397{
398 at_call_id_t *new_call_id;
399 at_call_id_t *call_id;
400
401 /* TODO: We should really not merely ignore a failure to allocate */
402 if ((new_call_id = (at_call_id_t *) span_alloc(sizeof(*new_call_id))) == NULL((void*)0))
403 return;
404 call_id = s->call_id;
405 /* If these strdups fail its pretty harmless. We just appear to not
406 have the relevant field. */
407 new_call_id->id = (id) ? strdup(id)(__extension__ (__builtin_constant_p (id) && ((size_t
)(const void *)((id) + 1) - (size_t)(const void *)(id) == 1) ?
(((const char *) (id))[0] == '\0' ? (char *) calloc ((size_t
) 1, (size_t) 1) : ({ size_t __len = strlen (id) + 1; char *__retval
= (char *) malloc (__len); if (__retval != ((void*)0)) __retval
= (char *) memcpy (__retval, id, __len); __retval; })) : __strdup
(id)))
: NULL((void*)0);
408 new_call_id->value = (value) ? strdup(value)(__extension__ (__builtin_constant_p (value) && ((size_t
)(const void *)((value) + 1) - (size_t)(const void *)(value) ==
1) ? (((const char *) (value))[0] == '\0' ? (char *) calloc (
(size_t) 1, (size_t) 1) : ({ size_t __len = strlen (value) + 1
; char *__retval = (char *) malloc (__len); if (__retval != (
(void*)0)) __retval = (char *) memcpy (__retval, value, __len
); __retval; })) : __strdup (value)))
: NULL((void*)0);
409 new_call_id->next = NULL((void*)0);
410
411 if (call_id)
412 {
413 while (call_id->next)
414 call_id = call_id->next;
415 call_id->next = new_call_id;
416 }
417 else
418 {
419 s->call_id = new_call_id;
420 }
421}
422/*- End of function --------------------------------------------------------*/
423
424SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_display_call_info(at_state_t *s)
425{
426 char buf[132 + 1];
427 at_call_id_t *call_id = s->call_id;
428
429 while (call_id)
430 {
431 snprintf(buf,
432 sizeof(buf),
433 "%s=%s",
434 (call_id->id) ? call_id->id : "NULL",
435 (call_id->value) ? call_id->value : "<NONE>");
436 at_put_response(s, buf);
437 call_id = call_id->next;
438 }
439 s->call_info_displayed = true1;
440}
441/*- End of function --------------------------------------------------------*/
442
443static int parse_num(const char **s, int max_value)
444{
445 int i;
446
447 /* The spec. says no digits is valid, and should be treated as zero. */
448 i = 0;
449 while (isdigit((int) **s)((*__ctype_b_loc ())[(int) (((int) **s))] & (unsigned short
int) _ISdigit)
)
450 {
451 i = i*10 + ((**s) - '0');
452 (*s)++;
453 }
454 if (i > max_value)
455 i = -1;
456 return i;
457}
458/*- End of function --------------------------------------------------------*/
459
460static int parse_hex_num(const char **s, int max_value)
461{
462 int i;
463
464 /* The spec. says a hex value is always 2 digits, and the alpha digits are
465 upper case. */
466 if (isdigit((int) **s)((*__ctype_b_loc ())[(int) (((int) **s))] & (unsigned short
int) _ISdigit)
)
467 i = **s - '0';
468 else if (**s >= 'A' && **s <= 'F')
469 i = **s - 'A';
470 else
471 return -1;
472 (*s)++;
473
474 if (isdigit((int) **s)((*__ctype_b_loc ())[(int) (((int) **s))] & (unsigned short
int) _ISdigit)
)
475 i = (i << 4) | (**s - '0');
476 else if (**s >= 'A' && **s <= 'F')
477 i = (i << 4) | (**s - 'A');
478 else
479 return -1;
480 (*s)++;
481 if (i > max_value)
482 i = -1;
483 return i;
484}
485/*- End of function --------------------------------------------------------*/
486
487static int match_element(const char **variant, const char *variants)
488{
489 int i;
490 size_t len;
491 char const *s;
492 char const *t;
493
494 s = variants;
495 for (i = 0; *s; i++)
496 {
497 if ((t = strchr(s, ',')(__extension__ (__builtin_constant_p (',') && !__builtin_constant_p
(s) && (',') == '\0' ? (char *) __rawmemchr (s, ',')
: __builtin_strchr (s, ',')))
))
498 len = t - s;
499 else
500 len = strlen(s);
501 if (len == (int) strlen(*variant) && memcmp(*variant, s, len) == 0)
502 {
503 *variant += len;
504 return i;
505 }
506 s += len;
507 if (*s == ',')
508 s++;
509 }
510 return -1;
511}
512/*- End of function --------------------------------------------------------*/
513
514static int parse_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def)
515{
516 char buf[100];
517 int val;
518
519 switch (*(*t)++)
3
Control jumps to 'case 63:' at line 539
520 {
521 case '=':
522 switch (**t)
523 {
524 case '?':
525 /* Show possible values */
526 (*t)++;
527 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
528 at_put_response(s, buf);
529 break;
530 default:
531 /* Set value */
532 if ((val = parse_num(t, max_value)) < 0)
533 return false0;
534 if (target)
535 *target = val;
536 break;
537 }
538 break;
539 case '?':
540 /* Show current value */
541 val = (target) ? *target : 0;
4
Assuming 'target' is null
5
'?' condition is false
542 snprintf(buf, sizeof(buf), "%s%d", (prefix) ? prefix : "", val);
6
'?' condition is false
543 at_put_response(s, buf);
7
Passing null pointer value via 1st parameter 's'
8
Calling 'at_put_response'
544 break;
545 default:
546 return false0;
547 }
548 return true1;
549}
550/*- End of function --------------------------------------------------------*/
551
552static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_value1, int *target2, int max_value2, const char *prefix, const char *def)
553{
554 char buf[100];
555 int val1;
556 int val2;
557
558 switch (*(*t)++)
559 {
560 case '=':
561 switch (**t)
562 {
563 case '?':
564 /* Show possible values */
565 (*t)++;
566 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
567 at_put_response(s, buf);
568 break;
569 default:
570 /* Set value */
571 if ((val1 = parse_num(t, max_value1)) < 0)
572 return false0;
573 if (target1)
574 *target1 = val1;
575 if (**t == ',')
576 {
577 (*t)++;
578 if ((val2 = parse_num(t, max_value2)) < 0)
579 return false0;
580 if (target2)
581 *target2 = val2;
582 }
583 break;
584 }
585 break;
586 case '?':
587 /* Show current value */
588 val1 = (target1) ? *target1 : 0;
589 val2 = (target2) ? *target2 : 0;
590 snprintf(buf, sizeof(buf), "%s%d,%d", (prefix) ? prefix : "", val1, val2);
591 at_put_response(s, buf);
592 break;
593 default:
594 return false0;
595 }
596 return true1;
597}
598/*- End of function --------------------------------------------------------*/
599
600static int parse_n_out(at_state_t *s,
601 const char **t,
602 int *targets[],
603 const int max_values[],
604 int entries,
605 const char *prefix,
606 const char *def)
607{
608 char buf[100];
609 int val;
610 int len;
611 int i;
612
613 switch (*(*t)++)
614 {
615 case '=':
616 switch (**t)
617 {
618 case '?':
619 /* Show possible values */
620 (*t)++;
621 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
622 at_put_response(s, buf);
623 break;
624 default:
625 /* Set value */
626 for (i = 0; i < entries; i++)
627 {
628 if ((val = parse_num(t, max_values[i])) < 0)
629 return false0;
630 if (targets[i])
631 *targets[i] = val;
632 if (**t != ',')
633 break;
634 (*t)++;
635 }
636 break;
637 }
638 break;
639 case '?':
640 /* Show current value */
641 len = snprintf(buf, sizeof(buf), "%s", (prefix) ? prefix : "");
642 for (i = 0; i < entries; i++)
643 {
644 if (i > 0)
645 len += snprintf(&buf[len], sizeof(buf) - len, ",");
646 val = (targets[i]) ? *targets[i] : 0;
647 len += snprintf(&buf[len], sizeof(buf) - len, "%d", val);
648 }
649 at_put_response(s, buf);
650 break;
651 default:
652 return false0;
653 }
654 return true1;
655}
656/*- End of function --------------------------------------------------------*/
657
658static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def)
659{
660 char buf[100];
661 int val;
662
663 switch (*(*t)++)
664 {
665 case '=':
666 switch (**t)
667 {
668 case '?':
669 /* Show possible values */
670 (*t)++;
671 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
672 at_put_response(s, buf);
673 break;
674 default:
675 /* Set value */
676 if ((val = parse_hex_num(t, max_value)) < 0)
677 return false0;
678 if (target)
679 *target = val;
680 break;
681 }
682 break;
683 case '?':
684 /* Show current value */
685 val = (target) ? *target : 0;
686 snprintf(buf, sizeof(buf), "%s%02X", (prefix) ? prefix : "", val);
687 at_put_response(s, buf);
688 break;
689 default:
690 return false0;
691 }
692 return true1;
693}
694/*- End of function --------------------------------------------------------*/
695
696static int parse_string_list_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def)
697{
698 char buf[100];
699 int val;
700 size_t len;
701 char *tmp;
702
703 switch (*(*t)++)
704 {
705 case '=':
706 switch (**t)
707 {
708 case '?':
709 /* Show possible values */
710 (*t)++;
711 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
712 at_put_response(s, buf);
713 break;
714 default:
715 /* Set value */
716 if ((val = match_element(t, def)) < 0)
717 return false0;
718 if (target)
719 *target = val;
720 break;
721 }
722 break;
723 case '?':
724 /* Show current index value from def */
725 val = (target) ? *target : 0;
726 while (val-- && (def = strchr(def, ',')(__extension__ (__builtin_constant_p (',') && !__builtin_constant_p
(def) && (',') == '\0' ? (char *) __rawmemchr (def, ','
) : __builtin_strchr (def, ',')))
))
727 def++;
728 if (def)
729 {
730 if ((tmp = strchr(def, ',')(__extension__ (__builtin_constant_p (',') && !__builtin_constant_p
(def) && (',') == '\0' ? (char *) __rawmemchr (def, ','
) : __builtin_strchr (def, ',')))
))
731 len = tmp - def;
732 else
733 len = strlen(def);
734 snprintf(buf, sizeof(buf), "%s%.*s", (prefix) ? prefix : "", (int) len, def);
735 }
736 else
737 {
738 buf[0] = '\0';
739 }
740 at_put_response(s, buf);
741 break;
742 default:
743 return false0;
744 }
745 return true1;
746}
747/*- End of function --------------------------------------------------------*/
748
749static int parse_string_out(at_state_t *s, const char **t, char **target, const char *prefix)
750{
751 char buf[100];
752
753 switch (*(*t)++)
754 {
755 case '=':
756 switch (**t)
757 {
758 case '?':
759 /* Show possible values */
760 (*t)++;
761 snprintf(buf, sizeof(buf), "%s", (prefix) ? prefix : "");
762 at_put_response(s, buf);
763 break;
764 default:
765 /* Set value */
766 if (*target)
767 span_free(*target);
768 /* If this strdup fails, it should be harmless */
769 *target = strdup(*t)(__extension__ (__builtin_constant_p (*t) && ((size_t
)(const void *)((*t) + 1) - (size_t)(const void *)(*t) == 1) ?
(((const char *) (*t))[0] == '\0' ? (char *) calloc ((size_t
) 1, (size_t) 1) : ({ size_t __len = strlen (*t) + 1; char *__retval
= (char *) malloc (__len); if (__retval != ((void*)0)) __retval
= (char *) memcpy (__retval, *t, __len); __retval; })) : __strdup
(*t)))
;
770 break;
771 }
772 break;
773 case '?':
774 /* Show current index value */
775 at_put_response(s, (*target) ? *target : "");
776 break;
777 default:
778 return false0;
779 }
780 while (**t)
781 (*t)++;
782 return true1;
783}
784/*- End of function --------------------------------------------------------*/
785
786static const char *s_reg_handler(at_state_t *s, const char *t, int reg)
787{
788 int val;
789 int b;
790 char buf[4];
791
792 /* Set or get an S register */
793 switch (*t++)
794 {
795 case '=':
796 switch (*t)
797 {
798 case '?':
799 t++;
800 snprintf(buf, sizeof(buf), "%3.3d", 0);
801 at_put_response(s, buf);
802 break;
803 default:
804 if ((val = parse_num(&t, 255)) < 0)
805 return NULL((void*)0);
806 s->p.s_regs[reg] = (uint8_t) val;
807 break;
808 }
809 break;
810 case '?':
811 snprintf(buf, sizeof(buf), "%3.3d", s->p.s_regs[reg]);
812 at_put_response(s, buf);
813 break;
814 case '.':
815 if ((b = parse_num(&t, 7)) < 0)
816 return NULL((void*)0);
817 switch (*t++)
818 {
819 case '=':
820 switch (*t)
821 {
822 case '?':
823 t++;
824 at_put_numeric_response(s, 0);
825 break;
826 default:
827 if ((val = parse_num(&t, 1)) < 0)
828 return NULL((void*)0);
829 if (val)
830 s->p.s_regs[reg] |= (1 << b);
831 else
832 s->p.s_regs[reg] &= ~(1 << b);
833 break;
834 }
835 break;
836 case '?':
837 at_put_numeric_response(s, (int) ((s->p.s_regs[reg] >> b) & 1));
838 break;
839 default:
840 return NULL((void*)0);
841 }
842 break;
843 default:
844 return NULL((void*)0);
845 }
846 return t;
847}
848/*- End of function --------------------------------------------------------*/
849
850static int process_class1_cmd(at_state_t *s, const char **t)
851{
852 int val;
853 int operation;
854 int direction;
855 int result;
856 const char *allowed;
857
858 direction = (*(*t + 2) == 'T');
859 operation = *(*t + 3);
860 /* Step past the "+Fxx" */
861 *t += 4;
862 switch (operation)
863 {
864 case 'S':
865 allowed = "0-255";
866 break;
867 case 'H':
868 allowed = "3";
869 break;
870 default:
871 allowed = "24,48,72,73,74,96,97,98,121,122,145,146";
872 break;
873 }
874
875 val = -1;
876 if (!parse_out(s, t, &val, 255, NULL((void*)0), allowed))
877 return true1;
878 if (val < 0)
879 {
880 /* It was just a query */
881 return true1;
882 }
883 /* All class 1 FAX commands are supposed to give an ERROR response, if the phone
884 is on-hook. */
885 if (s->at_rx_mode == AT_MODE_ONHOOK_COMMAND)
886 return false0;
887
888 result = true1;
889 if (s->class1_handler)
890 result = s->class1_handler(s->class1_user_data, direction, operation, val);
891 switch (result)
892 {
893 case 0:
894 /* Inhibit an immediate response. (These commands should not be part of a multi-command entry.) */
895 *t = (const char *) -1;
896 return true1;
897 case -1:
898 return false0;
899 }
900 return true1;
901}
902/*- End of function --------------------------------------------------------*/
903
904static const char *at_cmd_dummy(at_state_t *s, const char *t)
905{
906 /* Dummy routine to absorb delimiting characters from a command string */
907 return t + 1;
908}
909/*- End of function --------------------------------------------------------*/
910
911static const char *at_cmd_A(at_state_t *s, const char *t)
912{
913 /* V.250 6.3.5 - Answer (abortable) */
914 if (!answer_call(s))
915 return NULL((void*)0);
916 return (const char *) -1;
917}
918/*- End of function --------------------------------------------------------*/
919
920static const char *at_cmd_D(at_state_t *s, const char *t)
921{
922 char *u;
923 char num[100 + 1];
924 char ch;
925
926 /* V.250 6.3.1 - Dial (abortable) */
927 at_reset_call_info(s);
928 s->do_hangup = false0;
929 s->silent_dial = false0;
930 s->command_dial = false0;
931 t += 1;
932 /* There are a numbers of options in a dial command string.
933 Many are completely irrelevant in this application. */
934 u = num;
935 for ( ; (ch = *t); t++)
936 {
937 if (isdigit((int) ch)((*__ctype_b_loc ())[(int) (((int) ch))] & (unsigned short
int) _ISdigit)
)
938 {
939 /* V.250 6.3.1.1 Basic digit set */
940 *u++ = ch;
941 }
942 else
943 {
944 switch (ch)
945 {
946 case 'A':
947 case 'B':
948 case 'C':
949 case 'D':
950 case '*':
951 case '#':
952 /* V.250 6.3.1.1 Full DTMF repertoire */
953 if (!s->p.pulse_dial)
954 *u++ = ch;
955 break;
956 case ' ':
957 case '-':
958 /* Ignore spaces and dashes */
959 /* This is not a standards based thing. It just improves
960 compatibility with some other modems. */
961 break;
962 case '+':
963 /* V.250 6.3.1.1 International access code */
964 /* TODO: */
965 break;
966 case ',':
967 /* V.250 6.3.1.2 Pause */
968 /* Pass these through to the application to handle. */
969 *u++ = ch;
970 break;
971 case 'T':
972 /* V.250 6.3.1.3 Tone dial */
973 s->p.pulse_dial = false0;
974 break;
975 case 'P':
976 /* V.250 6.3.1.4 Pulse dial */
977 s->p.pulse_dial = true1;
978 break;
979 case '!':
980 /* V.250 6.3.1.5 Hook flash, register recall */
981 /* TODO: */
982 break;
983 case 'W':
984 /* V.250 6.3.1.6 Wait for dial tone */
985 /* TODO: */
986 break;
987 case '@':
988 /* V.250 6.3.1.7 Wait for quiet answer */
989 s->silent_dial = true1;
990 break;
991 case 'S':
992 /* V.250 6.3.1.8 Invoke stored string */
993 /* S=<location> */
994 /* TODO: */
995 break;
996 case 'G':
997 case 'g':
998 /* GSM07.07 6.2 - Control the CUG supplementary service for this call */
999 /* Uses index and info values set with command +CCUG. See +CCUG */
1000 /* TODO: */
1001 break;
1002 case 'I':
1003 case 'i':
1004 /* GSM07.07 6.2 - Override Calling Line Identification Restriction (CLIR) */
1005 /* I=invocation (restrict CLI presentation), i=suppression (allow CLI presentation). See +CLIR */
1006 /* TODO: */
1007 break;
1008 case ';':
1009 /* V.250 6.3.1 - Dial string terminator - make voice call and remain in command mode */
1010 s->command_dial = true1;
1011 break;
1012 case '>':
1013 /* GSM07.07 6.2 - Direct dialling from phone book supplementary service subscription
1014 default value for this call */
1015 /* TODO: */
1016 break;
1017 default:
1018 return NULL((void*)0);
1019 }
1020 }
1021 }
1022 *u = '\0';
1023 if (at_modem_control(s, AT_MODEM_CONTROL_CALL, num) < 0)
1024 return NULL((void*)0);
1025 /* Dialing should now be in progress. No AT response should be
1026 issued at this point. */
1027 return (const char *) -1;
1028}
1029/*- End of function --------------------------------------------------------*/
1030
1031static const char *at_cmd_E(at_state_t *s, const char *t)
1032{
1033 int val;
1034
1035 /* V.250 6.2.4 - Command echo */
1036 t += 1;
1037 if ((val = parse_num(&t, 1)) < 0)
1038 return NULL((void*)0);
1039 s->p.echo = val;
1040 return t;
1041}
1042/*- End of function --------------------------------------------------------*/
1043
1044static const char *at_cmd_H(at_state_t *s, const char *t)
1045{
1046 int val;
1047
1048 /* V.250 6.3.6 - Hook control */
1049 t += 1;
1050 if ((val = parse_num(&t, 1)) < 0)
1051 return NULL((void*)0);
1052 if (val)
1053 {
1054 /* Take the receiver off-hook, effectively busying-out the modem. */
1055 if (s->at_rx_mode != AT_MODE_ONHOOK_COMMAND && s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND)
1056 return NULL((void*)0);
1057 at_modem_control(s, AT_MODEM_CONTROL_OFFHOOK, NULL((void*)0));
1058 at_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
1059 return t;
1060 }
1061 at_reset_call_info(s);
1062 if (s->at_rx_mode != AT_MODE_ONHOOK_COMMAND && s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND)
1063 {
1064 /* Push out the last of the audio (probably by sending a short silence). */
1065 at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_FLUSH);
1066 s->do_hangup = true1;
1067 at_set_at_rx_mode(s, AT_MODE_CONNECTED);
1068 return (const char *) -1;
1069 }
1070 at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL((void*)0));
1071 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
1072 return t;
1073}
1074/*- End of function --------------------------------------------------------*/
1075
1076static const char *at_cmd_I(at_state_t *s, const char *t)
1077{
1078 int val;
1079
1080 /* V.250 6.1.3 - Request identification information */
1081 /* N.B. The information supplied in response to an ATIx command is very
1082 variable. It was widely used in different ways before the AT command
1083 set was standardised by the ITU. */
1084 t += 1;
1085 switch (val = parse_num(&t, 255))
1086 {
1087 case 0:
1088 at_put_response(s, model);
1089 break;
1090 case 3:
1091 at_put_response(s, manufacturer);
1092 break;
1093 default:
1094 return NULL((void*)0);
1095 }
1096 return t;
1097}
1098/*- End of function --------------------------------------------------------*/
1099
1100static const char *at_cmd_L(at_state_t *s, const char *t)
1101{
1102 int val;
1103
1104 /* V.250 6.3.13 - Monitor speaker loudness */
1105 /* Just absorb this command, as we have no speaker */
1106 t += 1;
1107 if ((val = parse_num(&t, 255)) < 0)
1108 return NULL((void*)0);
1109 s->speaker_volume = val;
1110 return t;
1111}
1112/*- End of function --------------------------------------------------------*/
1113
1114static const char *at_cmd_M(at_state_t *s, const char *t)
1115{
1116 int val;
1117
1118 /* V.250 6.3.14 - Monitor speaker mode */
1119 /* Just absorb this command, as we have no speaker */
1120 t += 1;
1121 if ((val = parse_num(&t, 255)) < 0)
1122 return NULL((void*)0);
1123 s->speaker_mode = val;
1124 return t;
1125}
1126/*- End of function --------------------------------------------------------*/
1127
1128static const char *at_cmd_O(at_state_t *s, const char *t)
1129{
1130 int val;
1131
1132 /* V.250 6.3.7 - Return to online data state */
1133 t += 1;
1134 if ((val = parse_num(&t, 1)) < 0)
1135 return NULL((void*)0);
1136 if (val == 0)
1137 {
1138 at_set_at_rx_mode(s, AT_MODE_CONNECTED);
1139 at_put_response_code(s, AT_RESPONSE_CODE_CONNECT);
1140 }
1141 return t;
1142}
1143/*- End of function --------------------------------------------------------*/
1144
1145static const char *at_cmd_P(at_state_t *s, const char *t)
1146{
1147 /* V.250 6.3.3 - Select pulse dialling (command) */
1148 t += 1;
1149 s->p.pulse_dial = true1;
1150 return t;
1151}
1152/*- End of function --------------------------------------------------------*/
1153
1154static const char *at_cmd_Q(at_state_t *s, const char *t)
1155{
1156 int val;
1157
1158 /* V.250 6.2.5 - Result code suppression */
1159 t += 1;
1160 if ((val = parse_num(&t, 1)) < 0)
1161 return NULL((void*)0);
1162 switch (val)
1163 {
1164 case 0:
1165 s->p.result_code_format = (s->p.verbose) ? ASCII_RESULT_CODES : NUMERIC_RESULT_CODES;
1166 break;
1167 case 1:
1168 s->p.result_code_format = NO_RESULT_CODES;
1169 break;
1170 }
1171 return t;
1172}
1173/*- End of function --------------------------------------------------------*/
1174
1175static const char *at_cmd_S0(at_state_t *s, const char *t)
1176{
1177 /* V.250 6.3.8 - Automatic answer */
1178 t += 2;
1179 return s_reg_handler(s, t, 0);
1180}
1181/*- End of function --------------------------------------------------------*/
1182
1183static const char *at_cmd_S10(at_state_t *s, const char *t)
1184{
1185 /* V.250 6.3.12 - Automatic disconnect delay */
1186 t += 3;
1187 return s_reg_handler(s, t, 10);
1188}
1189/*- End of function --------------------------------------------------------*/
1190
1191static const char *at_cmd_S3(at_state_t *s, const char *t)
1192{
1193 /* V.250 6.2.1 - Command line termination character */
1194 t += 2;
1195 return s_reg_handler(s, t, 3);
1196}
1197/*- End of function --------------------------------------------------------*/
1198
1199static const char *at_cmd_S4(at_state_t *s, const char *t)
1200{
1201 /* V.250 6.2.2 - Response formatting character */
1202 t += 2;
1203 return s_reg_handler(s, t, 4);
1204}
1205/*- End of function --------------------------------------------------------*/
1206
1207static const char *at_cmd_S5(at_state_t *s, const char *t)
1208{
1209 /* V.250 6.2.3 - Command line editing character */
1210 t += 2;
1211 return s_reg_handler(s, t, 5);
1212}
1213/*- End of function --------------------------------------------------------*/
1214
1215static const char *at_cmd_S6(at_state_t *s, const char *t)
1216{
1217 /* V.250 6.3.9 - Pause before blind dialling */
1218 t += 2;
1219 return s_reg_handler(s, t, 6);
1220}
1221/*- End of function --------------------------------------------------------*/
1222
1223static const char *at_cmd_S7(at_state_t *s, const char *t)
1224{
1225 /* V.250 6.3.10 - Connection completion timeout */
1226 t += 2;
1227 return s_reg_handler(s, t, 7);
1228}
1229/*- End of function --------------------------------------------------------*/
1230
1231static const char *at_cmd_S8(at_state_t *s, const char *t)
1232{
1233 /* V.250 6.3.11 - Comma dial modifier time */
1234 t += 2;
1235 return s_reg_handler(s, t, 8);
1236}
1237/*- End of function --------------------------------------------------------*/
1238
1239static const char *at_cmd_T(at_state_t *s, const char *t)
1240{
1241 /* V.250 6.3.2 - Select tone dialling (command) */
1242 t += 1;
1243 s->p.pulse_dial = false0;
1244 return t;
1245}
1246/*- End of function --------------------------------------------------------*/
1247
1248static const char *at_cmd_V(at_state_t *s, const char *t)
1249{
1250 int val;
1251
1252 /* V.250 6.2.6 - DCE response format */
1253 t += 1;
1254 if ((val = parse_num(&t, 1)) < 0)
1255 return NULL((void*)0);
1256 s->p.verbose = val;
1257 if (s->p.result_code_format != NO_RESULT_CODES)
1258 s->p.result_code_format = (s->p.verbose) ? ASCII_RESULT_CODES : NUMERIC_RESULT_CODES;
1259 return t;
1260}
1261/*- End of function --------------------------------------------------------*/
1262
1263static const char *at_cmd_X(at_state_t *s, const char *t)
1264{
1265 int val;
1266
1267 /* V.250 6.2.7 - Result code selection and call progress monitoring control */
1268 /* 0 CONNECT result code is given upon entering online data state.
1269 Dial tone and busy detection are disabled.
1270 1 CONNECT <text> result code is given upon entering online data state.
1271 Dial tone and busy detection are disabled.
1272 2 CONNECT <text> result code is given upon entering online data state.
1273 Dial tone detection is enabled, and busy detection is disabled.
1274 3 CONNECT <text> result code is given upon entering online data state.
1275 Dial tone detection is disabled, and busy detection is enabled.
1276 4 CONNECT <text> result code is given upon entering online data state.
1277 Dial tone and busy detection are both enabled. */
1278 t += 1;
1279 if ((val = parse_num(&t, 4)) < 0)
1280 return NULL((void*)0);
1281 s->result_code_mode = val;
1282 return t;
1283}
1284/*- End of function --------------------------------------------------------*/
1285
1286static const char *at_cmd_Z(at_state_t *s, const char *t)
1287{
1288 int val;
1289
1290 /* V.250 6.1.1 - Reset to default configuration */
1291 t += 1;
1292 if ((val = parse_num(&t, sizeof(profiles)/sizeof(profiles[0]) - 1)) < 0)
1293 return NULL((void*)0);
1294 /* Just make sure we are on hook */
1295 at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL((void*)0));
1296 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
1297 s->p = profiles[val];
1298 at_reset_call_info(s);
1299 return t;
1300}
1301/*- End of function --------------------------------------------------------*/
1302
1303static const char *at_cmd_amp_C(at_state_t *s, const char *t)
1304{
1305 int val;
1306
1307 /* V.250 6.2.8 - Circuit 109 (received line signal detector) behaviour */
1308 /* We have no RLSD pin, so just absorb this. */
1309 t += 2;
1310 if ((val = parse_num(&t, 1)) < 0)
1311 return NULL((void*)0);
1312 s->rlsd_behaviour = val;
1313 return t;
1314}
1315/*- End of function --------------------------------------------------------*/
1316
1317static const char *at_cmd_amp_D(at_state_t *s, const char *t)
1318{
1319 int val;
1320
1321 /* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */
1322 t += 2;
1323 if ((val = parse_num(&t, 2)) < 0)
1324 return NULL((void*)0);
1325 /* TODO: We have no DTR pin, but we need this to get into online
1326 command state. */
1327 s->dtr_behaviour = val;
1328 return t;
1329}
1330/*- End of function --------------------------------------------------------*/
1331
1332static const char *at_cmd_amp_F(at_state_t *s, const char *t)
1333{
1334 t += 2;
1335
1336 /* V.250 6.1.2 - Set to factory-defined configuration */
1337 /* Just make sure we are on hook */
1338 at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL((void*)0));
1339 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
1340 s->p = profiles[0];
1341 return t;
1342}
1343/*- End of function --------------------------------------------------------*/
1344
1345static const char *at_cmd_plus_A8A(at_state_t *s, const char *t)
1346{
1347 /* V.251 6.3 - V.8 calling tone indication */
1348 return t;
1349}
1350/*- End of function --------------------------------------------------------*/
1351
1352static const char *at_cmd_plus_A8C(at_state_t *s, const char *t)
1353{
1354 /* V.251 6.2 - V.8 answer signal indication */
1355 return t;
1356}
1357/*- End of function --------------------------------------------------------*/
1358
1359static const char *at_cmd_plus_A8E(at_state_t *s, const char *t)
1360{
1361 int val;
1362
1363 /* V.251 5.1 - V.8 and V.8bis operation controls */
1364 /* Syntax: +A8E=<v8o>,<v8a>,<v8cf>[,<v8b>][,<cfrange>][,<protrange>] */
1365 /* <v8o>=0 Disable V.8 origination negotiation
1366 <v8o>=1 Enable DCE-controlled V.8 origination negotiation
1367 <v8o>=2 Enable DTE-controlled V.8 origination negotiation, send V.8 CI only
1368 <v8o>=3 Enable DTE-controlled V.8 origination negotiation, send 1100Hz CNG only
1369 <v8o>=4 Enable DTE-controlled V.8 origination negotiation, send 1300Hz CT only
1370 <v8o>=5 Enable DTE-controlled V.8 origination negotiation, send no tones
1371 <v8o>=6 Enable DCE-controlled V.8 origination negotiation, issue +A8x indications
1372 <v8a>=0 Disable V.8 answer negotiation
1373 <v8a>=1 Enable DCE-controlled V.8 answer negotiation
1374 <v8a>=2 Enable DTE-controlled V.8 answer negotiation, send ANSam
1375 <v8a>=3 Enable DTE-controlled V.8 answer negotiation, send no signal
1376 <v8a>=4 Disable DTE-controlled V.8 answer negotiation, send ANS
1377 <v8a>=5 Enable DCE-controlled V.8 answer negotiation, issue +A8x indications
1378 <v8cf>=X..Y Set the V.8 CI signal call function to the hexadecimal octet value X..Y
1379 <v8b>=0 Disable V.8bis negotiation
1380 <v8b>=1 Enable DCE-controlled V.8bis negotiation
1381 <v8b>=2 Enable DTE-controlled V.8bis negotiation
1382 <cfrange>="<string of values>" Set to alternative list of call function "option bit"
1383 values that the answering DCE shall accept from the caller
1384 <protrange>="<string of values>" Set to alternative list of protocol "option bit" values that
1385 the answering DCE shall accept from the caller
1386 */
1387 /* TODO: */
1388 t += 4;
1389 if (!parse_out(s, &t, &val, 6, "+A8E:", "(0-6),(0-5),(00-FF)"))
1390 return NULL((void*)0);
1391 if (*t != ',')
1392 return t;
1393 if ((val = parse_num(&t, 5)) < 0)
1394 return NULL((void*)0);
1395 if (*t != ',')
1396 return t;
1397 return t;
1398}
1399/*- End of function --------------------------------------------------------*/
1400
1401static const char *at_cmd_plus_A8I(at_state_t *s, const char *t)
1402{
1403 /* V.251 6.1 - V.8 CI signal indication */
1404 return t;
1405}
1406/*- End of function --------------------------------------------------------*/
1407
1408static const char *at_cmd_plus_A8J(at_state_t *s, const char *t)
1409{
1410 /* V.251 6.4 - V.8 negotiation complete */
1411 return t;
1412}
1413/*- End of function --------------------------------------------------------*/
1414
1415static const char *at_cmd_plus_A8M(at_state_t *s, const char *t)
1416{
1417 /* V.251 5.2 - Send V.8 menu signals */
1418 /* Syntax: +A8M=<hexadecimal coded CM or JM octet string> */
1419 /* TODO: */
1420 t += 4;
1421 return t;
1422}
1423/*- End of function --------------------------------------------------------*/
1424
1425static const char *at_cmd_plus_A8R(at_state_t *s, const char *t)
1426{
1427 /* V.251 6.6 - V.8bis signal and message reporting */
1428 return t;
1429}
1430/*- End of function --------------------------------------------------------*/
1431
1432static const char *at_cmd_plus_A8T(at_state_t *s, const char *t)
1433{
1434 int val;
1435
1436 /* V.251 5.3 - Send V.8bis signal and/or message(s) */
1437 /* Syntax: +A8T=<signal>[,<1st message>][,<2nd message>][,<sig_en>][,<msg_en>][,<supp_delay>] */
1438 /* <signal>=0 None
1439 <signal>=1 Initiating Mre
1440 <signal>=2 Initiating MRd
1441 <signal>=3 Initiating CRe, low power
1442 <signal>=4 Initiating CRe, high power
1443 <signal>=5 Initiating CRd
1444 <signal>=6 Initiating Esi
1445 <signal>=7 Responding MRd, low power
1446 <signal>=8 Responding MRd, high power
1447 <signal>=9 Responding CRd
1448 <signal>=10 Responding Esr
1449 */
1450 /* TODO: */
1451 t += 4;
1452 if (!parse_out(s, &t, &val, 10, "+A8T:", "(0-10)"))
1453 return NULL((void*)0);
1454 s->v8bis_signal = val;
1455 if (*t != ',')
1456 return t;
1457 if ((val = parse_num(&t, 255)) < 0)
1458 return NULL((void*)0);
1459 s->v8bis_1st_message = val;
1460 if (*t != ',')
1461 return t;
1462 if ((val = parse_num(&t, 255)) < 0)
1463 return NULL((void*)0);
1464 s->v8bis_2nd_message = val;
1465 if (*t != ',')
1466 return t;
1467 if ((val = parse_num(&t, 255)) < 0)
1468 return NULL((void*)0);
1469 s->v8bis_sig_en = val;
1470 if (*t != ',')
1471 return t;
1472 if ((val = parse_num(&t, 255)) < 0)
1473 return NULL((void*)0);
1474 s->v8bis_msg_en = val;
1475 if (*t != ',')
1476 return t;
1477 if ((val = parse_num(&t, 255)) < 0)
1478 return NULL((void*)0);
1479 s->v8bis_supp_delay = val;
1480 return t;
1481}
1482/*- End of function --------------------------------------------------------*/
1483
1484static const char *at_cmd_plus_ASTO(at_state_t *s, const char *t)
1485{
1486 /* V.250 6.3.15 - Store telephone number */
1487 /* TODO: */
1488 t += 5;
1489 if (!parse_out(s, &t, NULL((void*)0), 1, "+ASTO:", ""))
1490 return NULL((void*)0);
1491 return t;
1492}
1493/*- End of function --------------------------------------------------------*/
1494
1495static const char *at_cmd_plus_CAAP(at_state_t *s, const char *t)
1496{
1497 /* 3GPP TS 27.007 7.25 - Automatic answer for eMLPP Service */
1498 /* TODO: */
1499 t += 5;
1500 if (!parse_2_out(s, &t, NULL((void*)0), 65535, NULL((void*)0), 65535, "+CAAP:", ""))
1501 return NULL((void*)0);
1502 return t;
1503}
1504/*- End of function --------------------------------------------------------*/
1505
1506static const char *at_cmd_plus_CACM(at_state_t *s, const char *t)
1507{
1508 /* 3GPP TS 27.007 8.25 - Accumulated call meter */
1509 /* TODO: */
1510 t += 5;
1511 if (!parse_out(s, &t, NULL((void*)0), 1, "+CACM:", ""))
1512 return NULL((void*)0);
1513 return t;
1514}
1515/*- End of function --------------------------------------------------------*/
1516
1517static const char *at_cmd_plus_CACSP(at_state_t *s, const char *t)
1518{
1519 /* 3GPP TS 27.007 11.1.7 - Voice Group or Voice Broadcast Call State Attribute Presentation */
1520 /* TODO: */
1521 t += 6;
1522 if (!parse_out(s, &t, NULL((void*)0), 1, "+CACSP:", ""))
1523 return NULL((void*)0);
1524 return t;
1525}
1526/*- End of function --------------------------------------------------------*/
1527
1528static const char *at_cmd_plus_CAD(at_state_t *s, const char *t)
1529{
1530 /* IS-99 5.6.3 - Query analogue or digital service */
1531 /* TODO: */
1532 t += 4;
1533 return t;
1534}
1535/*- End of function --------------------------------------------------------*/
1536
1537static const char *at_cmd_plus_CAEMLPP(at_state_t *s, const char *t)
1538{
1539 /* 3GPP TS 27.007 7.22 - eMLPP Priority Registration and Interrogation */
1540 /* TODO: */
1541 t += 8;
1542 if (!parse_out(s, &t, NULL((void*)0), 1, "+CAEMLPP:", ""))
1543 return NULL((void*)0);
1544 return t;
1545}
1546/*- End of function --------------------------------------------------------*/
1547
1548static const char *at_cmd_plus_CAHLD(at_state_t *s, const char *t)
1549{
1550 /* 3GPP TS 27.007 11.1.3 - Leave an ongoing Voice Group or Voice Broadcast Call */
1551 /* TODO: */
1552 t += 6;
1553 if (!parse_out(s, &t, NULL((void*)0), 1, "+CAHLD:", ""))
1554 return NULL((void*)0);
1555 return t;
1556}
1557/*- End of function --------------------------------------------------------*/
1558
1559static const char *at_cmd_plus_CAJOIN(at_state_t *s, const char *t)
1560{
1561 /* 3GPP TS 27.007 11.1.1 - Accept an incoming Voice Group or Voice Broadcast Call */
1562 /* TODO: */
1563 t += 7;
1564 if (!parse_out(s, &t, NULL((void*)0), 1, "+CAJOIN:", ""))
1565 return NULL((void*)0);
1566 return t;
1567}
1568/*- End of function --------------------------------------------------------*/
1569
1570static const char *at_cmd_plus_CALA(at_state_t *s, const char *t)
1571{
1572 /* 3GPP TS 27.007 8.16 - Alarm */
1573 /* TODO: */
1574 t += 5;
1575 if (!parse_out(s, &t, NULL((void*)0), 1, "+CALA:", ""))
1576 return NULL((void*)0);
1577 return t;
1578}
1579/*- End of function --------------------------------------------------------*/
1580
1581static const char *at_cmd_plus_CALCC(at_state_t *s, const char *t)
1582{
1583 /* 3GPP TS 27.007 11.1.6 - List current Voice Group and Voice Broadcast Calls */
1584 /* TODO: */
1585 t += 6;
1586 if (!parse_out(s, &t, NULL((void*)0), 1, "+CALCC:", ""))
1587 return NULL((void*)0);
1588 return t;
1589}
1590/*- End of function --------------------------------------------------------*/
1591
1592static const char *at_cmd_plus_CALD(at_state_t *s, const char *t)
1593{
1594 /* 3GPP TS 27.007 8.38 - Delete alarm */
1595 /* TODO: */
1596 t += 5;
1597 if (!parse_out(s, &t, NULL((void*)0), 1, "+CALD:", ""))
1598 return NULL((void*)0);
1599 return t;
1600}
1601/*- End of function --------------------------------------------------------*/
1602
1603static const char *at_cmd_plus_CALM(at_state_t *s, const char *t)
1604{
1605 /* 3GPP TS 27.007 8.20 - Alert sound mode */
1606 /* TODO: */
1607 t += 5;
1608 if (!parse_out(s, &t, NULL((void*)0), 1, "+CALM:", ""))
1609 return NULL((void*)0);
1610 return t;
1611}
1612/*- End of function --------------------------------------------------------*/
1613
1614static const char *at_cmd_plus_CAMM(at_state_t *s, const char *t)
1615{
1616 /* 3GPP TS 27.007 8.26 - Accumulated call meter maximum */
1617 /* TODO: */
1618 t += 5;
1619 if (!parse_out(s, &t, NULL((void*)0), 1, "+CAMM:", ""))
1620 return NULL((void*)0);
1621 return t;
1622}
1623/*- End of function --------------------------------------------------------*/
1624
1625static const char *at_cmd_plus_CANCHEV(at_state_t *s, const char *t)
1626{
1627 /* 3GPP TS 27.007 11.1.8 - NCH Support Indication */
1628 /* TODO: */
1629 t += 8;
1630 if (!parse_out(s, &t, NULL((void*)0), 1, "+CANCHEV:", ""))
1631 return NULL((void*)0);
1632 return t;
1633}
1634/*- End of function --------------------------------------------------------*/
1635
1636static const char *at_cmd_plus_CAOC(at_state_t *s, const char *t)
1637{
1638 /* 3GPP TS 27.007 7.16 - Advice of Charge */
1639 /* TODO: */
1640 t += 5;
1641 if (!parse_out(s, &t, NULL((void*)0), 1, "+CAOC:", ""))
1642 return NULL((void*)0);
1643 return t;
1644}
1645/*- End of function --------------------------------------------------------*/
1646
1647static const char *at_cmd_plus_CAPD(at_state_t *s, const char *t)
1648{
1649 /* 3GPP TS 27.007 8.39 - Postpone or dismiss an alarm */
1650 /* TODO: */
1651 t += 5;
1652 if (!parse_out(s, &t, NULL((void*)0), 1, "+CAPD:", ""))
1653 return NULL((void*)0);
1654 return t;
1655}
1656/*- End of function --------------------------------------------------------*/
1657
1658static const char *at_cmd_plus_CAPTT(at_state_t *s, const char *t)
1659{
1660 /* 3GPP TS 27.007 11.1.4 - Talker Access for Voice Group Call */
1661 /* TODO: */
1662 t += 6;
1663 if (!parse_out(s, &t, NULL((void*)0), 1, "+CAPTT:", ""))
1664 return NULL((void*)0);
1665 return t;
1666}
1667/*- End of function --------------------------------------------------------*/
1668
1669static const char *at_cmd_plus_CAREJ(at_state_t *s, const char *t)
1670{
1671 /* 3GPP TS 27.007 11.1.2 - Reject an incoming Voice Group or Voice Broadcast Call */
1672 /* TODO: */
1673 t += 6;
1674 if (!parse_out(s, &t, NULL((void*)0), 1, "+CAREJ:", ""))
1675 return NULL((void*)0);
1676 return t;
1677}
1678/*- End of function --------------------------------------------------------*/
1679
1680static const char *at_cmd_plus_CAULEV(at_state_t *s, const char *t)
1681{
1682 /* 3GPP TS 27.007 11.1.5 - Voice Group Call Uplink Status Presentation */
1683 /* TODO: */
1684 t += 7;
1685 if (!parse_out(s, &t, NULL((void*)0), 1, "+CAULEV:", ""))
1686 return NULL((void*)0);
1687 return t;
1688}
1689/*- End of function --------------------------------------------------------*/
1690
1691static const char *at_cmd_plus_CBC(at_state_t *s, const char *t)
1692{
1693 /* 3GPP TS 27.007 8.4 - Battery charge */
1694 /* TODO: */
1695 t += 4;
1696 if (!parse_out(s, &t, NULL((void*)0), 1, "+CBC:", ""))
1697 return NULL((void*)0);
1698 return t;
1699}
1700/*- End of function --------------------------------------------------------*/
1701
1702static const char *at_cmd_plus_CBCS(at_state_t *s, const char *t)
1703{
1704 /* 3GPP TS 27.007 11.3.2 - VBS subscriptions and GId status */
1705 /* TODO: */
1706 t += 5;
1707 if (!parse_out(s, &t, NULL((void*)0), 1, "+CBCS:", ""))
1708 return NULL((void*)0);
1709 return t;
1710}
1711/*- End of function --------------------------------------------------------*/
1712
1713static const char *at_cmd_plus_CBIP(at_state_t *s, const char *t)
1714{
1715 /* IS-99 5.6 - Base station IP address */
1716 /* TODO: */
1717 t += 5;
1718 return t;
1719}
1720/*- End of function --------------------------------------------------------*/
1721
1722static const char *at_cmd_plus_CBST(at_state_t *s, const char *t)
1723{
1724 /* 3GPP TS 27.007 6.7 - Select bearer service type */
1725 /* TODO: */
1726 t += 5;
1727 if (!parse_out(s, &t, NULL((void*)0), 1, "+CBST:", ""))
1728 return NULL((void*)0);
1729 return t;
1730}
1731/*- End of function --------------------------------------------------------*/
1732
1733static const char *at_cmd_plus_CCFC(at_state_t *s, const char *t)
1734{
1735 /* 3GPP TS 27.007 7.11 - Call forwarding number and conditions */
1736 /* TODO: */
1737 t += 5;
1738 if (!parse_out(s, &t, NULL((void*)0), 1, "+CCFC:", ""))
1739 return NULL((void*)0);
1740 return t;
1741}
1742/*- End of function --------------------------------------------------------*/
1743
1744static const char *at_cmd_plus_CCLK(at_state_t *s, const char *t)
1745{
1746 /* 3GPP TS 27.007 8.15 - Clock */
1747 /* TODO: */
1748 t += 5;
1749 if (!parse_out(s, &t, NULL((void*)0), 1, "+CCLK:", ""))
1750 return NULL((void*)0);
1751 return t;
1752}
1753/*- End of function --------------------------------------------------------*/
1754
1755static const char *at_cmd_plus_CCS(at_state_t *s, const char *t)
1756{
1757 /* IS-135 4.1.22 - Compression status */
1758 /* TODO: */
1759 t += 4;
1760 return t;
1761}
1762/*- End of function --------------------------------------------------------*/
1763
1764static const char *at_cmd_plus_CCUG(at_state_t *s, const char *t)
1765{
1766 /* 3GPP TS 27.007 7.10 - Closed user group */
1767 /* TODO: */
1768 t += 5;
1769 if (!parse_out(s, &t, NULL((void*)0), 1, "+CCUG:", ""))
1770 return NULL((void*)0);
1771 return t;
1772}
1773/*- End of function --------------------------------------------------------*/
1774
1775static const char *at_cmd_plus_CCWA(at_state_t *s, const char *t)
1776{
1777 /* 3GPP TS 27.007 7.12 - Call waiting */
1778 /* TODO: */
1779 t += 5;
1780 if (!parse_out(s, &t, NULL((void*)0), 1, "+CCWA:", ""))
1781 return NULL((void*)0);
1782 return t;
1783}
1784/*- End of function --------------------------------------------------------*/
1785
1786static const char *at_cmd_plus_CCWE(at_state_t *s, const char *t)
1787{
1788 /* 3GPP TS 27.007 8.28 - Call Meter maximum event */
1789 /* TODO: */
1790 t += 5;
1791 if (!parse_out(s, &t, NULL((void*)0), 1, "+CCWE:", ""))
1792 return NULL((void*)0);
1793 return t;
1794}
1795/*- End of function --------------------------------------------------------*/
1796
1797static const char *at_cmd_plus_CDIP(at_state_t *s, const char *t)
1798{
1799 /* 3GPP TS 27.007 7.9 - Called line identification presentation */
1800 /* TODO: */
1801 t += 5;
1802 if (!parse_out(s, &t, NULL((void*)0), 1, "+CDIP:", ""))
1803 return NULL((void*)0);
1804 return t;
1805}
1806/*- End of function --------------------------------------------------------*/
1807
1808static const char *at_cmd_plus_CDIS(at_state_t *s, const char *t)
1809{
1810 /* 3GPP TS 27.007 8.8 - Display control */
1811 /* TODO: */
1812 t += 5;
1813 if (!parse_out(s, &t, NULL((void*)0), 1, "+CDIS:", ""))
1814 return NULL((void*)0);
1815 return t;
1816}
1817/*- End of function --------------------------------------------------------*/
1818
1819static const char *at_cmd_plus_CDV(at_state_t *s, const char *t)
1820{
1821 /* IS-99 5.6 - Dial command for voice call */
1822 /* TODO: */
1823 t += 4;
1824 return t;
1825}
1826/*- End of function --------------------------------------------------------*/
1827
1828static const char *at_cmd_plus_CEER(at_state_t *s, const char *t)
1829{
1830 /* 3GPP TS 27.007 6.10 - Extended error report */
1831 /* TODO: */
1832 t += 5;
1833 if (!parse_out(s, &t, NULL((void*)0), 1, "+CEER:", ""))
1834 return NULL((void*)0);
1835 return t;
1836}
1837/*- End of function --------------------------------------------------------*/
1838
1839static const char *at_cmd_plus_CESP(at_state_t *s, const char *t)
1840{
1841 /* GSM07.05 3.2.4 - Enter SMS block mode protocol */
1842 /* TODO: */
1843 t += 5;
1844 return t;
1845}
1846/*- End of function --------------------------------------------------------*/
1847
1848static const char *at_cmd_plus_CFCS(at_state_t *s, const char *t)
1849{
1850 /* 3GPP TS 27.007 7.24 - Fast call setup conditions */
1851 /* TODO: */
1852 t += 5;
1853 if (!parse_out(s, &t, NULL((void*)0), 1, "+CFCS:", ""))
1854 return NULL((void*)0);
1855 return t;
1856}
1857/*- End of function --------------------------------------------------------*/
1858
1859static const char *at_cmd_plus_CFG(at_state_t *s, const char *t)
1860{
1861 /* IS-99 5.6 - Configuration string */
1862 /* TODO: */
1863 t += 4;
1864 return t;
1865}
1866/*- End of function --------------------------------------------------------*/
1867
1868static const char *at_cmd_plus_CFUN(at_state_t *s, const char *t)
1869{
1870 /* 3GPP TS 27.007 8.2 - Set phone functionality */
1871 /* TODO: */
1872 t += 5;
1873 if (!parse_out(s, &t, NULL((void*)0), 1, "+CFUN:", ""))
1874 return NULL((void*)0);
1875 return t;
1876}
1877/*- End of function --------------------------------------------------------*/
1878
1879static const char *at_cmd_plus_CGACT(at_state_t *s, const char *t)
1880{
1881 /* 3GPP TS 27.007 10.1.10 - PDP context activate or deactivate */
1882 /* TODO: */
1883 t += 6;
1884 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGACT:", ""))
1885 return NULL((void*)0);
1886 return t;
1887}
1888/*- End of function --------------------------------------------------------*/
1889
1890static const char *at_cmd_plus_CGANS(at_state_t *s, const char *t)
1891{
1892 /* 3GPP TS 27.007 10.1.16 - Manual response to a network request for PDP context activation */
1893 /* TODO: */
1894 t += 6;
1895 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGANS:", ""))
1896 return NULL((void*)0);
1897 return t;
1898}
1899/*- End of function --------------------------------------------------------*/
1900
1901static const char *at_cmd_plus_CGATT(at_state_t *s, const char *t)
1902{
1903 /* 3GPP TS 27.007 10.1.9 - PS attach or detach */
1904 /* TODO: */
1905 t += 6;
1906 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGATT:", ""))
1907 return NULL((void*)0);
1908 return t;
1909}
1910/*- End of function --------------------------------------------------------*/
1911
1912static const char *at_cmd_plus_CGAUTO(at_state_t *s, const char *t)
1913{
1914 /* 3GPP TS 27.007 10.1.15 - Automatic response to a network request for PDP context activation */
1915 /* TODO: */
1916 t += 7;
1917 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGAUTO:", ""))
1918 return NULL((void*)0);
1919 return t;
1920}
1921/*- End of function --------------------------------------------------------*/
1922
1923static const char *at_cmd_plus_CGCAP(at_state_t *s, const char *t)
1924{
1925 /* IS-99 5.6 - Request complete capabilities list */
1926 /* TODO: */
1927 t += 6;
1928 return t;
1929}
1930/*- End of function --------------------------------------------------------*/
1931
1932static const char *at_cmd_plus_CGCLASS(at_state_t *s, const char *t)
1933{
1934 /* 3GPP TS 27.007 10.1.17 - GPRS mobile station class (GPRS only) */
1935 /* TODO: */
1936 t += 8;
1937 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGCLASS:", ""))
1938 return NULL((void*)0);
1939 return t;
1940}
1941/*- End of function --------------------------------------------------------*/
1942
1943static const char *at_cmd_plus_CGCLOSP(at_state_t *s, const char *t)
1944{
1945 /* 3GPP TS 27.007 10.1.13 - Configure local Octet Stream PAD parameters (Obsolete) */
1946 /* TODO: */
1947 t += 8;
1948 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGCLOSP:", ""))
1949 return NULL((void*)0);
1950 return t;
1951}
1952/*- End of function --------------------------------------------------------*/
1953
1954static const char *at_cmd_plus_CGCLPAD(at_state_t *s, const char *t)
1955{
1956 /* 3GPP TS 27.007 10.1.12 - Configure local triple-X PAD parameters (GPRS only) (Obsolete) */
1957 /* TODO: */
1958 t += 8;
1959 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGCLPAD:", ""))
1960 return NULL((void*)0);
1961 return t;
1962}
1963/*- End of function --------------------------------------------------------*/
1964
1965static const char *at_cmd_plus_CGCMOD(at_state_t *s, const char *t)
1966{
1967 /* 3GPP TS 27.007 10.1.11 - PDP Context Modify */
1968 /* TODO: */
1969 t += 7;
1970 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGCMOD:", ""))
1971 return NULL((void*)0);
1972 return t;
1973}
1974/*- End of function --------------------------------------------------------*/
1975
1976static const char *at_cmd_plus_CGCS(at_state_t *s, const char *t)
1977{
1978 /* 3GPP TS 27.007 11.3.1 - VGCS subscriptions and GId status */
1979 /* TODO: */
1980 t += 5;
1981 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGCS:", ""))
1982 return NULL((void*)0);
1983 return t;
1984}
1985/*- End of function --------------------------------------------------------*/
1986
1987static const char *at_cmd_plus_CGDATA(at_state_t *s, const char *t)
1988{
1989 /* 3GPP TS 27.007 10.1.12 - Enter data state */
1990 /* TODO: */
1991 t += 7;
1992 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGDATA:", ""))
1993 return NULL((void*)0);
1994 return t;
1995}
1996/*- End of function --------------------------------------------------------*/
1997
1998static const char *at_cmd_plus_CGDCONT(at_state_t *s, const char *t)
1999{
2000 /* 3GPP TS 27.007 10.1.1 - Define PDP Context */
2001 /* TODO: */
2002 t += 8;
2003 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGDCONT:", ""))
2004 return NULL((void*)0);
2005 return t;
2006}
2007/*- End of function --------------------------------------------------------*/
2008
2009static const char *at_cmd_plus_CGDSCONT(at_state_t *s, const char *t)
2010{
2011 /* 3GPP TS 27.007 10.1.2 - Define Secondary PDP Context */
2012 /* TODO: */
2013 t += 9;
2014 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGDSCONT:", ""))
2015 return NULL((void*)0);
2016 return t;
2017}
2018/*- End of function --------------------------------------------------------*/
2019
2020static const char *at_cmd_plus_CGEQMIN(at_state_t *s, const char *t)
2021{
2022 /* 3GPP TS 27.007 10.1.7 - 3G Quality of Service Profile (Minimum acceptable) */
2023 /* TODO: */
2024 t += 8;
2025 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGEQMIN:", ""))
2026 return NULL((void*)0);
2027 return t;
2028}
2029/*- End of function --------------------------------------------------------*/
2030
2031static const char *at_cmd_plus_CGEQNEG(at_state_t *s, const char *t)
2032{
2033 /* 3GPP TS 27.007 10.1.8 - 3G Quality of Service Profile (Negotiated) */
2034 /* TODO: */
2035 t += 8;
2036 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGEQNEG:", ""))
2037 return NULL((void*)0);
2038 return t;
2039}
2040/*- End of function --------------------------------------------------------*/
2041
2042static const char *at_cmd_plus_CGEQREQ(at_state_t *s, const char *t)
2043{
2044 /* 3GPP TS 27.007 10.1.6 - 3G Quality of Service Profile (Requested) */
2045 /* TODO: */
2046 t += 8;
2047 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGEQREQ:", ""))
2048 return NULL((void*)0);
2049 return t;
2050}
2051/*- End of function --------------------------------------------------------*/
2052
2053static const char *at_cmd_plus_CGEREP(at_state_t *s, const char *t)
2054{
2055 /* 3GPP TS 27.007 10.1.18 - Packet Domain event reporting */
2056 /* TODO: */
2057 t += 7;
2058 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGEREP:", ""))
2059 return NULL((void*)0);
2060 return t;
2061}
2062/*- End of function --------------------------------------------------------*/
2063
2064static const char *at_cmd_plus_CGMI(at_state_t *s, const char *t)
2065{
2066 /* 3GPP TS 27.007 5.1 - Request manufacturer identification */
2067 /* TODO: */
2068 t += 5;
2069 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGMI:", ""))
2070 return NULL((void*)0);
2071 return t;
2072}
2073/*- End of function --------------------------------------------------------*/
2074
2075static const char *at_cmd_plus_CGMM(at_state_t *s, const char *t)
2076{
2077 /* 3GPP TS 27.007 5.2 - Request model identification */
2078 /* TODO: */
2079 t += 5;
2080 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGMM:", ""))
2081 return NULL((void*)0);
2082 return t;
2083}
2084/*- End of function --------------------------------------------------------*/
2085
2086static const char *at_cmd_plus_CGMR(at_state_t *s, const char *t)
2087{
2088 /* 3GPP TS 27.007 5.3 - Request revision identification */
2089 /* TODO: */
2090 t += 5;
2091 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGMR:", ""))
2092 return NULL((void*)0);
2093 return t;
2094}
2095/*- End of function --------------------------------------------------------*/
2096
2097static const char *at_cmd_plus_CGOI(at_state_t *s, const char *t)
2098{
2099 /* IS-99 5.6 - Request global object identification */
2100 /* TODO: */
2101 t += 5;
2102 return t;
2103}
2104/*- End of function --------------------------------------------------------*/
2105
2106static const char *at_cmd_plus_CGPADDR(at_state_t *s, const char *t)
2107{
2108 /* 3GPP TS 27.007 10.1.14 - Show PDP address */
2109 /* TODO: */
2110 t += 8;
2111 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGPADDR:", ""))
2112 return NULL((void*)0);
2113 return t;
2114}
2115/*- End of function --------------------------------------------------------*/
2116
2117static const char *at_cmd_plus_CGQMIN(at_state_t *s, const char *t)
2118{
2119 /* 3GPP TS 27.007 10.1.5 - Quality of Service Profile (Minimum acceptable) */
2120 /* TODO: */
2121 t += 7;
2122 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGQMIN:", ""))
2123 return NULL((void*)0);
2124 return t;
2125}
2126/*- End of function --------------------------------------------------------*/
2127
2128static const char *at_cmd_plus_CGQREQ(at_state_t *s, const char *t)
2129{
2130 /* 3GPP TS 27.007 10.1.4 - Quality of Service Profile (Requested) */
2131 /* TODO: */
2132 t += 7;
2133 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGQREQ:", ""))
2134 return NULL((void*)0);
2135 return t;
2136}
2137/*- End of function --------------------------------------------------------*/
2138
2139static const char *at_cmd_plus_CGREG(at_state_t *s, const char *t)
2140{
2141 /* 3GPP TS 27.007 10.1.19 - GPRS network registration status */
2142 /* TODO: */
2143 t += 6;
2144 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGREG:", ""))
2145 return NULL((void*)0);
2146 return t;
2147}
2148/*- End of function --------------------------------------------------------*/
2149
2150static const char *at_cmd_plus_CGSMS(at_state_t *s, const char *t)
2151{
2152 /* 3GPP TS 27.007 10.1.20 - Select service for MO SMS messages */
2153 /* TODO: */
2154 t += 6;
2155 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGSMS:", ""))
2156 return NULL((void*)0);
2157 return t;
2158}
2159/*- End of function --------------------------------------------------------*/
2160
2161static const char *at_cmd_plus_CGSN(at_state_t *s, const char *t)
2162{
2163 /* 3GPP TS 27.007 5.4 - Request product serial number identification */
2164 /* TODO: */
2165 t += 5;
2166 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGSN:", ""))
2167 return NULL((void*)0);
2168 return t;
2169}
2170/*- End of function --------------------------------------------------------*/
2171
2172static const char *at_cmd_plus_CGTFT(at_state_t *s, const char *t)
2173{
2174 /* 3GPP TS 27.007 10.1.3 - Traffic Flow Template */
2175 /* TODO: */
2176 t += 6;
2177 if (!parse_out(s, &t, NULL((void*)0), 1, "+CGTFT:", ""))
2178 return NULL((void*)0);
2179 return t;
2180}
2181/*- End of function --------------------------------------------------------*/
2182
2183static const char *at_cmd_plus_CHLD(at_state_t *s, const char *t)
2184{
2185 /* 3GPP TS 27.007 7.13 - Call related supplementary services */
2186 /* TODO: */
2187 t += 5;
2188 if (!parse_out(s, &t, NULL((void*)0), 1, "+CHLD:", ""))
2189 return NULL((void*)0);
2190 return t;
2191}
2192/*- End of function --------------------------------------------------------*/
2193
2194static const char *at_cmd_plus_CHSA(at_state_t *s, const char *t)
2195{
2196 /* 3GPP TS 27.007 6.18 - HSCSD non-transparent asymmetry configuration */
2197 /* TODO: */
2198 t += 5;
2199 if (!parse_out(s, &t, NULL((void*)0), 1, "+CHSA:", ""))
2200 return NULL((void*)0);
2201 return t;
2202}
2203/*- End of function --------------------------------------------------------*/
2204
2205static const char *at_cmd_plus_CHSC(at_state_t *s, const char *t)
2206{
2207 /* 3GPP TS 27.007 6.15 - HSCSD current call parameters */
2208 /* TODO: */
2209 t += 5;
2210 if (!parse_out(s, &t, NULL((void*)0), 1, "+CHSC:", ""))
2211 return NULL((void*)0);
2212 return t;
2213}
2214/*- End of function --------------------------------------------------------*/
2215
2216static const char *at_cmd_plus_CHSD(at_state_t *s, const char *t)
2217{
2218 /* 3GPP TS 27.007 6.12 - HSCSD device parameters */
2219 /* TODO: */
2220 t += 5;
2221 if (!parse_out(s, &t, NULL((void*)0), 1, "+CHSD:", ""))
2222 return NULL((void*)0);
2223 return t;
2224}
2225/*- End of function --------------------------------------------------------*/
2226
2227static const char *at_cmd_plus_CHSN(at_state_t *s, const char *t)
2228{
2229 /* 3GPP TS 27.007 6.14 - HSCSD non-transparent call configuration */
2230 /* TODO: */
2231 t += 5;
2232 if (!parse_out(s, &t, NULL((void*)0), 1, "+CHSN:", ""))
2233 return NULL((void*)0);
2234 return t;
2235}
2236/*- End of function --------------------------------------------------------*/
2237
2238static const char *at_cmd_plus_CHSR(at_state_t *s, const char *t)
2239{
2240 /* 3GPP TS 27.007 6.16 - HSCSD parameters report */
2241 /* TODO: */
2242 t += 5;
2243 if (!parse_out(s, &t, NULL((void*)0), 1, "+CHSR:", ""))
2244 return NULL((void*)0);
2245 return t;
2246}
2247/*- End of function --------------------------------------------------------*/
2248
2249static const char *at_cmd_plus_CHST(at_state_t *s, const char *t)
2250{
2251 /* 3GPP TS 27.007 6.13 - HSCSD transparent call configuration */
2252 /* TODO: */
2253 t += 5;
2254 if (!parse_out(s, &t, NULL((void*)0), 1, "+CHST:", ""))
2255 return NULL((void*)0);
2256 return t;
2257}
2258/*- End of function --------------------------------------------------------*/
2259
2260static const char *at_cmd_plus_CHSU(at_state_t *s, const char *t)
2261{
2262 /* 3GPP TS 27.007 6.17 - HSCSD automatic user initiated upgrading */
2263 /* TODO: */
2264 t += 5;
2265 if (!parse_out(s, &t, NULL((void*)0), 1, "+CHSU:", ""))
2266 return NULL((void*)0);
2267 return t;
2268}
2269/*- End of function --------------------------------------------------------*/
2270
2271static const char *at_cmd_plus_CHUP(at_state_t *s, const char *t)
2272{
2273 /* 3GPP TS 27.007 6.5 - Hangup call */
2274 /* TODO: */
2275 t += 5;
2276 if (!parse_out(s, &t, NULL((void*)0), 1, "+CHUP:", ""))
2277 return NULL((void*)0);
2278 return t;
2279}
2280/*- End of function --------------------------------------------------------*/
2281
2282static const char *at_cmd_plus_CHV(at_state_t *s, const char *t)
2283{
2284 /* IS-99 5.6 - Hang-up voice */
2285 /* TODO: */
2286 t += 4;
2287 return t;
2288}
2289/*- End of function --------------------------------------------------------*/
2290
2291static const char *at_cmd_plus_CIMI(at_state_t *s, const char *t)
2292{
2293 /* 3GPP TS 27.007 5.6 - Request international mobile subscriber identity */
2294 /* TODO: */
2295 t += 5;
2296 if (!parse_out(s, &t, NULL((void*)0), 1, "+CIMI:", ""))
2297 return NULL((void*)0);
2298 return t;
2299}
2300/*- End of function --------------------------------------------------------*/
2301
2302static const char *at_cmd_plus_CIND(at_state_t *s, const char *t)
2303{
2304 /* 3GPP TS 27.007 8.9 - Indicator control */
2305 /* TODO: */
2306 t += 5;
2307 if (!parse_out(s, &t, NULL((void*)0), 1, "+CIND:", ""))
2308 return NULL((void*)0);
2309 return t;
2310}
2311/*- End of function --------------------------------------------------------*/
2312
2313static const char *at_cmd_plus_CIT(at_state_t *s, const char *t)
2314{
2315 /* IS-99 5.6 - Command state inactivity timer */
2316 /* TODO: */
2317 t += 4;
2318 return t;
2319}
2320/*- End of function --------------------------------------------------------*/
2321
2322static const char *at_cmd_plus_CKPD(at_state_t *s, const char *t)
2323{
2324 /* 3GPP TS 27.007 8.7 - Keypad control */
2325 /* TODO: */
2326 t += 5;
2327 if (!parse_out(s, &t, NULL((void*)0), 1, "+CKPD:", ""))
2328 return NULL((void*)0);
2329 return t;
2330}
2331/*- End of function --------------------------------------------------------*/
2332
2333static const char *at_cmd_plus_CLAC(at_state_t *s, const char *t)
2334{
2335 /* 3GPP TS 27.007 8.37 - List all available AT commands */
2336 /* TODO: */
2337 t += 5;
2338 if (!parse_out(s, &t, NULL((void*)0), 1, "+CLAC:", ""))
2339 return NULL((void*)0);
2340 return t;
2341}
2342/*- End of function --------------------------------------------------------*/
2343
2344static const char *at_cmd_plus_CLAE(at_state_t *s, const char *t)
2345{
2346 /* 3GPP TS 27.007 8.31 - Language Event */
2347 /* TODO: */
2348 t += 5;
2349 if (!parse_out(s, &t, NULL((void*)0), 1, "+CLAE:", ""))
2350 return NULL((void*)0);
2351 return t;
2352}
2353/*- End of function --------------------------------------------------------*/
2354
2355static const char *at_cmd_plus_CLAN(at_state_t *s, const char *t)
2356{
2357 /* 3GPP TS 27.007 8.30 - Set Language */
2358 /* TODO: */
2359 t += 5;
2360 if (!parse_out(s, &t, NULL((void*)0), 1, "+CLAN:", ""))
2361 return NULL((void*)0);
2362 return t;
2363}
2364/*- End of function --------------------------------------------------------*/
2365
2366static const char *at_cmd_plus_CLCC(at_state_t *s, const char *t)
2367{
2368 /* 3GPP TS 27.007 7.18 - List current calls */
2369 /* TODO: */
2370 t += 5;
2371 if (!parse_out(s, &t, NULL((void*)0), 1, "+CLCC:", ""))
2372 return NULL((void*)0);
2373 return t;
2374}
2375/*- End of function --------------------------------------------------------*/
2376
2377static const char *at_cmd_plus_CLCK(at_state_t *s, const char *t)
2378{
2379 /* 3GPP TS 27.007 7.4 - Facility lock */
2380 /* TODO: */
2381 t += 5;
2382 if (!parse_out(s, &t, NULL((void*)0), 1, "+CLCK:", ""))
2383 return NULL((void*)0);
2384 return t;
2385}
2386/*- End of function --------------------------------------------------------*/
2387
2388static const char *at_cmd_plus_CLIP(at_state_t *s, const char *t)
2389{
2390 /* 3GPP TS 27.007 7.6 - Calling line identification presentation */
2391 /* TODO: */
2392 t += 5;
2393 if (!parse_out(s, &t, NULL((void*)0), 1, "+CLIP:", ""))
2394 return NULL((void*)0);
2395 return t;
2396}
2397/*- End of function --------------------------------------------------------*/
2398
2399static const char *at_cmd_plus_CLIR(at_state_t *s, const char *t)
2400{
2401 /* 3GPP TS 27.007 7.7 - Calling line identification restriction */
2402 /* TODO: */
2403 /* Parameter sets the adjustment for outgoing calls:
2404 0 presentation indicator is used according to the subscription of the CLIR service
2405 1 CLIR invocation
2406 2 CLIR suppression */
2407 t += 5;
2408 if (!parse_out(s, &t, NULL((void*)0), 1, "+CLIR:", ""))
2409 return NULL((void*)0);
2410 return t;
2411}
2412/*- End of function --------------------------------------------------------*/
2413
2414static const char *at_cmd_plus_CLVL(at_state_t *s, const char *t)
2415{
2416 /* 3GPP TS 27.007 8.23 - Loudspeaker volume level */
2417 /* TODO: */
2418 t += 5;
2419 if (!parse_out(s, &t, NULL((void*)0), 1, "+CLVL:", ""))
2420 return NULL((void*)0);
2421 return t;
2422}
2423/*- End of function --------------------------------------------------------*/
2424
2425static const char *at_cmd_plus_CMAR(at_state_t *s, const char *t)
2426{
2427 /* 3GPP TS 27.007 8.36 - Master Reset */
2428 /* TODO: */
2429 t += 5;
2430 if (!parse_out(s, &t, NULL((void*)0), 1, "+CMAR:", ""))
2431 return NULL((void*)0);
2432 return t;
2433}
2434/*- End of function --------------------------------------------------------*/
2435
2436static const char *at_cmd_plus_CMEC(at_state_t *s, const char *t)
2437{
2438 /* 3GPP TS 27.007 8.6 - Mobile Termination control mode */
2439 /* TODO: */
2440 t += 5;
2441 if (!parse_out(s, &t, NULL((void*)0), 1, "+CMEC:", ""))
2442 return NULL((void*)0);
2443 return t;
2444}
2445/*- End of function --------------------------------------------------------*/
2446
2447static const char *at_cmd_plus_CMEE(at_state_t *s, const char *t)
2448{
2449 /* GSM07.07 9.1 - Report mobile equipment error */
2450 /* TODO: */
2451 t += 5;
2452 return t;
2453}
2454/*- End of function --------------------------------------------------------*/
2455
2456static const char *at_cmd_plus_CMER(at_state_t *s, const char *t)
2457{
2458 /* 3GPP TS 27.007 8.10 - Mobile Termination event reporting */
2459 /* TODO: */
2460 t += 5;
2461 if (!parse_out(s, &t, NULL((void*)0), 1, "+CMER:", ""))
2462 return NULL((void*)0);
2463 return t;
2464}
2465/*- End of function --------------------------------------------------------*/
2466
2467static const char *at_cmd_plus_CMGC(at_state_t *s, const char *t)
2468{
2469 /* GSM07.05 3.5.5/4.5 - Send command */
2470 /* TODO: */
2471 t += 5;
2472 return t;
2473}
2474/*- End of function --------------------------------------------------------*/
2475
2476static const char *at_cmd_plus_CMGD(at_state_t *s, const char *t)
2477{
2478 /* GSM07.05 3.5.4 - Delete message */
2479 /* TODO: */
2480 t += 5;
2481 return t;
2482}
2483/*- End of function --------------------------------------------------------*/
2484
2485static const char *at_cmd_plus_CMGF(at_state_t *s, const char *t)
2486{
2487 /* GSM07.05 3.2.3 - Message Format */
2488 /* TODO: */
2489 t += 5;
2490 return t;
2491}
2492/*- End of function --------------------------------------------------------*/
2493
2494static const char *at_cmd_plus_CMGL(at_state_t *s, const char *t)
2495{
2496 /* GSM07.05 3.4.2/4.1 - List messages */
2497 /* TODO: */
2498 t += 5;
2499 return t;
2500}
2501/*- End of function --------------------------------------------------------*/
2502
2503static const char *at_cmd_plus_CMGR(at_state_t *s, const char *t)
2504{
2505 /* GSM07.05 3.4.3/4.2 - Read message */
2506 /* TODO: */
2507 t += 5;
2508 return t;
2509}
2510/*- End of function --------------------------------------------------------*/
2511
2512static const char *at_cmd_plus_CMGS(at_state_t *s, const char *t)
2513{
2514 /* GSM07.05 3.5.1/4.3 - Send message */
2515 /* TODO: */
2516 t += 5;
2517 return t;
2518}
2519/*- End of function --------------------------------------------------------*/
2520
2521static const char *at_cmd_plus_CMGW(at_state_t *s, const char *t)
2522{
2523 /* GSM07.05 3.5.3/4.4 - Write message to memory */
2524 /* TODO: */
2525 t += 5;
2526 return t;
2527}
2528/*- End of function --------------------------------------------------------*/
2529
2530static const char *at_cmd_plus_CMIP(at_state_t *s, const char *t)
2531{
2532 /* IS-99 5.6 - Mobile station IP address */
2533 /* TODO: */
2534 t += 5;
2535 return t;
2536}
2537/*- End of function --------------------------------------------------------*/
2538
2539static const char *at_cmd_plus_CMM(at_state_t *s, const char *t)
2540{
2541 /* IS-135 4.1.23 - Menu map */
2542 /* TODO: */
2543 t += 4;
2544 return t;
2545}
2546/*- End of function --------------------------------------------------------*/
2547
2548static const char *at_cmd_plus_CMMS(at_state_t *s, const char *t)
2549{
2550 /* GSM07.05 3.5.6 - More messages to send */
2551 /* TODO: */
2552 t += 5;
2553 return t;
2554}
2555/*- End of function --------------------------------------------------------*/
2556
2557static const char *at_cmd_plus_CMOD(at_state_t *s, const char *t)
2558{
2559 /* 3GPP TS 27.007 6.4 - Call mode */
2560 /* TODO: */
2561 t += 5;
2562 if (!parse_out(s, &t, NULL((void*)0), 1, "+CMOD:", ""))
2563 return NULL((void*)0);
2564 return t;
2565}
2566/*- End of function --------------------------------------------------------*/
2567
2568static const char *at_cmd_plus_CMSS(at_state_t *s, const char *t)
2569{
2570 /* GSM07.05 3.5.2/4.7 - Send message from storage */
2571 /* TODO: */
2572 t += 5;
2573 return t;
2574}
2575/*- End of function --------------------------------------------------------*/
2576
2577static const char *at_cmd_plus_CMUT(at_state_t *s, const char *t)
2578{
2579 /* 3GPP TS 27.007 8.24 - Mute control */
2580 /* TODO: */
2581 t += 5;
2582 if (!parse_out(s, &t, NULL((void*)0), 1, "+CMUT:", ""))
2583 return NULL((void*)0);
2584 return t;
2585}
2586/*- End of function --------------------------------------------------------*/
2587
2588static const char *at_cmd_plus_CNMA(at_state_t *s, const char *t)
2589{
2590 /* GSM07.05 3.4.4/4.6 - New message acknowledgement to terminal adapter */
2591 /* TODO: */
2592 t += 5;
2593 return t;
2594}
2595/*- End of function --------------------------------------------------------*/
2596
2597static const char *at_cmd_plus_CNMI(at_state_t *s, const char *t)
2598{
2599 /* GSM07.05 3.4.1 - New message indications to terminal equipment */
2600 /* TODO: */
2601 t += 5;
2602 return t;
2603}
2604/*- End of function --------------------------------------------------------*/
2605
2606static const char *at_cmd_plus_CMUX(at_state_t *s, const char *t)
2607{
2608 /* 3GPP TS 27.007 5.7 - Multiplexing mode */
2609 /* TODO: */
2610 t += 5;
2611 if (!parse_out(s, &t, NULL((void*)0), 1, "+CMUX:", ""))
2612 return NULL((void*)0);
2613 return t;
2614}
2615/*- End of function --------------------------------------------------------*/
2616
2617static const char *at_cmd_plus_CNUM(at_state_t *s, const char *t)
2618{
2619 /* 3GPP TS 27.007 7.1 - Subscriber number */
2620 /* TODO: */
2621 t += 5;
2622 if (!parse_out(s, &t, NULL((void*)0), 1, "+CNUM:", ""))
2623 return NULL((void*)0);
2624 return t;
2625}
2626/*- End of function --------------------------------------------------------*/
2627
2628static const char *at_cmd_plus_COLP(at_state_t *s, const char *t)
2629{
2630 /* 3GPP TS 27.007 7.8 - Connected line identification presentation */
2631 /* TODO: */
2632 t += 5;
2633 if (!parse_out(s, &t, NULL((void*)0), 1, "+COLP:", ""))
2634 return NULL((void*)0);
2635 return t;
2636}
2637/*- End of function --------------------------------------------------------*/
2638
2639static const char *at_cmd_plus_COPN(at_state_t *s, const char *t)
2640{
2641 /* 3GPP TS 27.007 7.21 - Read operator names */
2642 /* TODO: */
2643 t += 5;
2644 if (!parse_out(s, &t, NULL((void*)0), 1, "+COPN:", ""))
2645 return NULL((void*)0);
2646 return t;
2647}
2648/*- End of function --------------------------------------------------------*/
2649
2650static const char *at_cmd_plus_COPS(at_state_t *s, const char *t)
2651{
2652 /* 3GPP TS 27.007 7.3 - PLMN selection */
2653 /* TODO: */
2654 t += 5;
2655 if (!parse_out(s, &t, NULL((void*)0), 1, "+COPS:", ""))
2656 return NULL((void*)0);
2657 return t;
2658}
2659/*- End of function --------------------------------------------------------*/
2660
2661static const char *at_cmd_plus_COS(at_state_t *s, const char *t)
2662{
2663 /* IS-135 4.1.24 - Originating service */
2664 /* TODO: */
2665 t += 4;
2666 return t;
2667}
2668/*- End of function --------------------------------------------------------*/
2669
2670static const char *at_cmd_plus_COTDI(at_state_t *s, const char *t)
2671{
2672 /* 3GPP TS 27.007 11.1.9 - Originator to Dispatcher Information */
2673 /* TODO: */
2674 t += 6;
2675 if (!parse_out(s, &t, NULL((void*)0), 1, "+COTDI:", ""))
2676 return NULL((void*)0);
2677 return t;
2678}
2679/*- End of function --------------------------------------------------------*/
2680
2681static const char *at_cmd_plus_CPAS(at_state_t *s, const char *t)
2682{
2683 /* 3GPP TS 27.007 8.1 - Phone activity status */
2684 /* TODO: */
2685 t += 5;
2686 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPAS:", ""))
2687 return NULL((void*)0);
2688 return t;
2689}
2690/*- End of function --------------------------------------------------------*/
2691
2692static const char *at_cmd_plus_CPBF(at_state_t *s, const char *t)
2693{
2694 /* 3GPP TS 27.007 8.13 - Find phonebook entries */
2695 /* TODO: */
2696 t += 5;
2697 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPBF:", ""))
2698 return NULL((void*)0);
2699 return t;
2700}
2701/*- End of function --------------------------------------------------------*/
2702
2703static const char *at_cmd_plus_CPBR(at_state_t *s, const char *t)
2704{
2705 /* 3GPP TS 27.007 8.12 - Read phonebook entries */
2706 /* TODO: */
2707 t += 5;
2708 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPBR:", ""))
2709 return NULL((void*)0);
2710 return t;
2711}
2712/*- End of function --------------------------------------------------------*/
2713
2714static const char *at_cmd_plus_CPBS(at_state_t *s, const char *t)
2715{
2716 /* 3GPP TS 27.007 8.11 - Select phonebook memory storage */
2717 /* TODO: */
2718 t += 5;
2719 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPBS:", ""))
2720 return NULL((void*)0);
2721 return t;
2722}
2723/*- End of function --------------------------------------------------------*/
2724
2725static const char *at_cmd_plus_CPBW(at_state_t *s, const char *t)
2726{
2727 /* 3GPP TS 27.007 8.14 - Write phonebook entry */
2728 /* TODO: */
2729 t += 5;
2730 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPBW:", ""))
2731 return NULL((void*)0);
2732 return t;
2733}
2734/*- End of function --------------------------------------------------------*/
2735
2736static const char *at_cmd_plus_CPIN(at_state_t *s, const char *t)
2737{
2738 /* 3GPP TS 27.007 8.3 - Enter PIN */
2739 /* TODO: */
2740 t += 5;
2741 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPIN:", ""))
2742 return NULL((void*)0);
2743 return t;
2744}
2745/*- End of function --------------------------------------------------------*/
2746
2747static const char *at_cmd_plus_CPLS(at_state_t *s, const char *t)
2748{
2749 /* 3GPP TS 27.007 7.20 - Selection of preferred PLMN list */
2750 /* TODO: */
2751 t += 5;
2752 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPLS:", ""))
2753 return NULL((void*)0);
2754 return t;
2755}
2756/*- End of function --------------------------------------------------------*/
2757
2758static const char *at_cmd_plus_CPMS(at_state_t *s, const char *t)
2759{
2760 /* GSM07.05 3.2.2 - Preferred message storage */
2761 /* TODO: */
2762 t += 5;
2763 return t;
2764}
2765/*- End of function --------------------------------------------------------*/
2766
2767static const char *at_cmd_plus_CPOL(at_state_t *s, const char *t)
2768{
2769 /* 3GPP TS 27.007 7.19 - Preferred PLMN list */
2770 /* TODO: */
2771 t += 5;
2772 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPOL:", ""))
2773 return NULL((void*)0);
2774 return t;
2775}
2776/*- End of function --------------------------------------------------------*/
2777
2778static const char *at_cmd_plus_CPPS(at_state_t *s, const char *t)
2779{
2780 /* 3GPP TS 27.007 7.23 - eMLPP subscriptions */
2781 /* TODO: */
2782 t += 5;
2783 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPPS:", ""))
2784 return NULL((void*)0);
2785 return t;
2786}
2787/*- End of function --------------------------------------------------------*/
2788
2789static const char *at_cmd_plus_CPROT(at_state_t *s, const char *t)
2790{
2791 /* 3GPP TS 27.007 8.42 - Enter protocol mode */
2792 /* TODO: */
2793 t += 6;
2794 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPROT:", ""))
2795 return NULL((void*)0);
2796 return t;
2797}
2798/*- End of function --------------------------------------------------------*/
2799
2800static const char *at_cmd_plus_CPUC(at_state_t *s, const char *t)
2801{
2802 /* 3GPP TS 27.007 8.27 - Price per unit and currency table */
2803 /* TODO: */
2804 t += 5;
2805 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPUC:", ""))
2806 return NULL((void*)0);
2807 return t;
2808}
2809/*- End of function --------------------------------------------------------*/
2810
2811static const char *at_cmd_plus_CPWC(at_state_t *s, const char *t)
2812{
2813 /* 3GPP TS 27.007 8.29 - Power class */
2814 /* TODO: */
2815 t += 5;
2816 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPWC:", ""))
2817 return NULL((void*)0);
2818 return t;
2819}
2820/*- End of function --------------------------------------------------------*/
2821
2822static const char *at_cmd_plus_CPWD(at_state_t *s, const char *t)
2823{
2824 /* 3GPP TS 27.007 7.5 - Change password */
2825 /* TODO: */
2826 t += 5;
2827 if (!parse_out(s, &t, NULL((void*)0), 1, "+CPWD:", ""))
2828 return NULL((void*)0);
2829 return t;
2830}
2831/*- End of function --------------------------------------------------------*/
2832
2833static const char *at_cmd_plus_CQD(at_state_t *s, const char *t)
2834{
2835 /* IS-135 4.1.25 - Query disconnect timer */
2836 /* TODO: */
2837 t += 4;
2838 return t;
2839}
2840/*- End of function --------------------------------------------------------*/
2841
2842static const char *at_cmd_plus_CR(at_state_t *s, const char *t)
2843{
2844 /* 3GPP TS 27.007 6.9 - Service reporting control */
2845 /* TODO: */
2846 t += 3;
2847 if (!parse_out(s, &t, NULL((void*)0), 1, "+CR:", ""))
2848 return NULL((void*)0);
2849 return t;
2850}
2851/*- End of function --------------------------------------------------------*/
2852
2853static const char *at_cmd_plus_CRC(at_state_t *s, const char *t)
2854{
2855 /* 3GPP TS 27.007 6.11 - Cellular result codes */
2856 /* TODO: */
2857 t += 4;
2858 if (!parse_out(s, &t, NULL((void*)0), 1, "+CRC:", ""))
2859 return NULL((void*)0);
2860 return t;
2861}
2862/*- End of function --------------------------------------------------------*/
2863
2864static const char *at_cmd_plus_CREG(at_state_t *s, const char *t)
2865{
2866 /* 3GPP TS 27.007 7.2 - Network registration */
2867 /* TODO: */
2868 t += 5;
2869 if (!parse_out(s, &t, NULL((void*)0), 1, "+CREG:", ""))
2870 return NULL((void*)0);
2871 return t;
2872}
2873/*- End of function --------------------------------------------------------*/
2874
2875static const char *at_cmd_plus_CRES(at_state_t *s, const char *t)
2876{
2877 /* GSM07.05 3.3.6 - Restore Settings */
2878 /* TODO: */
2879 t += 5;
2880 if (!parse_out(s, &t, NULL((void*)0), 1, "+CRLP:", ""))
2881 return NULL((void*)0);
2882 return t;
2883}
2884/*- End of function --------------------------------------------------------*/
2885
2886static const char *at_cmd_plus_CRLP(at_state_t *s, const char *t)
2887{
2888 /* 3GPP TS 27.007 6.8 - Radio link protocol */
2889 /* TODO: */
2890 t += 5;
2891 if (!parse_out(s, &t, NULL((void*)0), 1, "+CRLP:", ""))
2892 return NULL((void*)0);
2893 return t;
2894}
2895/*- End of function --------------------------------------------------------*/
2896
2897static const char *at_cmd_plus_CRM(at_state_t *s, const char *t)
2898{
2899 /* IS-99 5.6 - Set rm interface protocol */
2900 /* TODO: */
2901 t += 4;
2902 return t;
2903}
2904/*- End of function --------------------------------------------------------*/
2905
2906static const char *at_cmd_plus_CRMC(at_state_t *s, const char *t)
2907{
2908 /* 3GPP TS 27.007 8.34 - Ring Melody Control */
2909 /* TODO: */
2910 t += 5;
2911 if (!parse_out(s, &t, NULL((void*)0), 1, "+CRMC:", ""))
2912 return NULL((void*)0);
2913 return t;
2914}
2915/*- End of function --------------------------------------------------------*/
2916
2917static const char *at_cmd_plus_CRMP(at_state_t *s, const char *t)
2918{
2919 /* 3GPP TS 27.007 8.35 - Ring Melody Playback */
2920 /* TODO: */
2921 t += 5;
2922 if (!parse_out(s, &t, NULL((void*)0), 1, "+CRMP:", ""))
2923 return NULL((void*)0);
2924 return t;
2925}
2926/*- End of function --------------------------------------------------------*/
2927
2928static const char *at_cmd_plus_CRSL(at_state_t *s, const char *t)
2929{
2930 /* 3GPP TS 27.007 8.21 - Ringer sound level */
2931 /* TODO: */
2932 t += 5;
2933 if (!parse_out(s, &t, NULL((void*)0), 1, "+CRSL:", ""))
2934 return NULL((void*)0);
2935 return t;
2936}
2937/*- End of function --------------------------------------------------------*/
2938
2939static const char *at_cmd_plus_CRSM(at_state_t *s, const char *t)
2940{
2941 /* 3GPP TS 27.007 8.18 - Restricted SIM access */
2942 /* TODO: */
2943 t += 5;
2944 if (!parse_out(s, &t, NULL((void*)0), 1, "+CRSM:", ""))
2945 return NULL((void*)0);
2946 return t;
2947}
2948/*- End of function --------------------------------------------------------*/
2949
2950static const char *at_cmd_plus_CSAS(at_state_t *s, const char *t)
2951{
2952 /* GSM07.05 3.3.5 - Save settings */
2953 /* TODO: */
2954 t += 5;
2955 return t;
2956}
2957/*- End of function --------------------------------------------------------*/
2958
2959static const char *at_cmd_plus_CSCA(at_state_t *s, const char *t)
2960{
2961 /* GSM07.05 3.3.1 - Service centre address */
2962 /* TODO: */
2963 t += 5;
2964 return t;
2965}
2966/*- End of function --------------------------------------------------------*/
2967
2968static const char *at_cmd_plus_CSCB(at_state_t *s, const char *t)
2969{
2970 /* GSM07.05 3.3.4 - Select cell broadcast message types */
2971 /* TODO: */
2972 t += 5;
2973 return t;
2974}
2975/*- End of function --------------------------------------------------------*/
2976
2977static const char *at_cmd_plus_CSCC(at_state_t *s, const char *t)
2978{
2979 /* 3GPP TS 27.007 8.19 - Secure control command */
2980 /* TODO: */
2981 t += 5;
2982 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSCC:", ""))
2983 return NULL((void*)0);
2984 return t;
2985}
2986/*- End of function --------------------------------------------------------*/
2987
2988static const char *at_cmd_plus_CSCS(at_state_t *s, const char *t)
2989{
2990 /* 3GPP TS 27.007 5.5 - Select TE character set */
2991 /* TODO: */
2992 t += 5;
2993 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSCS:", ""))
2994 return NULL((void*)0);
2995 return t;
2996}
2997/*- End of function --------------------------------------------------------*/
2998
2999static const char *at_cmd_plus_CSDF(at_state_t *s, const char *t)
3000{
3001 /* 3GPP TS 27.007 6.22 - Settings date format */
3002 /* TODO: */
3003 t += 5;
3004 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSDF:", ""))
3005 return NULL((void*)0);
3006 return t;
3007}
3008/*- End of function --------------------------------------------------------*/
3009
3010static const char *at_cmd_plus_CSDH(at_state_t *s, const char *t)
3011{
3012 /* GSM07.05 3.3.3 - Show text mode parameters */
3013 /* TODO: */
3014 t += 5;
3015 return t;
3016}
3017/*- End of function --------------------------------------------------------*/
3018
3019static const char *at_cmd_plus_CSGT(at_state_t *s, const char *t)
3020{
3021 /* 3GPP TS 27.007 8.32 - Set Greeting Text */
3022 /* TODO: */
3023 t += 5;
3024 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSGT:", ""))
3025 return NULL((void*)0);
3026 return t;
3027}
3028/*- End of function --------------------------------------------------------*/
3029
3030static const char *at_cmd_plus_CSIL(at_state_t *s, const char *t)
3031{
3032 /* 3GPP TS 27.007 6.23 - Silence Command */
3033 /* TODO: */
3034 t += 5;
3035 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSIL:", ""))
3036 return NULL((void*)0);
3037 return t;
3038}
3039/*- End of function --------------------------------------------------------*/
3040
3041static const char *at_cmd_plus_CSIM(at_state_t *s, const char *t)
3042{
3043 /* 3GPP TS 27.007 8.17 - Generic SIM access */
3044 /* TODO: */
3045 t += 5;
3046 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSIM:", ""))
3047 return NULL((void*)0);
3048 return t;
3049}
3050/*- End of function --------------------------------------------------------*/
3051
3052static const char *at_cmd_plus_CSMP(at_state_t *s, const char *t)
3053{
3054 /* GSM07.05 3.3.2 - Set text mode parameters */
3055 /* TODO: */
3056 t += 5;
3057 return t;
3058}
3059/*- End of function --------------------------------------------------------*/
3060
3061static const char *at_cmd_plus_CSMS(at_state_t *s, const char *t)
3062{
3063 /* GSM07.05 3.2.1 - Select Message Service */
3064 /* TODO: */
3065 t += 5;
3066 return t;
3067}
3068/*- End of function --------------------------------------------------------*/
3069
3070static const char *at_cmd_plus_CSNS(at_state_t *s, const char *t)
3071{
3072 /* 3GPP TS 27.007 6.19 - Single numbering scheme */
3073 /* TODO: */
3074 t += 5;
3075 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSNS:", ""))
3076 return NULL((void*)0);
3077 return t;
3078}
3079/*- End of function --------------------------------------------------------*/
3080
3081static const char *at_cmd_plus_CSQ(at_state_t *s, const char *t)
3082{
3083 /* 3GPP TS 27.007 8.5 - Signal quality */
3084 /* TODO: */
3085 t += 4;
3086 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSQ:", ""))
3087 return NULL((void*)0);
3088 return t;
3089}
3090/*- End of function --------------------------------------------------------*/
3091
3092static const char *at_cmd_plus_CSS(at_state_t *s, const char *t)
3093{
3094 /* IS-135 4.1.28 - Serving system identification */
3095 /* TODO: */
3096 t += 4;
3097 return t;
3098}
3099/*- End of function --------------------------------------------------------*/
3100
3101static const char *at_cmd_plus_CSSN(at_state_t *s, const char *t)
3102{
3103 /* 3GPP TS 27.007 7.17 - Supplementary service notifications */
3104 /* TODO: */
3105 t += 5;
3106 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSSN:", ""))
3107 return NULL((void*)0);
3108 return t;
3109}
3110/*- End of function --------------------------------------------------------*/
3111
3112static const char *at_cmd_plus_CSTA(at_state_t *s, const char *t)
3113{
3114 /* 3GPP TS 27.007 6.1 - Select type of address */
3115 /* TODO: */
3116 t += 5;
3117 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSTA:", ""))
3118 return NULL((void*)0);
3119 return t;
3120}
3121/*- End of function --------------------------------------------------------*/
3122
3123static const char *at_cmd_plus_CSTF(at_state_t *s, const char *t)
3124{
3125 /* 3GPP TS 27.007 6.24 - Settings time format */
3126 /* TODO: */
3127 t += 5;
3128 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSTF:", ""))
3129 return NULL((void*)0);
3130 return t;
3131}
3132/*- End of function --------------------------------------------------------*/
3133
3134static const char *at_cmd_plus_CSVM(at_state_t *s, const char *t)
3135{
3136 /* 3GPP TS 27.007 8.33 - Set Voice Mail Number */
3137 /* TODO: */
3138 t += 5;
3139 if (!parse_out(s, &t, NULL((void*)0), 1, "+CSVM:", ""))
3140 return NULL((void*)0);
3141 return t;
3142}
3143/*- End of function --------------------------------------------------------*/
3144
3145static const char *at_cmd_plus_CTA(at_state_t *s, const char *t)
3146{
3147 /* IS-135 4.1.29 - MT-Terminated async. Data calls */
3148 /* TODO: */
3149 t += 4;
3150 return t;
3151}
3152/*- End of function --------------------------------------------------------*/
3153
3154static const char *at_cmd_plus_CTF(at_state_t *s, const char *t)
3155{
3156 /* IS-135 4.1.30 - MT-Terminated FAX calls */
3157 /* TODO: */
3158 t += 4;
3159 return t;
3160}
3161/*- End of function --------------------------------------------------------*/
3162
3163static const char *at_cmd_plus_CTFR(at_state_t *s, const char *t)
3164{
3165 /* 3GPP TS 27.007 7.14 - Call deflection */
3166 /* TODO: */
3167 t += 5;
3168 if (!parse_out(s, &t, NULL((void*)0), 1, "+CTFR:", ""))
3169 return NULL((void*)0);
3170 return t;
3171}
3172/*- End of function --------------------------------------------------------*/
3173
3174static const char *at_cmd_plus_CTZR(at_state_t *s, const char *t)
3175{
3176 /* 3GPP TS 27.007 8.41 - Time Zone Reporting */
3177 /* TODO: */
3178 t += 5;
3179 if (!parse_out(s, &t, NULL((void*)0), 1, "+CTZR:", ""))
3180 return NULL((void*)0);
3181 return t;
3182}
3183/*- End of function --------------------------------------------------------*/
3184
3185static const char *at_cmd_plus_CTZU(at_state_t *s, const char *t)
3186{
3187 /* 3GPP TS 27.007 8.40 - Automatic Time Zone Update */
3188 /* TODO: */
3189 t += 5;
3190 if (!parse_out(s, &t, NULL((void*)0), 1, "+CTZU:", ""))
3191 return NULL((void*)0);
3192 return t;
3193}
3194/*- End of function --------------------------------------------------------*/
3195
3196static const char *at_cmd_plus_CUSD(at_state_t *s, const char *t)
3197{
3198 /* 3GPP TS 27.007 7.15 - Unstructured supplementary service data */
3199 /* TODO: */
3200 t += 5;
3201 if (!parse_out(s, &t, NULL((void*)0), 1, "+CUSD:", ""))
3202 return NULL((void*)0);
3203 return t;
3204}
3205/*- End of function --------------------------------------------------------*/
3206
3207static const char *at_cmd_plus_CUUS1(at_state_t *s, const char *t)
3208{
3209 /* 3GPP TS 27.007 7.26 - User to User Signalling Service 1 */
3210 /* TODO: */
3211 t += 6;
3212 if (!parse_out(s, &t, NULL((void*)0), 1, "+CUUS1:", ""))
3213 return NULL((void*)0);
3214 return t;
3215}
3216/*- End of function --------------------------------------------------------*/
3217
3218static const char *at_cmd_plus_CV120(at_state_t *s, const char *t)
3219{
3220 /* 3GPP TS 27.007 6.21 - V.120 rate adaption protocol */
3221 /* TODO: */
3222 t += 6;
3223 if (!parse_out(s, &t, NULL((void*)0), 1, "+CV120:", ""))
3224 return NULL((void*)0);
3225 return t;
3226}
3227/*- End of function --------------------------------------------------------*/
3228
3229static const char *at_cmd_plus_CVHU(at_state_t *s, const char *t)
3230{
3231 /* 3GPP TS 27.007 6.20 - Voice Hangup Control */
3232 /* TODO: */
3233 t += 5;
3234 if (!parse_out(s, &t, NULL((void*)0), 1, "+CVHU:", ""))
3235 return NULL((void*)0);
3236 return t;
3237}
3238/*- End of function --------------------------------------------------------*/
3239
3240static const char *at_cmd_plus_CVIB(at_state_t *s, const char *t)
3241{
3242 /* 3GPP TS 27.007 8.22 - Vibrator mode */
3243 /* TODO: */
3244 t += 5;
3245 if (!parse_out(s, &t, NULL((void*)0), 1, "+CVIB:", ""))
3246 return NULL((void*)0);
3247 return t;
3248}
3249/*- End of function --------------------------------------------------------*/
3250
3251static const char *at_cmd_plus_CXT(at_state_t *s, const char *t)
3252{
3253 /* IS-99 5.6 - Cellular extension */
3254 /* TODO: */
3255 t += 4;
3256 return t;
3257}
3258/*- End of function --------------------------------------------------------*/
3259
3260static const char *at_cmd_plus_DR(at_state_t *s, const char *t)
3261{
3262 /* V.250 6.6.2 - Data compression reporting */
3263 /* TODO: */
3264 t += 3;
3265 if (!parse_out(s, &t, NULL((void*)0), 1, "+DR:", ""))
3266 return NULL((void*)0);
3267 return t;
3268}
3269/*- End of function --------------------------------------------------------*/
3270
3271static const char *at_cmd_plus_DS(at_state_t *s, const char *t)
3272{
3273 /* V.250 6.6.1 - Data compression */
3274 /* TODO: */
3275 t += 3;
3276 if (!parse_out(s, &t, NULL((void*)0), 1, "+DS:", ""))
3277 return NULL((void*)0);
3278 return t;
3279}
3280/*- End of function --------------------------------------------------------*/
3281
3282static const char *at_cmd_plus_DS44(at_state_t *s, const char *t)
3283{
3284 /* V.250 6.6.2 - V.44 data compression */
3285 /* TODO: */
3286 t += 5;
3287 return t;
3288}
3289/*- End of function --------------------------------------------------------*/
3290
3291static const char *at_cmd_plus_EB(at_state_t *s, const char *t)
3292{
3293 /* V.250 6.5.2 - Break handling in error control operation */
3294 /* TODO: */
3295 t += 3;
3296 if (!parse_out(s, &t, NULL((void*)0), 1, "+EB:", ""))
3297 return NULL((void*)0);
3298 return t;
3299}
3300/*- End of function --------------------------------------------------------*/
3301
3302static const char *at_cmd_plus_EFCS(at_state_t *s, const char *t)
3303{
3304 /* V.250 6.5.4 - 32-bit frame check sequence */
3305 /* TODO: */
3306 t += 5;
3307 if (!parse_out(s, &t, NULL((void*)0), 2, "+EFCS:", "(0-2)"))
3308 return NULL((void*)0);
3309 return t;
3310}
3311/*- End of function --------------------------------------------------------*/
3312
3313static const char *at_cmd_plus_EFRAM(at_state_t *s, const char *t)
3314{
3315 /* V.250 6.5.8 - Frame length */
3316 /* TODO: */
3317 t += 6;
3318 if (!parse_2_out(s, &t, NULL((void*)0), 65535, NULL((void*)0), 65535, "+EFRAM:", "(1-65535),(1-65535)"))
3319 return NULL((void*)0);
3320 return t;
3321}
3322/*- End of function --------------------------------------------------------*/
3323
3324static const char *at_cmd_plus_ER(at_state_t *s, const char *t)
3325{
3326 /* V.250 6.5.5 - Error control reporting */
3327 /* 0 Error control reporting disabled (no +ER intermediate result code transmitted)
3328 1 Error control reporting enabled (+ER intermediate result code transmitted) */
3329 /* TODO: */
3330 t += 3;
3331 if (!parse_out(s, &t, NULL((void*)0), 1, "+ER:", "(0,1)"))
3332 return NULL((void*)0);
3333 return t;
3334}
3335/*- End of function --------------------------------------------------------*/
3336
3337static const char *at_cmd_plus_ES(at_state_t *s, const char *t)
3338{
3339 static const int maxes[3] =
3340 {
3341 7, 4, 9
3342 };
3343 int *locations[3];
3344
3345 /* V.250 6.5.1 - Error control selection */
3346
3347 /* orig_rqst
3348 0: Direct mode
3349 1: Initiate call with Buffered mode only
3350 2: Initiate V.42 without Detection Phase. If Rec. V.8 is in use, this is a request to disable V.42 Detection Phase
3351 3: Initiate V.42 with Detection Phase
3352 4: Initiate Altemative Protocol
3353 5: Initiate Synchronous Mode when connection is completed, immediately after the entire CONNECT result code
3354 is delivered. V.24 circuits 113 and 115 are activated when Data State is entered
3355 6: Initiate Synchronous Access Mode when connection is completed, and Data State is entered
3356 7: Initiate Frame Tunnelling Mode when connection is completed, and Data State is entered
3357
3358 orig_fbk
3359 0: Error control optional (either LAPM or Alternative acceptable); if error control not established, maintain
3360 DTE-DCE data rate and use V.14 buffered mode with flow control during non-error-control operation
3361 1: Error control optional (either LAPM or Alternative acceptable); if error control not established, change
3362 DTE-DCE data rate to match line rate and use Direct mode
3363 2: Error control required (either LAPM or Alternative acceptable); if error control not established, disconnect
3364 3: Error control required (only LAPM acceptable); if error control not established, disconnect
3365 4: Error control required (only Altemative protocol acceptable); if error control not established, disconnect
3366
3367 ans_fbk
3368 0: Direct mode
3369 1: Error control disabled, use Buffered mode
3370 2: Error control optional (either LAPM or Alternative acceptable); if error control not established, maintain
3371 DTE-DCE data rate and use local buffering and flow control during non-error-control operation
3372 3: Error control optional (either LAPM or Alternative acceptable); if error control not established, change
3373 DTE-DCE data rate to match line rate and use Direct mode
3374 4: Error control required (either LAPM or Alternative acceptable); if error control not established, disconnect
3375 5: Error control required (only LAPM acceptable); if error control not established, disconnect
3376 6: Error control required (only Alternative protocol acceptable); if error control not established, disconnect
3377 7: Initiate Synchronous Mode when connection is completed, immediately after the entire CONNECT result code
3378 is delivered. V.24 cicuits 113 and 115 are activated when Data State is entered
3379 8: Initiate Synchronous Access Mode when connection is completed, and Data State is entered
3380 9: Initiate Frame Tunnelling Mode when connection is completed, and Data State is entered */
3381
3382 /* TODO: */
3383 t += 3;
3384 locations[0] = NULL((void*)0);
3385 locations[1] = NULL((void*)0);
3386 locations[2] = NULL((void*)0);
3387 if (!parse_n_out(s, &t, locations, maxes, 3, "+ES:", "(0-7),(0-4),(0-9)"))
3388 return NULL((void*)0);
3389 return t;
3390}
3391/*- End of function --------------------------------------------------------*/
3392
3393static const char *at_cmd_plus_ESA(at_state_t *s, const char *t)
3394{
3395 static const int maxes[8] =
3396 {
3397 2, 1, 1, 1, 2, 1, 255, 255
3398 };
3399 int *locations[8];
3400 int i;
3401
3402 /* V.80 8.2 - Synchronous access mode configuration */
3403 /* TODO: */
3404 t += 4;
3405 for (i = 0; i < 8; i++)
3406 locations[i] = NULL((void*)0);
3407 if (!parse_n_out(s, &t, locations, maxes, 8, "+ESA:", "(0-2),(0-1),(0-1),(0-1),(0-2),(0-1),(0-255),(0-255)"))
3408 return NULL((void*)0);
3409 return t;
3410}
3411/*- End of function --------------------------------------------------------*/
3412
3413static const char *at_cmd_plus_ESR(at_state_t *s, const char *t)
3414{
3415 /* V.250 6.5.3 - Selective repeat */
3416 /* TODO: */
3417 t += 4;
3418 return t;
3419}
3420/*- End of function --------------------------------------------------------*/
3421
3422static const char *at_cmd_plus_ETBM(at_state_t *s, const char *t)
3423{
3424 /* V.250 6.5.6 - Call termination buffer management */
3425 /* TODO: */
3426 t += 5;
3427 if (!parse_2_out(s, &t, NULL((void*)0), 2, NULL((void*)0), 2, "+ETBM:", "(0-2),(0-2),(0-30)"))
3428 return NULL((void*)0);
3429 return t;
3430}
3431/*- End of function --------------------------------------------------------*/
3432
3433static const char *at_cmd_plus_EWIND(at_state_t *s, const char *t)
3434{
3435 /* V.250 6.5.7 - Window size */
3436 /* TODO: */
3437 t += 6;
3438 if (!parse_2_out(s, &t, &s->rx_window, 127, &s->tx_window, 127, "+EWIND:", "(1-127),(1-127)"))
3439 return NULL((void*)0);
3440 return t;
3441}
3442/*- End of function --------------------------------------------------------*/
3443
3444static const char *at_cmd_plus_F34(at_state_t *s, const char *t)
3445{
3446 static const int maxes[5] =
3447 {
3448 14, 14, 2, 14, 14
3449 };
3450 int *locations[5];
3451 int i;
3452
3453 /* T.31 B.6.1 - Initial V.34 rate controls for FAX */
3454 /* Syntax: +F34=[<maxp>][,[<minp>][,<prefc>][,<maxp2>][,<minp2]] */
3455 /* TODO */
3456 t += 4;
3457 for (i = 0; i < 5; i++)
3458 locations[i] = NULL((void*)0);
3459 if (!parse_n_out(s, &t, locations, maxes, 5, "+F34:", "(0-14),(0-14),(0-2),(0-14),(0-14)"))
3460 return NULL((void*)0);
3461 return t;
3462}
3463/*- End of function --------------------------------------------------------*/
3464
3465static const char *at_cmd_plus_FAA(at_state_t *s, const char *t)
3466{
3467 /* T.32 8.5.2.5 - Adaptive answer parameter */
3468 /* TODO */
3469 t += 4;
3470 return t;
3471}
3472/*- End of function --------------------------------------------------------*/
3473
3474static const char *at_cmd_plus_FAP(at_state_t *s, const char *t)
3475{
3476 /* T.32 8.5.1.12 - Addressing and polling capabilities parameter */
3477 /* TODO */
3478 t += 4;
3479 return t;
3480}
3481/*- End of function --------------------------------------------------------*/
3482
3483static const char *at_cmd_plus_FAR(at_state_t *s, const char *t)
3484{
3485 /* T.31 8.5.1 - Adaptive reception control */
3486 t += 4;
3487 if (!parse_out(s, &t, &s->p.adaptive_receive, 1, NULL((void*)0), "0,1"))
3488 return NULL((void*)0);
3489 return t;
3490}
3491/*- End of function --------------------------------------------------------*/
3492
3493static const char *at_cmd_plus_FBO(at_state_t *s, const char *t)
3494{
3495 /* T.32 8.5.3.4 - Phase C data bit order */
3496 /* TODO */
3497 t += 4;
3498 return t;
3499}
3500/*- End of function --------------------------------------------------------*/
3501
3502static const char *at_cmd_plus_FBS(at_state_t *s, const char *t)
3503{
3504 /* T.32 8.5.3.2 - Buffer Size, read only parameter */
3505 /* TODO */
3506 t += 4;
3507 return t;
3508}
3509/*- End of function --------------------------------------------------------*/
3510
3511static const char *at_cmd_plus_FBU(at_state_t *s, const char *t)
3512{
3513 /* T.32 8.5.1.10 - HDLC Frame Reporting parameter */
3514 /* TODO */
3515 t += 4;
3516 return t;
3517}
3518/*- End of function --------------------------------------------------------*/
3519
3520static const char *at_cmd_plus_FCC(at_state_t *s, const char *t)
3521{
3522 /* T.32 8.5.1.1 - DCE capabilities parameters */
3523 /* TODO */
3524 t += 4;
3525 return t;
3526}
3527/*- End of function --------------------------------------------------------*/
3528
3529static const char *at_cmd_plus_FCL(at_state_t *s, const char *t)
3530{
3531 /* T.31 8.5.2 - Carrier loss timeout */
3532 t += 4;
3533 if (!parse_out(s, &t, &s->carrier_loss_timeout, 255, NULL((void*)0), "(0-255)"))
3534 return NULL((void*)0);
3535 return t;
3536}
3537/*- End of function --------------------------------------------------------*/
3538
3539static const char *at_cmd_plus_FCLASS(at_state_t *s, const char *t)
3540{
3541 /* T.31 8.2 - Capabilities identification and control */
3542 t += 7;
3543 /* T.31 says the reply string should be "0,1.0", however making
3544 it "0,1,1.0" makes things compatible with a lot more software
3545 that may be expecting a pre-T.31 modem. */
3546 if (!parse_string_list_out(s, &t, &s->fclass_mode, 1, NULL((void*)0), "0,1,1.0"))
3547 return NULL((void*)0);
3548 return t;
3549}
3550/*- End of function --------------------------------------------------------*/
3551
3552static const char *at_cmd_plus_FCQ(at_state_t *s, const char *t)
3553{
3554 /* T.32 8.5.2.3 - Copy quality checking parameter */
3555 /* TODO */
3556 t += 4;
3557 return t;
3558}
3559/*- End of function --------------------------------------------------------*/
3560
3561static const char *at_cmd_plus_FCR(at_state_t *s, const char *t)
3562{
3563 /* T.32 8.5.1.9 - Capability to receive parameter */
3564 /* TODO */
3565 t += 4;
3566 return t;
3567}
3568/*- End of function --------------------------------------------------------*/
3569
3570static const char *at_cmd_plus_FCS(at_state_t *s, const char *t)
3571{
3572 /* T.32 8.5.1.3 - Current Session Results parameters */
3573 /* TODO */
3574 t += 4;
3575 return t;
3576}
3577/*- End of function --------------------------------------------------------*/
3578
3579static const char *at_cmd_plus_FCT(at_state_t *s, const char *t)
3580{
3581 /* T.32 8.5.2.6 - DTE phase C timeout parameter */
3582 /* TODO */
3583 t += 4;
3584 return t;
3585}
3586/*- End of function --------------------------------------------------------*/
3587
3588static const char *at_cmd_plus_FDD(at_state_t *s, const char *t)
3589{
3590 /* T.31 8.5.3 - Double escape character replacement */
3591 t += 4;
3592 if (!parse_out(s, &t, &s->p.double_escape, 1, NULL((void*)0), "(0,1)"))
3593 return NULL((void*)0);
3594 return t;
3595}
3596/*- End of function --------------------------------------------------------*/
3597
3598static const char *at_cmd_plus_FDR(at_state_t *s, const char *t)
3599{
3600 /* T.32 8.3.4 - Data reception command */
3601 /* TODO */
3602 t += 4;
3603 return t;
3604}
3605/*- End of function --------------------------------------------------------*/
3606
3607static const char *at_cmd_plus_FDT(at_state_t *s, const char *t)
3608{
3609 /* T.32 8.3.3 - Data transmission command */
3610 /* TODO */
3611 t += 4;
3612 return t;
3613}
3614/*- End of function --------------------------------------------------------*/
3615
3616static const char *at_cmd_plus_FEA(at_state_t *s, const char *t)
3617{
3618 /* T.32 8.5.3.5 - Phase C received EOL alignment parameter */
3619 /* TODO */
3620 t += 4;
3621 return t;
3622}
3623/*- End of function --------------------------------------------------------*/
3624
3625static const char *at_cmd_plus_FFC(at_state_t *s, const char *t)
3626{
3627 /* T.32 8.5.3.6 - Format conversion parameter */
3628 /* TODO */
3629 t += 4;
3630 return t;
3631}
3632/*- End of function --------------------------------------------------------*/
3633
3634static const char *at_cmd_plus_FFD(at_state_t *s, const char *t)
3635{
3636 /* T.32 8.5.1.14 - File diagnostic message parameter */
3637 /* TODO */
3638 t += 4;
3639 return t;
3640}
3641/*- End of function --------------------------------------------------------*/
3642
3643static const char *at_cmd_plus_FHS(at_state_t *s, const char *t)
3644{
3645 /* T.32 8.5.2.7 - Call termination status parameter */
3646 /* TODO */
3647 t += 4;
3648 return t;
3649}
3650/*- End of function --------------------------------------------------------*/
3651
3652static const char *at_cmd_plus_FIE(at_state_t *s, const char *t)
3653{
3654 /* T.32 8.5.2.1 - Procedure interrupt enable parameter */
3655 /* TODO */
3656 t += 4;
3657 return t;
3658}
3659/*- End of function --------------------------------------------------------*/
3660
3661static const char *at_cmd_plus_FIP(at_state_t *s, const char *t)
3662{
3663 /* T.32 8.3.6 - Initialize Facsimile Parameters */
3664 t += 4;
3665 return t;
3666}
3667/*- End of function --------------------------------------------------------*/
3668
3669static const char *at_cmd_plus_FIS(at_state_t *s, const char *t)
3670{
3671 /* T.32 8.5.1.2 - Current session parameters */
3672 /* TODO */
3673 t += 4;
3674 return t;
3675}
3676/*- End of function --------------------------------------------------------*/
3677
3678static const char *at_cmd_plus_FIT(at_state_t *s, const char *t)
3679{
3680 /* T.31 8.5.4 - DTE inactivity timeout */
3681 t += 4;
3682 if (!parse_2_out(s, &t, &s->dte_inactivity_timeout, 255, &s->dte_inactivity_action, 1, "+FIT:", "(0-255),(0-1)"))
3683 return NULL((void*)0);
3684 return t;
3685}
3686/*- End of function --------------------------------------------------------*/
3687
3688static const char *at_cmd_plus_FKS(at_state_t *s, const char *t)
3689{
3690 /* T.32 8.3.5 - Session termination command */
3691 /* TODO: */
3692 t += 4;
3693 return t;
3694}
3695/*- End of function --------------------------------------------------------*/
3696
3697static const char *at_cmd_plus_FLI(at_state_t *s, const char *t)
3698{
3699 /* T.32 8.5.1.5 - Local ID string parameter, TSI or CSI */
3700 /* TODO: */
3701 t += 4;
3702 return t;
3703}
3704/*- End of function --------------------------------------------------------*/
3705
3706static const char *at_cmd_plus_FLO(at_state_t *s, const char *t)
3707{
3708 /* T.31 Annex A */
3709 /* Implement something similar to the V.250 +IFC command */
3710 /* 0: None.
3711 1: XON/XOFF.
3712 2: Hardware (default) */
3713 t += 4;
3714 span_log(&s->logging, SPAN_LOG_FLOW, "+FLO received\n");
3715 if (!parse_out(s, &t, &s->dte_dce_flow_control, 2, "+FLO:", "(0-2)"))
3716 return NULL((void*)0);
3717 s->dce_dte_flow_control = s->dte_dce_flow_control;
3718 return t;
3719}
3720/*- End of function --------------------------------------------------------*/
3721
3722static const char *at_cmd_plus_FLP(at_state_t *s, const char *t)
3723{
3724 /* T.32 8.5.1.7 - Indicate document to poll parameter */
3725 /* TODO: */
3726 t += 4;
3727 return t;
3728}
3729/*- End of function --------------------------------------------------------*/
3730
3731static const char *at_cmd_plus_FMI(at_state_t *s, const char *t)
3732{
3733 /* T.31 says to duplicate +GMI */
3734 t += 4;
3735 if (t[0] == '?')
3736 {
3737 at_put_response(s, manufacturer);
3738 t += 1;
3739 }
3740 return t;
3741}
3742/*- End of function --------------------------------------------------------*/
3743
3744static const char *at_cmd_plus_FMM(at_state_t *s, const char *t)
3745{
3746 /* T.31 says to duplicate +GMM */
3747 t += 4;
3748 if (t[0] == '?')
3749 {
3750 at_put_response(s, model);
3751 t += 1;
3752 }
3753 return t;
3754}
3755/*- End of function --------------------------------------------------------*/
3756
3757static const char *at_cmd_plus_FMR(at_state_t *s, const char *t)
3758{
3759 /* T.31 says to duplicate +GMR */
3760 t += 4;
3761 if (t[0] == '?')
3762 {
3763 at_put_response(s, revision);
3764 t += 1;
3765 }
3766 return t;
3767}
3768/*- End of function --------------------------------------------------------*/
3769
3770static const char *at_cmd_plus_FMS(at_state_t *s, const char *t)
3771{
3772 /* T.32 8.5.2.9 - Minimum phase C speed parameter */
3773 t += 4;
3774 return t;
3775}
3776/*- End of function --------------------------------------------------------*/
3777
3778static const char *at_cmd_plus_FND(at_state_t *s, const char *t)
3779{
3780 /* T.32 8.5.2.10 - Non-Standard Message Data Indication parameter */
3781 t += 4;
3782 return t;
3783}
3784/*- End of function --------------------------------------------------------*/
3785
3786static const char *at_cmd_plus_FNR(at_state_t *s, const char *t)
3787{
3788 /* T.32 8.5.1.11 - Negotiation message reporting control parameters */
3789 t += 4;
3790 return t;
3791}
3792/*- End of function --------------------------------------------------------*/
3793
3794static const char *at_cmd_plus_FNS(at_state_t *s, const char *t)
3795{
3796 /* T.32 8.5.1.6 - Non-Standard Frame FIF parameter */
3797 t += 4;
3798 return t;
3799}
3800/*- End of function --------------------------------------------------------*/
3801
3802static const char *at_cmd_plus_FPA(at_state_t *s, const char *t)
3803{
3804 /* T.32 8.5.1.13 - Selective polling address parameter */
3805 t += 4;
3806 return t;
3807}
3808/*- End of function --------------------------------------------------------*/
3809
3810static const char *at_cmd_plus_FPI(at_state_t *s, const char *t)
3811{
3812 /* T.32 8.5.1.5 - Local Polling ID String parameter */
3813 t += 4;
3814 return t;
3815}
3816/*- End of function --------------------------------------------------------*/
3817
3818static const char *at_cmd_plus_FPP(at_state_t *s, const char *t)
3819{
3820 /* T.32 8.5.3 - Facsimile packet protocol */
3821 t += 4;
3822 return t;
3823}
3824/*- End of function --------------------------------------------------------*/
3825
3826static const char *at_cmd_plus_FPR(at_state_t *s, const char *t)
3827{
3828 /* T.31 Annex A */
3829 /* Implement something similar to the V.250 +IPR command */
3830 t += 4;
3831 if (!parse_out(s, &t, &s->dte_rate, 115200, NULL((void*)0), "115200"))
3832 return NULL((void*)0);
3833 return t;
3834}
3835/*- End of function --------------------------------------------------------*/
3836
3837static const char *at_cmd_plus_FPS(at_state_t *s, const char *t)
3838{
3839 /* T.32 8.5.2.2 - Page Status parameter */
3840 t += 4;
3841 return t;
3842}
3843/*- End of function --------------------------------------------------------*/
3844
3845static const char *at_cmd_plus_FPW(at_state_t *s, const char *t)
3846{
3847 /* T.32 8.5.1.13 - PassWord parameter (Sending or Polling) */
3848 t += 4;
3849 return t;
3850}
3851/*- End of function --------------------------------------------------------*/
3852
3853static const char *at_cmd_plus_FRH(at_state_t *s, const char *t)
3854{
3855 /* T.31 8.3.6 - HDLC receive */
3856 if (!process_class1_cmd(s, &t))
3857 return NULL((void*)0);
3858 return t;
3859}
3860/*- End of function --------------------------------------------------------*/
3861
3862static const char *at_cmd_plus_FRM(at_state_t *s, const char *t)
3863{
3864 /* T.31 8.3.4 - Facsimile receive */
3865 if (!process_class1_cmd(s, &t))
3866 return NULL((void*)0);
3867 return t;
3868}
3869/*- End of function --------------------------------------------------------*/
3870
3871static const char *at_cmd_plus_FRQ(at_state_t *s, const char *t)
3872{
3873 /* T.32 8.5.2.4 - Receive Quality Thresholds parameters */
3874 /* TODO */
3875 t += 4;
3876 return t;
3877}
3878/*- End of function --------------------------------------------------------*/
3879
3880static const char *at_cmd_plus_FRS(at_state_t *s, const char *t)
3881{
3882 /* T.31 8.3.2 - Receive silence */
3883 if (!process_class1_cmd(s, &t))
3884 return NULL((void*)0);
3885 return t;
3886}
3887/*- End of function --------------------------------------------------------*/
3888
3889static const char *at_cmd_plus_FRY(at_state_t *s, const char *t)
3890{
3891 /* T.32 8.5.2.8 - ECM Retry Value parameter */
3892 /* TODO */
3893 t += 4;
3894 return t;
3895}
3896/*- End of function --------------------------------------------------------*/
3897
3898static const char *at_cmd_plus_FSA(at_state_t *s, const char *t)
3899{
3900 /* T.32 8.5.1.13 - Subaddress parameter */
3901 /* TODO */
3902 t += 4;
3903 return t;
3904}
3905/*- End of function --------------------------------------------------------*/
3906
3907static const char *at_cmd_plus_FSP(at_state_t *s, const char *t)
3908{
3909 /* T.32 8.5.1.8 - Request to poll parameter */
3910 /* TODO */
3911 t += 4;
3912 return t;
3913}
3914/*- End of function --------------------------------------------------------*/
3915
3916static const char *at_cmd_plus_FTH(at_state_t *s, const char *t)
3917{
3918 /* T.31 8.3.5 - HDLC transmit */
3919 if (!process_class1_cmd(s, &t))
3920 return NULL((void*)0);
3921 return t;
3922}
3923/*- End of function --------------------------------------------------------*/
3924
3925static const char *at_cmd_plus_FTM(at_state_t *s, const char *t)
3926{
3927 /* T.31 8.3.3 - Facsimile transmit */
3928 if (!process_class1_cmd(s, &t))
3929 return NULL((void*)0);
3930 return t;
3931}
3932/*- End of function --------------------------------------------------------*/
3933
3934static const char *at_cmd_plus_FTS(at_state_t *s, const char *t)
3935{
3936 /* T.31 8.3.1 - Transmit silence */
3937 if (!process_class1_cmd(s, &t))
3938 return NULL((void*)0);
3939 return t;
3940}
3941/*- End of function --------------------------------------------------------*/
3942
3943static const char *at_cmd_plus_GCAP(at_state_t *s, const char *t)
3944{
3945 /* V.250 6.1.9 - Request complete capabilities list */
3946 t += 5;
3947 /* Response elements
3948 +FCLASS +F (FAX) commands
3949 +MS +M (modulation control) commands +MS and +MR
3950 +MV18S +M (modulation control) commands +MV18S and +MV18R
3951 +ES +E (error control) commands +ES, +EB, +ER, +EFCS, and +ETBM
3952 +DS +D (data compression) commands +DS and +DR */
3953 /* TODO: make this adapt to the configuration we really have. */
3954 if (t[0] == '?')
3955 {
3956 at_put_response(s, "+GCAP:+FCLASS");
3957 t += 1;
3958 }
3959 return t;
3960}
3961/*- End of function --------------------------------------------------------*/
3962
3963static const char *at_cmd_plus_GCI(at_state_t *s, const char *t)
3964{
3965 /* V.250 6.1.10 - Country of installation, */
3966 t += 4;
3967 if (!parse_hex_out(s, &t, &s->country_of_installation, 255, "+GCI:", "(00-FF)"))
3968 return NULL((void*)0);
3969 return t;
3970}
3971/*- End of function --------------------------------------------------------*/
3972
3973static const char *at_cmd_plus_GMI(at_state_t *s, const char *t)
3974{
3975 /* V.250 6.1.4 - Request manufacturer identification */
3976 t += 4;
3977 if (t[0] == '?')
3978 {
3979 at_put_response(s, manufacturer);
3980 t += 1;
3981 }
3982 return t;
3983}
3984/*- End of function --------------------------------------------------------*/
3985
3986static const char *at_cmd_plus_GMM(at_state_t *s, const char *t)
3987{
3988 /* V.250 6.1.5 - Request model identification */
3989 t += 4;
3990 if (t[0] == '?')
3991 {
3992 at_put_response(s, model);
3993 t += 1;
3994 }
3995 return t;
3996}
3997/*- End of function --------------------------------------------------------*/
3998
3999static const char *at_cmd_plus_GMR(at_state_t *s, const char *t)
4000{
4001 /* V.250 6.1.6 - Request revision identification */
4002 t += 4;
4003 if (t[0] == '?')
4004 {
4005 at_put_response(s, revision);
4006 t += 1;
4007 }
4008 return t;
4009}
4010/*- End of function --------------------------------------------------------*/
4011
4012static const char *at_cmd_plus_GOI(at_state_t *s, const char *t)
4013{
4014 /* V.250 6.1.8 - Request global object identification */
4015 /* TODO: */
4016 t += 4;
4017 if (t[0] == '?')
4018 {
4019 at_put_response(s, GLOBAL_OBJECT_IDENTITY"42");
4020 t += 1;
4021 }
4022 return t;
4023}
4024/*- End of function --------------------------------------------------------*/
4025
4026static const char *at_cmd_plus_GSN(at_state_t *s, const char *t)
4027{
4028 /* V.250 6.1.7 - Request product serial number identification */
4029 /* TODO: */
4030 t += 4;
4031 if (t[0] == '?')
4032 {
4033 at_put_response(s, SERIAL_NUMBER"42");
4034 t += 1;
4035 }
4036 return t;
4037}
4038/*- End of function --------------------------------------------------------*/
4039
4040static const char *at_cmd_plus_IBC(at_state_t *s, const char *t)
4041{
4042 static const int maxes[13] =
4043 {
4044 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
4045 };
4046 int *locations[13];
4047 int i;
4048
4049 /* V.80 7.9 - Control of in-band control */
4050 /* TODO: */
4051 t += 4;
4052 /* 0: In-band control service disabled
4053 1: In-band control service enabled, 7-bit codes allowed, and top bit insignificant
4054 2; In-band control service enabled, 7-bit codes allowed, and 8-bit codes available
4055
4056 Circuits 105, 106, 107, 108, 109, 110, 125, 132, 133, 135, 142 in that order. For each one:
4057 0: disabled
4058 1: enabled
4059
4060 DCE line connect status reports:
4061 0: disabled
4062 1: enabled */
4063 for (i = 0; i < 13; i++)
4064 locations[i] = NULL((void*)0);
4065 if (!parse_n_out(s, &t, locations, maxes, 13, "+IBC:", "(0-2),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0.1),(0,1)"))
4066 return NULL((void*)0);
4067 return t;
4068}
4069/*- End of function --------------------------------------------------------*/
4070
4071static const char *at_cmd_plus_IBM(at_state_t *s, const char *t)
4072{
4073 static const int maxes[3] =
4074 {
4075 7, 255, 255
4076 };
4077 int *locations[3];
4078
4079 /* V.80 7.10 - In-band MARK idle reporting control */
4080 /* TODO: */
4081 t += 4;
4082 /* Report control
4083 0: No reports
4084 1: Report only once when <T1 > expires
4085 2: Report each time <T2> expires
4086 3: Report once when <T1> expires, and then each time <T2> expires
4087 4: Report only when the Mark-ldle Period ends; T3 = the entire interval
4088 5: Report the first time when <T1> is exceeded, and then once more when the mark idle period ends
4089 6: Report each time when <T2> is exceeded, and then once more when the mark idle period ends;
4090 T3 = entire interval -- N*T2
4091 7: report the first time when <T1> is exceeded, and then each time <T2> is exceeded, and then once
4092 more when the mark idle period ends; T3 = entire mark idle period -- N*T2 - T1
4093
4094 T1 in units of 10ms
4095
4096 T2 in units of 10ms */
4097 locations[0] = NULL((void*)0);
4098 locations[1] = NULL((void*)0);
4099 locations[2] = NULL((void*)0);
4100 if (!parse_n_out(s, &t, locations, maxes, 3, "+IBM:", "(0-7),(0-255),(0-255)"))
4101 return NULL((void*)0);
4102 return t;
4103}
4104/*- End of function --------------------------------------------------------*/
4105
4106static const char *at_cmd_plus_ICF(at_state_t *s, const char *t)
4107{
4108 /* V.250 6.2.11 - DTE-DCE character framing */
4109 t += 4;
4110 /* Character format
4111 0: auto detect
4112 1: 8 data 2 stop
4113 2: 8 data 1 parity 1 stop
4114 3: 8 data 1 stop
4115 4: 7 data 2 stop
4116 5: 7 data 1 parity 1 stop
4117 6: 7 data 1 stop
4118
4119 Parity
4120 0: Odd
4121 1: Even
4122 2: Mark
4123 3: Space */
4124 if (!parse_2_out(s, &t, &s->dte_char_format, 6, &s->dte_parity, 3, "+ICF:", "(0-6),(0-3)"))
4125 return NULL((void*)0);
4126 return t;
4127}
4128/*- End of function --------------------------------------------------------*/
4129
4130static const char *at_cmd_plus_ICLOK(at_state_t *s, const char *t)
4131{
4132 /* V.250 6.2.14 - Select sync transmit clock source */
4133 t += 6;
4134 if (!parse_out(s, &t, &s->sync_tx_clock_source, 2, "+ICLOK:", "(0-2)"))
4135 return NULL((void*)0);
4136 return t;
4137}
4138/*- End of function --------------------------------------------------------*/
4139
4140static const char *at_cmd_plus_IDSR(at_state_t *s, const char *t)
4141{
4142 /* V.250 6.2.16 - Select data set ready option */
4143 t += 5;
4144 if (!parse_out(s, &t, &s->dsr_option, 2, "+IDSR:", "(0-2)"))
4145 return NULL((void*)0);
4146 return t;
4147}
4148/*- End of function --------------------------------------------------------*/
4149
4150static const char *at_cmd_plus_IFC(at_state_t *s, const char *t)
4151{
4152 /* V.250 6.2.12 - DTE-DCE local flow control */
4153 /* 0: None.
4154 1: XON/XOFF.
4155 2: Hardware (default) */
4156 span_log(&s->logging, SPAN_LOG_FLOW, "+IFC received\n");
4157 t += 4;
4158 if (!parse_2_out(s, &t, &s->dte_dce_flow_control, 2, &s->dce_dte_flow_control, 2, "+IFC:", "(0-2),(0-2)"))
4159 return NULL((void*)0);
4160 return t;
4161}
4162/*- End of function --------------------------------------------------------*/
4163
4164static const char *at_cmd_plus_ILRR(at_state_t *s, const char *t)
4165{
4166 /* V.250 6.2.13 - DTE-DCE local rate reporting */
4167 /* TODO: */
4168 t += 5;
4169 return t;
4170}
4171/*- End of function --------------------------------------------------------*/
4172
4173static const char *at_cmd_plus_ILSD(at_state_t *s, const char *t)
4174{
4175 /* V.250 6.2.15 - Select long space disconnect option */
4176 t += 5;
4177 if (!parse_out(s, &t, &s->long_space_disconnect_option, 2, "+ILSD:", "(0,1)"))
4178 return NULL((void*)0);
4179 return t;
4180}
4181/*- End of function --------------------------------------------------------*/
4182
4183static const char *at_cmd_plus_IPR(at_state_t *s, const char *t)
4184{
4185 /* V.250 6.2.10 - Fixed DTE rate */
4186 /* TODO: */
4187 t += 4;
4188 if (!parse_out(s, &t, &s->dte_rate, 115200, "+IPR:", "(115200),(115200)"))
4189 return NULL((void*)0);
4190 return t;
4191}
4192/*- End of function --------------------------------------------------------*/
4193
4194static const char *at_cmd_plus_IRTS(at_state_t *s, const char *t)
4195{
4196 /* V.250 6.2.17 - Select synchronous mode RTS option */
4197 t += 5;
4198 if (!parse_out(s, &t, NULL((void*)0), 1, "+IRTS:", "(0,1)"))
4199 return NULL((void*)0);
4200 return t;
4201}
4202/*- End of function --------------------------------------------------------*/
4203
4204static const char *at_cmd_plus_ITF(at_state_t *s, const char *t)
4205{
4206 /* V.80 8.4 - Transmit flow control thresholds */
4207 /* TODO: */
4208 t += 5;
4209 return t;
4210}
4211/*- End of function --------------------------------------------------------*/
4212
4213static const char *at_cmd_plus_MA(at_state_t *s, const char *t)
4214{
4215 /* V.250 6.4.2 - Modulation automode control */
4216 /* TODO: */
4217 t += 3;
4218 return t;
4219}
4220/*- End of function --------------------------------------------------------*/
4221
4222static const char *at_cmd_plus_MR(at_state_t *s, const char *t)
4223{
4224 /* V.250 6.4.3 - Modulation reporting control */
4225 /* 0: Disables reporting of modulation connection (+MCR: and +MRR: are not transmitted)
4226 1: Enables reporting of modulation connection (+MCR: and +MRR: are transmitted) */
4227 /* TODO: */
4228 t += 3;
4229 if (!parse_out(s, &t, NULL((void*)0), 1, "+MR:", "(0,1)"))
4230 return NULL((void*)0);
4231 return t;
4232}
4233/*- End of function --------------------------------------------------------*/
4234
4235static const char *at_cmd_plus_MS(at_state_t *s, const char *t)
4236{
4237 /* V.250 6.4.1 - Modulation selection */
4238 /* TODO: */
4239 t += 3;
4240 return t;
4241}
4242/*- End of function --------------------------------------------------------*/
4243
4244static const char *at_cmd_plus_MSC(at_state_t *s, const char *t)
4245{
4246 /* V.250 6.4.8 - Seamless rate change enable */
4247 /* 0 Disables V.34 seamless rate change
4248 1 Enables V.34 seamless rate change */
4249 /* TODO: */
4250 t += 4;
4251 if (!parse_out(s, &t, NULL((void*)0), 1, "+MSC:", "(0,1)"))
4252 return NULL((void*)0);
4253 return t;
4254}
4255/*- End of function --------------------------------------------------------*/
4256
4257static const char *at_cmd_plus_MV18AM(at_state_t *s, const char *t)
4258{
4259 /* V.250 6.4.6 - V.18 answering message editing */
4260 /* TODO: */
4261 t += 7;
4262 return t;
4263}
4264/*- End of function --------------------------------------------------------*/
4265
4266static const char *at_cmd_plus_MV18P(at_state_t *s, const char *t)
4267{
4268 /* V.250 6.4.7 - Order of probes */
4269 /* 2 Send probe message in 5-bit (Baudot) mode
4270 3 Send probe message in DTMF mode
4271 4 Send probe message in EDT mode
4272 5 Send Rec. V.21 carrier as a probe
4273 6 Send Rec. V.23 carrier as a probe
4274 7 Send Bell 103 carrier as a probe */
4275 /* TODO: */
4276 t += 6;
4277 if (!parse_out(s, &t, NULL((void*)0), 7, "+MV18P:", "(2-7)"))
4278 return NULL((void*)0);
4279 return t;
4280}
4281/*- End of function --------------------------------------------------------*/
4282
4283static const char *at_cmd_plus_MV18R(at_state_t *s, const char *t)
4284{
4285 /* V.250 6.4.5 - V.18 reporting control */
4286 /* TODO: */
4287 t += 6;
4288 if (!parse_out(s, &t, NULL((void*)0), 1, "+MV18R:", "(0,1)"))
4289 return NULL((void*)0);
4290 return t;
4291}
4292/*- End of function --------------------------------------------------------*/
4293
4294static const char *at_cmd_plus_MV18S(at_state_t *s, const char *t)
4295{
4296 /* V.250 6.4.4 - V.18 selection */
4297 /* mode:
4298 0 Disables V.18 operation
4299 1 V.18 operation, auto detect mode
4300 2 V.18 operation, connect in 5-bit (Baudot) mode
4301 3 V.18 operation, connect in DTMF mode
4302 4 V.18 operation, connect in EDT mode
4303 5 V.18 operation, connect in V.21 mode
4304 6 V.18 operation, connect in V.23 mode
4305 7 V.18 operation, connect in Bell 103-type mode
4306
4307 dflt_ans_mode:
4308 0 Disables V.18 answer operation
4309 1 No default specified (auto detect)
4310 2 V.18 operation connect in 5-bit (Baudot) mode
4311 3 V.18 operation connect in DTMF mode
4312 4 V.18 operation connect in EDT mode
4313
4314 fbk_time_enable:
4315 0 Disable
4316 1 Enable
4317
4318 ans_msg_enable
4319 0 Disable
4320 1 Enable
4321
4322 probing_en
4323 0 Disable probing
4324 1 Enable probing
4325 2 Initiate probing */
4326 /* TODO: */
4327 t += 6;
4328 return t;
4329}
4330/*- End of function --------------------------------------------------------*/
4331
4332static const char *at_cmd_plus_PCW(at_state_t *s, const char *t)
4333{
4334 /* V.250 6.8.1 - Call waiting enable (V.92 DCE) */
4335 /* TODO: */
4336 t += 4;
4337 return t;
4338}
4339/*- End of function --------------------------------------------------------*/
4340
4341static const char *at_cmd_plus_PIG(at_state_t *s, const char *t)
4342{
4343 /* V.250 6.8.5 - PCM upstream ignore */
4344 /* TODO: */
4345 t += 4;
4346 return t;
4347}
4348/*- End of function --------------------------------------------------------*/
4349
4350static const char *at_cmd_plus_PMH(at_state_t *s, const char *t)
4351{
4352 /* V.250 6.8.2 - Modem on hold enable */
4353 /* TODO: */
4354 t += 4;
4355 return t;
4356}
4357/*- End of function --------------------------------------------------------*/
4358
4359static const char *at_cmd_plus_PMHF(at_state_t *s, const char *t)
4360{
4361 /* V.250 6.8.6 - V.92 Modem on hold hook flash */
4362 /* TODO: */
4363 t += 5;
4364 return t;
4365}
4366/*- End of function --------------------------------------------------------*/
4367
4368static const char *at_cmd_plus_PMHR(at_state_t *s, const char *t)
4369{
4370 /* V.250 6.8.4 - Initiate modem on hold */
4371 /* TODO: */
4372 t += 5;
4373 return t;
4374}
4375/*- End of function --------------------------------------------------------*/
4376
4377static const char *at_cmd_plus_PMHT(at_state_t *s, const char *t)
4378{
4379 /* V.250 6.8.3 - Modem on hold timer */
4380 /* TODO: */
4381 t += 5;
4382 return t;
4383}
4384/*- End of function --------------------------------------------------------*/
4385
4386static const char *at_cmd_plus_PQC(at_state_t *s, const char *t)
4387{
4388 /* V.250 6.8.7 - V.92 Phase 1 and Phase 2 Control */
4389 /* TODO: */
4390 t += 4;
4391 return t;
4392}
4393/*- End of function --------------------------------------------------------*/
4394
4395static const char *at_cmd_plus_PSS(at_state_t *s, const char *t)
4396{
4397 /* V.250 6.8.8 - V.92 Use Short Sequence */
4398 /* TODO: */
4399 t += 4;
4400 return t;
4401}
4402/*- End of function --------------------------------------------------------*/
4403
4404static const char *at_cmd_plus_SAC(at_state_t *s, const char *t)
4405{
4406 /* V.252 3.4 - Audio transmit configuration */
4407 /* TODO: */
4408 t += 4;
4409 return t;
4410}
4411/*- End of function --------------------------------------------------------*/
4412
4413static const char *at_cmd_plus_SAM(at_state_t *s, const char *t)
4414{
4415 /* V.252 3.5 - Audio receive mode */
4416 /* TODO: */
4417 t += 4;
4418 return t;
4419}
4420/*- End of function --------------------------------------------------------*/
4421
4422static const char *at_cmd_plus_SAR(at_state_t *s, const char *t)
4423{
4424 /* V.252 5.3 - Audio receive channel indication */
4425 /* TODO: */
4426 t += 4;
4427 return t;
4428}
4429/*- End of function --------------------------------------------------------*/
4430
4431static const char *at_cmd_plus_SARR(at_state_t *s, const char *t)
4432{
4433 /* V.252 3.9 - Audio indication reporting */
4434 /* TODO: */
4435 t += 5;
4436 return t;
4437}
4438/*- End of function --------------------------------------------------------*/
4439
4440static const char *at_cmd_plus_SAT(at_state_t *s, const char *t)
4441{
4442 /* V.252 5.4 - Audio transmit channel indication */
4443 /* TODO: */
4444 t += 4;
4445 return t;
4446}
4447/*- End of function --------------------------------------------------------*/
4448
4449static const char *at_cmd_plus_SCRR(at_state_t *s, const char *t)
4450{
4451 /* V.252 3.11 - Capabilities indication reporting */
4452 /* TODO: */
4453 t += 5;
4454 return t;
4455}
4456/*- End of function --------------------------------------------------------*/
4457
4458static const char *at_cmd_plus_SDC(at_state_t *s, const char *t)
4459{
4460 /* V.252 3.3 - Data configuration */
4461 /* TODO: */
4462 t += 4;
4463 return t;
4464}
4465/*- End of function --------------------------------------------------------*/
4466
4467static const char *at_cmd_plus_SDI(at_state_t *s, const char *t)
4468{
4469 /* V.252 5.2 - Data channel identification */
4470 /* TODO: */
4471 t += 4;
4472 return t;
4473}
4474/*- End of function --------------------------------------------------------*/
4475
4476static const char *at_cmd_plus_SDR(at_state_t *s, const char *t)
4477{
4478 /* V.252 3.8 - Data indication reporting */
4479 /* TODO: */
4480 t += 4;
4481 return t;
4482}
4483/*- End of function --------------------------------------------------------*/
4484
4485static const char *at_cmd_plus_SRSC(at_state_t *s, const char *t)
4486{
4487 /* V.252 5.1.2 - Remote terminal simultaneous capability indication */
4488 /* TODO: */
4489 t += 5;
4490 return t;
4491}
4492/*- End of function --------------------------------------------------------*/
4493
4494static const char *at_cmd_plus_STC(at_state_t *s, const char *t)
4495{
4496 /* V.252 3.1 - Terminal configuration */
4497 /* TODO: */
4498 t += 4;
4499 return t;
4500}
4501/*- End of function --------------------------------------------------------*/
4502
4503static const char *at_cmd_plus_STH(at_state_t *s, const char *t)
4504{
4505 /* V.252 3.2 - Close logical channel */
4506 /* TODO: */
4507 t += 4;
4508 return t;
4509}
4510/*- End of function --------------------------------------------------------*/
4511
4512static const char *at_cmd_plus_SVC(at_state_t *s, const char *t)
4513{
4514 /* V.252 3.6 - Video transmit configuration */
4515 /* TODO: */
4516 t += 4;
4517 return t;
4518}
4519/*- End of function --------------------------------------------------------*/
4520
4521static const char *at_cmd_plus_SVM(at_state_t *s, const char *t)
4522{
4523 /* V.252 3.7 - Video receive mode */
4524 /* TODO: */
4525 t += 4;
4526 return t;
4527}
4528/*- End of function --------------------------------------------------------*/
4529
4530static const char *at_cmd_plus_SVR(at_state_t *s, const char *t)
4531{
4532 /* V.252 5.5 - Video receive channel indication */
4533 /* TODO: */
4534 t += 4;
4535 return t;
4536}
4537/*- End of function --------------------------------------------------------*/
4538
4539static const char *at_cmd_plus_SVRR(at_state_t *s, const char *t)
4540{
4541 /* V.252 3.10 - Video indication reporting */
4542 /* TODO: */
4543 t += 5;
4544 return t;
4545}
4546/*- End of function --------------------------------------------------------*/
4547
4548static const char *at_cmd_plus_SVT(at_state_t *s, const char *t)
4549{
4550 /* V.252 5.6 - Video transmit channel indication */
4551 /* TODO: */
4552 t += 4;
4553 return t;
4554}
4555/*- End of function --------------------------------------------------------*/
4556
4557static const char *at_cmd_plus_TADR(at_state_t *s, const char *t)
4558{
4559 /* V.250 6.7.2.9 - Local V.54 address */
4560 /* TODO: */
4561 t += 5;
4562 return t;
4563}
4564/*- End of function --------------------------------------------------------*/
4565
4566static const char *at_cmd_plus_TAL(at_state_t *s, const char *t)
4567{
4568 /* V.250 6.7.2.15 - Local analogue loop */
4569 /* Action
4570 0 Disable analogue loop
4571 1 Enable analogue loop
4572 Band
4573 0 Low frequency band
4574 1 High frequency band */
4575 /* TODO: */
4576 t += 4;
4577 if (!parse_2_out(s, &t, NULL((void*)0), 1, NULL((void*)0), 1, "+TAL:", "(0,1),(0,1)"))
4578 return NULL((void*)0);
4579 return t;
4580}
4581/*- End of function --------------------------------------------------------*/
4582
4583static const char *at_cmd_plus_TALS(at_state_t *s, const char *t)
4584{
4585 /* V.250 6.7.2.6 - Analogue loop status */
4586 /* 0 Inactive
4587 1 V.24 circuit 141 invoked
4588 2 Front panel invoked
4589 3 Network management system invoked */
4590 /* TODO: */
4591 t += 5;
4592 if (!parse_out(s, &t, NULL((void*)0), 3, "+TALS:", "(0-3)"))
4593 return NULL((void*)0);
4594 return t;
4595}
4596/*- End of function --------------------------------------------------------*/
4597
4598static const char *at_cmd_plus_TDLS(at_state_t *s, const char *t)
4599{
4600 /* V.250 6.7.2.7 - Local digital loop status */
4601 /* 0 Disabled
4602 1 Enabled, inactive
4603 2 Front panel invoked
4604 3 Network management system invoked
4605 4 Remote invoked */
4606 /* TODO: */
4607 t += 5;
4608 if (!parse_out(s, &t, NULL((void*)0), 3, "+TDLS:", "(0-4)"))
4609 return NULL((void*)0);
4610 return t;
4611}
4612/*- End of function --------------------------------------------------------*/
4613
4614static const char *at_cmd_plus_TE140(at_state_t *s, const char *t)
4615{
4616 /* V.250 6.7.2.1 - Enable ckt 140 */
4617 /* 0 Disabled
4618 1 Enabled */
4619 /* TODO: */
4620 t += 6;
4621 if (!parse_out(s, &t, NULL((void*)0), 1, "+TE140:", "(0,1)"))
4622 return NULL((void*)0);
4623 return t;
4624}
4625/*- End of function --------------------------------------------------------*/
4626
4627static const char *at_cmd_plus_TE141(at_state_t *s, const char *t)
4628{
4629 /* V.250 6.7.2.2 - Enable ckt 141 */
4630 /* 0 Response is disabled
4631 1 Response is enabled */
4632 /* TODO: */
4633 t += 6;
4634 if (!parse_out(s, &t, NULL((void*)0), 1, "+TE141:", "(0,1)"))
4635 return NULL((void*)0);
4636 return t;
4637}
4638/*- End of function --------------------------------------------------------*/
4639
4640static const char *at_cmd_plus_TEPAL(at_state_t *s, const char *t)
4641{
4642 /* V.250 6.7.2.5 - Enable front panel analogue loop */
4643 /* 0 Disabled
4644 1 Enabled */
4645 /* TODO: */
4646 t += 6;
4647 if (!parse_out(s, &t, NULL((void*)0), 1, "+TEPAL:", "(0,1)"))
4648 return NULL((void*)0);
4649 return t;
4650}
4651/*- End of function --------------------------------------------------------*/
4652
4653static const char *at_cmd_plus_TEPDL(at_state_t *s, const char *t)
4654{
4655 /* V.250 6.7.2.4 - Enable front panel RDL */
4656 /* 0 Disabled
4657 1 Enabled */
4658 /* TODO: */
4659 t += 6;
4660 if (!parse_out(s, &t, NULL((void*)0), 1, "+TEPDL:", "(0,1)"))
4661 return NULL((void*)0);
4662 return t;
4663}
4664/*- End of function --------------------------------------------------------*/
4665
4666static const char *at_cmd_plus_TERDL(at_state_t *s, const char *t)
4667{
4668 /* V.250 6.7.2.3 - Enable RDL from remote */
4669 /* 0 Local DCE will ignore command from remote
4670 1 Local DCE will obey command from remote */
4671 /* TODO: */
4672 t += 6;
4673 if (!parse_out(s, &t, NULL((void*)0), 1, "+TERDL:", "(0,1)"))
4674 return NULL((void*)0);
4675 return t;
4676}
4677/*- End of function --------------------------------------------------------*/
4678
4679static const char *at_cmd_plus_TLDL(at_state_t *s, const char *t)
4680{
4681 /* V.250 6.7.2.13 - Local digital loop */
4682 /* 0 Stop test
4683 1 Start test */
4684 /* TODO: */
4685 t += 5;
4686 if (!parse_out(s, &t, NULL((void*)0), 1, "+TLDL:", "(0,1)"))
4687 return NULL((void*)0);
4688 return t;
4689}
4690/*- End of function --------------------------------------------------------*/
4691
4692static const char *at_cmd_plus_TMO(at_state_t *s, const char *t)
4693{
4694 /* V.250 6.9 - V.59 command */
4695 /* TODO: */
4696 t += 4;
4697 return t;
4698}
4699/*- End of function --------------------------------------------------------*/
4700
4701static const char *at_cmd_plus_TMODE(at_state_t *s, const char *t)
4702{
4703 /* V.250 6.7.2.10 - Set V.54 mode */
4704 /* TODO: */
4705 t += 6;
4706 if (!parse_out(s, &t, NULL((void*)0), 1, "+TMODE:", "(0,1)"))
4707 return NULL((void*)0);
4708 return t;
4709}
4710/*- End of function --------------------------------------------------------*/
4711
4712static const char *at_cmd_plus_TNUM(at_state_t *s, const char *t)
4713{
4714 /* V.250 6.7.2.12 - Errored bit and block counts */
4715 /* TODO: */
4716 t += 5;
4717 return t;
4718}
4719/*- End of function --------------------------------------------------------*/
4720
4721static const char *at_cmd_plus_TRDL(at_state_t *s, const char *t)
4722{
4723 /* V.250 6.7.2.14 - Request remote digital loop */
4724 /* 0 Stop RDL
4725 1 Start RDL */
4726 /* TODO: */
4727 t += 5;
4728 if (!parse_out(s, &t, NULL((void*)0), 1, "+TRDL:", "(0,1)"))
4729 return NULL((void*)0);
4730 return t;
4731}
4732/*- End of function --------------------------------------------------------*/
4733
4734static const char *at_cmd_plus_TRDLS(at_state_t *s, const char *t)
4735{
4736 /* V.250 6.7.2.8 - Remote digital loop status */
4737 /* TODO: */
4738 t += 6;
4739 return t;
4740}
4741/*- End of function --------------------------------------------------------*/
4742
4743static const char *at_cmd_plus_TRES(at_state_t *s, const char *t)
4744{
4745 /* V.250 6.7.2.17 - Self test result */
4746 /* 0 No test
4747 1 Pass
4748 2 Fail */
4749 /* TODO: */
4750 t += 5;
4751 if (!parse_out(s, &t, NULL((void*)0), 1, "+TRES:", "(0-2)"))
4752 return NULL((void*)0);
4753 return t;
4754}
4755/*- End of function --------------------------------------------------------*/
4756
4757static const char *at_cmd_plus_TSELF(at_state_t *s, const char *t)
4758{
4759 /* V.250 6.7.2.16 - Self test */
4760 /* 0 Intrusive full test
4761 1 Safe partial test */
4762 /* TODO: */
4763 t += 6;
4764 if (!parse_out(s, &t, NULL((void*)0), 1, "+TSELF:", "(0,1)"))
4765 return NULL((void*)0);
4766 return t;
4767}
4768/*- End of function --------------------------------------------------------*/
4769
4770static const char *at_cmd_plus_TTER(at_state_t *s, const char *t)
4771{
4772 /* V.250 6.7.2.11 - Test error rate */
4773 /* TODO: */
4774 t += 5;
4775 if (!parse_2_out(s, &t, NULL((void*)0), 65535, NULL((void*)0), 65535, "+TTER:", "(0-65535),(0-65535)"))
4776 return NULL((void*)0);
4777 return t;
4778}
4779/*- End of function --------------------------------------------------------*/
4780
4781static const char *at_cmd_plus_VAC(at_state_t *s, const char *t)
4782{
4783 /* V.252 4.1 - Set audio code */
4784 return t;
4785}
4786/*- End of function --------------------------------------------------------*/
4787
4788static const char *at_cmd_plus_VACR(at_state_t *s, const char *t)
4789{
4790 /* V.252 6.1 - Audio code report */
4791 /* TODO: */
4792 t += 5;
4793 return t;
4794}
4795/*- End of function --------------------------------------------------------*/
4796
4797static const char *at_cmd_plus_VBT(at_state_t *s, const char *t)
4798{
4799 /* 3GPP TS 27.007 C.2.2 - Buffer threshold setting */
4800 /* TODO: */
4801 t += 4;
4802 return t;
4803}
4804/*- End of function --------------------------------------------------------*/
4805
4806static const char *at_cmd_plus_VCID(at_state_t *s, const char *t)
4807{
4808 /* 3GPP TS 27.007 C.2.3 - Calling number ID presentation */
4809 /* TODO: */
4810 t += 5;
4811 if (!parse_out(s, &t, &s->display_call_info, 1, NULL((void*)0), "0,1"))
1
Passing value via 1st parameter 's'
2
Calling 'parse_out'
4812 return NULL((void*)0);
4813 return t;
4814}
4815/*- End of function --------------------------------------------------------*/
4816
4817static const char *at_cmd_plus_VCIDR(at_state_t *s, const char *t)
4818{
4819 /* V.252 6.2 - Caller ID report */
4820 /* TODO: */
4821 t += 6;
4822 return t;
4823}
4824/*- End of function --------------------------------------------------------*/
4825
4826static const char *at_cmd_plus_VDID(at_state_t *s, const char *t)
4827{
4828 /* V.253 9.2.4 - DID service */
4829 /* TODO: */
4830 t += 5;
4831 return t;
4832}
4833/*- End of function --------------------------------------------------------*/
4834
4835static const char *at_cmd_plus_VDIDR(at_state_t *s, const char *t)
4836{
4837 /* V.252 6.2 - DID report */
4838 /* TODO: */
4839 t += 6;
4840 return t;
4841}
4842/*- End of function --------------------------------------------------------*/
4843
4844static const char *at_cmd_plus_VDR(at_state_t *s, const char *t)
4845{
4846 /* V.253 10.3.1 - Distinctive ring (ring cadence reporting) */
4847 /* TODO: */
4848 t += 4;
4849 return t;
4850}
4851/*- End of function --------------------------------------------------------*/
4852
4853static const char *at_cmd_plus_VDT(at_state_t *s, const char *t)
4854{
4855 /* V.253 10.3.2 - Control tone cadence reporting */
4856 /* TODO: */
4857 t += 4;
4858 return t;
4859}
4860/*- End of function --------------------------------------------------------*/
4861
4862static const char *at_cmd_plus_VDX(at_state_t *s, const char *t)
4863{
4864 /* V.253 10.5.6 - Speakerphone duplex mode */
4865 /* TODO: */
4866 t += 4;
4867 return t;
4868}
4869/*- End of function --------------------------------------------------------*/
4870
4871static const char *at_cmd_plus_VEM(at_state_t *s, const char *t)
4872{
4873 /* V.253 10.5.7 - Deliver event reports */
4874 /* TODO: */
4875 t += 4;
4876 return t;
4877}
4878/*- End of function --------------------------------------------------------*/
4879
4880static const char *at_cmd_plus_VGM(at_state_t *s, const char *t)
4881{
4882 /* V.253 10.5.2 - Microphone gain */
4883 /* TODO: */
4884 t += 4;
4885 return t;
4886}
4887/*- End of function --------------------------------------------------------*/
4888
4889static const char *at_cmd_plus_VGR(at_state_t *s, const char *t)
4890{
4891 /* V.253 10.2.1 - Receive gain selection */
4892 /* TODO: */
4893 t += 4;
4894 return t;
4895}
4896/*- End of function --------------------------------------------------------*/
4897
4898static const char *at_cmd_plus_VGS(at_state_t *s, const char *t)
4899{
4900 /* V.253 10.5.3 - Speaker gain */
4901 /* TODO: */
4902 t += 4;
4903 return t;
4904}
4905/*- End of function --------------------------------------------------------*/
4906
4907static const char *at_cmd_plus_VGT(at_state_t *s, const char *t)
4908{
4909 /* V.253 10.2.2 - Volume selection */
4910 /* TODO: */
4911 t += 4;
4912 return t;
4913}
4914/*- End of function --------------------------------------------------------*/
4915
4916static const char *at_cmd_plus_VHC(at_state_t *s, const char *t)
4917{
4918 /* V.252 4.12 - Telephony port hook control */
4919 /* TODO: */
4920 t += 4;
4921 return t;
4922}
4923/*- End of function --------------------------------------------------------*/
4924
4925static const char *at_cmd_plus_VIP(at_state_t *s, const char *t)
4926{
4927 /* V.253 10.1.1 - Initialize voice parameters */
4928 /* TODO: */
4929 t += 4;
4930 return t;
4931}
4932/*- End of function --------------------------------------------------------*/
4933
4934static const char *at_cmd_plus_VIT(at_state_t *s, const char *t)
4935{
4936 /* V.253 10.2.3 - DTE/DCE inactivity timer */
4937 /* TODO: */
4938 t += 4;
4939 return t;
4940}
4941/*- End of function --------------------------------------------------------*/
4942
4943static const char *at_cmd_plus_VLS(at_state_t *s, const char *t)
4944{
4945 /* V.253 10.2.4 - Analogue source/destination selection */
4946 /* TODO: */
4947 t += 4;
4948 return t;
4949}
4950/*- End of function --------------------------------------------------------*/
4951
4952static const char *at_cmd_plus_VNH(at_state_t *s, const char *t)
4953{
4954 /* V.253 9.2.5 - Automatic hangup control */
4955 /* TODO: */
4956 t += 4;
4957 return t;
4958}
4959/*- End of function --------------------------------------------------------*/
4960
4961static const char *at_cmd_plus_VPH(at_state_t *s, const char *t)
4962{
4963 /* V.252 4.11 - Phone hookswitch status */
4964 /* TODO: */
4965 t += 4;
4966 return t;
4967}
4968/*- End of function --------------------------------------------------------*/
4969
4970static const char *at_cmd_plus_VPP(at_state_t *s, const char *t)
4971{
4972 /* V.253 10.4.2 - Voice packet protocol */
4973 /* TODO: */
4974 t += 4;
4975 return t;
4976}
4977/*- End of function --------------------------------------------------------*/
4978
4979static const char *at_cmd_plus_VPR(at_state_t *s, const char *t)
4980{
4981 /* IS-101 10.4.3 - Select DTE/DCE interface rate */
4982 /* TODO: */
4983 t += 4;
4984 return t;
4985}
4986/*- End of function --------------------------------------------------------*/
4987
4988static const char *at_cmd_plus_VRA(at_state_t *s, const char *t)
4989{
4990 /* V.253 10.2.5 - Ringing tone goes away timer */
4991 /* TODO: */
4992 t += 4;
4993 return t;
4994}
4995/*- End of function --------------------------------------------------------*/
4996
4997static const char *at_cmd_plus_VRID(at_state_t *s, const char *t)
4998{
4999 int val;
5000
5001 /* Extension of V.253 +VCID, Calling number ID report/repeat */
5002 t += 5;
5003 val = 0;
5004 if (!parse_out(s, &t, &val, 1, NULL((void*)0), "0,1"))
5005 return NULL((void*)0);
5006 if (val == 1)
5007 at_display_call_info(s);
5008 return t;
5009}
5010/*- End of function --------------------------------------------------------*/
5011
5012static const char *at_cmd_plus_VRL(at_state_t *s, const char *t)
5013{
5014 /* V.253 10.1.2 - Ring local phone */
5015 /* TODO: */
5016 t += 4;
5017 return t;
5018}
5019/*- End of function --------------------------------------------------------*/
5020
5021static const char *at_cmd_plus_VRN(at_state_t *s, const char *t)
5022{
5023 /* V.253 10.2.6 - Ringing tone never appeared timer */
5024 /* TODO: */
5025 t += 4;
5026 return t;
5027}
5028/*- End of function --------------------------------------------------------*/
5029
5030static const char *at_cmd_plus_VRX(at_state_t *s, const char *t)
5031{
5032 /* V.253 10.1.3 - Voice receive state */
5033 /* TODO: */
5034 t += 4;
5035 return t;
5036}
5037/*- End of function --------------------------------------------------------*/
5038
5039static const char *at_cmd_plus_VSD(at_state_t *s, const char *t)
5040{
5041 /* V.253 10.2.7 - Silence detection (QUIET and SILENCE) */
5042 /* TODO: */
5043 t += 4;
5044 return t;
5045}
5046/*- End of function --------------------------------------------------------*/
5047
5048static const char *at_cmd_plus_VSID(at_state_t *s, const char *t)
5049{
5050 /* Extension of V.253 +VCID, Set calling number ID */
5051 t += 5;
5052 if (!parse_string_out(s, &t, &s->local_id, NULL((void*)0)))
5053 return NULL((void*)0);
5054 if (at_modem_control(s, AT_MODEM_CONTROL_SETID, s->local_id) < 0)
5055 return NULL((void*)0);
5056 return t;
5057}
5058/*- End of function --------------------------------------------------------*/
5059
5060static const char *at_cmd_plus_VSM(at_state_t *s, const char *t)
5061{
5062 /* V.253 10.2.8 - Compression method selection */
5063 /* TODO: */
5064 t += 4;
5065 return t;
5066}
5067/*- End of function --------------------------------------------------------*/
5068
5069static const char *at_cmd_plus_VSP(at_state_t *s, const char *t)
5070{
5071 /* V.253 10.5.1 - Voice speakerphone state */
5072 /* TODO: */
5073 t += 4;
5074 return t;
5075}
5076/*- End of function --------------------------------------------------------*/
5077
5078static const char *at_cmd_plus_VTA(at_state_t *s, const char *t)
5079{
5080 /* V.253 10.5.4 - Train acoustic echo-canceller */
5081 /* TODO: */
5082 t += 4;
5083 return t;
5084}
5085/*- End of function --------------------------------------------------------*/
5086
5087static const char *at_cmd_plus_VTD(at_state_t *s, const char *t)
5088{
5089 /* V.253 10.2.9 - Beep tone duration timer */
5090 /* TODO: */
5091 t += 4;
5092 return t;
5093}
5094/*- End of function --------------------------------------------------------*/
5095
5096static const char *at_cmd_plus_VTER(at_state_t *s, const char *t)
5097{
5098 /* V.252 6.4 - Simple telephony event report */
5099 /* TODO: */
5100 t += 4;
5101 return t;
5102}
5103/*- End of function --------------------------------------------------------*/
5104
5105static const char *at_cmd_plus_VTH(at_state_t *s, const char *t)
5106{
5107 /* V.253 10.5.5 - Train line echo-canceller */
5108 /* TODO: */
5109 t += 4;
5110 return t;
5111}
5112/*- End of function --------------------------------------------------------*/
5113
5114static const char *at_cmd_plus_VTR(at_state_t *s, const char *t)
5115{
5116 /* V.253 10.1.4 - Voice duplex state */
5117 /* TODO: */
5118 t += 4;
5119 return t;
5120}
5121/*- End of function --------------------------------------------------------*/
5122
5123static const char *at_cmd_plus_VTS(at_state_t *s, const char *t)
5124{
5125 /* V.253 10.1.5 - DTMF and tone generation in voice */
5126 /* TODO: */
5127 t += 4;
5128 return t;
5129}
5130/*- End of function --------------------------------------------------------*/
5131
5132static const char *at_cmd_plus_VTX(at_state_t *s, const char *t)
5133{
5134 /* V.253 10.1.6 - Transmit data state */
5135 /* TODO: */
5136 t += 4;
5137 return t;
5138}
5139/*- End of function --------------------------------------------------------*/
5140
5141static const char *at_cmd_plus_VXT(at_state_t *s, const char *t)
5142{
5143 /* IS-101 10.1.5 - Translate voice data */
5144 /* TODO: */
5145 t += 4;
5146 return t;
5147}
5148/*- End of function --------------------------------------------------------*/
5149
5150static const char *at_cmd_plus_W(at_state_t *s, const char *t)
5151{
5152 /* TIA-678 5.2.4.1 - Compliance indication */
5153 /* TODO: */
5154 t += 2;
5155 return t;
5156}
5157/*- End of function --------------------------------------------------------*/
5158
5159static const char *at_cmd_plus_WBAG(at_state_t *s, const char *t)
5160{
5161 /* TIA-678 C.5.6 Bias Modem Audio Gain */
5162 /* TODO: */
5163 t += 5;
5164 return t;
5165}
5166/*- End of function --------------------------------------------------------*/
5167
5168static const char *at_cmd_plus_WCDA(at_state_t *s, const char *t)
5169{
5170 /* TIA-678 B.3.2.5 Display Data Link Address */
5171 /* TODO: */
5172 t += 5;
5173 return t;
5174}
5175/*- End of function --------------------------------------------------------*/
5176
5177static const char *at_cmd_plus_WCHG(at_state_t *s, const char *t)
5178{
5179 /* TIA-678 B.3.2.4 Display Battery Charging Status */
5180 /* TODO: */
5181 t += 5;
5182 return t;
5183}
5184/*- End of function --------------------------------------------------------*/
5185
5186static const char *at_cmd_plus_WCID(at_state_t *s, const char *t)
5187{
5188 /* TIA-678 B.3.2.1 Display System ID (operator) */
5189 /* TODO: */
5190 t += 5;
5191 return t;
5192}
5193/*- End of function --------------------------------------------------------*/
5194
5195static const char *at_cmd_plus_WCLK(at_state_t *s, const char *t)
5196{
5197 /* TIA-678 B.3.2.3 Lock/Unlock DCE */
5198 /* TODO: */
5199 t += 5;
5200 return t;
5201}
5202/*- End of function --------------------------------------------------------*/
5203
5204static const char *at_cmd_plus_WCPN(at_state_t *s, const char *t)
5205{
5206 /* TIA-678 B.3.2.2 Set Personal Identification Number */
5207 /* TODO: */
5208 t += 5;
5209 return t;
5210}
5211/*- End of function --------------------------------------------------------*/
5212
5213static const char *at_cmd_plus_WCXF(at_state_t *s, const char *t)
5214{
5215 /* TIA-678 B.3.2.6 Display Supported Annex B commands */
5216 /* TODO: */
5217 t += 5;
5218 return t;
5219}
5220/*- End of function --------------------------------------------------------*/
5221
5222static const char *at_cmd_plus_WDAC(at_state_t *s, const char *t)
5223{
5224 /* TIA-678 C.5.1 Data over Analogue Cellular Command Query */
5225 /* TODO: */
5226 t += 5;
5227 return t;
5228}
5229/*- End of function --------------------------------------------------------*/
5230
5231static const char *at_cmd_plus_WDIR(at_state_t *s, const char *t)
5232{
5233 /* TIA-678 C.5.8 Phone Number Directory Selection */
5234 /* TODO: */
5235 t += 5;
5236 return t;
5237}
5238/*- End of function --------------------------------------------------------*/
5239
5240static const char *at_cmd_plus_WECR(at_state_t *s, const char *t)
5241{
5242 /* TIA-678 C.5.3 Enable Cellular Result Codes */
5243 /* TODO: */
5244 t += 5;
5245 return t;
5246}
5247/*- End of function --------------------------------------------------------*/
5248
5249static const char *at_cmd_plus_WFON(at_state_t *s, const char *t)
5250{
5251 /* TIA-678 C.5.5 Phone Specification */
5252 /* TODO: */
5253 t += 5;
5254 return t;
5255}
5256/*- End of function --------------------------------------------------------*/
5257
5258static const char *at_cmd_plus_WKPD(at_state_t *s, const char *t)
5259{
5260 /* TIA-678 C.5.7 Keypad Emulation */
5261 /* TODO: */
5262 t += 5;
5263 return t;
5264}
5265/*- End of function --------------------------------------------------------*/
5266
5267static const char *at_cmd_plus_WPBA(at_state_t *s, const char *t)
5268{
5269 /* TIA-678 C.5.9 Phone Battery Query */
5270 /* TODO: */
5271 t += 5;
5272 return t;
5273}
5274/*- End of function --------------------------------------------------------*/
5275
5276static const char *at_cmd_plus_WPTH(at_state_t *s, const char *t)
5277{
5278 /* TIA-678 C.5.10 Call Path */
5279 /* TODO: */
5280 t += 5;
5281 return t;
5282}
5283/*- End of function --------------------------------------------------------*/
5284
5285static const char *at_cmd_plus_WRLK(at_state_t *s, const char *t)
5286{
5287 /* TIA-678 C.5.4 Roam Lockout */
5288 /* TODO: */
5289 t += 5;
5290 return t;
5291}
5292/*- End of function --------------------------------------------------------*/
5293
5294static const char *at_cmd_plus_WS45(at_state_t *s, const char *t)
5295{
5296 /* TIA-678 5.2.4.2 DTE-side stack selection */
5297 /* TODO: */
5298 t += 5;
5299 return t;
5300}
5301/*- End of function --------------------------------------------------------*/
5302
5303static const char *at_cmd_plus_WS46(at_state_t *s, const char *t)
5304{
5305 /* 3GPP TS 27.007 5.9 - PCCA STD-101 [17] select wireless network */
5306 /* TODO: */
5307 t += 5;
5308 return t;
5309}
5310/*- End of function --------------------------------------------------------*/
5311
5312static const char *at_cmd_plus_WS50(at_state_t *s, const char *t)
5313{
5314 /* TIA-678 B.3.1.1 Normalized Signal Strength */
5315 /* TODO: */
5316 t += 5;
5317 return t;
5318}
5319/*- End of function --------------------------------------------------------*/
5320
5321static const char *at_cmd_plus_WS51(at_state_t *s, const char *t)
5322{
5323 /* TIA-678 B.3.1.2 Carrier Detect Signal Threshold */
5324 /* TODO: */
5325 t += 5;
5326 return t;
5327}
5328/*- End of function --------------------------------------------------------*/
5329
5330static const char *at_cmd_plus_WS52(at_state_t *s, const char *t)
5331{
5332 /* TIA-678 B.3.1.3 Normalized Battery Level */
5333 /* TODO: */
5334 t += 5;
5335 return t;
5336}
5337/*- End of function --------------------------------------------------------*/
5338
5339static const char *at_cmd_plus_WS53(at_state_t *s, const char *t)
5340{
5341 /* TIA-678 B.3.1.4 Normalized Channel Quality */
5342 /* TODO: */
5343 t += 5;
5344 return t;
5345}
5346/*- End of function --------------------------------------------------------*/
5347
5348static const char *at_cmd_plus_WS54(at_state_t *s, const char *t)
5349{
5350 /* TIA-678 B.3.1.5 Carrier Detect Channel Quality Threshold */
5351 /* TODO: */
5352 t += 5;
5353 return t;
5354}
5355/*- End of function --------------------------------------------------------*/
5356
5357static const char *at_cmd_plus_WS57(at_state_t *s, const char *t)
5358{
5359 /* TIA-678 B.3.1.7 Antenna Preference */
5360 /* TODO: */
5361 t += 5;
5362 return t;
5363}
5364/*- End of function --------------------------------------------------------*/
5365
5366static const char *at_cmd_plus_WS58(at_state_t *s, const char *t)
5367{
5368 /* TIA-678 B.3.1.8 Idle Time-out Value */
5369 /* TODO: */
5370 t += 5;
5371 return t;
5372}
5373/*- End of function --------------------------------------------------------*/
5374
5375static const char *at_cmd_plus_WSTL(at_state_t *s, const char *t)
5376{
5377 /* TIA-678 C.5.2 Call Session Time Limit */
5378 /* TODO: */
5379 t += 5;
5380 return t;
5381}
5382/*- End of function --------------------------------------------------------*/
5383
5384/*
5385 AT command group prefixes:
5386
5387 +A Call control (network addressing) issues, common, PSTN, ISDN, Rec. X.25, switched digital
5388 +C Digital cellular extensions
5389 +D Data compression, Rec. V.42bis
5390 +E Error control, Rec. V.42
5391 +F Facsimile, Rec. T.30, etc.
5392 +G Generic issues such as identity and capabilities
5393 +I DTE-DCE interface issues, Rec. V.24, etc.
5394 +M Modulation, Rec. V.32bis, etc.
5395 +S Switched or simultaneous data types
5396 +T Test issues
5397 +V Voice extensions
5398 +W Wireless extensions
5399*/
5400
5401#include "at_interpreter_dictionary.h"
5402
5403static int command_search(const char *u, int *matched)
5404{
5405 int i;
5406 int index;
5407 int first;
5408 int last;
5409 int entry;
5410 int ptr;
5411
5412 entry = 0;
5413 /* Loop over the length of the string to search the trie... */
5414 for (i = 0, ptr = 0; ptr < COMMAND_TRIE_LEN4041 - 2; i++)
5415 {
5416 /* The character in u we are processing... */
5417 /* V.250 5.4.1 says upper and lower case are equivalent in commands */
5418 index = toupper((int) u[i])(__extension__ ({ int __res; if (sizeof ((int) u[i]) > 1) {
if (__builtin_constant_p ((int) u[i])) { int __c = ((int) u[
i]); __res = __c < -128 || __c > 255 ? __c : (*__ctype_toupper_loc
())[__c]; } else __res = toupper ((int) u[i]); } else __res =
(*__ctype_toupper_loc ())[(int) ((int) u[i])]; __res; }))
;
5419 /* Is there a child node for this character? */
5420 /* Note: First and last could have been packed into one uint16_t,
5421 but space is not that critical, so the other packing is good
5422 enough to make the table reasonable. */
5423 first = command_trie[ptr++];
5424 last = command_trie[ptr++];
5425 entry = command_trie[ptr++];
5426 if (index < first || index > last)
5427 break;
5428 if ((ptr = command_trie[ptr + index - first]) == 0)
5429 break;
5430 ptr--;
5431 }
5432 *matched = i;
5433 return entry;
5434}
5435/*- End of function --------------------------------------------------------*/
5436
5437SPAN_DECLARE(int)__attribute__((visibility("default"))) int at_modem_control(at_state_t *s, int op, const char *num)
5438{
5439 switch (op)
5440 {
5441 case AT_MODEM_CONTROL_ANSWER:
5442 break;
5443 case AT_MODEM_CONTROL_CALL:
5444 break;
5445 case AT_MODEM_CONTROL_HANGUP:
5446 break;
5447 case AT_MODEM_CONTROL_OFFHOOK:
5448 break;
5449 case AT_MODEM_CONTROL_DTR:
5450 break;
5451 case AT_MODEM_CONTROL_RTS:
5452 break;
5453 case AT_MODEM_CONTROL_CTS:
5454 break;
5455 case AT_MODEM_CONTROL_CAR:
5456 break;
5457 case AT_MODEM_CONTROL_RNG:
5458 break;
5459 case AT_MODEM_CONTROL_DSR:
5460 break;
5461 case AT_MODEM_CONTROL_RESTART:
5462 break;
5463 default:
5464 break;
5465 }
5466 /*endswitch*/
5467 return s->modem_control_handler(s->modem_control_user_data, op, num);
5468}
5469/*- End of function --------------------------------------------------------*/
5470
5471SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_interpreter(at_state_t *s, const char *cmd, int len)
5472{
5473 int i;
5474 int c;
5475 int entry;
5476 int matched;
5477 const char *t;
5478
5479 if (s->p.echo)
5480 s->at_tx_handler(s->at_tx_user_data, (uint8_t *) cmd, len);
5481
5482 for (i = 0; i < len; i++)
5483 {
5484 /* The spec says the top bit should be ignored */
5485 c = *cmd++ & 0x7F;
5486 /* Handle incoming character */
5487 if (s->line_ptr < 2)
5488 {
5489 /* Look for the initial "at", "AT", "a/" or "A/", and ignore anything before it */
5490 /* V.250 5.2.1 only shows "at" and "AT" as command prefixes. "At" and "aT" are
5491 not specified, despite 5.4.1 saying upper and lower case are equivalent in
5492 commands. Let's be tolerant and accept them. */
5493 if (tolower(c)(__extension__ ({ int __res; if (sizeof (c) > 1) { if (__builtin_constant_p
(c)) { int __c = (c); __res = __c < -128 || __c > 255 ?
__c : (*__ctype_tolower_loc ())[__c]; } else __res = tolower
(c); } else __res = (*__ctype_tolower_loc ())[(int) (c)]; __res
; }))
== 'a')
5494 {
5495 s->line_ptr = 0;
5496 s->line[s->line_ptr++] = (char) toupper(c)(__extension__ ({ int __res; if (sizeof (c) > 1) { if (__builtin_constant_p
(c)) { int __c = (c); __res = __c < -128 || __c > 255 ?
__c : (*__ctype_toupper_loc ())[__c]; } else __res = toupper
(c); } else __res = (*__ctype_toupper_loc ())[(int) (c)]; __res
; }))
;
5497 }
5498 else if (s->line_ptr == 1)
5499 {
5500 if (tolower(c)(__extension__ ({ int __res; if (sizeof (c) > 1) { if (__builtin_constant_p
(c)) { int __c = (c); __res = __c < -128 || __c > 255 ?
__c : (*__ctype_tolower_loc ())[__c]; } else __res = tolower
(c); } else __res = (*__ctype_tolower_loc ())[(int) (c)]; __res
; }))
== 't')
5501 {
5502 /* We have an "AT" command */
5503 s->line[s->line_ptr++] = (char) toupper(c)(__extension__ ({ int __res; if (sizeof (c) > 1) { if (__builtin_constant_p
(c)) { int __c = (c); __res = __c < -128 || __c > 255 ?
__c : (*__ctype_toupper_loc ())[__c]; } else __res = toupper
(c); } else __res = (*__ctype_toupper_loc ())[(int) (c)]; __res
; }))
;
5504 }
5505 else if (c == '/')
5506 {
5507 /* We have an "A/" command */
5508 /* TODO: implement "A/" command repeat */
5509 s->line[s->line_ptr++] = (char) c;
5510 }
5511 else
5512 {
5513 s->line_ptr = 0;
5514 }
5515 }
5516 }
5517 else
5518 {
5519 /* We are beyond the initial AT */
5520 if (c >= 0x20 && c <= 0x7E)
5521 {
5522 /* Add a new char */
5523 if (s->line_ptr < (int) (sizeof(s->line) - 1))
5524 s->line[s->line_ptr++] = (char) toupper(c)(__extension__ ({ int __res; if (sizeof (c) > 1) { if (__builtin_constant_p
(c)) { int __c = (c); __res = __c < -128 || __c > 255 ?
__c : (*__ctype_toupper_loc ())[__c]; } else __res = toupper
(c); } else __res = (*__ctype_toupper_loc ())[(int) (c)]; __res
; }))
;
5525 }
5526 else if (c == s->p.s_regs[3])
5527 {
5528 /* End of command line. Do line validation */
5529 s->line[s->line_ptr] = '\0';
5530 if (s->line_ptr > 2)
5531 {
5532 /* The spec says the commands within a command line are executed in order, until
5533 an error is found, or the end of the command line is reached. */
5534 t = s->line + 2;
5535 while (t && *t)
5536 {
5537 if ((entry = command_search(t, &matched)) <= 0)
5538 break;
5539 /* The following test shouldn't be needed, but let's keep it here for completeness. */
5540 if (entry > sizeof(at_commands)/sizeof(at_commands[0]))
5541 break;
5542 if ((t = at_commands[entry - 1](s, t)) == NULL((void*)0))
5543 break;
5544 if (t == (const char *) -1)
5545 break;
5546 }
5547 if (t != (const char *) -1)
5548 {
5549 if (t == NULL((void*)0))
5550 at_put_response_code(s, AT_RESPONSE_CODE_ERROR);
5551 else
5552 at_put_response_code(s, AT_RESPONSE_CODE_OK);
5553 }
5554 }
5555 else if (s->line_ptr == 2)
5556 {
5557 /* It's just an empty "AT" command, return OK. */
5558 at_put_response_code(s, AT_RESPONSE_CODE_OK);
5559 }
5560 s->line_ptr = 0;
5561 }
5562 else if (c == s->p.s_regs[5])
5563 {
5564 /* Command line editing character (backspace) */
5565 if (s->line_ptr > 0)
5566 s->line_ptr--;
5567 }
5568 else
5569 {
5570 /* The spec says control characters, other than those
5571 explicitly handled, should be ignored, and so this
5572 invalid character causes everything buffered
5573 before it to also be ignored. */
5574 s->line_ptr = 0;
5575 }
5576 }
5577 }
5578}
5579/*- End of function --------------------------------------------------------*/
5580
5581SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_set_class1_handler(at_state_t *s, at_class1_handler_t handler, void *user_data)
5582{
5583 s->class1_handler = handler;
5584 s->class1_user_data = user_data;
5585}
5586/*- End of function --------------------------------------------------------*/
5587
5588SPAN_DECLARE(void)__attribute__((visibility("default"))) void at_set_modem_control_handler(at_state_t *s,
5589 at_modem_control_handler_t modem_control_handler,
5590 void *modem_control_user_data)
5591{
5592 s->modem_control_handler = modem_control_handler;
5593 s->modem_control_user_data = modem_control_user_data;
5594}
5595/*- End of function --------------------------------------------------------*/
5596
5597SPAN_DECLARE(logging_state_t *)__attribute__((visibility("default"))) logging_state_t * at_get_logging_state(at_state_t *s)
5598{
5599 return &s->logging;
5600}
5601/*- End of function --------------------------------------------------------*/
5602
5603SPAN_DECLARE(at_state_t *)__attribute__((visibility("default"))) at_state_t * at_init(at_state_t *s,
5604 at_tx_handler_t at_tx_handler,
5605 void *at_tx_user_data,
5606 at_modem_control_handler_t modem_control_handler,
5607 void *modem_control_user_data)
5608{
5609 if (s == NULL((void*)0))
5610 {
5611 if ((s = (at_state_t *) span_alloc(sizeof(*s))) == NULL((void*)0))
5612 return NULL((void*)0);
5613 }
5614 memset(s, '\0', sizeof(*s));
5615 span_log_init(&s->logging, SPAN_LOG_NONE, NULL((void*)0));
5616 span_log_set_protocol(&s->logging, "AT");
5617 s->modem_control_handler = modem_control_handler;
5618 s->modem_control_user_data = modem_control_user_data;
5619 s->at_tx_handler = at_tx_handler;
5620 s->at_tx_user_data = at_tx_user_data;
5621 s->call_id = NULL((void*)0);
5622 s->local_id = NULL((void*)0);
5623 s->display_call_info = 0;
5624 s->dte_dce_flow_control = 2;
5625 s->dce_dte_flow_control = 2;
5626 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
5627 s->p = profiles[0];
5628 return s;
5629}
5630/*- End of function --------------------------------------------------------*/
5631
5632SPAN_DECLARE(int)__attribute__((visibility("default"))) int at_release(at_state_t *s)
5633{
5634 at_reset_call_info(s);
5635 if (s->local_id)
5636 span_free(s->local_id);
5637 return 0;
5638}
5639/*- End of function --------------------------------------------------------*/
5640
5641SPAN_DECLARE(int)__attribute__((visibility("default"))) int at_free(at_state_t *s)
5642{
5643 int ret;
5644
5645 ret = at_release(s);
5646 span_free(s);
5647 return ret;
5648}
5649/*- End of function --------------------------------------------------------*/
5650/*- End of file ------------------------------------------------------------*/