Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/make_at_dictionary.c @ 4:26cd8f1ef0b1
import spandsp-0.0.6pre17
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 15:50:58 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:c6c5a16ce2f2 | 4:26cd8f1ef0b1 |
---|---|
1 /* | |
2 * SpanDSP - a series of DSP components for telephony | |
3 * | |
4 * make_at_dictionary.c - Generate a trie based dictionary for the AT | |
5 * commands supported by the AT interpreter. | |
6 * | |
7 * Written by Steve Underwood <steveu@coppice.org> | |
8 * | |
9 * Copyright (C) 2006 Steve Underwood | |
10 * | |
11 * All rights reserved. | |
12 * | |
13 * This program is free software; you can redistribute it and/or modify | |
14 * it under the terms of the GNU Lesser General Public License version 2.1, | |
15 * as published by the Free Software Foundation. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU Lesser General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU Lesser General Public | |
23 * License along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
25 * | |
26 * $Id: make_at_dictionary.c,v 1.6 2009/10/09 14:53:57 steveu Exp $ | |
27 */ | |
28 | |
29 #if defined(HAVE_CONFIG_H) | |
30 #include "config.h" | |
31 #endif | |
32 | |
33 #include <inttypes.h> | |
34 #include <stdlib.h> | |
35 #include <stdio.h> | |
36 #include <fcntl.h> | |
37 #include <string.h> | |
38 #include <assert.h> | |
39 | |
40 const char *wordlist[] = | |
41 { | |
42 " ", /* Dummy to absorb spaces in commands */ | |
43 "&C", /* V.250 6.2.8 - Circuit 109 (received line signal detector), behaviour */ | |
44 "&D", /* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */ | |
45 "&F", /* V.250 6.1.2 - Set to factory-defined configuration */ | |
46 "+A8A", /* V.251 6.3 - V.8 calling tone indication */ | |
47 "+A8C", /* V.251 6.2 - V.8 answer signal indication */ | |
48 "+A8E", /* V.251 5.1 - V.8 and V.8bis operation controls */ | |
49 "+A8I", /* V.251 6.1 - V.8 CI signal indication */ | |
50 "+A8J", /* V.251 6.4 - V.8 negotiation complete */ | |
51 "+A8M", /* V.251 5.2 - Send V.8 menu signals */ | |
52 "+A8R", /* V.251 6.6 - V.8bis signal and message reporting */ | |
53 "+A8T", /* V.251 5.3 - Send V.8bis signal and/or message(s) */ | |
54 "+ASTO", /* V.250 6.3.15 - Store telephone number */ | |
55 "+CAAP", /* 3GPP TS 27.007 7.25 - Automatic answer for eMLPP Service */ | |
56 "+CACM", /* 3GPP TS 27.007 8.25 - Accumulated call meter */ | |
57 "+CACSP", /* 3GPP TS 27.007 11.1.7 - Voice Group or Voice Broadcast Call State Attribute Presentation */ | |
58 "+CAD", /* IS-99 5.6.3 - Query analogue or digital service */ | |
59 "+CAEMLPP", /* 3GPP TS 27.007 7.22 - eMLPP Priority Registration and Interrogation */ | |
60 "+CAHLD", /* 3GPP TS 27.007 11.1.3 - Leave an ongoing Voice Group or Voice Broadcast Call */ | |
61 "+CAJOIN", /* 3GPP TS 27.007 11.1.1 - Accept an incoming Voice Group or Voice Broadcast Call */ | |
62 "+CALA", /* 3GPP TS 27.007 8.16 - Alarm */ | |
63 "+CALCC", /* 3GPP TS 27.007 11.1.6 - List current Voice Group and Voice Broadcast Calls */ | |
64 "+CALD", /* 3GPP TS 27.007 8.38 - Delete alar m */ | |
65 "+CALM", /* 3GPP TS 27.007 8.20 - Alert sound mode */ | |
66 "+CAMM", /* 3GPP TS 27.007 8.26 - Accumulated call meter maximum */ | |
67 "+CANCHEV", /* 3GPP TS 27.007 11.1.8 - NCH Support Indication */ | |
68 "+CAOC", /* 3GPP TS 27.007 7.16 - Advice of Charge */ | |
69 "+CAPD", /* 3GPP TS 27.007 8.39 - Postpone or dismiss an alarm */ | |
70 "+CAPTT", /* 3GPP TS 27.007 11.1.4 - Talker Access for Voice Group Call */ | |
71 "+CAREJ", /* 3GPP TS 27.007 11.1.2 - Reject an incoming Voice Group or Voice Broadcast Call */ | |
72 "+CAULEV", /* 3GPP TS 27.007 11.1.5 - Voice Group Call Uplink Status Presentation */ | |
73 "+CBC", /* 3GPP TS 27.007 8.4 - Battery charge */ | |
74 "+CBCS", /* 3GPP TS 27.007 11.3.2 - VBS subscriptions and GId status */ | |
75 "+CBIP", /* IS-99 5.6 - Base station IP address */ | |
76 "+CBST", /* 3GPP TS 27.007 6.7 - Select bearer service type */ | |
77 "+CCFC", /* 3GPP TS 27.007 7.11 - Call forwarding number and conditions */ | |
78 "+CCLK", /* 3GPP TS 27.007 8.15 - Clock */ | |
79 "+CCS", /* IS-135 4.1.22 - Compression status */ | |
80 "+CCUG", /* 3GPP TS 27.007 7.10 - Closed user group */ | |
81 "+CCWA", /* 3GPP TS 27.007 7.12 - Call waiting */ | |
82 "+CCWE", /* 3GPP TS 27.007 8.28 - Call Meter maximum event */ | |
83 "+CDIP", /* 3GPP TS 27.007 7.9 - Called line identification presentation */ | |
84 "+CDIS", /* 3GPP TS 27.007 8.8 - Display control */ | |
85 "+CDV", /* IS-99 5.6 - Dial command for voice call */ | |
86 "+CEER", /* 3GPP TS 27.007 6.10 - Extended error report */ | |
87 "+CESP", /* GSM07.05 3.2.4 - Enter SMS block mode protocol */ | |
88 "+CFCS", /* 3GPP TS 27.007 7.24 - Fast call setup conditions */ | |
89 "+CFG", /* IS-99 5.6 - Configuration string */ | |
90 "+CFUN", /* 3GPP TS 27.007 8.2 - Set phone functionality */ | |
91 "+CGACT", /* 3GPP TS 27.007 10.1.10 - PDP context activate or deactivate */ | |
92 "+CGANS", /* 3GPP TS 27.007 10.1.16 - Manual response to a network request for PDP context activation */ | |
93 "+CGATT", /* 3GPP TS 27.007 10.1.9 - PS attach or detach */ | |
94 "+CGAUTO", /* 3GPP TS 27.007 10.1.15 - Automatic response to a network request for PDP context activation */ | |
95 "+CGCAP", /* IS-99 5.6 - Request complete capabilities list */ | |
96 "+CGCLASS", /* 3GPP TS 27.007 10.1.17 - GPRS mobile station class (GPRS only) */ | |
97 "+CGCLOSP", /* 3GPP TS 27.007 10.1.13 - Configure local octet stream PAD parameters (Obsolete) */ | |
98 "+CGCLPAD", /* 3GPP TS 27.007 10.1.12 - Configure local triple-X PAD parameters (GPRS only) (Obsolete) */ | |
99 "+CGCMOD", /* 3GPP TS 27.007 10.1.11 - PDP Context Modify */ | |
100 "+CGCS", /* 3GPP TS 27.007 11.3.1 - VGCS subscriptions and GId status */ | |
101 "+CGDATA", /* 3GPP TS 27.007 10.1.12 - Enter data state */ | |
102 "+CGDCONT", /* 3GPP TS 27.007 10.1.1 - Define PDP Context */ | |
103 "+CGDSCONT",/* 3GPP TS 27.007 10.1.2 - Define Secondary PDP Context */ | |
104 "+CGEQMIN", /* 3GPP TS 27.007 10.1.7 - 3G Quality of Service Profile (Minimum acceptable) */ | |
105 "+CGEQNEG", /* 3GPP TS 27.007 10.1.8 - 3G Quality of Service Profile (Negotiated) */ | |
106 "+CGEQREQ", /* 3GPP TS 27.007 10.1.6 - 3G Quality of Service Profile (Requested) */ | |
107 "+CGEREP", /* 3GPP TS 27.007 10.1.18 - Packet Domain event reporting */ | |
108 "+CGMI", /* 3GPP TS 27.007 5.1 - Request manufacturer identification */ | |
109 "+CGMM", /* 3GPP TS 27.007 5.2 - Request model identification */ | |
110 "+CGMR", /* 3GPP TS 27.007 5.3 - Request revision identification */ | |
111 "+CGOI", /* IS-99 5.6 - Request global object identification */ | |
112 "+CGPADDR", /* 3GPP TS 27.007 10.1.14 - Show PDP address */ | |
113 "+CGQMIN", /* 3GPP TS 27.007 10.1.5 - Quality of Service Profile (Minimum acceptable) */ | |
114 "+CGQREQ", /* 3GPP TS 27.007 10.1.4 - Quality of Service Profile (Requested) */ | |
115 "+CGREG", /* 3GPP TS 27.007 10.1.19 - GPRS network registration status */ | |
116 "+CGSMS", /* 3GPP TS 27.007 10.1.20 - Select service for MO SMS messages */ | |
117 "+CGSN", /* 3GPP TS 27.007 5.4 - Request product serial number identification */ | |
118 "+CGTFT", /* 3GPP TS 27.007 10.1.3 - Traffic Flow Template */ | |
119 "+CHLD", /* 3GPP TS 27.007 7.13 - Call related supplementary services */ | |
120 "+CHSA", /* 3GPP TS 27.007 6.18 - HSCSD non-transparent asymmetry configuration */ | |
121 "+CHSC", /* 3GPP TS 27.007 6.15 - HSCSD current call parameters */ | |
122 "+CHSD", /* 3GPP TS 27.007 6.12 - HSCSD device parameters */ | |
123 "+CHSN", /* 3GPP TS 27.007 6.14 - HSCSD non-transparent call configuration */ | |
124 "+CHSR", /* 3GPP TS 27.007 6.16 - HSCSD parameters report */ | |
125 "+CHST", /* 3GPP TS 27.007 6.13 - HSCSD transparent call configuration */ | |
126 "+CHSU", /* 3GPP TS 27.007 6.17 - HSCSD automatic user initiated upgrading */ | |
127 "+CHUP", /* 3GPP TS 27.007 6.5 - Hangup call */ | |
128 "+CHV", /* IS-99 5.6 - Hang-up voice */ | |
129 "+CIMI", /* 3GPP TS 27.007 5.6 - Request international mobile subscriber identity */ | |
130 "+CIND", /* 3GPP TS 27.007 8.9 - Indicator control */ | |
131 "+CIT", /* IS-99 5.6 - Command state inactivity timer */ | |
132 "+CKPD", /* 3GPP TS 27.007 8.7 - Keypad control */ | |
133 "+CLAC", /* 3GPP TS 27.007 8.37 - List all available AT commands */ | |
134 "+CLAE", /* 3GPP TS 27.007 8.31 - Language Event */ | |
135 "+CLAN", /* 3GPP TS 27.007 8.30 - Set Language */ | |
136 "+CLCC", /* 3GPP TS 27.007 7.18 - List current calls */ | |
137 "+CLCK", /* 3GPP TS 27.007 7.4 - Facility lock */ | |
138 "+CLIP", /* 3GPP TS 27.007 7.6 - Calling line identification presentation */ | |
139 "+CLIR", /* 3GPP TS 27.007 7.7 - Calling line identification restriction */ | |
140 "+CLVL", /* 3GPP TS 27.007 8.23 - Loudspeaker volume level */ | |
141 "+CMAR", /* 3GPP TS 27.007 8.36 - Master reset */ | |
142 "+CMEC", /* 3GPP TS 27.007 8.6 - Mobile termination control mode */ | |
143 "+CMEE", /* GSM07.07 9.1 - Report mobile equipment error */ | |
144 "+CMER", /* 3GPP TS 27.007 8.10 - Mobile termination event reporting */ | |
145 "+CMGC", /* GSM07.05 3.5.5/4.5 - Send command */ | |
146 "+CMGD", /* GSM07.05 3.5.4 - Delete message */ | |
147 "+CMGF", /* GSM07.05 3.2.3 - Message Format */ | |
148 "+CMGL", /* GSM07.05 3.4.2/4.1 - List messages */ | |
149 "+CMGR", /* GSM07.05 3.4.3/4.2 - Read message */ | |
150 "+CMGS", /* GSM07.05 3.5.1/4.3 - Send message */ | |
151 "+CMGW", /* GSM07.05 3.5.3/4.4 - Write message to memory */ | |
152 "+CMIP", /* IS-99 5.6 - Mobile station IP address */ | |
153 "+CMM", /* IS-135 4.1.23 - Menu map */ | |
154 "+CMMS", /* GSM07.05 3.5.6 - More messages to send */ | |
155 "+CMOD", /* 3GPP TS 27.007 6.4 - Call mode */ | |
156 "+CMSS", /* GSM07.05 3.5.2/4.7 - Send message from storage */ | |
157 "+CMUT", /* 3GPP TS 27.007 8.24 - Mute control */ | |
158 "+CMUX", /* 3GPP TS 27.007 5.7 - Multiplexing mode */ | |
159 "+CNMA", /* GSM07.05 3.4.4/4.6 - New message acknowledgement to terminal adapter */ | |
160 "+CNMI", /* GSM07.05 3.4.1 - New message indications to terminal equipment */ | |
161 "+CNUM", /* 3GPP TS 27.007 7.1 - Subscriber number */ | |
162 "+COLP", /* 3GPP TS 27.007 7.8 - Connected line identification presentation */ | |
163 "+COPN", /* 3GPP TS 27.007 7.21 - Read operator names */ | |
164 "+COPS", /* 3GPP TS 27.007 7.3 - PLMN selection */ | |
165 "+COS", /* IS-135 4.1.24 - Originating service */ | |
166 "+COTDI", /* 3GPP TS 27.007 11.1.9 - Originator to Dispatcher Information */ | |
167 "+CPAS", /* 3GPP TS 27.007 8.1 - Phone activity status */ | |
168 "+CPBF", /* 3GPP TS 27.007 8.13 - Find phonebook entries */ | |
169 "+CPBR", /* 3GPP TS 27.007 8.12 - Read phonebook entries */ | |
170 "+CPBS", /* 3GPP TS 27.007 8.11 - Select phonebook memory storage */ | |
171 "+CPBW", /* 3GPP TS 27.007 8.14 - Write phonebook entry */ | |
172 "+CPIN", /* 3GPP TS 27.007 8.3 - Enter PIN */ | |
173 "+CPLS", /* 3GPP TS 27.007 7.20 - Selection of preferred PLMN list */ | |
174 "+CPMS", /* GSM07.05 3.2.2 - Preferred message storage */ | |
175 "+CPOL", /* 3GPP TS 27.007 7.19 - Preferred PLMN list */ | |
176 "+CPPS", /* 3GPP TS 27.007 7.23 - eMLPP subscriptions */ | |
177 "+CPROT", /* 3GPP TS 27.007 8.42 - Enter protocol mode */ | |
178 "+CPUC", /* 3GPP TS 27.007 8.27 - Price per unit and currency table */ | |
179 "+CPWC", /* 3GPP TS 27.007 8.29 - Power class */ | |
180 "+CPWD", /* 3GPP TS 27.007 7.5 - Change password */ | |
181 "+CQD", /* IS-135 4.1.25 - Query disconnect timer */ | |
182 "+CR", /* 3GPP TS 27.007 6.9 - Service reporting control */ | |
183 "+CRC", /* 3GPP TS 27.007 6.11 - Cellular result codes */ | |
184 "+CREG", /* 3GPP TS 27.007 7.2 - Network registration */ | |
185 "+CRES", /* GSM07.05 3.3.6 - Restore Settings */ | |
186 "+CRLP", /* 3GPP TS 27.007 6.8 - Radio link protocol */ | |
187 "+CRM", /* IS-99 5.6 - Set rm interface protocol */ | |
188 "+CRMC", /* 3GPP TS 27.007 8.34 - Ring Melody Control */ | |
189 "+CRMP", /* 3GPP TS 27.007 8.35 - Ring Melody Playback */ | |
190 "+CRSL", /* 3GPP TS 27.007 8.21 - Ringer sound level */ | |
191 "+CRSM", /* 3GPP TS 27.007 8.18 - Restricted SIM access */ | |
192 "+CSAS", /* GSM07.05 3.3.5 - Save settings */ | |
193 "+CSCA", /* GSM07.05 3.3.1 - Service centre address */ | |
194 "+CSCB", /* GSM07.05 3.3.4 - Select cell broadcast message types */ | |
195 "+CSCC", /* 3GPP TS 27.007 8.19 - Secure control command */ | |
196 "+CSCS", /* 3GPP TS 27.007 5.5 - Select TE character set */ | |
197 "+CSDF", /* 3GPP TS 27.007 6.22 - Settings date format */ | |
198 "+CSDH", /* GSM07.05 3.3.3 - Show text mode parameters */ | |
199 "+CSGT", /* 3GPP TS 27.007 8.32 - Set Greeting Text */ | |
200 "+CSIL", /* 3GPP TS 27.007 6.23 - Silence Command */ | |
201 "+CSIM", /* 3GPP TS 27.007 8.17 - Generic SIM access */ | |
202 "+CSMP", /* GSM07.05 3.3.2 - Set text mode parameters */ | |
203 "+CSMS", /* GSM07.05 3.2.1 - Select Message Service */ | |
204 "+CSNS", /* 3GPP TS 27.007 6.19 - Single numbering scheme */ | |
205 "+CSQ", /* 3GPP TS 27.007 8.5 - Signal quality */ | |
206 "+CSS", /* IS-135 4.1.28 - Serving system identification */ | |
207 "+CSSN", /* 3GPP TS 27.007 7.17 - Supplementary service notifications */ | |
208 "+CSTA", /* 3GPP TS 27.007 6.1 - Select type of address */ | |
209 "+CSTF", /* 3GPP TS 27.007 6.24 - Settings time format */ | |
210 "+CSVM", /* 3GPP TS 27.007 8.33 - Set Voice Mail Number */ | |
211 "+CTA", /* IS-135 4.1.29 - MT-Terminated async. Data calls */ | |
212 "+CTF", /* IS-135 4.1.30 - MT-Terminated FAX calls */ | |
213 "+CTFR", /* 3GPP TS 27.007 7.14 - Call deflection */ | |
214 "+CTZR", /* 3GPP TS 27.007 8.41 - Time Zone Reporting */ | |
215 "+CTZU", /* 3GPP TS 27.007 8.40 - Automatic Time Zone Update */ | |
216 "+CUSD", /* 3GPP TS 27.007 7.15 - Unstructured supplementary service data */ | |
217 "+CUUS1", /* 3GPP TS 27.007 7.26 - User to User Signalling Service 1 */ | |
218 "+CV120", /* 3GPP TS 27.007 6.21 - V.120 rate adaption protocol */ | |
219 "+CVHU", /* 3GPP TS 27.007 6.20 - Voice Hangup Control */ | |
220 "+CVIB", /* 3GPP TS 27.007 8.22 - Vibrator mode */ | |
221 "+CXT", /* IS-99 5.6 - Cellular extension */ | |
222 "+DR", /* V.250 6.6.2 - Data compression reporting */ | |
223 "+DS", /* V.250 6.6.1 - Data compression */ | |
224 "+DS44", /* V.250 6.6.2 - V.44 data compression */ | |
225 "+EB", /* V.250 6.5.2 - Break handling in error control operation */ | |
226 "+EFCS", /* V.250 6.5.4 - 32-bit frame check sequence */ | |
227 "+EFRAM", /* V.250 6.5.8 - Frame length */ | |
228 "+ER", /* V.250 6.5.5 - Error control reporting */ | |
229 "+ES", /* V.250 6.5.1 - Error control selection */ | |
230 "+ESA", /* V.80 8.2 - Synchronous access mode configuration */ | |
231 "+ESR", /* V.250 6.5.3 - Selective repeat */ | |
232 "+ETBM", /* V.250 6.5.6 - Call termination buffer management */ | |
233 "+EWIND", /* V.250 6.5.7 - Window size */ | |
234 "+F34", /* T.31 B.6.1 - Initial V.34 rate controls for FAX */ | |
235 "+FAA", /* T.32 8.5.2.5 - Adaptive Answer parameter */ | |
236 "+FAP", /* T.32 8.5.1.12 - Addressing and polling capabilities parameter */ | |
237 "+FAR", /* T.31 8.5.1 - Adaptive reception control */ | |
238 "+FBO", /* T.32 8.5.3.4 - Phase C data bit order */ | |
239 "+FBS", /* T.32 8.5.3.2 - Buffer Size, read only parameter */ | |
240 "+FBU", /* T.32 8.5.1.10 - HDLC Frame Reporting parameter */ | |
241 "+FCC", /* T.32 8.5.1.1 - DCE capabilities parameters */ | |
242 "+FCL", /* T.31 8.5.2 - Carrier loss timeout */ | |
243 "+FCLASS", /* T.31 8.2 - Capabilities identification and control */ | |
244 "+FCQ", /* T.32 8.5.2.3 - Copy quality checking parameter */ | |
245 "+FCR", /* T.32 8.5.1.9 - Capability to receive parameter */ | |
246 "+FCS", /* T.32 8.5.1.3 - Current Session Results parameters */ | |
247 "+FCT", /* T.32 8.5.2.6 - DTE phase C timeout parameter */ | |
248 "+FDD", /* T.31 8.5.3 - Double escape character replacement */ | |
249 "+FDR", /* T.32 8.3.4 - Data reception command */ | |
250 "+FDT", /* T.32 8.3.3 - Data transmission command */ | |
251 "+FEA", /* T.32 8.5.3.5 - Phase C received EOL alignment parameter */ | |
252 "+FFC", /* T.32 8.5.3.6 - Format conversion parameter */ | |
253 "+FFD", /* T.32 8.5.1.14 - File diagnostic message parameter */ | |
254 "+FHS", /* T.32 8.5.2.7 - Call termination status parameter */ | |
255 "+FIE", /* T.32 8.5.2.1 - Procedure interrupt enable parameter */ | |
256 "+FIP", /* T.32 8.3.6 - Initialize facsimile parameters */ | |
257 "+FIS", /* T.32 8.5.1.2 - Current session parameters */ | |
258 "+FIT", /* T.31 8.5.4 - DTE inactivity timeout */ | |
259 "+FKS", /* T.32 8.3.5 - Session termination command */ | |
260 "+FLI", /* T.32 8.5.1.5 - Local ID string parameter, TSI or CSI */ | |
261 "+FLO", /* T.31 says to implement something similar to +IFC */ | |
262 "+FLP", /* T.32 8.5.1.7 - Indicate document to poll parameter */ | |
263 "+FMI", /* T.31 says to duplicate +GMI */ | |
264 "+FMM", /* T.31 says to duplicate +GMM */ | |
265 "+FMR", /* T.31 says to duplicate +GMR */ | |
266 "+FMS", /* T.32 8.5.2.9 - Minimum phase C speed parameter */ | |
267 "+FND", /* T.32 8.5.2.10 - Non-Standard Message Data Indication parameter */ | |
268 "+FNR", /* T.32 8.5.1.11 - Negotiation message reporting control parameters */ | |
269 "+FNS", /* T.32 8.5.1.6 - Non-Standard Frame FIF parameter */ | |
270 "+FPA", /* T.32 8.5.1.13 - Selective polling address parameter */ | |
271 "+FPI", /* T.32 8.5.1.5 - Local Polling ID String parameter */ | |
272 "+FPP", /* T.32 8.5.3 - Facsimile packet protocol */ | |
273 "+FPR", /* T.31 says to implement something similar to +IPR */ | |
274 "+FPS", /* T.32 8.5.2.2 - Page Status parameter */ | |
275 "+FPW", /* T.32 8.5.1.13 - PassWord parameter (Sending or Polling) */ | |
276 "+FRH", /* T.31 8.3.6 - HDLC receive */ | |
277 "+FRM", /* T.31 8.3.4 - Facsimile receive */ | |
278 "+FRQ", /* T.32 8.5.2.4 - Receive Quality Thresholds parameters */ | |
279 "+FRS", /* T.31 8.3.2 - Receive silence */ | |
280 "+FRY", /* T.32 8.5.2.8 - ECM Retry Value parameter */ | |
281 "+FSA", /* T.32 8.5.1.13 - Subaddress parameter */ | |
282 "+FSP", /* T.32 8.5.1.8 - Request to poll parameter */ | |
283 "+FTH", /* T.31 8.3.5 - HDLC transmit */ | |
284 "+FTM", /* T.31 8.3.3 - Facsimile transmit */ | |
285 "+FTS", /* T.31 8.3.1 - Transmit silence */ | |
286 "+GCAP", /* V.250 6.1.9 - Request complete capabilities list */ | |
287 "+GCI", /* V.250 6.1.10 - Country of installation, */ | |
288 "+GMI", /* V.250 6.1.4 - Request manufacturer identification */ | |
289 "+GMM", /* V.250 6.1.5 - Request model identification */ | |
290 "+GMR", /* V.250 6.1.6 - Request revision identification */ | |
291 "+GOI", /* V.250 6.1.8 - Request global object identification */ | |
292 "+GSN", /* V.250 6.1.7 - Request product serial number identification */ | |
293 "+IBC", /* V.80 7.9 - Control of in-band control */ | |
294 "+IBM", /* V.80 7.10 - In-band MARK idle reporting control */ | |
295 "+ICF", /* V.250 6.2.11 - DTE-DCE character framing */ | |
296 "+ICLOK", /* V.250 6.2.14 - Select sync transmit clock source */ | |
297 "+IDSR", /* V.250 6.2.16 - Select data set ready option */ | |
298 "+IFC", /* V.250 6.2.12 - DTE-DCE local flow control */ | |
299 "+ILRR", /* V.250 6.2.13 - DTE-DCE local rate reporting */ | |
300 "+ILSD", /* V.250 6.2.15 - Select long space disconnect option */ | |
301 "+IPR", /* V.250 6.2.10 - Fixed DTE rate */ | |
302 "+IRTS", /* V.250 6.2.17 - Select synchronous mode RTS option */ | |
303 "+ITF", /* V.80 8.4 - Transmit flow control thresholds */ | |
304 "+MA", /* V.250 6.4.2 - Modulation automode control */ | |
305 "+MR", /* V.250 6.4.3 - Modulation reporting control */ | |
306 "+MS", /* V.250 6.4.1 - Modulation selection */ | |
307 "+MSC", /* V.250 6.4.8 - Seamless rate change enable */ | |
308 "+MV18AM", /* V.250 6.4.6 - V.18 answering message editing */ | |
309 "+MV18P", /* V.250 6.4.7 - Order of probes */ | |
310 "+MV18R", /* V.250 6.4.5 - V.18 reporting control */ | |
311 "+MV18S", /* V.250 6.4.4 - V.18 selection */ | |
312 "+PCW", /* V.250 6.8.1 - Call waiting enable (V.92 DCE) */ | |
313 "+PIG", /* V.250 6.8.5 - PCM upstream ignore */ | |
314 "+PMH", /* V.250 6.8.2 - Modem on hold enable */ | |
315 "+PMHF", /* V.250 6.8.6 - V.92 Modem on hold hook flash */ | |
316 "+PMHR", /* V.250 6.8.4 - Initiate modem on hold */ | |
317 "+PMHT", /* V.250 6.8.3 - Modem on hold timer */ | |
318 "+PQC", /* V.250 6.8.7 - V.92 Phase 1 and Phase 2 Control */ | |
319 "+PSS", /* V.250 6.8.8 - V.92 Use Short Sequence */ | |
320 "+SAC", /* V.252 3.4 - Audio transmit configuration */ | |
321 "+SAM", /* V.252 3.5 - Audio receive mode */ | |
322 "+SAR", /* V.252 5.3 - Audio receive channel indication */ | |
323 "+SARR", /* V.252 3.9 - Audio indication reporting */ | |
324 "+SAT", /* V.252 5.4 - Audio transmit channel indication */ | |
325 "+SCRR", /* V.252 3.11 - Capabilities indication reporting */ | |
326 "+SDC", /* V.252 3.3 - Data configuration */ | |
327 "+SDI", /* V.252 5.2 - Data channel identification */ | |
328 "+SDR", /* V.252 3.8 - Data indication reporting */ | |
329 "+SRSC", /* V.252 5.1.2 - Remote terminal simultaneous capability indication */ | |
330 "+STC", /* V.252 3.1 - Terminal configuration */ | |
331 "+STH", /* V.252 3.2 - Close logical channel */ | |
332 "+SVC", /* V.252 3.6 - Video transmit configuration */ | |
333 "+SVM", /* V.252 3.7 - Video receive mode */ | |
334 "+SVR", /* V.252 5.5 - Video receive channel indication */ | |
335 "+SVRR", /* V.252 3.10 - Video indication reporting */ | |
336 "+SVT", /* V.252 5.6 - Video transmit channel indication */ | |
337 "+TADR", /* V.250 6.7.2.9 - Local V.54 address */ | |
338 "+TAL", /* V.250 6.7.2.15 - Local analogue loop */ | |
339 "+TALS", /* V.250 6.7.2.6 - Analogue loop status */ | |
340 "+TDLS", /* V.250 6.7.2.7 - Local digital loop status */ | |
341 "+TE140", /* V.250 6.7.2.1 - Enable ckt 140 */ | |
342 "+TE141", /* V.250 6.7.2.2 - Enable ckt 141 */ | |
343 "+TEPAL", /* V.250 6.7.2.5 - Enable front panel analogue loop */ | |
344 "+TEPDL", /* V.250 6.7.2.4 - Enable front panel RDL */ | |
345 "+TERDL", /* V.250 6.7.2.3 - Enable RDL from remote */ | |
346 "+TLDL", /* V.250 6.7.2.13 - Local digital loop */ | |
347 "+TMO", /* V.250 6.9 - V.59 command */ | |
348 "+TMODE", /* V.250 6.7.2.10 - Set V.54 mode */ | |
349 "+TNUM", /* V.250 6.7.2.12 - Errored bit and block counts */ | |
350 "+TRDL", /* V.250 6.7.2.14 - Request remote digital loop */ | |
351 "+TRDLS", /* V.250 6.7.2.8 - Remote digital loop status */ | |
352 "+TRES", /* V.250 6.7.2.17 - Self test result */ | |
353 "+TSELF", /* V.250 6.7.2.16 - Self test */ | |
354 "+TTER", /* V.250 6.7.2.11 - Test error rate */ | |
355 "+VAC", /* V.252 4.1 - Set audio code */ | |
356 "+VACR", /* V.252 6.1 - Audio code report */ | |
357 "+VBT", /* 3GPP TS 27.007 C.2.2 - Buffer threshold setting */ | |
358 "+VCID", /* V.253 9.2.3 - Caller ID service */ | |
359 "+VCIDR", /* V.252 6.2 - Caller ID report */ | |
360 "+VDID", /* V.253 9.2.4 - DID service */ | |
361 "+VDIDR", /* V.252 6.2 - DID report */ | |
362 "+VDR", /* V.253 10.3.1 - Distinctive ring (ring cadence reporting) */ | |
363 "+VDT", /* V.253 10.3.2 - Control tone cadence reporting */ | |
364 "+VDX", /* V.253 10.5.6 - Speakerphone duplex mode */ | |
365 "+VEM", /* V.253 10.5.7 - Deliver event reports */ | |
366 "+VGM", /* V.253 10.5.2 - Microphone gain */ | |
367 "+VGR", /* V.253 10.2.1 - Receive gain selection */ | |
368 "+VGS", /* V.253 10.5.3 - Speaker gain */ | |
369 "+VGT", /* V.253 10.2.2 - Volume selection */ | |
370 "+VHC", /* V.252 4.12 - Telephony port hook control */ | |
371 "+VIP", /* V.253 10.1.1 - Initialize voice parameters */ | |
372 "+VIT", /* V.253 10.2.3 - DTE/DCE inactivity timer */ | |
373 "+VLS", /* V.253 10.2.4 - Analogue source/destination selection */ | |
374 "+VNH", /* V.253 9.2.5 - Automatic hangup control */ | |
375 "+VPH", /* V.252 4.11 - Phone hookswitch status */ | |
376 "+VPP", /* V.253 10.4.2 - Voice packet protocol */ | |
377 "+VPR", /* IS-101 10.4.3 - Select DTE/DCE interface rate */ | |
378 "+VRA", /* V.253 10.2.5 - Ringing tone goes away timer */ | |
379 "+VRID", /* Extension - Find the originating and destination numbers */ | |
380 "+VRL", /* V.253 10.1.2 - Ring local phone */ | |
381 "+VRN", /* V.253 10.2.6 - Ringing tone never appeared timer */ | |
382 "+VRX", /* V.253 10.1.3 - Voice receive state */ | |
383 "+VSD", /* V.253 10.2.7 - Silence detection (QUIET and SILENCE) */ | |
384 "+VSID", /* Extension - Set the originating number */ | |
385 "+VSM", /* V.253 10.2.8 - Compression method selection */ | |
386 "+VSP", /* V.253 10.5.1 - Voice speakerphone state */ | |
387 "+VTA", /* V.253 10.5.4 - Train acoustic echo-canceller */ | |
388 "+VTD", /* V.253 10.2.9 - Beep tone duration timer */ | |
389 "+VTER", /* V.252 6.4 - Simple telephony event report */ | |
390 "+VTH", /* V.253 10.5.5 - Train line echo-canceller */ | |
391 "+VTR", /* V.253 10.1.4 - Voice duplex state */ | |
392 "+VTS", /* V.253 10.1.5 - DTMF and tone generation in voice */ | |
393 "+VTX", /* V.253 10.1.6 - Transmit data state */ | |
394 "+VXT", /* IS-101 10.1.5 - Translate voice data */ | |
395 "+W", /* TIA-678 5.2.4.1 - Compliance indication */ | |
396 "+WBAG", /* TIA-678 C.5.6 Bias modem audio gain */ | |
397 "+WCDA", /* TIA-678 B.3.2.5 Display data link address */ | |
398 "+WCHG", /* TIA-678 B.3.2.4 Display battery charging status */ | |
399 "+WCID", /* TIA-678 B.3.2.1 Display system ID (operator) */ | |
400 "+WCLK", /* TIA-678 B.3.2.3 Lock/unlock DCE */ | |
401 "+WCPN", /* TIA-678 B.3.2.2 Set personal identification number */ | |
402 "+WCXF", /* TIA-678 B.3.2.6 Display supported annex B commands */ | |
403 "+WDAC", /* TIA-678 C.5.1 Data over analogue cellular command query */ | |
404 "+WDIR", /* TIA-678 C.5.8 Phone number directory selection */ | |
405 "+WECR", /* TIA-678 C.5.3 Enable cellular result codes */ | |
406 "+WFON", /* TIA-678 C.5.5 Phone specification */ | |
407 "+WKPD", /* TIA-678 C.5.7 Keypad emulation */ | |
408 "+WPBA", /* TIA-678 C.5.9 Phone battery query */ | |
409 "+WPTH", /* TIA-678 C.5.10 Call path */ | |
410 "+WRLK", /* TIA-678 C.5.4 Roam lockout */ | |
411 "+WS45", /* TIA-678 5.2.4.2 DTE-side stack selection */ | |
412 "+WS46", /* 3GPP TS 27.007 5.9 - PCCA STD-101 [17] select wireless network */ | |
413 "+WS50", /* TIA-678 B.3.1.1 Normalized signal strength */ | |
414 "+WS51", /* TIA-678 B.3.1.2 Carrier detect signal threshold */ | |
415 "+WS52", /* TIA-678 B.3.1.3 Normalized battery level */ | |
416 "+WS53", /* TIA-678 B.3.1.4 Normalized channel quality */ | |
417 "+WS54", /* TIA-678 B.3.1.5 Carrier detect channel quality threshold */ | |
418 "+WS57", /* TIA-678 B.3.1.7 Antenna preference */ | |
419 "+WS58", /* TIA-678 B.3.1.8 Idle time-out value */ | |
420 "+WSTL", /* TIA-678 C.5.2 Call session time limit */ | |
421 ";", /* Dummy to absorb semi-colon delimiters in commands */ | |
422 "A", /* V.250 6.3.5 - Answer */ | |
423 "D", /* V.250 6.3.1 - Dial */ | |
424 "E", /* V.250 6.2.4 - Command echo */ | |
425 "H", /* V.250 6.3.6 - Hook control */ | |
426 "I", /* V.250 6.1.3 - Request identification information */ | |
427 "L", /* V.250 6.3.13 - Monitor speaker loudness */ | |
428 "M", /* V.250 6.3.14 - Monitor speaker mode */ | |
429 "O", /* V.250 6.3.7 - Return to online data state */ | |
430 "P", /* V.250 6.3.3 - Select pulse dialling (command) */ | |
431 "Q", /* V.250 6.2.5 - Result code suppression */ | |
432 "S0", /* V.250 6.3.8 - Automatic answer */ | |
433 "S10", /* V.250 6.3.12 - Automatic disconnect delay */ | |
434 "S3", /* V.250 6.2.1 - Command line termination character */ | |
435 "S4", /* V.250 6.2.2 - Response formatting character */ | |
436 "S5", /* V.250 6.2.3 - Command line editing character */ | |
437 "S6", /* V.250 6.3.9 - Pause before blind dialling */ | |
438 "S7", /* V.250 6.3.10 - Connection completion timeout */ | |
439 "S8", /* V.250 6.3.11 - Comma dial modifier time */ | |
440 "T", /* V.250 6.3.2 - Select tone dialling (command) */ | |
441 "V", /* V.250 6.2.6 - DCE response format */ | |
442 "X", /* V.250 6.2.7 - Result code selection and call progress monitoring control */ | |
443 "Z", /* V.250 6.1.1 - Reset to default configuration */ | |
444 NULL | |
445 }; | |
446 | |
447 int packed_ptr = 0; | |
448 | |
449 short int packed_trie[30000]; | |
450 | |
451 #define ALPHABET_SIZE 128 | |
452 | |
453 typedef struct trie_node_s | |
454 { | |
455 int first; | |
456 int last; | |
457 int node_no; | |
458 int entry; | |
459 /* Array of pointers to children */ | |
460 struct trie_node_s *child_list[ALPHABET_SIZE]; | |
461 } trie_node_t; | |
462 | |
463 typedef struct | |
464 { | |
465 int entries; | |
466 /* The root of the trie */ | |
467 trie_node_t *root; | |
468 } trie_t; | |
469 | |
470 static trie_node_t *trie_node_create(void) | |
471 { | |
472 trie_node_t *s; | |
473 | |
474 if ((s = (trie_node_t *) malloc(sizeof(*s)))) | |
475 { | |
476 memset(s, 0, sizeof(*s)); | |
477 s->first = ALPHABET_SIZE - 1; | |
478 } | |
479 return s; | |
480 } | |
481 /*- End of function --------------------------------------------------------*/ | |
482 | |
483 static trie_t *trie_create(void) | |
484 { | |
485 trie_t *s; | |
486 | |
487 if ((s = (trie_t *) malloc(sizeof(*s)))) | |
488 { | |
489 memset(s, 0, sizeof(*s)); | |
490 s->root = trie_node_create(); | |
491 } | |
492 return s; | |
493 } | |
494 /*- End of function --------------------------------------------------------*/ | |
495 | |
496 static void trie_recursive_add_node_numbers(trie_node_t *t) | |
497 { | |
498 int index; | |
499 | |
500 if (t) | |
501 { | |
502 if (t->first <= t->last) | |
503 { | |
504 t->node_no = packed_ptr + 1; | |
505 packed_ptr += (t->last - t->first + 1 + 3); | |
506 for (index = 0; index < ALPHABET_SIZE; index++) | |
507 trie_recursive_add_node_numbers(t->child_list[index]); | |
508 } | |
509 else | |
510 { | |
511 t->node_no = packed_ptr + 1; | |
512 packed_ptr += 3; | |
513 } | |
514 } | |
515 } | |
516 /*- End of function --------------------------------------------------------*/ | |
517 | |
518 static void trie_recursive_build_packed_trie(trie_node_t *t) | |
519 { | |
520 int i; | |
521 | |
522 if (t) | |
523 { | |
524 if (t->first <= t->last) | |
525 { | |
526 packed_trie[packed_ptr++] = t->first; | |
527 packed_trie[packed_ptr++] = t->last; | |
528 packed_trie[packed_ptr++] = t->entry; | |
529 for (i = t->first; i <= t->last; i++) | |
530 packed_trie[packed_ptr++] = (t->child_list[i]) ? t->child_list[i]->node_no : 0; | |
531 for (i = t->first; i <= t->last; i++) | |
532 trie_recursive_build_packed_trie(t->child_list[i]); | |
533 } | |
534 else | |
535 { | |
536 packed_trie[packed_ptr++] = 1; | |
537 packed_trie[packed_ptr++] = 0; | |
538 packed_trie[packed_ptr++] = t->entry; | |
539 } | |
540 } | |
541 } | |
542 /*- End of function --------------------------------------------------------*/ | |
543 | |
544 static void trie_add(trie_t *s, const char *u, size_t len) | |
545 { | |
546 size_t i; | |
547 int index; | |
548 trie_node_t *t; | |
549 | |
550 s->entries++; | |
551 /* Loop over the length of the string to add and traverse the trie... */ | |
552 for (t = s->root, i = 0; i < len; i++) | |
553 { | |
554 /* The character in u we are processing... */ | |
555 index = (unsigned char) u[i]; | |
556 | |
557 /* Is there a child node for this character? */ | |
558 if (t->child_list[index] == NULL) | |
559 { | |
560 t->child_list[index] = trie_node_create(); | |
561 if (index < t->first) | |
562 t->first = index; | |
563 if (index > t->last) | |
564 t->last = index; | |
565 } | |
566 | |
567 /* Move to the new node... and loop */ | |
568 t = t->child_list[index]; | |
569 } | |
570 t->entry = s->entries; | |
571 } | |
572 /*- End of function --------------------------------------------------------*/ | |
573 | |
574 static void dump_trie(void) | |
575 { | |
576 int i; | |
577 | |
578 printf("\nstatic const at_cmd_service_t at_commands[] =\n{\n"); | |
579 for (i = 0; wordlist[i]; i++) | |
580 { | |
581 switch (wordlist[i][0]) | |
582 { | |
583 case ' ': | |
584 case ';': | |
585 printf(" at_cmd_dummy,\n"); | |
586 break; | |
587 case '+': | |
588 printf(" at_cmd_plus_%s,\n", wordlist[i] + 1); | |
589 break; | |
590 case '&': | |
591 printf(" at_cmd_amp_%s,\n", wordlist[i] + 1); | |
592 break; | |
593 default: | |
594 printf(" at_cmd_%s,\n", wordlist[i]); | |
595 break; | |
596 } | |
597 } | |
598 printf("};\n"); | |
599 | |
600 printf("\nstatic const uint16_t command_trie[] =\n{"); | |
601 for (i = 0; i < packed_ptr; i++) | |
602 { | |
603 if ((i & 7) == 0) | |
604 printf("\n "); | |
605 printf("0x%04X, ", packed_trie[i]); | |
606 } | |
607 printf("\n};\n"); | |
608 printf("\n#define COMMAND_TRIE_LEN %d\n", packed_ptr); | |
609 | |
610 } | |
611 /*- End of function --------------------------------------------------------*/ | |
612 | |
613 int main(int argc, char *argv[]) | |
614 { | |
615 trie_t *s; | |
616 int i; | |
617 | |
618 s = trie_create(); | |
619 | |
620 for (i = 0; wordlist[i]; i++) | |
621 trie_add(s, wordlist[i], strlen(wordlist[i])); | |
622 printf("// The trie contains %d entries\n", i); | |
623 | |
624 packed_ptr = 0; | |
625 trie_recursive_add_node_numbers(s->root); | |
626 packed_ptr = 0; | |
627 trie_recursive_build_packed_trie(s->root); | |
628 | |
629 dump_trie(); | |
630 | |
631 return 0; | |
632 } | |
633 /*- End of function --------------------------------------------------------*/ | |
634 /*- End of file ------------------------------------------------------------*/ |