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