3 * Utility routines for WAP dissectors
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * WAP dissector based on original work by Ben Fowler
12 * Updated by Neil Hunter <neil.hunter@energis-squared.com>
13 * WTLS support by Alexandre P. Ferreira (Splice IP)
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 #include <epan/packet.h>
34 #include "packet-wap.h"
37 * Accessor to retrieve variable length int as used in WAP protocol.
38 * The value is encoded in the lower 7 bits. If the top bit is set, then the
39 * value continues into the next byte.
40 * The octetCount parameter holds the number of bytes read in order to return
41 * the final value. Can be pre-initialised to start at offset+count.
44 tvb_get_guintvar (tvbuff_t
*tvb
, guint offset
, guint
*octetCount
)
52 if (octetCount
!= NULL
)
54 fprintf (stderr
, "dissect_wap: Starting tvb_get_guintvar at offset %d, count=%d\n", offset
, *octetCount
);
55 /* counter = *octetCount; */
59 fprintf (stderr
, "dissect_wap: Starting tvb_get_guintvar at offset %d, count=NULL\n", offset
);
65 value
<<= 7; /* Value only exists in 7 of the 8 bits */
66 octet
= tvb_get_guint8 (tvb
, offset
+counter
);
68 value
+= (octet
& 0x7F);
69 cont
= (octet
& 0x80);
71 fprintf (stderr
, "dissect_wap: computing: octet is %d (0x%02x), count=%d, value=%d, cont=%d\n",
72 octet
, octet
, counter
, value
, cont
);
76 if (octetCount
!= NULL
)
78 *octetCount
= counter
;
80 fprintf (stderr
, "dissect_wap: Leaving tvb_get_guintvar count=%d, value=%u\n", *octetCount
, value
);
87 /* See http://www.iana.org/assignments/character-sets for the MIBenum mapping */
88 /* Updated from 10/04/2012 version */
89 static const value_string wap_mib_enum_vals_character_sets
[] = {
100 { 12, "ISO-8859-9" },
101 { 13, "ISO-8859-10" },
102 { 14, "ISO_6937-2-add" },
104 { 16, "JIS_Encoding" },
107 { 19, "Extended_UNIX_Code_Fixed_Width_for_Japanese" },
109 { 21, "SEN_850200_C" },
114 { 26, "NF_Z_62-010" },
115 { 27, "ISO-10646-UTF-1" },
116 { 28, "ISO_646.basic:1983" },
118 { 30, "ISO_646.irv:1983" },
120 { 32, "NATS-SEFI-ADD" },
122 { 34, "NATS-DANO-ADD" },
123 { 35, "SEN_850200_B" },
124 { 36, "KS_C_5601-1987" },
125 { 37, "ISO-2022-KR" },
127 { 39, "ISO-2022-JP" },
128 { 40, "ISO-2022-JP-2" },
129 { 41, "JIS_C6220-1969-jp" },
130 { 42, "JIS_C6220-1969-ro" },
132 { 44, "greek7-old" },
133 { 45, "latin-greek" },
134 { 46, "NF_Z_62-010_(1973)" },
135 { 47, "Latin-greek-1" },
137 { 49, "JIS_C6226-1978" },
138 { 50, "BS_viewdata" },
141 { 53, "INIS-cyrillic" },
142 { 54, "ISO_5427:1981" },
143 { 55, "ISO_5428:1980" },
144 { 56, "GB_1988-80" },
145 { 57, "GB_2312-80" },
147 { 59, "videotex-suppl" },
150 { 62, "MSZ_7795.3" },
151 { 63, "JIS_C6226-1983" },
155 { 67, "JIS_C6229-1984-a" },
156 { 68, "JIS_C6229-1984-b" },
157 { 69, "JIS_C6229-1984-b-add" },
158 { 70, "JIS_C6229-1984-hand" },
159 { 71, "JIS_C6229-1984-hand-add" },
160 { 72, "JIS_C6229-1984-kana" },
161 { 73, "ISO_2033-1983" },
162 { 74, "ANSI_X3.110-1983" },
165 { 77, "ECMA-cyrillic" },
166 { 78, "CSA_Z243.4-1985-1" },
167 { 79, "CSA_Z243.4-1985-2" },
168 { 80, "CSA_Z243.4-1985-gr" },
169 { 81, "ISO-8859-6-E" },
170 { 82, "ISO-8859-6-I" },
172 { 84, "ISO-8859-8-E" },
173 { 85, "ISO-8859-8-I" },
174 { 86, "CSN_369103" },
175 { 87, "JUS_I.B1.002" },
177 { 89, "JUS_I.B1.003-serb" },
178 { 90, "JUS_I.B1.003-mac" },
179 { 91, "greek-ccitt" },
180 { 92, "NC_NC00-10:81" },
181 { 93, "ISO_6937-2-25" },
182 { 94, "GOST_19768-74" },
183 { 95, "ISO_8859-supp" },
184 { 96, "ISO_10367-box" },
186 { 98, "JIS_X0212-1990" },
191 { 103, "UNICODE-1-1-UTF-7" },
192 { 104, "ISO-2022-CN" },
193 { 105, "ISO-2022-CN-EXT" },
195 { 109, "ISO-8859-13" },
196 { 110, "ISO-8859-14" },
197 { 111, "ISO-8859-15" },
198 { 112, "ISO-8859-16" },
201 { 115, "OSD_EBCDIC_DF04_15" },
202 { 116, "OSD_EBCDIC_DF03_IRV" },
203 { 117, "OSD_EBCDIC_DF04_1" },
204 { 118, "ISO-11548-1" },
207 { 1000, "ISO-10646-UCS-2" },
208 { 1001, "ISO-10646-UCS-4" },
209 { 1002, "ISO-10646-UCS-Basic" },
210 { 1003, "ISO-10646-Unicode-Latin1" },
211 { 1004, "ISO-10646-J-1" },
212 { 1005, "ISO-Unicode-IBM-1261" },
213 { 1006, "ISO-Unicode-IBM-1268" },
214 { 1007, "ISO-Unicode-IBM-1276" },
215 { 1008, "ISO-Unicode-IBM-1264" },
216 { 1009, "ISO-Unicode-IBM-1265" },
217 { 1010, "UNICODE-1-1" },
220 { 1013, "UTF-16BE" },
221 { 1014, "UTF-16LE" },
225 { 1018, "UTF-32BE" },
226 { 1019, "UTF-32LE" },
229 { 2000, "ISO-8859-1-Windows-3.0-Latin-1" },
230 { 2001, "ISO-8859-1-Windows-3.1-Latin-1" },
231 { 2002, "ISO-8859-2-Windows-Latin-2" },
232 { 2003, "ISO-8859-9-Windows-Latin-5" },
233 { 2004, "hp-roman8" },
234 { 2005, "Adobe-Standard-Encoding" },
235 { 2006, "Ventura-US" },
236 { 2007, "Ventura-International" },
241 { 2012, "PC8-Danish-Norwegian" },
243 { 2014, "PC8-Turkish" },
244 { 2015, "IBM-Symbols" },
245 { 2016, "IBM-Thai" },
246 { 2017, "HP-Legal" },
247 { 2018, "HP-Pi-font" },
248 { 2019, "HP-Math8" },
249 { 2020, "Adobe-Symbol-Encoding" },
250 { 2021, "HP-DeskTop" },
251 { 2022, "Ventura-Math" },
252 { 2023, "Microsoft-Publishing" },
253 { 2024, "Windows-31J" },
256 { 2027, "macintosh" },
293 { 2064, "EBCDIC-AT-DE" },
294 { 2065, "EBCDIC-AT-DE-A" },
295 { 2066, "EBCDIC-CA-FR" },
296 { 2067, "EBCDIC-DK-NO" },
297 { 2068, "EBCDIC-DK-NO-A" },
298 { 2069, "EBCDIC-FI-SE" },
299 { 2070, "EBCDIC-FI-SE-A" },
300 { 2071, "EBCDIC-FR" },
301 { 2072, "EBCDIC-IT" },
302 { 2073, "EBCDIC-PT" },
303 { 2074, "EBCDIC-ES" },
304 { 2075, "EBCDIC-ES-A" },
305 { 2076, "EBCDIC-ES-S" },
306 { 2077, "EBCDIC-UK" },
307 { 2078, "EBCDIC-US" },
308 { 2079, "UNKNOWN-8BIT" },
309 { 2080, "MNEMONIC" },
314 { 2085, "HZ-GB-2312" },
318 { 2089, "IBM00858" },
319 { 2090, "IBM00924" },
320 { 2091, "IBM01140" },
321 { 2092, "IBM01141" },
322 { 2093, "IBM01142" },
323 { 2094, "IBM01143" },
324 { 2095, "IBM01144" },
325 { 2096, "IBM01145" },
326 { 2097, "IBM01146" },
327 { 2098, "IBM01147" },
328 { 2099, "IBM01148" },
329 { 2100, "IBM01149" },
330 { 2101, "Big5-HKSCS" },
333 { 2104, "Amiga-1251" },
334 { 2105, "KOI7-switched" },
338 { 2109, "windows-874" },
340 { 2250, "windows-1250" },
341 { 2251, "windows-1251" },
342 { 2252, "windows-1252" },
343 { 2253, "windows-1253" },
344 { 2254, "windows-1254" },
345 { 2255, "windows-1255" },
346 { 2256, "windows-1256" },
347 { 2257, "windows-1257" },
348 { 2258, "windows-1258" },
353 value_string_ext wap_mib_enum_vals_character_sets_ext
= VALUE_STRING_EXT_INIT(wap_mib_enum_vals_character_sets
);