strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
[obnox/wireshark/wip.git] / epan / dissectors / packet-wbxml.c
1 /* packet-wbxml.c
2  *
3  * Routines for WAP Binary XML dissection
4  * Copyright 2003, 2004, Olivier Biot.
5  *
6  * Routines for WV-CSP 1.3 dissection
7  * Copyright 2007, Andrei Rubaniuk.
8  *
9  * $Id$
10  *
11  * Refer to the AUTHORS file or the AUTHORS section in the man page
12  * for contacting the author(s) of this file.
13  *
14  * Wireshark - Network traffic analyzer
15  * By Gerald Combs <gerald@wireshark.org>
16  * Copyright 1998 Gerald Combs
17  *
18  * WAP Binary XML decoding functionality provided by Olivier Biot.
19  * WV-CSP 1.2 updated to Release version and WV-CSP 1.3 protocol
20  * decoding functionality provided by Andrei Rubaniuk.
21  *
22  * The WAP specifications used to be found at the WAP Forum:
23  *      <http://www.wapforum.org/what/Technical.htm>
24  * But now the correct link is at the Open Mobile Alliance:
25  *      <http://www.openmobilealliance.org/tech/affiliates/wap/wapindex.html>
26  * Media types defined by OMA affiliates will have their standards at:
27  *      <http://www.openmobilealliance.org/tech/affiliates/index.html>
28  *      <http://www.openmobilealliance.org/release_program/index.html>
29  *
30  * This program is free software; you can redistribute it and/or
31  * modify it under the terms of the GNU General Public License
32  * as published by the Free Software Foundation; either version 2
33  * of the License, or (at your option) any later version.
34  *
35  * This program is distributed in the hope that it will be useful,
36  * but WITHOUT ANY WARRANTY; without even the implied warranty of
37  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
38  * GNU General Public License for more details.
39  *
40  * You should have received a copy of the GNU General Public License
41  * along with this program; if not, write to the Free Software
42  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
43  */
44
45 /* Edit this file with 4-space tabulation */
46
47 #ifdef HAVE_CONFIG_H
48 # include "config.h"
49 #endif
50
51 #include <stdio.h>
52 #include <stdlib.h>
53 #include <string.h>
54
55 #include <glib.h>
56
57 #include <epan/packet.h>
58
59 #include <epan/prefs.h>
60 #include <epan/emem.h>
61
62 /* We need the function tvb_get_guintvar() */
63 #include "packet-wap.h"
64
65 #ifdef NEED_G_ASCII_STRCASECMP_H
66 #include "g_ascii_strcasecmp.h"
67 #endif
68
69 /* General-purpose debug logger.
70  * Requires double parentheses because of variable arguments of printf().
71  *
72  * Enable debug logging for WBXML by defining AM_FLAGS
73  * so that it contains "-DDEBUG_wbxml"
74  */
75 #ifdef DEBUG_wbxml
76 #define DebugLog(x)                             \
77         g_print("%s:%u: ", __FILE__, __LINE__); \
78         g_print x
79 #else
80 #define DebugLog(x) ;
81 #endif
82
83 /* The code in this source file dissects the WAP Binary XML content,
84  * and if possible renders it. WBXML mappings are defined in the
85  * "wbxml_decoding" structure.
86  *
87  * NOTES:
88  *
89  *  - Some WBXML content is *not* backwards compatible across minor versions.
90  *    This painful remark is true for:
91  *      o  WMLC 1.0 with respect to later WMLC 1.x
92  *      o  All WV-CSP versions (never backwards compatible)
93  *    The only way of correctly rendering the WBXML is to let the end-user
94  *    choose from the possible renderings. This only applies to the case when
95  *    the WBXML DocType is not included in the WBXML header (unknown/missing).
96  *
97  *  - Some WBXML content uses EXT_T_* in a non-tableref manner. This is the
98  *    case with WV-CSP 1.1 and up, where the index points to a value_string
99  *    containing WV-CSP specific token values. This is allowed as it is not
100  *    explicitly forbidden in the WBXML specifications. Hence the global token
101  *    map for content must also contain a function pointer if no tableref
102  *    string is used.
103  *
104  *  - Code page switches apply until a new code page switch. In the WBXML/1.x
105  *    ABNF notation, it can be proven that the switch_page can only precede
106  *    the following tokens:
107  *      o  stag      : TAG | LITERAL | LITERAL_A | LITERAL_C | LITERAL_AC
108  *      o  attr      : ATTRSTART | ATTRVALUE
109  *      o  extension : EXT_I | EXT_T | EXT
110  *    Code page switches are displayed in a separate column.
111  *
112  *  - The WBXML spec states that code pages are static to both the tag and the
113  *    attribute state parser. A SWITCH_PAGE within a state switches the code
114  *    page of the active state only. Note that code page 255 is reserved for
115  *    application-specific (read: testing) purposes.
116  *
117  *  - In order to render the XML content, recursion is inevitable at some
118  *    point (when a tag with content occurs in the content of a tag with
119  *    content). The code will however not recurse if this is not strictly
120  *    required (e.g., tag without content in the content of a tag with
121  *    content).
122  *
123  *  - I found it useful to display the XML nesting level as a first "column",
124  *    followed by the abbreviated WBXML token interpretation. When a mapping
125  *    is defined for the parsed WBXML content, then the XML rendering is
126  *    displayed with appropriate indentation (maximum nesting level = 255,
127  *    after which the nesting and level will safely roll-over to 0).
128  *
129  *  - The WAP Forum defines the order of precedence for finding out the
130  *    WBXML content type (same rules for charset) as follows:
131  *      1. Look in the Content-Type WSP header
132  *      2. Look in the WBXML header
133  *    Currently there is no means of using content type parameters:
134  *      o  Type=<some_type>
135  *      o  Charset=<charset_of_the_content>
136  *    So it is possible some WBXML content types are incorrectly parsed.
137  *    This would only be the case when the content type declaration in the
138  *    WSP Content-Type header would be different (or would have parameters
139  *    which are relevant to the WBXML decoding) from the content type
140  *    identifier specified in the WBXML header. This has to do with the
141  *    decoding of terminated text strings in the different character codings.
142  *    TODO: investigate this and provide correct decoding at all times.
143  */
144
145 typedef struct _value_valuestring {
146         guint32 value;
147         const value_string *valstrptr;
148 } value_valuestring;
149
150 /* Tries to match val against each element in the value_value_string array vvs.
151  * Returns the associated value_string ptr on a match, or NULL on failure. */
152 static const value_string *
153 val_to_valstr(guint32 val, const value_valuestring *vvs)
154 {
155         gint i = 0;
156
157         while (vvs[i].valstrptr) {
158                 if (vvs[i].value == val)
159                         return(vvs[i].valstrptr);
160                 i++;
161         }
162
163         return(NULL);
164 }
165
166 /* Note on Token mapping
167  * ---------------------
168  *
169  * The WBXML dissector will try mapping the token decoding to their textual
170  * representation if the media type has a defined token representation. The
171  * following logic applies:
172  *
173  * a. Inspect the WBXML PublicID
174  *      This means that I need a list { PublicID, decoding }
175  *
176  * b. Inspect the literal media type
177  *      This requires a list { "media/type", discriminator, { decodings } }
178  *
179  *   b.1. Use a discriminator to choose an appropriate token mapping;
180  *      The disciminator needs a small number of bytes from the data tvbuff_t.
181  *
182  * else
183  *   b.2. Provide a list to the end-user with all possible token mappings.
184  *
185  * c. If none match then only show the tokens without mapping.
186  *
187  */
188
189 /* ext_t_func_ptr is a pointer to a function handling the EXT_T_i tokens:
190  *
191  * char * ext_t_function(tvbuff_t *tvb, guint32 value, guint32 strtbl);
192  */
193 typedef char * (* ext_t_func_ptr)(tvbuff_t *, guint32, guint32);
194
195 /* Note on parsing of OPAQUE data
196  * ------------------------------
197  *
198  * The WBXML encapsulation allows the insertion of opaque binary data in the
199  * WBXML body. Although this opaque data has no meaning in WBXML, the media
200  * type itself may define compact encoding of given input by encoding it in
201  * such a OPAQUE blob of bytes.
202  *
203  * The WBXML dissector now supports dissection of OPAQUE data by means of a
204  * mapping function that will operate based on the token (well-known or literal)
205  * and the active code page.
206  *
207  * For well-known tokens the simplest approach is to use a switch for the code
208  * pages and another switch for the relevant tokens within a code page.
209  *
210  * For literal tokens (tags and attribute names), the only approach is a string
211  * comparison with the literal representation of the given tag or attribute
212  * name.
213  *
214  * opaque_token_func_ptr is a pointer to a function handling OPAQUE values
215  * for binary tokens representing tags or attribute starts.
216  * opaque_literal_func_ptr is a pointer to a function handling OPAQUE values
217  * for literal tokens representing tags or attribute starts.
218  *
219  * The length field of the OPAQUE entry starts at offset (not offset + 1).
220  *
221  * The length of the processed OPAQUE value is returned by reference.
222  *
223  * char * opaque_token_function(tvbuff_t *tvb, guint32 offset,
224  *              guint8 token, guint8 codepage, guint32 *length);
225  * char * opaque_literal_function(tvbuff_t *tvb, guint32 offset,
226  *              const char *token, guint8 codepage, guint32 *length);
227  */
228 typedef char * (* opaque_token_func_ptr)(tvbuff_t *, guint32, guint8, guint8, guint32 *);
229 typedef char * (* opaque_literal_func_ptr)(tvbuff_t *, guint32, const char *, guint8, guint32 *);
230
231 static char *
232 default_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
233                           guint8 token _U_, guint8 codepage _U_, guint32 *length)
234 {
235         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
236         char *str = g_strdup_printf("(%d bytes of opaque data)", data_len);
237         *length += data_len;
238         return str;
239 }
240
241 static char *
242 default_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
243                            const char *token _U_, guint8 codepage _U_, guint32 *length)
244 {
245         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
246         char *str = g_strdup_printf("(%d bytes of opaque data)", data_len);
247         *length += data_len;
248         return str;
249 }
250
251 static char *
252 default_opaque_binary_attr(tvbuff_t *tvb, guint32 offset,
253                            guint8 token _U_, guint8 codepage _U_, guint32 *length)
254 {
255         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
256         char *str = g_strdup_printf("(%d bytes of opaque data)", data_len);
257         *length += data_len;
258         return str;
259 }
260
261 static char *
262 default_opaque_literal_attr(tvbuff_t *tvb, guint32 offset,
263                             const char *token _U_, guint8 codepage _U_, guint32 *length)
264 {
265         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
266         char *str = g_strdup_printf("(%d bytes of opaque data)", data_len);
267         *length += data_len;
268         return str;
269 }
270
271 /* Render a hex %dateTime encoded timestamp as a string.
272  * 0x20011231123456 becomes "2001-12-31T12:34:56Z" */
273 static char *
274 date_time_from_opaque(tvbuff_t *tvb, guint32 offset, guint32 data_len)
275 {
276         char *str;
277
278         switch (data_len) {
279         case 4: /* YYYY-MM-DD[T00:00:00Z] */
280                 str = g_strdup_printf("%%DateTime: "
281                                       "%02x%02x-%02x-%02xT00:00:00Z",
282                                       tvb_get_guint8(tvb, offset),
283                                       tvb_get_guint8(tvb, offset + 1),
284                                       tvb_get_guint8(tvb, offset + 2),
285                                       tvb_get_guint8(tvb, offset + 3));
286                 break;
287         case 5: /* YYYY-MM-DDThh[:00:00Z] */
288                 str = g_strdup_printf("%%DateTime: "
289                                       "%02x%02x-%02x-%02xT%02x:00:00Z",
290                                       tvb_get_guint8(tvb, offset),
291                                       tvb_get_guint8(tvb, offset + 1),
292                                       tvb_get_guint8(tvb, offset + 2),
293                                       tvb_get_guint8(tvb, offset + 3),
294                                       tvb_get_guint8(tvb, offset + 4));
295                 break;
296         case 6: /* YYYY-MM-DDThh:mm[:00Z] */
297                 str = g_strdup_printf("%%DateTime: "
298                                       "%02x%02x-%02x-%02xT%02x:%02x:00Z",
299                                       tvb_get_guint8(tvb, offset),
300                                       tvb_get_guint8(tvb, offset + 1),
301                                       tvb_get_guint8(tvb, offset + 2),
302                                       tvb_get_guint8(tvb, offset + 3),
303                                       tvb_get_guint8(tvb, offset + 4),
304                                       tvb_get_guint8(tvb, offset + 5));
305                 break;
306         case 7: /* YYYY-MM-DDThh:mm[:00Z] */
307                 str = g_strdup_printf("%%DateTime: "
308                                       "%02x%02x-%02x-%02xT%02x:%02x:%02xZ",
309                                       tvb_get_guint8(tvb, offset),
310                                       tvb_get_guint8(tvb, offset + 1),
311                                       tvb_get_guint8(tvb, offset + 2),
312                                       tvb_get_guint8(tvb, offset + 3),
313                                       tvb_get_guint8(tvb, offset + 4),
314                                       tvb_get_guint8(tvb, offset + 5),
315                                       tvb_get_guint8(tvb, offset + 6));
316                 break;
317         default:
318                 str = g_strdup_printf("<Error: invalid binary %%DateTime "
319                                       "(%d bytes of opaque data)>", data_len);
320                 break;
321         }
322
323         return str;
324 }
325
326 /* Is ALWAYS 6 bytes long:
327  * 00YY YYYY  YYYY YYMM  MMDD DDDh  hhhh mmmm  mmss ssss  ZZZZ ZZZZ */
328 static char *
329 wv_datetime_from_opaque(tvbuff_t *tvb, guint32 offset, guint32 data_len)
330 {
331         char *str;
332         guint16 year;
333         guint8 month, day, hour, minute, second, timezone;
334         guint8 peek;
335
336         if (data_len == 6) { /* Valid */
337
338                 /* Octet 1: 00YY YYYY */
339                 year = tvb_get_guint8(tvb, offset) & 0x3F; /* ..11 1111 */
340                 year <<=6;
341                 /* Octet 2: YYYY YYMM */
342                 peek = tvb_get_guint8(tvb, offset + 1);
343                 year += (peek >> 2); /* 1111 11.. */
344                 month = (peek & 0x03) << 2; /* .... ..11 */
345                 /* Octet 3: MMDD DDDh */
346                 peek = tvb_get_guint8(tvb, offset + 2);
347                 month += (peek >> 6); /* 11.. .... */
348                 day = (peek & 0x3E) >> 1; /* ..11 111. */
349                 hour = (peek & 0x01) << 4; /* .... ...1 */
350                 /* Octet 4: hhhh mmmm */
351                 peek = tvb_get_guint8(tvb, offset + 3);
352                 hour += (peek >> 4);
353                 minute = (peek & 0x0F) << 2; /* .... 1111 */
354                 /* Octet 5: mmss ssss */
355                 peek = tvb_get_guint8(tvb, offset + 4);
356                 minute += (peek >> 6); /* 11.. .... */
357                 second = peek & 0x3F; /* ..11 1111 */
358                 /* octet 6: ZZZZZZZZ */
359                 timezone = tvb_get_guint8(tvb, offset + 5);
360                 /* Now construct the string */
361                 str = g_strdup_printf("WV-CSP DateTime: "
362                                       "%04d-%02d-%02dT%02d:%02d:%02d%c",
363                                       year, month, day, hour, minute, second, timezone);
364         } else { /* Invalid length for a WV-CSP DateTime tag value */
365                 str = g_strdup_printf("<Error: invalid binary WV-CSP DateTime value "
366                                       "(%d bytes of opaque data)>", data_len);
367         }
368         return str;
369 }
370
371 /* WV-CSP integer values for tag content is encoded in a fashion similar
372  * to a Long-Integer in WSP */
373 static char *
374 wv_integer_from_opaque(tvbuff_t *tvb, guint32 offset, guint32 data_len)
375 {
376         char *str;
377
378         switch (data_len) {
379         case 1:
380                 str = g_strdup_printf("WV-CSP Integer: %d",
381                                       tvb_get_guint8(tvb, offset));
382                 break;
383         case 2:
384                 str = g_strdup_printf("WV-CSP Integer: %d",
385                                       tvb_get_ntohs(tvb, offset));
386                 break;
387         case 3:
388                 str = g_strdup_printf("WV-CSP Integer: %d",
389                                       tvb_get_ntoh24(tvb, offset));
390                 break;
391         case 4:
392                 str = g_strdup_printf("WV-CSP Integer: %d",
393                                       tvb_get_ntohl(tvb, offset));
394                 break;
395         default:
396                 str = g_strdup_printf("<Error: invalid binary WV-CSP Integer value "
397                                       "(%d bytes of opaque data)>", data_len);
398                 break;
399         }
400
401         return str;
402 }
403
404 static char *
405 wv_csp10_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
406                            guint8 token, guint8 codepage, guint32 *length)
407 {
408         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
409         char *str = NULL;
410
411         switch (codepage) {
412         case 0: /* Common code page */
413                 switch (token) {
414                 case 0x0B: /* <Code> */
415                 case 0x0F: /* <ContentSize> */
416                 case 0x1A: /* <MessageCount> */
417                 case 0x3C: /* <Validity> */
418                         str = wv_integer_from_opaque(tvb,
419                                                      offset + *length, data_len);
420                         break;
421                 case 0x11: /* <DateTime> */
422                         str = wv_datetime_from_opaque(tvb,
423                                                       offset + *length, data_len);
424                         break;
425                 default:
426                         break;
427                 }
428                 break;
429         case 1: /* Access code page */
430                 switch (token) {
431                 case 0x1C: /* <KeepAliveTime> */
432                 case 0x32: /* <TimeToLive> */
433                         str = wv_integer_from_opaque(tvb,
434                                                      offset + *length, data_len);
435                         break;
436                 default:
437                         break;
438                 }
439                 break;
440         case 3: /* Client capability code page */
441                 switch (token) {
442                 case 0x06: /* <AcceptedContentLength> */
443                 case 0x0C: /* <MultiTrans> */
444                 case 0x0D: /* <ParserSize> */
445                 case 0x0E: /* <ServerPollMin> */
446                 case 0x11: /* <TCPAddress> */
447                 case 0x12: /* <TCPPort> */
448                 case 0x13: /* <UDPPort> */
449                         str = wv_integer_from_opaque(tvb,
450                                                      offset + *length, data_len);
451                         break;
452                 default:
453                         break;
454                 }
455                 break;
456         default:
457                 break;
458         }
459         if (str == NULL) { /* Error, or not parsed */
460                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
461         }
462         *length += data_len;
463
464         return str;
465 }
466
467 static char *
468 wv_csp10_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
469                             const char *token, guint8 codepage _U_, guint32 *length)
470 {
471         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
472         char *str = NULL;
473
474         if ( token && ( (strcmp(token, "Code") == 0)
475                         || (strcmp(token, "ContentSize") == 0)
476                         || (strcmp(token, "MessageCount") == 0)
477                         || (strcmp(token, "Validity") == 0)
478                         || (strcmp(token, "KeepAliveTime") == 0)
479                         || (strcmp(token, "TimeToLive") == 0)
480                         || (strcmp(token, "AcceptedContentLength") == 0)
481                         || (strcmp(token, "MultiTrans") == 0)
482                         || (strcmp(token, "ParserSize") == 0)
483                         || (strcmp(token, "ServerPollMin") == 0)
484                         || (strcmp(token, "TCPAddress") == 0)
485                         || (strcmp(token, "TCPPort") == 0)
486                         || (strcmp(token, "UDPPort") == 0) ) )
487                 {
488                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
489                 }
490         else if ( token && ( strcmp(token, "DateTime") == 0) )
491                 {
492                         str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
493                 }
494
495         if (str == NULL) { /* Error, or not parsed */
496                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
497         }
498         *length += data_len;
499         return str;
500 }
501
502 static char *
503 wv_csp11_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
504                            guint8 token, guint8 codepage, guint32 *length)
505 {
506         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
507         char *str = NULL;
508
509         switch (codepage) {
510         case 0: /* Common code page */
511                 switch (token) {
512                 case 0x0B: /* <Code> */
513                 case 0x0F: /* <ContentSize> */
514                 case 0x1A: /* <MessageCount> */
515                 case 0x3C: /* <Validity> */
516                         str = wv_integer_from_opaque(tvb,
517                                                      offset + *length, data_len);
518                         break;
519                 case 0x11: /* <DateTime> */
520                         str = wv_datetime_from_opaque(tvb,
521                                                       offset + *length, data_len);
522                         break;
523                 default:
524                         break;
525                 }
526                 break;
527         case 1: /* Access code page */
528                 switch (token) {
529                 case 0x1C: /* <KeepAliveTime> */
530                 case 0x32: /* <TimeToLive> */
531                         str = wv_integer_from_opaque(tvb,
532                                                      offset + *length, data_len);
533                         break;
534                 default:
535                         break;
536                 }
537                 break;
538         case 3: /* Client capability code page */
539                 switch (token) {
540                 case 0x06: /* <AcceptedContentLength> */
541                 case 0x0C: /* <MultiTrans> */
542                 case 0x0D: /* <ParserSize> */
543                 case 0x0E: /* <ServerPollMin> */
544                 case 0x12: /* <TCPPort> */
545                 case 0x13: /* <UDPPort> */
546                         str = wv_integer_from_opaque(tvb,
547                                                      offset + *length, data_len);
548                         break;
549                 default:
550                         break;
551                 }
552                 break;
553         case 6: /* Messaging code page */
554                 switch (token) {
555                 case 0x1A: /* <DeliveryTime> - not in 1.0 */
556                         str = wv_datetime_from_opaque(tvb,
557                                                       offset + *length, data_len);
558                         break;
559                 default:
560                         break;
561                 }
562                 break;
563         default:
564                 break;
565         }
566         if (str == NULL) { /* Error, or not parsed */
567                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
568         }
569         *length += data_len;
570
571         return str;
572 }
573
574 static char *
575 wv_csp11_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
576                             const char *token, guint8 codepage _U_, guint32 *length)
577 {
578         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
579         char *str = NULL;
580
581         if ( token && ( (strcmp(token, "Code") == 0)
582                         || (strcmp(token, "ContentSize") == 0)
583                         || (strcmp(token, "MessageCount") == 0)
584                         || (strcmp(token, "Validity") == 0)
585                         || (strcmp(token, "KeepAliveTime") == 0)
586                         || (strcmp(token, "TimeToLive") == 0)
587                         || (strcmp(token, "AcceptedContentLength") == 0)
588                         || (strcmp(token, "MultiTrans") == 0)
589                         || (strcmp(token, "ParserSize") == 0)
590                         || (strcmp(token, "ServerPollMin") == 0)
591                         || (strcmp(token, "TCPPort") == 0)
592                         || (strcmp(token, "UDPPort") == 0) ) )
593                 {
594                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
595                 }
596         else
597                 if ( token && ( (strcmp(token, "DateTime") == 0)
598                                 || (strcmp(token, "DeliveryTime") == 0) ) )
599                         {
600                                 str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
601                         }
602
603         if (str == NULL) { /* Error, or not parsed */
604                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
605         }
606         *length += data_len;
607         return str;
608 }
609
610
611 static char *
612 wv_csp12_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
613                            guint8 token, guint8 codepage, guint32 *length)
614 {
615         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
616         char *str = NULL;
617
618         switch (codepage) {
619         case 0: /* Common code page */
620                 switch (token) {
621                 case 0x0B: /* <Code> */
622                 case 0x0F: /* <ContentSize> */
623                 case 0x1A: /* <MessageCount> */
624                 case 0x3C: /* <Validity> */
625                         str = wv_integer_from_opaque(tvb,
626                                                      offset + *length, data_len);
627                         break;
628                 case 0x11: /* <DateTime> */
629                         str = wv_datetime_from_opaque(tvb,
630                                                       offset + *length, data_len);
631                         break;
632                 default:
633                         break;
634                 }
635                 break;
636         case 1: /* Access code page */
637                 switch (token) {
638                 case 0x1C: /* <KeepAliveTime> */
639                 case 0x32: /* <TimeToLive> */
640                         str = wv_integer_from_opaque(tvb,
641                                                      offset + *length, data_len);
642                         break;
643                 default:
644                         break;
645                 }
646                 break;
647         case 3: /* Client capability code page */
648                 switch (token) {
649                 case 0x06: /* <AcceptedContentLength> */
650                 case 0x0C: /* <MultiTrans> */
651                 case 0x0D: /* <ParserSize> */
652                 case 0x0E: /* <ServerPollMin> */
653                 case 0x12: /* <TCPPort> */
654                 case 0x13: /* <UDPPort> */
655                         str = wv_integer_from_opaque(tvb,
656                                                      offset + *length, data_len);
657                         break;
658                 default:
659                         break;
660                 }
661                 break;
662         case 6: /* Messaging code page */
663                 switch (token) {
664                 case 0x1A: /* <DeliveryTime> - not in 1.0 */
665                         str = wv_datetime_from_opaque(tvb,
666                                                       offset + *length, data_len);
667                         break;
668                 default:
669                         break;
670                 }
671                 break;
672         case 9: /* Common code page (continued) */
673                 switch (token) {
674                 case 0x08: /* <HistoryPeriod> - 1.2 only */
675                 case 0x0A: /* <MaxWatcherList> - 1.2 only */
676                         str = wv_integer_from_opaque(tvb,
677                                                      offset + *length, data_len);
678                         break;
679                 default:
680                         break;
681                 }
682                 break;
683         default:
684                 break;
685         }
686         if (str == NULL) { /* Error, or not parsed */
687                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
688         }
689         *length += data_len;
690
691         return str;
692 }
693
694 static char *
695 wv_csp12_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
696                             const char *token, guint8 codepage _U_, guint32 *length)
697 {
698         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
699         char *str = NULL;
700
701         if ( token && ( (strcmp(token, "Code") == 0)
702                         || (strcmp(token, "ContentSize") == 0)
703                         || (strcmp(token, "MessageCount") == 0)
704                         || (strcmp(token, "Validity") == 0)
705                         || (strcmp(token, "KeepAliveTime") == 0)
706                         || (strcmp(token, "TimeToLive") == 0)
707                         || (strcmp(token, "AcceptedContentLength") == 0)
708                         || (strcmp(token, "MultiTrans") == 0)
709                         || (strcmp(token, "ParserSize") == 0)
710                         || (strcmp(token, "ServerPollMin") == 0)
711                         || (strcmp(token, "TCPPort") == 0)
712                         || (strcmp(token, "UDPPort") == 0)
713                         || (strcmp(token, "HistoryPeriod") == 0)
714                         || (strcmp(token, "MaxWatcherList") == 0) ) )
715                 {
716                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
717                 }
718         else
719                 if ( token && ( (strcmp(token, "DateTime") == 0)
720                                 || (strcmp(token, "DeliveryTime") == 0) ) )
721                         {
722                                 str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
723                         }
724
725         if (str == NULL) { /* Error, or not parsed */
726                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
727         }
728         *length += data_len;
729         return str;
730 }
731
732 static char *
733 wv_csp13_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
734                            guint8 token, guint8 codepage, guint32 *length)
735 {
736         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
737         char *str = NULL;
738
739         switch (codepage)
740                 {
741                 case 0: /* Common code page */
742                         switch (token)
743                                 {
744                                 case 0x0B: /* <Code> */
745                                 case 0x0F: /* <ContentSize> */
746                                 case 0x1A: /* <MessageCount> */
747                                 case 0x3C: /* <Validity> */
748                                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
749                                         break;
750                                 case 0x11: /* <DateTime> */
751                                         str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
752                                         break;
753                                 default:
754                                         break;
755                                 }
756                         break;
757
758                 case 1: /* Access code page */
759                         switch (token)
760                                 {
761                                 case 0x1C: /* <KeepAliveTime> */
762                                 case 0x25: /* <SearchFindings> */
763                                 case 0x26: /* <SearchID> */
764                                 case 0x27: /* <SearchIndex> */
765                                 case 0x28: /* <SearchLimit> */
766                                 case 0x32: /* <TimeToLive> */
767                                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
768                                         break;
769                                 default:
770                                         break;
771                                 }
772                         break;
773
774                 case 3: /* Client capability code page */
775                         switch (token)
776                                 {
777                                 case 0x06: /* <AcceptedContentLength> */
778                                 case 0x0C: /* <MultiTrans> */
779                                 case 0x0D: /* <ParserSize> */
780                                 case 0x0E: /* <ServerPollMin> */
781                                 case 0x12: /* <TCPPort> */
782                                 case 0x13: /* <UDPPort> */
783                                         /* New in WV-CSP 1.3*/
784                                 case 0x16: /* <AcceptedPullLength> */
785                                 case 0x17: /* <AcceptedPushLength> */
786                                 case 0x18: /* <AcceptedRichContentLength> */
787                                 case 0x19: /* <AcceptedTextContentLength> */
788                                 case 0x1B: /* <PlainTextCharset> MIBenum number - character set, i.e. UTF-8, windows-1251, etc. */
789                                 case 0x1C: /* <SessionPriority> */
790                                 case 0x1F: /* <UserSessionLimit> */
791                                 case 0x21: /* <MultiTransPerMessage> */
792                                 case 0x24: /* <ContentPolicyLimit> */
793                                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
794                                         break;
795                                 default:
796                                         break;
797                                 }
798                         break;
799
800                 case 5: /* Presence attribute code page */
801                         switch (token)
802                                 {
803                                         /* New in WV-CSP 1.3*/
804                                         /*              case 0x3B: */ /* <ClientContentLimit> */
805                                 case 0x3C: /* <ClientIMPriority> */
806                                 case 0x3D: /* <MaxPullLength> */
807                                 case 0x3E: /* <MaxPushLength> */
808                                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
809                                         break;
810                                 default:
811                                         break;
812                                 }
813                         break;
814
815                 case 6: /* Messaging code page */
816                         switch (token)
817                                 {
818                                 case 0x1A: /* <DeliveryTime> - not in 1.0 */
819                                         /* New in WV-CSP 1.3*/
820                                 case 0x1C: /* <AnswerOptionID> */
821                                         str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
822                                         break;
823                                 default:
824                                         break;
825                                 }
826                         break;
827
828                 case 9: /* Common code page (continued) */
829                         switch (token)
830                                 {
831                                 case 0x08: /* <HistoryPeriod> - 1.2 only */
832                                 case 0x0A: /* <MaxWatcherList> - 1.2 only */
833                                         /* New in WV-CSP 1.3*/
834                                 case 0x25: /* <SegmentCount> */
835                                 case 0x28: /* <SegmentReference> */
836                                 case 0x30: /* <TryAgainTimeout> */
837                                 case 0x3A: /* <GroupContentLimit> */
838                                 case 0x3B: /* <MessageTotalCount> */
839                                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
840                                         break;
841                                 default:
842                                         break;
843                                 }
844                         break;
845
846                 case 10:
847                         switch (token)
848                                 {
849                                         /* New in WV-CSP 1.3*/
850                                 case 0x0C: /* <PairID> */
851                                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
852                                         break;
853                                 default:
854                                         break;
855                                 }
856                         break;
857                 default:
858                         break;
859                 }
860
861         if (str == NULL)
862                 { /* Error, or not parsed */
863                         str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
864                 }
865         *length += data_len;
866
867         return str;
868 }
869
870
871 static char *
872 wv_csp13_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
873                             const char *token, guint8 codepage _U_, guint32 *length)
874 {
875         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
876         char *str = NULL;
877
878         if ( token && ( (strcmp(token, "Code") == 0)
879                         || (strcmp(token, "ContentSize") == 0)
880                         || (strcmp(token, "MessageCount") == 0)
881                         || (strcmp(token, "Validity") == 0)
882                         || (strcmp(token, "KeepAliveTime") == 0)
883                         || (strcmp(token, "TimeToLive") == 0)
884                         || (strcmp(token, "AcceptedContentLength") == 0)
885                         || (strcmp(token, "MultiTrans") == 0)
886                         || (strcmp(token, "ParserSize") == 0)
887                         || (strcmp(token, "ServerPollMin") == 0)
888                         || (strcmp(token, "TCPPort") == 0)
889                         || (strcmp(token, "UDPPort") == 0)
890                         || (strcmp(token, "HistoryPeriod") == 0)
891                         || (strcmp(token, "MaxWatcherList") == 0)
892                         /* New in WV-CSP 1.3*/
893                         || (strcmp(token, "SearchFindings") == 0)
894                         || (strcmp(token, "SearchID") == 0)
895                         || (strcmp(token, "SearchIndex") == 0)
896                         || (strcmp(token, "SearchLimit") == 0)
897                         || (strcmp(token, "AcceptedPullLength") == 0)
898                         || (strcmp(token, "AcceptedPushLength") == 0)
899                         || (strcmp(token, "AcceptedRichContentLength") == 0)
900                         || (strcmp(token, "AcceptedTextContentLength") == 0)
901                         || (strcmp(token, "SessionPriority") == 0)
902                         || (strcmp(token, "UserSessionLimit") == 0)
903                         || (strcmp(token, "MultiTransPerMessage") == 0)
904                         || (strcmp(token, "ContentPolicyLimit") == 0)
905                         || (strcmp(token, "AnswerOptionID") == 0)
906                         || (strcmp(token, "SegmentCount") == 0)
907                         || (strcmp(token, "SegmentReference") == 0)
908                         || (strcmp(token, "TryAgainTimeout") == 0)
909                         || (strcmp(token, "GroupContentLimit") == 0)
910                         || (strcmp(token, "MessageTotalCount") == 0)
911                         || (strcmp(token, "PairID") == 0) ) )
912                 {
913                         str = wv_integer_from_opaque(tvb, offset + *length, data_len);
914                 }
915         else
916                 if ( token && ( (strcmp(token, "DateTime") == 0)
917                                 || (strcmp(token, "DeliveryTime") == 0) ) )
918                         {
919                                 str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
920                         }
921
922         if (str == NULL) { /* Error, or not parsed */
923                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
924         }
925         *length += data_len;
926         return str;
927 }
928
929 static char *
930 sic10_opaque_literal_attr(tvbuff_t *tvb, guint32 offset,
931                           const char *token, guint8 codepage _U_, guint32 *length)
932 {
933         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
934         char *str = NULL;
935
936         if ( token && ( (strcmp(token, "created") == 0)
937                         || (strcmp(token, "si-expires") == 0) ) )
938                 {
939                         str = date_time_from_opaque(tvb, offset + *length, data_len);
940                 }
941         if (str == NULL) { /* Error, or not parsed */
942                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
943         }
944         *length += data_len;
945
946         return str;
947 }
948
949 static char *
950 sic10_opaque_binary_attr(tvbuff_t *tvb, guint32 offset,
951                          guint8 token, guint8 codepage, guint32 *length)
952 {
953         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
954         char *str = NULL;
955
956         switch (codepage) {
957         case 0: /* Only valid codepage for SI */
958                 switch (token) {
959                 case 0x0A: /* created= */
960                 case 0x10: /* si-expires= */
961                         str = date_time_from_opaque(tvb,
962                                                     offset + *length, data_len);
963                         break;
964                 default:
965                         break;
966                 }
967                 break;
968         default:
969                 break;
970         }
971         if (str == NULL) { /* Error, or not parsed */
972                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
973         }
974         *length += data_len;
975
976         return str;
977 }
978
979 static char *
980 emnc10_opaque_literal_attr(tvbuff_t *tvb, guint32 offset,
981                            const char *token, guint8 codepage _U_, guint32 *length)
982 {
983         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
984         char *str = NULL;
985
986         if ( token && (strcmp(token, "timestamp") == 0) )
987                 {
988                         str = date_time_from_opaque(tvb, offset + *length, data_len);
989                 }
990         if (str == NULL) { /* Error, or not parsed */
991                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
992         }
993         *length += data_len;
994
995         return str;
996 }
997
998 static char *
999 emnc10_opaque_binary_attr(tvbuff_t *tvb, guint32 offset,
1000                           guint8 token, guint8 codepage, guint32 *length)
1001 {
1002         guint32 data_len = tvb_get_guintvar(tvb, offset, length);
1003         char *str = NULL;
1004
1005         switch (codepage) {
1006         case 0: /* Only valid codepage for EMN */
1007                 switch (token) {
1008                 case 0x05: /* timestamp= */
1009                         str = date_time_from_opaque(tvb,
1010                                                     offset + *length, data_len);
1011                         break;
1012                 default:
1013                         break;
1014                 }
1015                 break;
1016         default:
1017                 break;
1018         }
1019         if (str == NULL) { /* Error, or not parsed */
1020                 str = g_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
1021         }
1022         *length += data_len;
1023
1024         return str;
1025 }
1026
1027 typedef struct _wbxml_decoding {
1028         const char *name;
1029         const char *abbrev;
1030         ext_t_func_ptr ext_t[3];
1031         opaque_token_func_ptr   opaque_binary_tag;
1032         opaque_literal_func_ptr opaque_literal_tag;
1033         opaque_token_func_ptr   opaque_binary_attr;
1034         opaque_literal_func_ptr opaque_literal_attr;
1035         const value_valuestring *global;
1036         const value_valuestring *tags;
1037         const value_valuestring *attrStart;
1038         const value_valuestring *attrValue;
1039 } wbxml_decoding;
1040
1041 /* Define a pointer to a discriminator function taking a tvb and the start
1042  * offset of the WBXML tokens in the body as arguments.
1043  */
1044 typedef const wbxml_decoding * (* discriminator_func_ptr)(tvbuff_t *, guint32);
1045
1046 /* For the decoding lists based on the known WBXML public ID */
1047 typedef struct _wbxml_integer_list {
1048         guint32 public_id;
1049         const wbxml_decoding *map;
1050 } wbxml_integer_list;
1051
1052 /* For the decoding lists on the literal content type */
1053 typedef struct _wbxml_literal_list {
1054         const char *content_type;
1055         discriminator_func_ptr discriminator; /* TODO */
1056         const wbxml_decoding *map;
1057 } wbxml_literal_list;
1058
1059 /************************** Variable declarations **************************/
1060
1061
1062 /* Initialize the protocol and registered fields */
1063 static int proto_wbxml = -1;
1064 static int hf_wbxml_version = -1;
1065 static int hf_wbxml_public_id_known = -1;
1066 static int hf_wbxml_public_id_literal = -1;
1067 static int hf_wbxml_charset = -1;
1068
1069 /* Initialize the subtree pointers */
1070 static gint ett_wbxml = -1;
1071 static gint ett_wbxml_str_tbl = -1;
1072 static gint ett_wbxml_content = -1;
1073
1074 /* WBXML Preferences */
1075 static gboolean skip_wbxml_token_mapping = FALSE;
1076 static gboolean disable_wbxml_token_parsing = FALSE;
1077
1078
1079 /**************** WBXML related declarations and definitions ****************/
1080
1081
1082 /* WBXML public ID mappings. For an up-to-date list, see
1083  * http://www.openmobilealliance.org/tech/omna/ */
1084 static const value_string vals_wbxml_public_ids[] = {
1085         /* 0x00 = literal public identifier */
1086         { 0x01, "Unknown or missing Public Identifier" },
1087         { 0x02, "-//WAPFORUM//DTD WML 1.0//EN (WML 1.0)" },
1088         { 0x03, "-//WAPFORUM//DTD WTA 1.0//EN (WTA Event 1.0) - Deprecated" },
1089         { 0x04, "-//WAPFORUM//DTD WML 1.1//EN (WML 1.1)" },
1090         { 0x05, "-//WAPFORUM//DTD SI 1.0//EN (Service Indication 1.0)" },
1091         { 0x06, "-//WAPFORUM//DTD SL 1.0//EN (Service Loading 1.0)" },
1092         { 0x07, "-//WAPFORUM//DTD CO 1.0//EN (Cache Operation 1.0)" },
1093         { 0x08, "-//WAPFORUM//DTD CHANNEL 1.1//EN (Channel 1.1)" },
1094         { 0x09, "-//WAPFORUM//DTD WML 1.2//EN (WML 1.2)" },
1095         { 0x0a, "-//WAPFORUM//DTD WML 1.3//EN (WML 1.3)" },
1096         { 0x0b, "-//WAPFORUM//DTD PROV 1.0//EN (Provisioning 1.0)" },
1097         { 0x0c, "-//WAPFORUM//DTD WTA-WML 1.2//EN (WTA-WML 1.2)" },
1098         { 0x0d, "-//WAPFORUM//DTD EMN 1.0//EN (Email Notification 1.0)" },
1099         { 0x0e, "-//WAPFORUM//DTD DRMREL 1.0//EN (DRMREL 1.0)" },
1100         { 0x0f, "-//WIRELESSVILLAGE//DTD CSP 1.0//EN"
1101           " (Wireless Village Client-Server Protocol DTD v1.0)" },
1102         { 0x10, "-//WIRELESSVILLAGE//DTD CSP 1.1//EN"
1103           " (Wireless Village Client-Server Protocol DTD v1.1)" },
1104         { 0x11, "-//OMA//DTD WV-CSP 1.2//EN (OMA IMPS - CSP protocol DTD v1.2)" },
1105         { 0x12, "-//OMA//DTD IMPS-CSP 1.3//EN (OMA IMPS - CSP protocol DTD v1.3)" },
1106         { 0x13, "-//OMA//DRM 2.1//EN (OMA DRM 2.1)" },
1107         /* 0x14 -- 0x7F: reserved */
1108
1109         /* Registered values - www.syncml.org */
1110         { 0x0fd1, "-//SYNCML//DTD SyncML 1.0//EN (SyncML 1.0)" },
1111         { 0x0fd3, "-//SYNCML//DTD SyncML 1.1//EN (SyncML 1.1)" },
1112
1113         /* Registered values - www.wapforum.org/wina/ */
1114         { 0x1100, "-//PHONE.COM//DTD ALERT 1.0//EN" },
1115         { 0x1101, "-//PHONE.COM//DTD CACHE-OPERATION 1.0//EN" },
1116         { 0x1102, "-//PHONE.COM//DTD SIGNAL 1.0//EN" },
1117         { 0x1103, "-//PHONE.COM//DTD LIST 1.0//EN" },
1118         { 0x1104, "-//PHONE.COM//DTD LISTCMD 1.0//EN" },
1119         { 0x1105, "-//PHONE.COM//DTD CHANNEL 1.0//EN" },
1120         { 0x1106, "-//PHONE.COM//DTD MMC 1.0//EN" },
1121         { 0x1107, "-//PHONE.COM//DTD BEARER-CHOICE 1.0//EN" },
1122         { 0x1108, "-//PHONE.COM//DTD WML 1.1//EN (WML+ 1.1)" },
1123         { 0x1109, "-//PHONE.COM//DTD CHANNEL 1.1//EN" },
1124         { 0x110a, "-//PHONE.COM//DTD LIST 1.1//EN" },
1125         { 0x110b, "-//PHONE.COM//DTD LISTCMD 1.1//EN" },
1126         { 0x110c, "-//PHONE.COM//DTD MMC 1.1//EN" },
1127         { 0x110d, "-//PHONE.COM//DTD WML 1.3//EN (WML+ 1.3)" },
1128         { 0x110e, "-//PHONE.COM//DTD MMC 2.0//EN" },
1129         /* 0x110F -- 0x11FF: unassigned */
1130         { 0x1200, "-//3GPP2.COM//DTD IOTA 1.0//EN" },
1131         { 0x1201, "-//SYNCML//DTD SyncML 1.2//EN" },
1132         { 0x1202, "-//SYNCML//DTD MetaInf 1.2//EN" },
1133         { 0x1203, "-//SYNCML//DTD DevInf 1.2//EN" },
1134         { 0x1204, "-//NOKIA//DTD LANDMARKS 1.0//EN" },
1135
1136         { 0x00, NULL }
1137 };
1138
1139 static const value_string vals_wbxml_versions[] = {
1140         { 0x00, "1.0" },        /* WAP-104-WBXML */
1141         { 0x01, "1.1" },        /* WAP-135-WBXML */
1142         { 0x02, "1.2" },        /* WAP-154-WBXML */
1143         { 0x03, "1.3" },        /* WAP-192-WBXML */
1144
1145         { 0x00, NULL }
1146 };
1147
1148 /* WBXML 1.0 global tokens: WAP-104-WBXML
1149  * Same token mapping as in vals_wbxml1x_global_tokens, but:
1150  *   { 0xC3, "RESERVED_2" }
1151  */
1152
1153 /* WBXML 1.x (x>0) global tokens: WAP-135-WBXML, WAP-154-WBXML, WAP-192-WBXML
1154  */
1155 static const value_string vals_wbxml1x_global_tokens[] = {
1156         { 0x00, "SWITCH_PAGE" },
1157         { 0x01, "END" },
1158         { 0x02, "ENTITY" },
1159         { 0x03, "STR_I" },
1160         { 0x04, "LITERAL" },
1161
1162         { 0x40, "EXT_I_0" },
1163         { 0x41, "EXT_I_1" },
1164         { 0x42, "EXT_I_2" },
1165         { 0x43, "PI" },
1166         { 0x44, "LITERAL_C" },
1167
1168         { 0x80, "EXT_T_0" },
1169         { 0x81, "EXT_T_1" },
1170         { 0x82, "EXT_T_2" },
1171         { 0x83, "STR_T" },
1172         { 0x84, "LITERAL_A" },
1173
1174         { 0xC0, "EXT_0" },
1175         { 0xC1, "EXT_1" },
1176         { 0xC2, "EXT_2" },
1177         { 0xC3, "OPAQUE" },
1178         { 0xC4, "LITERAL_AC" },
1179
1180         { 0x00, NULL }
1181 };
1182
1183
1184
1185
1186
1187 /********************** WBXML token mapping definition **********************/
1188
1189 /*
1190  * NOTE: Please make sure the Attribute Start values all contain an equal sign
1191  *       even in cases where they do not contain the start of an Attribute
1192  *       Value.
1193  */
1194
1195
1196 /* WML 1.0
1197  *
1198  * Wireless Markup Language
1199  ***************************************/
1200 static char *
1201 ext_t_0_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
1202 {
1203         gint str_len = tvb_strsize (tvb, str_tbl + value);
1204         char *str = g_strdup_printf("Variable substitution - escaped: '%s'",
1205                                     tvb_get_ptr(tvb, str_tbl + value, str_len));
1206         return str;
1207 }
1208
1209 static char *
1210 ext_t_1_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
1211 {
1212         gint str_len = tvb_strsize (tvb, str_tbl + value);
1213         char *str = g_strdup_printf("Variable substitution - unescaped: '%s'",
1214                                     tvb_get_ptr(tvb, str_tbl + value, str_len));
1215         return str;
1216 }
1217
1218 static char *
1219 ext_t_2_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
1220 {
1221         gint str_len = tvb_strsize (tvb, str_tbl + value);
1222         char *str = g_strdup_printf("Variable substitution - no transformation: '%s'",
1223                                     tvb_get_ptr(tvb, str_tbl + value, str_len));
1224         return str;
1225 }
1226 /*****   Global extension tokens   *****/
1227 static const value_string wbxml_wmlc10_global_cp0[] = {
1228         { 0x40, "Variable substitution - escaped" },
1229         { 0x41, "Variable substitution - unescaped" },
1230         { 0x42, "Variable substitution - no transformation" },
1231         { 0x80, "Variable substitution - escaped" },
1232         { 0x81, "Variable substitution - unescaped" },
1233         { 0x82, "Variable substitution - no transformation" },
1234         { 0xC0, "Reserved" },
1235         { 0xC1, "Reserved" },
1236         { 0xC2, "Reserved" },
1237
1238         { 0x00, NULL }
1239 };
1240
1241 /*****         Tag tokens          *****/
1242 static const value_string wbxml_wmlc10_tags_cp0[] = {
1243         /* 0x00 -- 0x04 GLOBAL */
1244         /* 0x05 -- 0x21 */
1245         { 0x22, "A" },
1246         { 0x23, "ACCESS" },
1247         { 0x24, "B" },
1248         { 0x25, "BIG" },
1249         { 0x26, "BR" },
1250         { 0x27, "CARD" },
1251         { 0x28, "DO" },
1252         { 0x29, "EM" },
1253         { 0x2A, "FIELDSET" },
1254         { 0x2B, "GO" },
1255         { 0x2C, "HEAD" },
1256         { 0x2D, "I" },
1257         { 0x2E, "IMG" },
1258         { 0x2F, "INPUT" },
1259         { 0x30, "META" },
1260         { 0x31, "NOOP" },
1261         { 0x32, "PREV" },
1262         { 0x33, "ONEVENT" },
1263         { 0x34, "OPTGROUP" },
1264         { 0x35, "OPTION" },
1265         { 0x36, "REFRESH" },
1266         { 0x37, "SELECT" },
1267         { 0x38, "SMALL" },
1268         { 0x39, "STRONG" },
1269         { 0x3A, "TAB" },
1270         { 0x3B, "TEMPLATE" },
1271         { 0x3C, "TIMER" },
1272         { 0x3D, "U" },
1273         { 0x3E, "VAR" },
1274         { 0x3F, "WML" },
1275
1276         { 0x00, NULL }
1277 };
1278
1279 /*****    Attribute Start tokens   *****/
1280 static const value_string wbxml_wmlc10_attrStart_cp0[] = {
1281         /* 0x00 -- 0x04 GLOBAL */
1282         { 0x05, "ACCEPT-CHARSET=" },
1283         { 0x06, "ALIGN='BOTTOM'" },
1284         { 0x07, "ALIGN='CENTER'" },
1285         { 0x08, "ALIGN='LEFT'" },
1286         { 0x09, "ALIGN='MIDDLE'" },
1287         { 0x0A, "ALIGN='RIGHT'" },
1288         { 0x0B, "ALIGN='TOP'" },
1289         { 0x0C, "ALT=" },
1290         { 0x0D, "CONTENT=" },
1291         { 0x0E, "DEFAULT=" },
1292         { 0x0F, "DOMAIN=" },
1293         { 0x10, "EMPTYOK='FALSE'" },
1294         { 0x11, "EMPTYOK='TRUE'" },
1295         { 0x12, "FORMAT=" },
1296         { 0x13, "HEIGHT=" },
1297         { 0x14, "HSPACE=" },
1298         { 0x15, "IDEFAULT=" },
1299         { 0x16, "IKEY=" },
1300         { 0x17, "KEY=" },
1301         { 0x18, "LABEL=" },
1302         { 0x19, "LOCALSRC=" },
1303         { 0x1A, "MAXLENGTH=" },
1304         { 0x1B, "METHOD='GET'" },
1305         { 0x1C, "METHOD='POST'" },
1306         { 0x1D, "MODE='NOWRAP'" },
1307         { 0x1E, "MODE='WRAP'" },
1308         { 0x1F, "MULTIPLE='FALSE'" },
1309         { 0x20, "MULTIPLE='TRUE'" },
1310         { 0x21, "NAME=" },
1311         { 0x22, "NEWCONTEXT='FALSE'" },
1312         { 0x23, "NEWCONTEXT='TRUE'" },
1313         { 0x24, "ONCLICK=" },
1314         { 0x25, "ONENTERBACKWARD=" },
1315         { 0x26, "ONENTERFORWARD=" },
1316         { 0x27, "ONTIMER=" },
1317         { 0x28, "OPTIONAL='FALSE'" },
1318         { 0x29, "OPTIONAL='TRUE'" },
1319         { 0x2A, "PATH=" },
1320         { 0x2B, "POSTDATA=" },
1321         { 0x2C, "PUBLIC='FALSE'" },
1322         { 0x2D, "PUBLIC='TRUE'" },
1323         { 0x2E, "SCHEME=" },
1324         { 0x2F, "SENDREFERER='FALSE'" },
1325         { 0x30, "SENDREFERER='TRUE'" },
1326         { 0x31, "SIZE=" },
1327         { 0x32, "SRC=" },
1328         { 0x33, "STYLE='LIST'" },
1329         { 0x34, "STYLE='SET'" },
1330         { 0x35, "TABINDEX=" },
1331         { 0x36, "TITLE=" },
1332         { 0x37, "TYPE=" },
1333         { 0x38, "TYPE='ACCEPT'" },
1334         { 0x39, "TYPE='DELETE'" },
1335         { 0x3A, "TYPE='HELP'" },
1336         { 0x3B, "TYPE='PASSWORD'" },
1337         { 0x3C, "TYPE='ONCLICK'" },
1338         { 0x3D, "TYPE='ONENTERBACKWARD'" },
1339         { 0x3E, "TYPE='ONENTERFORWARD'" },
1340         { 0x3F, "TYPE='ONTIMER'" },
1341         /* 0x40 -- 0x44 GLOBAL */
1342         { 0x45, "TYPE='OPTIONS'" },
1343         { 0x46, "TYPE='PREV'" },
1344         { 0x47, "TYPE='RESET'" },
1345         { 0x48, "TYPE='TEXT'" },
1346         { 0x49, "TYPE='vnd.'" },
1347         { 0x4A, "URL=" },
1348         { 0x4B, "URL='http://'" },
1349         { 0x4C, "URL='https://'" },
1350         { 0x4D, "USER-AGENT=" },
1351         { 0x4E, "VALUE=" },
1352         { 0x4F, "VSPACE=" },
1353         { 0x50, "WIDTH=" },
1354         { 0x51, "xml:lang=" },
1355
1356         { 0x00, NULL }
1357 };
1358
1359 /*****    Attribute Value tokens   *****/
1360 static const value_string wbxml_wmlc10_attrValue_cp0[] = {
1361         /* 0x80 -- 0x84 GLOBAL */
1362         { 0x85, "'.com/'" },
1363         { 0x86, "'.edu/'" },
1364         { 0x87, "'.net/'" },
1365         { 0x88, "'.org/'" },
1366         { 0x89, "'ACCEPT'" },
1367         { 0x8A, "'BOTTOM'" },
1368         { 0x8B, "'CLEAR'" },
1369         { 0x8C, "'DELETE'" },
1370         { 0x8D, "'HELP'" },
1371         { 0x8E, "'http://'" },
1372         { 0x8F, "'http://www.'" },
1373         { 0x90, "'https://'" },
1374         { 0x91, "'https://www.'" },
1375         { 0x92, "'LIST'" },
1376         { 0x93, "'MIDDLE'" },
1377         { 0x94, "'NOWRAP'" },
1378         { 0x95, "'ONCLICK'" },
1379         { 0x96, "'ONENTERBACKWARD'" },
1380         { 0x97, "'ONENTERFORWARD'" },
1381         { 0x98, "'ONTIMER'" },
1382         { 0x99, "'OPTIONS'" },
1383         { 0x9A, "'PASSWORD'" },
1384         { 0x9B, "'RESET'" },
1385         { 0x9C, "'SET'" },
1386         { 0x9D, "'TEXT'" },
1387         { 0x9E, "'TOP'" },
1388         { 0x9F, "'UNKNOWN'" },
1389         { 0xA0, "'WRAP'" },
1390         { 0xA1, "'www.'" },
1391
1392         { 0x00, NULL }
1393 };
1394
1395 /***** Token code page aggregation *****/
1396 static const value_valuestring wbxml_wmlc10_global[] = {
1397         { 0, wbxml_wmlc10_global_cp0 },
1398         { 0, NULL }
1399 };
1400
1401 static const value_valuestring wbxml_wmlc10_tags[] = {
1402         { 0, wbxml_wmlc10_tags_cp0 },
1403         { 0, NULL }
1404 };
1405
1406 static const value_valuestring wbxml_wmlc10_attrStart[] = {
1407         { 0, wbxml_wmlc10_attrStart_cp0 },
1408         { 0, NULL }
1409 };
1410
1411 static const value_valuestring wbxml_wmlc10_attrValue[] = {
1412         { 0, wbxml_wmlc10_attrValue_cp0 },
1413         { 0, NULL }
1414 };
1415
1416 static const wbxml_decoding decode_wmlc_10 = {
1417         "Wireless Markup Language 1.0",
1418         "WML 1.0",
1419         { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
1420         default_opaque_binary_tag,
1421         default_opaque_literal_tag,
1422         default_opaque_binary_attr,
1423         default_opaque_literal_attr,
1424         wbxml_wmlc10_global,
1425         wbxml_wmlc10_tags,
1426         wbxml_wmlc10_attrStart,
1427         wbxml_wmlc10_attrValue
1428 };
1429
1430
1431
1432
1433 /* WML 1.1
1434  *
1435  * Wireless Markup Language
1436  ***************************************/
1437
1438 /*****   Global extension tokens   *****/
1439 /* Same as in WML 1.0 */
1440
1441 /*****         Tag tokens          *****/
1442 static const value_string wbxml_wmlc11_tags_cp0[] = {
1443         /* 0x00 -- 0x04 GLOBAL */
1444         /* 0x05 -- 0x1B */
1445         { 0x1C, "a" },
1446         { 0x1D, "td" },
1447         { 0x1E, "tr" },
1448         { 0x1F, "table" },
1449         { 0x20, "p" },
1450         { 0x21, "postfield" },
1451         { 0x22, "anchor" },
1452         { 0x23, "access" },
1453         { 0x24, "b" },
1454         { 0x25, "big" },
1455         { 0x26, "br" },
1456         { 0x27, "card" },
1457         { 0x28, "do" },
1458         { 0x29, "em" },
1459         { 0x2A, "fieldset" },
1460         { 0x2B, "go" },
1461         { 0x2C, "head" },
1462         { 0x2D, "i" },
1463         { 0x2E, "img" },
1464         { 0x2F, "input" },
1465         { 0x30, "meta" },
1466         { 0x31, "noop" },
1467         { 0x32, "prev" },
1468         { 0x33, "onevent" },
1469         { 0x34, "optgroup" },
1470         { 0x35, "option" },
1471         { 0x36, "refresh" },
1472         { 0x37, "select" },
1473         { 0x38, "small" },
1474         { 0x39, "strong" },
1475         /* 0x3A */
1476         { 0x3B, "template" },
1477         { 0x3C, "timer" },
1478         { 0x3D, "u" },
1479         { 0x3E, "setvar" },
1480         { 0x3F, "wml" },
1481
1482         { 0x00, NULL }
1483 };
1484
1485 /*****    Attribute Start tokens   *****/
1486 static const value_string wbxml_wmlc11_attrStart_cp0[] = {
1487         /* 0x00 -- 0x04 GLOBAL */
1488         { 0x05, "accept-charset=" },
1489         { 0x06, "align='bottom'" },
1490         { 0x07, "align='center'" },
1491         { 0x08, "align='left'" },
1492         { 0x09, "align='middle'" },
1493         { 0x0A, "align='right'" },
1494         { 0x0B, "align='top'" },
1495         { 0x0C, "alt=" },
1496         { 0x0D, "content=" },
1497         /* 0x0E */
1498         { 0x0F, "domain=" },
1499         { 0x10, "emptyok='false'" },
1500         { 0x11, "emptyok='true'" },
1501         { 0x12, "format=" },
1502         { 0x13, "height=" },
1503         { 0x14, "hspace=" },
1504         { 0x15, "ivalue=" },
1505         { 0x16, "iname=" },
1506         /* 0x17 */
1507         { 0x18, "label=" },
1508         { 0x19, "localsrc=" },
1509         { 0x1A, "maxlength=" },
1510         { 0x1B, "method='get'" },
1511         { 0x1C, "method='post'" },
1512         { 0x1D, "mode='nowrap'" },
1513         { 0x1E, "mode='wrap'" },
1514         { 0x1F, "multiple='false'" },
1515         { 0x20, "multiple='true'" },
1516         { 0x21, "name=" },
1517         { 0x22, "newcontext='false'" },
1518         { 0x23, "newcontext='true'" },
1519         { 0x24, "onpick=" },
1520         { 0x25, "onenterbackward=" },
1521         { 0x26, "onenterforward=" },
1522         { 0x27, "ontimer=" },
1523         { 0x28, "optional='false'" },
1524         { 0x29, "optional='true'" },
1525         { 0x2A, "path=" },
1526         /* 0x2B -- 0x2D */
1527         { 0x2E, "scheme=" },
1528         { 0x2F, "sendreferer='false'" },
1529         { 0x30, "sendreferer='true'" },
1530         { 0x31, "size=" },
1531         { 0x32, "src=" },
1532         { 0x33, "ordered='false'" },
1533         { 0x34, "ordered='true'" },
1534         { 0x35, "tabindex=" },
1535         { 0x36, "title=" },
1536         { 0x37, "type=" },
1537         { 0x38, "type='accept'" },
1538         { 0x39, "type='delete'" },
1539         { 0x3A, "type='help'" },
1540         { 0x3B, "type='password'" },
1541         { 0x3C, "type='onpick'" },
1542         { 0x3D, "type='onenterbackward'" },
1543         { 0x3E, "type='onenterforward'" },
1544         { 0x3F, "type='ontimer'" },
1545         /* 0x40 -- 0x44 GLOBAL */
1546         { 0x45, "type='options'" },
1547         { 0x46, "type='prev'" },
1548         { 0x47, "type='reset'" },
1549         { 0x48, "type='text'" },
1550         { 0x49, "type='vnd.'" },
1551         { 0x4A, "href=" },
1552         { 0x4B, "href='http://'" },
1553         { 0x4C, "href='https://'" },
1554         { 0x4D, "value=" },
1555         { 0x4E, "vspace=" },
1556         { 0x4F, "width=" },
1557         { 0x50, "xml:lang=" },
1558         /* 0x51 */
1559         { 0x52, "align=" },
1560         { 0x53, "columns=" },
1561         { 0x54, "class=" },
1562         { 0x55, "id=" },
1563         { 0x56, "forua='false'" },
1564         { 0x57, "forua='true'" },
1565         { 0x58, "src='http://'" },
1566         { 0x59, "src='https://'" },
1567         { 0x5A, "http-equiv=" },
1568         { 0x5B, "http-equiv='Content-Type'" },
1569         { 0x5C, "content='application/vnd.wap.wmlc;charset='" },
1570         { 0x5D, "http-equiv='Expires'" },
1571
1572         { 0x00, NULL }
1573 };
1574
1575 /*****    Attribute Value tokens   *****/
1576 static const value_string wbxml_wmlc11_attrValue_cp0[] = {
1577         /* 0x80 -- 0x84 GLOBAL */
1578         { 0x85, "'.com/'" },
1579         { 0x86, "'.edu/'" },
1580         { 0x87, "'.net/'" },
1581         { 0x88, "'.org/'" },
1582         { 0x89, "'accept'" },
1583         { 0x8A, "'bottom'" },
1584         { 0x8B, "'clear'" },
1585         { 0x8C, "'delete'" },
1586         { 0x8D, "'help'" },
1587         { 0x8E, "'http://'" },
1588         { 0x8F, "'http://www.'" },
1589         { 0x90, "'https://'" },
1590         { 0x91, "'https://www.'" },
1591         /* 0x92 */
1592         { 0x93, "'middle'" },
1593         { 0x94, "'nowrap'" },
1594         { 0x95, "'onpick'" },
1595         { 0x96, "'onenterbackward'" },
1596         { 0x97, "'onenterforward'" },
1597         { 0x98, "'ontimer'" },
1598         { 0x99, "'options'" },
1599         { 0x9A, "'password'" },
1600         { 0x9B, "'reset'" },
1601         /* 0x9C */
1602         { 0x9D, "'text'" },
1603         { 0x9E, "'top'" },
1604         { 0x9F, "'unknown'" },
1605         { 0xA0, "'wrap'" },
1606         { 0xA1, "'www.'" },
1607
1608         { 0x00, NULL }
1609 };
1610
1611 /***** Token code page aggregation *****/
1612 static const value_valuestring wbxml_wmlc11_global[] = {
1613         { 0, wbxml_wmlc10_global_cp0 }, /* Same as WML 1.0 */
1614         { 0, NULL }
1615 };
1616
1617 static const value_valuestring wbxml_wmlc11_tags[] = {
1618         { 0, wbxml_wmlc11_tags_cp0 },
1619         { 0, NULL }
1620 };
1621
1622 static const value_valuestring wbxml_wmlc11_attrStart[] = {
1623         { 0, wbxml_wmlc11_attrStart_cp0 },
1624         { 0, NULL }
1625 };
1626
1627 static const value_valuestring wbxml_wmlc11_attrValue[] = {
1628         { 0, wbxml_wmlc11_attrValue_cp0 },
1629         { 0, NULL }
1630 };
1631
1632 static const wbxml_decoding decode_wmlc_11 = {
1633         "Wireless Markup Language 1.1",
1634         "WML 1.1",
1635         { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
1636         default_opaque_binary_tag,
1637         default_opaque_literal_tag,
1638         default_opaque_binary_attr,
1639         default_opaque_literal_attr,
1640         wbxml_wmlc11_global,
1641         wbxml_wmlc11_tags,
1642         wbxml_wmlc11_attrStart,
1643         wbxml_wmlc11_attrValue
1644 };
1645
1646
1647
1648
1649
1650 /* WML 1.2
1651  *
1652  * Wireless Markup Language
1653  ***************************************/
1654
1655 /*****   Global extension tokens   *****/
1656 /* Same as in WML 1.0 */
1657
1658 /*****         Tag tokens          *****/
1659 static const value_string wbxml_wmlc12_tags_cp0[] = {
1660         /* 0x00 -- 0x04 GLOBAL */
1661         /* 0x05 -- 0x1A */
1662         { 0x1B, "pre" },
1663         { 0x1C, "a" },
1664         { 0x1D, "td" },
1665         { 0x1E, "tr" },
1666         { 0x1F, "table" },
1667         { 0x20, "p" },
1668         { 0x21, "postfield" },
1669         { 0x22, "anchor" },
1670         { 0x23, "access" },
1671         { 0x24, "b" },
1672         { 0x25, "big" },
1673         { 0x26, "br" },
1674         { 0x27, "card" },
1675         { 0x28, "do" },
1676         { 0x29, "em" },
1677         { 0x2A, "fieldset" },
1678         { 0x2B, "go" },
1679         { 0x2C, "head" },
1680         { 0x2D, "i" },
1681         { 0x2E, "img" },
1682         { 0x2F, "input" },
1683         { 0x30, "meta" },
1684         { 0x31, "noop" },
1685         { 0x32, "prev" },
1686         { 0x33, "onevent" },
1687         { 0x34, "optgroup" },
1688         { 0x35, "option" },
1689         { 0x36, "refresh" },
1690         { 0x37, "select" },
1691         { 0x38, "small" },
1692         { 0x39, "strong" },
1693         /* 0x3A */
1694         { 0x3B, "template" },
1695         { 0x3C, "timer" },
1696         { 0x3D, "u" },
1697         { 0x3E, "setvar" },
1698         { 0x3F, "wml" },
1699
1700         { 0x00, NULL }
1701 };
1702
1703 /*****    Attribute Start tokens   *****/
1704 static const value_string wbxml_wmlc12_attrStart_cp0[] = {
1705         /* 0x00 -- 0x04 GLOBAL */
1706         { 0x05, "accept-charset=" },
1707         { 0x06, "align='bottom'" },
1708         { 0x07, "align='center'" },
1709         { 0x08, "align='left'" },
1710         { 0x09, "align='middle'" },
1711         { 0x0A, "align='right'" },
1712         { 0x0B, "align='top'" },
1713         { 0x0C, "alt=" },
1714         { 0x0D, "content=" },
1715         /* 0x0E */
1716         { 0x0F, "domain=" },
1717         { 0x10, "emptyok='false'" },
1718         { 0x11, "emptyok='true'" },
1719         { 0x12, "format=" },
1720         { 0x13, "height=" },
1721         { 0x14, "hspace=" },
1722         { 0x15, "ivalue=" },
1723         { 0x16, "iname=" },
1724         /* 0x17 */
1725         { 0x18, "label=" },
1726         { 0x19, "localsrc=" },
1727         { 0x1A, "maxlength=" },
1728         { 0x1B, "method='get'" },
1729         { 0x1C, "method='post'" },
1730         { 0x1D, "mode='nowrap'" },
1731         { 0x1E, "mode='wrap'" },
1732         { 0x1F, "multiple='false'" },
1733         { 0x20, "multiple='true'" },
1734         { 0x21, "name=" },
1735         { 0x22, "newcontext='false'" },
1736         { 0x23, "newcontext='true'" },
1737         { 0x24, "onpick=" },
1738         { 0x25, "onenterbackward=" },
1739         { 0x26, "onenterforward=" },
1740         { 0x27, "ontimer=" },
1741         { 0x28, "optional='false'" },
1742         { 0x29, "optional='true'" },
1743         { 0x2A, "path=" },
1744         /* 0x2B -- 0x2D */
1745         { 0x2E, "scheme=" },
1746         { 0x2F, "sendreferer='false'" },
1747         { 0x30, "sendreferer='true'" },
1748         { 0x31, "size=" },
1749         { 0x32, "src=" },
1750         { 0x33, "ordered='false'" },
1751         { 0x34, "ordered='true'" },
1752         { 0x35, "tabindex=" },
1753         { 0x36, "title=" },
1754         { 0x37, "type=" },
1755         { 0x38, "type='accept'" },
1756         { 0x39, "type='delete'" },
1757         { 0x3A, "type='help'" },
1758         { 0x3B, "type='password'" },
1759         { 0x3C, "type='onpick'" },
1760         { 0x3D, "type='onenterbackward'" },
1761         { 0x3E, "type='onenterforward'" },
1762         { 0x3F, "type='ontimer'" },
1763         /* 0x40 -- 0x44 GLOBAL */
1764         { 0x45, "type='options'" },
1765         { 0x46, "type='prev'" },
1766         { 0x47, "type='reset'" },
1767         { 0x48, "type='text'" },
1768         { 0x49, "type='vnd.'" },
1769         { 0x4A, "href=" },
1770         { 0x4B, "href='http://'" },
1771         { 0x4C, "href='https://'" },
1772         { 0x4D, "value=" },
1773         { 0x4E, "vspace=" },
1774         { 0x4F, "width=" },
1775         { 0x50, "xml:lang=" },
1776         /* 0x51 */
1777         { 0x52, "align=" },
1778         { 0x53, "columns=" },
1779         { 0x54, "class=" },
1780         { 0x55, "id=" },
1781         { 0x56, "forua='false'" },
1782         { 0x57, "forua='true'" },
1783         { 0x58, "src='http://'" },
1784         { 0x59, "src='https://'" },
1785         { 0x5A, "http-equiv=" },
1786         { 0x5B, "http-equiv='Content-Type'" },
1787         { 0x5C, "content='application/vnd.wap.wmlc;charset='" },
1788         { 0x5D, "http-equiv='Expires'" },
1789         { 0x5E, "accesskey=" },
1790         { 0x5F, "enctype=" },
1791         { 0x60, "enctype='application/x-www-form-urlencoded'" },
1792         { 0x61, "enctype='multipart/form-data'" },
1793
1794         { 0x00, NULL }
1795 };
1796
1797 /*****    Attribute Value tokens   *****/
1798 /* Same as in WML 1.1 */
1799
1800 /***** Token code page aggregation *****/
1801 static const value_valuestring wbxml_wmlc12_global[] = {
1802         { 0, wbxml_wmlc10_global_cp0 }, /* Same as WML 1.0 */
1803         { 0, NULL }
1804 };
1805
1806 static const value_valuestring wbxml_wmlc12_tags[] = {
1807         { 0, wbxml_wmlc12_tags_cp0 },
1808         { 0, NULL }
1809 };
1810
1811 static const value_valuestring wbxml_wmlc12_attrStart[] = {
1812         { 0, wbxml_wmlc12_attrStart_cp0 },
1813         { 0, NULL }
1814 };
1815
1816 static const value_valuestring wbxml_wmlc12_attrValue[] = {
1817         { 0, wbxml_wmlc11_attrValue_cp0 }, /* Same as WML 1.1 */
1818         { 0, NULL }
1819 };
1820
1821 static const wbxml_decoding decode_wmlc_12 = {
1822         "Wireless Markup Language 1.2",
1823         "WML 1.2",
1824         { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
1825         default_opaque_binary_tag,
1826         default_opaque_literal_tag,
1827         default_opaque_binary_attr,
1828         default_opaque_literal_attr,
1829         wbxml_wmlc12_global,
1830         wbxml_wmlc12_tags,
1831         wbxml_wmlc12_attrStart,
1832         wbxml_wmlc12_attrValue
1833 };
1834
1835
1836
1837
1838
1839 /* WML 1.3
1840  *
1841  * Wireless Markup Language
1842  ***************************************/
1843
1844 /*****   Global extension tokens   *****/
1845 /* Same as in WML 1.0 */
1846
1847 /*****         Tag tokens          *****/
1848 /* Same as in WML 1.2 */
1849
1850 /*****    Attribute Start tokens   *****/
1851 static const value_string wbxml_wmlc13_attrStart_cp0[] = {
1852         /* 0x00 -- 0x04 GLOBAL */
1853         { 0x05, "accept-charset=" },
1854         { 0x06, "align='bottom'" },
1855         { 0x07, "align='center'" },
1856         { 0x08, "align='left'" },
1857         { 0x09, "align='middle'" },
1858         { 0x0A, "align='right'" },
1859         { 0x0B, "align='top'" },
1860         { 0x0C, "alt=" },
1861         { 0x0D, "content=" },
1862         /* 0x0E */
1863         { 0x0F, "domain=" },
1864         { 0x10, "emptyok='false'" },
1865         { 0x11, "emptyok='true'" },
1866         { 0x12, "format=" },
1867         { 0x13, "height=" },
1868         { 0x14, "hspace=" },
1869         { 0x15, "ivalue=" },
1870         { 0x16, "iname=" },
1871         /* 0x17 */
1872         { 0x18, "label=" },
1873         { 0x19, "localsrc=" },
1874         { 0x1A, "maxlength=" },
1875         { 0x1B, "method='get'" },
1876         { 0x1C, "method='post'" },
1877         { 0x1D, "mode='nowrap'" },
1878         { 0x1E, "mode='wrap'" },
1879         { 0x1F, "multiple='false'" },
1880         { 0x20, "multiple='true'" },
1881         { 0x21, "name=" },
1882         { 0x22, "newcontext='false'" },
1883         { 0x23, "newcontext='true'" },
1884         { 0x24, "onpick=" },
1885         { 0x25, "onenterbackward=" },
1886         { 0x26, "onenterforward=" },
1887         { 0x27, "ontimer=" },
1888         { 0x28, "optional='false'" },
1889         { 0x29, "optional='true'" },
1890         { 0x2A, "path=" },
1891         /* 0x2B -- 0x2D */
1892         { 0x2E, "scheme=" },
1893         { 0x2F, "sendreferer='false'" },
1894         { 0x30, "sendreferer='true'" },
1895         { 0x31, "size=" },
1896         { 0x32, "src=" },
1897         { 0x33, "ordered='false'" },
1898         { 0x34, "ordered='true'" },
1899         { 0x35, "tabindex=" },
1900         { 0x36, "title=" },
1901         { 0x37, "type=" },
1902         { 0x38, "type='accept'" },
1903         { 0x39, "type='delete'" },
1904         { 0x3A, "type='help'" },
1905         { 0x3B, "type='password'" },
1906         { 0x3C, "type='onpick'" },
1907         { 0x3D, "type='onenterbackward'" },
1908         { 0x3E, "type='onenterforward'" },
1909         { 0x3F, "type='ontimer'" },
1910         /* 0x40 -- 0x44 GLOBAL */
1911         { 0x45, "type='options'" },
1912         { 0x46, "type='prev'" },
1913         { 0x47, "type='reset'" },
1914         { 0x48, "type='text'" },
1915         { 0x49, "type='vnd.'" },
1916         { 0x4A, "href=" },
1917         { 0x4B, "href='http://'" },
1918         { 0x4C, "href='https://'" },
1919         { 0x4D, "value=" },
1920         { 0x4E, "vspace=" },
1921         { 0x4F, "width=" },
1922         { 0x50, "xml:lang=" },
1923         /* 0x51 */
1924         { 0x52, "align=" },
1925         { 0x53, "columns=" },
1926         { 0x54, "class=" },
1927         { 0x55, "id=" },
1928         { 0x56, "forua='false'" },
1929         { 0x57, "forua='true'" },
1930         { 0x58, "src='http://'" },
1931         { 0x59, "src='https://'" },
1932         { 0x5A, "http-equiv=" },
1933         { 0x5B, "http-equiv='Content-Type'" },
1934         { 0x5C, "content='application/vnd.wap.wmlc;charset='" },
1935         { 0x5D, "http-equiv='Expires'" },
1936         { 0x5E, "accesskey=" },
1937         { 0x5F, "enctype=" },
1938         { 0x60, "enctype='application/x-www-form-urlencoded'" },
1939         { 0x61, "enctype='multipart/form-data'" },
1940         { 0x62, "xml:space='preserve'" },
1941         { 0x63, "xml:space='default'" },
1942         { 0x64, "cache-control='no-cache'" },
1943
1944         { 0x00, NULL }
1945 };
1946
1947 /*****    Attribute Value tokens   *****/
1948 /* Same as in WML 1.1 */
1949
1950 /***** Token code page aggregation *****/
1951 static const value_valuestring wbxml_wmlc13_global[] = {
1952         { 0, wbxml_wmlc10_global_cp0 }, /* Same as WML 1.0 */
1953         { 0, NULL }
1954 };
1955
1956 static const value_valuestring wbxml_wmlc13_tags[] = {
1957         { 0, wbxml_wmlc12_tags_cp0 },
1958         { 0, NULL }
1959 };
1960
1961 static const value_valuestring wbxml_wmlc13_attrStart[] = {
1962         { 0, wbxml_wmlc13_attrStart_cp0 },
1963         { 0, NULL }
1964 };
1965
1966 static const value_valuestring wbxml_wmlc13_attrValue[] = {
1967         { 0, wbxml_wmlc11_attrValue_cp0 }, /* Same as WML 1.1 */
1968         { 0, NULL }
1969 };
1970
1971 static const wbxml_decoding decode_wmlc_13 = {
1972         "Wireless Markup Language 1.3",
1973         "WML 1.3",
1974         { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
1975         default_opaque_binary_tag,
1976         default_opaque_literal_tag,
1977         default_opaque_binary_attr,
1978         default_opaque_literal_attr,
1979         wbxml_wmlc13_global,
1980         wbxml_wmlc13_tags,
1981         wbxml_wmlc13_attrStart,
1982         wbxml_wmlc13_attrValue
1983 };
1984
1985
1986
1987
1988
1989 /* SI 1.0
1990  *
1991  * Service Indication
1992  ***************************************/
1993
1994 /*****   Global extension tokens   *****/
1995
1996 /*****         Tag tokens          *****/
1997 static const value_string wbxml_sic10_tags_cp0[] = {
1998         /* 0x00 -- 0x04 GLOBAL */
1999         { 0x05, "si" },
2000         { 0x06, "indication" },
2001         { 0x07, "info" },
2002         { 0x08, "item" },
2003
2004         { 0x00, NULL }
2005 };
2006
2007 /*****    Attribute Start tokens   *****/
2008 static const value_string wbxml_sic10_attrStart_cp0[] = {
2009         /* 0x00 -- 0x04 GLOBAL */
2010         { 0x05, "action='signal-none'" },
2011         { 0x06, "action='signal-low'" },
2012         { 0x07, "action='signal-medium'" },
2013         { 0x08, "action='signal-high'" },
2014         { 0x09, "action='delete'" },
2015         { 0x0a, "created=" },
2016         { 0x0b, "href=" },
2017         { 0x0c, "href='http://'" },
2018         { 0x0d, "href='http://www.'" },
2019         { 0x0e, "href='https://'" },
2020         { 0x0f, "href='https://www.'" },
2021         { 0x10, "si-expires=" },
2022         { 0x11, "si-id=" },
2023         { 0x12, "class=" },
2024
2025         { 0x00, NULL }
2026 };
2027
2028 /*****    Attribute Value tokens   *****/
2029 static const value_string wbxml_sic10_attrValue_cp0[] = {
2030         /* 0x80 -- 0x84 GLOBAL */
2031         { 0x85, "'.com/'" },
2032         { 0x86, "'.edu/'" },
2033         { 0x87, "'.net/'" },
2034         { 0x88, "'.org/'" },
2035
2036         { 0x00, NULL }
2037 };
2038
2039 /***** Token code page aggregation *****/
2040 static const value_valuestring wbxml_sic10_tags[] = {
2041         { 0, wbxml_sic10_tags_cp0 },
2042         { 0, NULL }
2043 };
2044
2045 static const value_valuestring wbxml_sic10_attrStart[] = {
2046         { 0, wbxml_sic10_attrStart_cp0 },
2047         { 0, NULL }
2048 };
2049
2050 static const value_valuestring wbxml_sic10_attrValue[] = {
2051         { 0, wbxml_sic10_attrValue_cp0 },
2052         { 0, NULL }
2053 };
2054
2055 static const wbxml_decoding decode_sic_10 = {
2056         "Service Indication 1.0",
2057         "SI 1.0",
2058         { NULL, NULL, NULL },
2059         default_opaque_binary_tag,
2060         default_opaque_literal_tag,
2061         sic10_opaque_binary_attr,
2062         sic10_opaque_literal_attr,
2063         NULL,
2064         wbxml_sic10_tags,
2065         wbxml_sic10_attrStart,
2066         wbxml_sic10_attrValue
2067 };
2068
2069
2070
2071
2072
2073 /* SL 1.0
2074  *
2075  * Service Loading
2076  ***************************************/
2077
2078 /*****   Global extension tokens   *****/
2079
2080 /*****         Tag tokens          *****/
2081 static const value_string wbxml_slc10_tags_cp0[] = {
2082         /* 0x00 -- 0x04 GLOBAL */
2083         { 0x05, "sl" },
2084
2085         { 0x00, NULL }
2086 };
2087
2088 /*****    Attribute Start tokens   *****/
2089 static const value_string wbxml_slc10_attrStart_cp0[] = {
2090         /* 0x00 -- 0x04 GLOBAL */
2091         { 0x05, "action='execute-low'" },
2092         { 0x06, "action='execute-high'" },
2093         { 0x07, "action='cache'" },
2094         { 0x08, "href=" },
2095         { 0x09, "href='http://'" },
2096         { 0x0a, "href='http://www.'" },
2097         { 0x0b, "href='https://'" },
2098         { 0x0c, "href='https://www.'" },
2099
2100         { 0x00, NULL }
2101 };
2102
2103 /*****    Attribute Value tokens   *****/
2104 /* Same as in SI 1.0 */
2105
2106 /***** Token code page aggregation *****/
2107 static const value_valuestring wbxml_slc10_tags[] = {
2108         { 0, wbxml_slc10_tags_cp0 },
2109         { 0, NULL }
2110 };
2111
2112 static const value_valuestring wbxml_slc10_attrStart[] = {
2113         { 0, wbxml_slc10_attrStart_cp0 },
2114         { 0, NULL }
2115 };
2116
2117 static const value_valuestring wbxml_slc10_attrValue[] = {
2118         { 0, wbxml_sic10_attrValue_cp0 }, /* Same as SI 1.0 */
2119         { 0, NULL }
2120 };
2121
2122 static const wbxml_decoding decode_slc_10 = {
2123         "Service Loading 1.0",
2124         "SL 1.0",
2125         { NULL, NULL, NULL },
2126         default_opaque_binary_tag,
2127         default_opaque_literal_tag,
2128         default_opaque_binary_attr,
2129         default_opaque_literal_attr,
2130         NULL,
2131         wbxml_slc10_tags,
2132         wbxml_slc10_attrStart,
2133         wbxml_slc10_attrValue
2134 };
2135
2136
2137
2138
2139
2140 /* CO 1.0
2141  *
2142  * Cache Operation
2143  ***************************************/
2144
2145 /*****   Global extension tokens   *****/
2146
2147 /*****         Tag tokens          *****/
2148 static const value_string wbxml_coc10_tags_cp0[] = {
2149         /* 0x00 -- 0x04 GLOBAL */
2150         { 0x05, "co" },
2151         { 0x06, "invalidate-object" },
2152         { 0x07, "invalidate-service" },
2153
2154         { 0x00, NULL }
2155 };
2156
2157 /*****    Attribute Start tokens   *****/
2158 static const value_string wbxml_coc10_attrStart_cp0[] = {
2159         /* 0x00 -- 0x04 GLOBAL */
2160         { 0x05, "uri=" },
2161         { 0x06, "uri='http://'" },
2162         { 0x07, "uri='http://www.'" },
2163         { 0x08, "uri='https://'" },
2164         { 0x09, "uri='https://www.'" },
2165
2166         { 0x00, NULL }
2167 };
2168
2169 /*****    Attribute Value tokens   *****/
2170 /* Same as in SI 1.0 */
2171
2172 /***** Token code page aggregation *****/
2173 static const value_valuestring wbxml_coc10_tags[] = {
2174         { 0, wbxml_coc10_tags_cp0 },
2175         { 0, NULL }
2176 };
2177
2178 static const value_valuestring wbxml_coc10_attrStart[] = {
2179         { 0, wbxml_coc10_attrStart_cp0 },
2180         { 0, NULL }
2181 };
2182
2183 static const value_valuestring wbxml_coc10_attrValue[] = {
2184         { 0, wbxml_sic10_attrValue_cp0 }, /* Same as SI 1.0 */
2185         { 0, NULL }
2186 };
2187
2188 static const wbxml_decoding decode_coc_10 = {
2189         "Cache Operation 1.0",
2190         "CO 1.0",
2191         { NULL, NULL, NULL },
2192         default_opaque_binary_tag,
2193         default_opaque_literal_tag,
2194         default_opaque_binary_attr,
2195         default_opaque_literal_attr,
2196         NULL,
2197         wbxml_coc10_tags,
2198         wbxml_coc10_attrStart,
2199         wbxml_coc10_attrValue
2200 };
2201
2202
2203
2204
2205
2206 /* PROV 1.0
2207  *
2208  * Client Provisioning
2209  ***************************************/
2210
2211 /*****   Global extension tokens   *****/
2212
2213 /*****         Tag tokens          *****/
2214 static const value_string wbxml_provc10_tags_cp0[] = {
2215         /* 0x00 -- 0x04 GLOBAL */
2216         { 0x05, "wap-provisioningdoc" },
2217         { 0x06, "characteristic" },
2218         { 0x07, "parm" },
2219
2220         { 0x00, NULL }
2221 };
2222 static const value_string wbxml_provc10_tags_cp1[] = {
2223         /* 0x00 -- 0x04 GLOBAL */
2224         /* 0x05 */
2225         { 0x06, "characteristic" },
2226         { 0x07, "parm" },
2227
2228         { 0x00, NULL }
2229 };
2230
2231 /*****    Attribute Start tokens   *****/
2232 static const value_string wbxml_provc10_attrStart_cp0[] = {
2233         /* 0x00 -- 0x04 GLOBAL */
2234         { 0x05, "name=" },
2235         { 0x06, "value=" },
2236         { 0x07, "name='NAME'" },
2237         { 0x08, "name='NAP-ADDRESS'" },
2238         { 0x09, "name='NAP-ADDRTYPE'" },
2239         { 0x0A, "name='CALLTYPE'" },
2240         { 0x0B, "name='VALIDUNTIL'" },
2241         { 0x0C, "name='AUTHTYPE'" },
2242         { 0x0D, "name='AUTHNAME'" },
2243         { 0x0E, "name='AUTHSECRET'" },
2244         { 0x0F, "name='LINGER'" },
2245         { 0x10, "name='BEARER'" },
2246         { 0x11, "name='NAPID'" },
2247         { 0x12, "name='COUNTRY'" },
2248         { 0x13, "name='NETWORK'" },
2249         { 0x14, "name='INTERNET'" },
2250         { 0x15, "name='PROXY-ID'" },
2251         { 0x16, "name='PROXY-PROVIDER-ID'" },
2252         { 0x17, "name='DOMAIN'" },
2253         { 0x18, "name='PROVURL'" },
2254         { 0x19, "name='PXAUTH-TYPE'" },
2255         { 0x1A, "name='PXAUTH-ID'" },
2256         { 0x1B, "name='PXAUTH-PW'" },
2257         { 0x1C, "name='STARTPAGE'" },
2258         { 0x1D, "name='BASAUTH-ID'" },
2259         { 0x1E, "name='BASAUTH-PW'" },
2260         { 0x1F, "name='PUSHENABLED'" },
2261         { 0x20, "name='PXADDR'" },
2262         { 0x21, "name='PXADDRTYPE'" },
2263         { 0x22, "name='TO-NAPID'" },
2264         { 0x23, "name='PORTNBR'" },
2265         { 0x24, "name='SERVICE'" },
2266         { 0x25, "name='LINKSPEED'" },
2267         { 0x26, "name='DNLINKSPEED'" },
2268         { 0x27, "name='LOCAL-ADDR'" },
2269         { 0x28, "name='LOCAL-ADDRTYPE'" },
2270         { 0x29, "name='CONTEXT-ALLOW'" },
2271         { 0x2A, "name='TRUST'" },
2272         { 0x2B, "name='MASTER'" },
2273         { 0x2C, "name='SID'" },
2274         { 0x2D, "name='SOC'" },
2275         { 0x2E, "name='WSP-VERSION'" },
2276         { 0x2F, "name='PHYSICAL-PROXY-ID'" },
2277         { 0x30, "name='CLIENT-ID'" },
2278         { 0x31, "name='DELIVERY-ERR-SDU'" },
2279         { 0x32, "name='DELIVERY-ORDER'" },
2280         { 0x33, "name='TRAFFIC-CLASS'" },
2281         { 0x34, "name='MAX-SDU-SIZE'" },
2282         { 0x35, "name='MAX-BITRATE-UPLINK'" },
2283         { 0x36, "name='MAX-BITRATE-DNLINK'" },
2284         { 0x37, "name='RESIDUAL-BER'" },
2285         { 0x38, "name='SDU-ERROR-RATIO'" },
2286         { 0x39, "name='TRAFFIC-HANDL-PRIO'" },
2287         { 0x3A, "name='TRANSFER-DELAY'" },
2288         { 0x3B, "name='GUARANTEED-BITRATE-UPLINK'" },
2289         { 0x3C, "name='GUARANTEED-BITRATE-DNLINK'" },
2290         { 0x3D, "name='PXADDR-FQDN'" },
2291         { 0x3E, "name='PROXY-PW'" },
2292         { 0x3F, "name='PPGAUTH-TYPE'" },
2293         /* 0x40 -- 0x44 GLOBAL */
2294         { 0x45, "version=" },
2295         { 0x46, "version='1.0'" },
2296         { 0x47, "name='PULLENABLED'" },
2297         { 0x48, "name='DNS-ADDR'" },
2298         { 0x49, "name='MAX-NUM-RETRY'" },
2299         { 0x4A, "name='FIRST-RETRY-TIMEOUT'" },
2300         { 0x4B, "name='REREG-THRESHOLD'" },
2301         { 0x4C, "name='T-BIT'" },
2302         /* 0x4D */
2303         { 0x4E, "name='AUTH-ENTITY'" },
2304         { 0x4F, "name='SPI'" },
2305         { 0x50, "type=" },
2306         { 0x51, "type='PXLOGICAL'" },
2307         { 0x52, "type='PXPHYSICAL'" },
2308         { 0x53, "type='PORT'" },
2309         { 0x54, "type='VALIDITY'" },
2310         { 0x55, "type='NAPDEF'" },
2311         { 0x56, "type='BOOTSTRAP'" },
2312         { 0x57, "type='VENDORCONFIG'" },
2313         { 0x58, "type='CLIENTIDENTITY'" },
2314         { 0x59, "type='PXAUTHINFO'" },
2315         { 0x5A, "type='NAPAUTHINFO'" },
2316         { 0x5B, "type='ACCESS'" },
2317
2318         { 0x00, NULL }
2319 };
2320 static const value_string wbxml_provc10_attrStart_cp1[] = {
2321         /* 0x00 -- 0x04 GLOBAL */
2322         /* 0x05 -- 0x06 */
2323         { 0x07, "name='NAME'" },
2324         /* 0x08 -- 0x13 */
2325         { 0x14, "name='INTERNET'" },
2326         /* 0x15 -- 0x1B */
2327         { 0x1C, "name='STARTPAGE'" },
2328         /* 0x1D -- 0x21 */
2329         { 0x22, "name='TO-NAPID'" },
2330         { 0x23, "name='PORTNBR'" },
2331         { 0x24, "name='SERVICE'" },
2332         /* 0x25 -- 0x2D */
2333         { 0x2E, "name='AACCEPT'" },
2334         { 0x2F, "name='AAUTHDATA'" },
2335         { 0x30, "name='AAUTHLEVEL'" },
2336         { 0x31, "name='AAUTHNAME'" },
2337         { 0x32, "name='AAUTHSECRET'" },
2338         { 0x33, "name='AAUTHTYPE'" },
2339         { 0x34, "name='ADDR'" },
2340         { 0x35, "name='ADDRTYPE'" },
2341         { 0x36, "name='APPID'" },
2342         { 0x37, "name='APROTOCOL'" },
2343         { 0x38, "name='PROVIDER-ID'" },
2344         { 0x39, "name='TO-PROXY'" },
2345         { 0x3A, "name='URI'" },
2346         { 0x3B, "name='RULE'" },
2347         /* 0x3C -- 0x3F */
2348         /* 0x40 -- 0x44 GLOBAL */
2349         /* 0x45 -- 0x4F */
2350         { 0x50, "type=" },
2351         /* 0x51 -- 0x52 */
2352         { 0x53, "type='PORT'" },
2353         /* 0x54 */
2354         { 0x55, "type='APPLICATION'" },
2355         { 0x56, "type='APPADDR'" },
2356         { 0x57, "type='APPAUTH'" },
2357         { 0x58, "type='CLIENTIDENTITY'" },
2358         { 0x59, "type='RESOURCE'" },
2359         /* 0x5A -- 0x7F */
2360
2361         { 0x00, NULL }
2362 };
2363
2364 /*****    Attribute Start tokens   *****/
2365 static const value_string wbxml_provc10_attrValue_cp0[] = {
2366         /* 0x80 -- 0x84 GLOBAL */
2367         { 0x85, "'IPV4'" },
2368         { 0x86, "'IPV6'" },
2369         { 0x87, "'E164'" },
2370         { 0x88, "'ALPHA'" },
2371         { 0x89, "'APN'" },
2372         { 0x8A, "'SCODE'" },
2373         { 0x8B, "'TETRA-ITSI'" },
2374         { 0x8C, "'MAN'" },
2375         /* 0x8D -- 0x8F */
2376         { 0x90, "'ANALOG-MODEM'" },
2377         { 0x91, "'V.120'" },
2378         { 0x92, "'V.110'" },
2379         { 0x93, "'X.31'" },
2380         { 0x94, "'BIT-TRANSPARENT'" },
2381         { 0x95, "'DIRECT-ASYNCHRONOUS-DATA-SERVICE'" },
2382         /* 0x96 -- 0x99 */
2383         { 0x9A, "'PAP'" },
2384         { 0x9B, "'CHAP'" },
2385         { 0x9C, "'HTTP-BASIC'" },
2386         { 0x9D, "'HTTP-DIGEST'" },
2387         { 0x9E, "'WTLS-SS'" },
2388         { 0x9F, "'MD5'" },
2389         /* 0xA0 -- 0xA1 */
2390         { 0xA2, "'GSM-USSD'" },
2391         { 0xA3, "'GSM-SMS'" },
2392         { 0xA4, "'ANSI-136-GUTS'" },
2393         { 0xA5, "'IS-95-CDMA-SMS'" },
2394         { 0xA6, "'IS-95-CDMA-CSD'" },
2395         { 0xA7, "'IS-95-CDMA-PACKET'" },
2396         { 0xA8, "'ANSI-136-CSD'" },
2397         { 0xA9, "'ANSI-136-GPRS'" },
2398         { 0xAA, "'GSM-CSD'" },
2399         { 0xAB, "'GSM-GPRS'" },
2400         { 0xAC, "'AMPS-CDPD'" },
2401         { 0xAD, "'PDC-CSD'" },
2402         { 0xAE, "'PDC-PACKET'" },
2403         { 0xAF, "'IDEN-SMS'" },
2404         { 0xB0, "'IDEN-CSD'" },
2405         { 0xB1, "'IDEN-PACKET'" },
2406         { 0xB2, "'FLEX/REFLEX'" },
2407         { 0xB3, "'PHS-SMS'" },
2408         { 0xB4, "'PHS-CSD'" },
2409         { 0xB5, "'TETRA-SDS'" },
2410         { 0xB6, "'TETRA-PACKET'" },
2411         { 0xB7, "'ANSI-136-GHOST'" },
2412         { 0xB8, "'MOBITEX-MPAK'" },
2413         { 0xB9, "'CDMA2000-IX-SIMPLE-IP'" },
2414         { 0xBA, "'CDMA2000-IX-MOBILE-IP'" },
2415         /* 0xBB -- 0xBF */
2416         /* 0xC0 -- 0xC4 GLOBAL */
2417         { 0xC5, "'AUTOBAUDING'" },
2418         /* 0xC6 -- 0xC9 */
2419         { 0xCA, "'CL-WSP'" },
2420         { 0xCB, "'CO-WSP'" },
2421         { 0xCC, "'CL-SEC-WSP'" },
2422         { 0xCD, "'CO-SEC-WSP'" },
2423         { 0xCE, "'CL-SEC-WTA'" },
2424         { 0xCF, "'CO-SEC-WTA'" },
2425         { 0xD0, "'OTA-HTTP-TO'" },
2426         { 0xD1, "'OTA-HTTP-TLS-TO'" },
2427         { 0xD2, "'OTA-HTTP-PO'" },
2428         { 0xD3, "'OTA-HTTP-TLS-PO'" },
2429         /* 0xD4 -- 0xFF */
2430
2431         { 0x00, NULL }
2432 };
2433 static const value_string wbxml_provc10_attrValue_cp1[] = {
2434         /* 0x80 -- 0x84 GLOBAL */
2435         /* 0x85 */
2436         { 0x86, "'IPV6'" },
2437         { 0x87, "'E164'" },
2438         { 0x88, "'ALPHA'" },
2439         { 0x8D, "'APPSRV'" },
2440         { 0x8E, "'OBEX'" },
2441         /* 0x8F */
2442
2443         /* XXX - Errors that require a fix in the OMA/WAP Client Provisioning specs:
2444            { 0xXXX, "','" },
2445            { 0xXXX, "'HTTP-'" },
2446            { 0xXXX, "'BASIC'" },
2447            { 0xXXX, "'DIGEST'" },
2448         */
2449
2450         { 0xE0, "'AAA'" },
2451         { 0xE1, "'HA'" },
2452
2453         { 0x00, NULL }
2454 };
2455
2456 /***** Token code page aggregation *****/
2457 static const value_valuestring wbxml_provc10_tags[] = {
2458         { 0, wbxml_provc10_tags_cp0 },
2459         { 1, wbxml_provc10_tags_cp1 },
2460         { 0, NULL }
2461 };
2462
2463 static const value_valuestring wbxml_provc10_attrStart[] = {
2464         { 0, wbxml_provc10_attrStart_cp0 },
2465         { 1, wbxml_provc10_attrStart_cp1 },
2466         { 0, NULL }
2467 };
2468
2469 static const value_valuestring wbxml_provc10_attrValue[] = {
2470         { 0, wbxml_provc10_attrValue_cp0 },
2471         { 1, wbxml_provc10_attrValue_cp1 },
2472         { 0, NULL }
2473 };
2474
2475 static const wbxml_decoding decode_provc_10 = {
2476         "WAP Client Provisioning Document 1.0",
2477         "WAP ProvisioningDoc 1.0",
2478         { NULL, NULL, NULL },
2479         default_opaque_binary_tag,
2480         default_opaque_literal_tag,
2481         default_opaque_binary_attr,
2482         default_opaque_literal_attr,
2483         NULL,
2484         wbxml_provc10_tags,
2485         wbxml_provc10_attrStart,
2486         wbxml_provc10_attrValue
2487 };
2488
2489
2490
2491
2492
2493 /* EMN 1.0
2494  *
2495  * Email Notification
2496  ***************************************/
2497
2498 /*****   Global extension tokens   *****/
2499
2500 /*****         Tag tokens          *****/
2501 static const value_string wbxml_emnc10_tags_cp0[] = {
2502         /* 0x00 -- 0x04 GLOBAL */
2503         { 0x05, "emn" },
2504
2505         { 0x00, NULL }
2506 };
2507
2508 /*****    Attribute Start tokens   *****/
2509 static const value_string wbxml_emnc10_attrStart_cp0[] = {
2510         /* 0x00 -- 0x04 GLOBAL */
2511         { 0x05, "timestamp=" },
2512         { 0x06, "mailbox=" },
2513         { 0x07, "mailbox='mailat:'" },
2514         { 0x08, "mailbox='pop://'" },
2515         { 0x09, "mailbox='imap://'" },
2516         { 0x0a, "mailbox='http://'" },
2517         { 0x0b, "mailbox='http://www.'" },
2518         { 0x0c, "mailbox='https://'" },
2519         { 0x0D, "mailbox='https://www.'" },
2520
2521         { 0x00, NULL }
2522 };
2523
2524 /*****    Attribute Value tokens   *****/
2525 /* Same as in SI 1.0 */
2526
2527 /***** Token code page aggregation *****/
2528 static const value_valuestring wbxml_emnc10_tags[] = {
2529         { 0, wbxml_emnc10_tags_cp0 },
2530         { 0, NULL }
2531 };
2532
2533 static const value_valuestring wbxml_emnc10_attrStart[] = {
2534         { 0, wbxml_emnc10_attrStart_cp0 },
2535         { 0, NULL }
2536 };
2537
2538 static const value_valuestring wbxml_emnc10_attrValue[] = {
2539         { 0, wbxml_sic10_attrValue_cp0 }, /* Same as SI 1.0 */
2540         { 0, NULL }
2541 };
2542
2543 static const wbxml_decoding decode_emnc_10 = {
2544         "E-Mail Notification 1.0",
2545         "EMN 1.0",
2546         { NULL, NULL, NULL },
2547         default_opaque_binary_tag,
2548         default_opaque_literal_tag,
2549         emnc10_opaque_binary_attr,
2550         emnc10_opaque_literal_attr,
2551         NULL,
2552         wbxml_emnc10_tags,
2553         wbxml_emnc10_attrStart,
2554         wbxml_emnc10_attrValue
2555 };
2556
2557
2558
2559
2560
2561 /* SyncML 1.0
2562  *
2563  * SyncML Representation Protocol
2564  ***************************************/
2565
2566 /*****   Global extension tokens   *****/
2567
2568 /*****         Tag tokens          *****/
2569 static const value_string wbxml_syncmlc10_tags_cp0[] = { /* SyncML 1.0 */
2570         /* 0x00 -- 0x04 GLOBAL */
2571         { 0x05, "Add" },
2572         { 0x06, "Alert" },
2573         { 0x07, "Archive" },
2574         { 0x08, "Atomic" },
2575         { 0x09, "Chal" },
2576         { 0x0A, "Cmd" },
2577         { 0x0B, "CmdID" },
2578         { 0x0C, "CmdRef" },
2579         { 0x0D, "Copy" },
2580         { 0x0E, "Cred" },
2581         { 0x0F, "Data" },
2582         { 0x10, "Delete" },
2583         { 0x11, "Exec" },
2584         { 0x12, "Final" },
2585         { 0x13, "Get" },
2586         { 0x14, "Item" },
2587         { 0x15, "Lang" },
2588         { 0x16, "LocName" },
2589         { 0x17, "LocURI" },
2590         { 0x18, "Map" },
2591         { 0x19, "MapItem" },
2592         { 0x1A, "Meta" },
2593         { 0x1B, "MsgID" },
2594         { 0x1C, "MsgRef" },
2595         { 0x1D, "NoResp" },
2596         { 0x1E, "NoResults" },
2597         { 0x1F, "Put" },
2598         { 0x20, "Replace" },
2599         { 0x21, "RespURI" },
2600         { 0x22, "Results" },
2601         { 0x23, "Search" },
2602         { 0x24, "Sequence" },
2603         { 0x25, "SessionID" },
2604         { 0x26, "SftDel" },
2605         { 0x27, "Source" },
2606         { 0x28, "SourceRef" },
2607         { 0x29, "Status" },
2608         { 0x2A, "Sync" },
2609         { 0x2B, "SyncBody" },
2610         { 0x2C, "SyncHdr" },
2611         { 0x2D, "SyncML" },
2612         { 0x2E, "Target" },
2613         { 0x2F, "TargetRef" },
2614         /* 0x30 - Reserved */
2615         { 0x31, "VerDTD" },
2616         { 0x32, "VerProto" },
2617
2618         { 0x00, NULL }
2619 };
2620
2621 static const value_string wbxml_syncmlc10_tags_cp1[] = { /* MetInf 1.0 */
2622         /* 0x00 -- 0x04 GLOBAL */
2623         { 0x05, "Anchor" },
2624         { 0x06, "EMI" },
2625         { 0x07, "Format" },
2626         { 0x08, "FreeID" },
2627         { 0x09, "FreeMem" },
2628         { 0x0A, "Last" },
2629         { 0x0B, "Mark" },
2630         { 0x0C, "MaxMsgSize" },
2631         { 0x0D, "Mem" },
2632         { 0x0E, "MetInf" },
2633         { 0x0F, "Next" },
2634         { 0x10, "NextNonce" },
2635         { 0x11, "SharedMem" },
2636         { 0x12, "Size" },
2637         { 0x13, "Type" },
2638         { 0x14, "Version" },
2639
2640         { 0x00, NULL }
2641 };
2642
2643 /*****    Attribute Start tokens   *****/
2644
2645 /*****    Attribute Value tokens   *****/
2646
2647 /***** Token code page aggregation *****/
2648 static const value_valuestring wbxml_syncmlc10_tags[] = {
2649         { 0, wbxml_syncmlc10_tags_cp0 }, /* -//SYNCML//DTD SyncML 1.0//EN */
2650         { 1, wbxml_syncmlc10_tags_cp1 }, /* -//SYNCML//DTD MetInf 1.0//EN */
2651         { 0, NULL }
2652 };
2653
2654 static const wbxml_decoding decode_syncmlc_10 = {
2655         "SyncML Representation Protocol 1.0",
2656         "SyncML 1.0",
2657         { NULL, NULL, NULL },
2658         default_opaque_binary_tag,
2659         default_opaque_literal_tag,
2660         default_opaque_binary_attr,
2661         default_opaque_literal_attr,
2662         NULL,
2663         wbxml_syncmlc10_tags,
2664         NULL,
2665         NULL
2666 };
2667
2668
2669
2670
2671
2672 /* SyncML 1.1
2673  *
2674  * SyncML Representation Protocol
2675  ***************************************/
2676
2677 /*****   Global extension tokens   *****/
2678
2679 /*****         Tag tokens          *****/
2680 static const value_string wbxml_syncmlc11_tags_cp0[] = { /* SyncML 1.1 */
2681         /* 0x00 -- 0x04 GLOBAL */
2682         { 0x05, "Add" },
2683         { 0x06, "Alert" },
2684         { 0x07, "Archive" },
2685         { 0x08, "Atomic" },
2686         { 0x09, "Chal" },
2687         { 0x0a, "Cmd" },
2688         { 0x0b, "CmdID" },
2689         { 0x0c, "CmdRef" },
2690         { 0x0d, "Copy" },
2691         { 0x0e, "Cred" },
2692         { 0x0f, "Data" },
2693         { 0x10, "Delete" },
2694         { 0x11, "Exec" },
2695         { 0x12, "Final" },
2696         { 0x13, "Get" },
2697         { 0x14, "Item" },
2698         { 0x15, "Lang" },
2699         { 0x16, "LocName" },
2700         { 0x17, "LocURI" },
2701         { 0x18, "Map" },
2702         { 0x19, "MapItem" },
2703         { 0x1a, "Meta" },
2704         { 0x1b, "MsgID" },
2705         { 0x1c, "MsgRef" },
2706         { 0x1d, "NoResp" },
2707         { 0x1e, "NoResults" },
2708         { 0x1f, "Put" },
2709         { 0x20, "Replace" },
2710         { 0x21, "RespURI" },
2711         { 0x22, "Results" },
2712         { 0x23, "Search" },
2713         { 0x24, "Sequence" },
2714         { 0x25, "SessionID" },
2715         { 0x26, "SftDel" },
2716         { 0x27, "Source" },
2717         { 0x28, "SourceRef" },
2718         { 0x29, "Status" },
2719         { 0x2a, "Sync" },
2720         { 0x2b, "SyncBody" },
2721         { 0x2c, "SyncHdr" },
2722         { 0x2d, "SyncML" },
2723         { 0x2e, "Target" },
2724         { 0x2f, "TargetRef" },
2725         /* 0x30 - Reserved */
2726         { 0x31, "VerDTD" },
2727         { 0x32, "VerProto" },
2728         { 0x33, "NumberOfChanges" },
2729         { 0x34, "MoreData" },
2730
2731         { 0x00, NULL }
2732 };
2733
2734 static const value_string wbxml_syncmlc11_tags_cp1[] = { /* MetInf 1.1 */
2735         /* 0x00 -- 0x04 GLOBAL */
2736         { 0x05, "Anchor" },
2737         { 0x06, "EMI" },
2738         { 0x07, "Format" },
2739         { 0x08, "FreeID" },
2740         { 0x09, "FreeMem" },
2741         { 0x0A, "Last" },
2742         { 0x0B, "Mark" },
2743         { 0x0C, "MaxMsgSize" },
2744         { 0x0D, "Mem" },
2745         { 0x0E, "MetInf" },
2746         { 0x0F, "Next" },
2747         { 0x10, "NextNonce" },
2748         { 0x11, "SharedMem" },
2749         { 0x12, "Size" },
2750         { 0x13, "Type" },
2751         { 0x14, "Version" },
2752         { 0x15, "MaxObjSize" },
2753
2754         { 0x00, NULL }
2755 };
2756
2757 /*****    Attribute Start tokens   *****/
2758
2759 /*****    Attribute Value tokens   *****/
2760
2761 /***** Token code page aggregation *****/
2762 static const value_valuestring wbxml_syncmlc11_tags[] = {
2763         { 0, wbxml_syncmlc11_tags_cp0 }, /* -//SYNCML//DTD SyncML 1.1//EN */
2764         { 1, wbxml_syncmlc11_tags_cp1 }, /* -//SYNCML//DTD MetInf 1.1//EN */
2765         { 0, NULL }
2766 };
2767
2768 static const wbxml_decoding decode_syncmlc_11 = {
2769         "SyncML Representation Protocol 1.1",
2770         "SyncML 1.1",
2771         { NULL, NULL, NULL },
2772         default_opaque_binary_tag,
2773         default_opaque_literal_tag,
2774         default_opaque_binary_attr,
2775         default_opaque_literal_attr,
2776         NULL,
2777         wbxml_syncmlc11_tags,
2778         NULL,
2779         NULL
2780 };
2781
2782
2783
2784
2785
2786 /* CHANNEL 1.0
2787  *
2788  * WTA Channel
2789  ***************************************/
2790
2791 /*****   Global extension tokens   *****/
2792
2793 /*****         Tag tokens          *****/
2794 static const value_string wbxml_channelc10_tags_cp0[] = {
2795         /* 0x00 -- 0x04 GLOBAL */
2796         { 0x05, "channel" },
2797         { 0x06, "title" },
2798         { 0x07, "abstract" },
2799         { 0x08, "resource" },
2800
2801         { 0x00, NULL }
2802 };
2803
2804 /*****    Attribute Start tokens   *****/
2805 static const value_string wbxml_channelc10_attrStart_cp0[] = {
2806         /* 0x00 -- 0x04 GLOBAL */
2807         { 0x05, "maxspace=" },
2808         { 0x06, "base=" },
2809         { 0x07, "href=" },
2810         { 0x08, "href='http://'" },
2811         { 0x09, "href='https://'" },
2812         { 0x0A, "lastmod=" },
2813         { 0x0B, "etag=" },
2814         { 0x0C, "md5=" },
2815         { 0x0D, "success=" },
2816         { 0x0E, "success='http://'" },
2817         { 0x0F, "success='https://'" },
2818         { 0x10, "failure=" },
2819         { 0x11, "failure='http://'" },
2820         { 0x12, "failure='https://'" },
2821         { 0x13, "EventId=" },
2822
2823         { 0x00, NULL }
2824 };
2825
2826 /*****    Attribute Value tokens   *****/
2827
2828 /***** Token code page aggregation *****/
2829 static const value_valuestring wbxml_channelc10_tags[] = {
2830         { 0, wbxml_channelc10_tags_cp0 },
2831         { 0, NULL }
2832 };
2833
2834 static const value_valuestring wbxml_channelc10_attrStart[] = {
2835         { 0, wbxml_channelc10_attrStart_cp0 },
2836         { 0, NULL }
2837 };
2838
2839 static const wbxml_decoding decode_channelc_10 = {
2840         "Wireless Telephony Application (WTA) Channel 1.0",
2841         "CHANNEL 1.0",
2842         { NULL, NULL, NULL },
2843         default_opaque_binary_tag,
2844         default_opaque_literal_tag,
2845         default_opaque_binary_attr,
2846         default_opaque_literal_attr,
2847         NULL,
2848         wbxml_channelc10_tags,
2849         wbxml_channelc10_attrStart,
2850         NULL
2851 };
2852
2853
2854
2855
2856
2857 /* application/x-wap-prov.browser-settings
2858  * application/x-wap-prov.browser-bookmarks
2859  *
2860  * Nokia OTA Provisioning document format
2861  ***************************************/
2862
2863 /*****   Global extension tokens   *****/
2864
2865 /*****         Tag tokens          *****/
2866 static const value_string wbxml_nokiaprovc70_tags_cp0[] = {
2867         /* 0x00 -- 0x04 GLOBAL */
2868         { 0x05, "CHARACTERISTIC-LIST" },
2869         { 0x06, "CHARACTERISTIC" },
2870         { 0x07, "PARM" },
2871
2872         { 0x00, NULL }
2873 };
2874
2875 /*****    Attribute Start tokens   *****/
2876 static const value_string wbxml_nokiaprovc70_attrStart_cp0[] = {
2877         /* 0x00 -- 0x04 GLOBAL */
2878         { 0x06, "TYPE='ADDRESS'" },
2879         { 0x07, "TYPE='URL'" },
2880         { 0x08, "TYPE='NAME'" },
2881         { 0x10, "NAME=" },
2882         { 0x11, "VALUE=" },
2883         { 0x12, "NAME='BEARER'" },
2884         { 0x13, "NAME='PROXY'" },
2885         { 0x14, "NAME='PORT'" },
2886         { 0x15, "NAME='NAME'" },
2887         { 0x16, "NAME='PROXY_TYPE'" },
2888         { 0x17, "NAME='URL'" },
2889         { 0x18, "NAME='PROXY_AUTHNAME'" },
2890         { 0x19, "NAME='PROXY_AUTHSECRET'" },
2891         { 0x1A, "NAME='SMS_SMSC_ADDRESS'" },
2892         { 0x1B, "NAME='USSD_SERVICE_CODE'" },
2893         { 0x1C, "NAME='GPRS_ACCESSPOINTNAME'" },
2894         { 0x1D, "NAME='PPP_LOGINTYPE'" },
2895         { 0x1E, "NAME='PROXY_LOGINTYPE'" },
2896         { 0x21, "NAME='CSD_DIALSTRING'" },
2897         { 0x22, "NAME='PPP_AUTHTYPE'" },
2898         { 0x23, "NAME='PPP_AUTHNAME'" },
2899         { 0x24, "NAME='PPP_AUTHSECRET'" },
2900         { 0x28, "NAME='CSD_CALLTYPE'" },
2901         { 0x29, "NAME='CSD_CALLSPEED'" },
2902         { 0x45, "VALUE='GSM/CSD'" },
2903         { 0x46, "VALUE='GSM/SMS'" },
2904         { 0x47, "VALUE='GSM/USSD'" },
2905         { 0x48, "VALUE='IS-136/CSD'" },
2906         { 0x49, "VALUE='GPRS'" },
2907         { 0x60, "VALUE='9200'" },
2908         { 0x61, "VALUE='9201'" },
2909         { 0x62, "VALUE='9202'" },
2910         { 0x63, "VALUE='9203'" },
2911         { 0x64, "VALUE='AUTOMATIC'" },
2912         { 0x65, "VALUE='MANUAL'" },
2913         { 0x6A, "VALUE='AUTO'" },
2914         { 0x6B, "VALUE='9600'" },
2915         { 0x6C, "VALUE='14400'" },
2916         { 0x6D, "VALUE='19200'" },
2917         { 0x6E, "VALUE='28800'" },
2918         { 0x6F, "VALUE='38400'" },
2919         { 0x70, "VALUE='PAP'" },
2920         { 0x71, "VALUE='CHAP'" },
2921         { 0x72, "VALUE='ANALOGUE'" },
2922         { 0x73, "VALUE='ISDN'" },
2923         { 0x74, "VALUE='43200'" },
2924         { 0x75, "VALUE='57600'" },
2925         { 0x76, "VALUE='MSISDN_NO'" },
2926         { 0x77, "VALUE='IPV4'" },
2927         { 0x78, "VALUE='MS_CHAP'" },
2928         { 0x7C, "TYPE='MMSURL'" },
2929         { 0x7D, "TYPE='ID'" },
2930         { 0x7E, "NAME='ISP_NAME'" },
2931         { 0x7F, "TYPE='BOOKMARK'" },
2932
2933         { 0x00, NULL }
2934 };
2935
2936 /*****    Attribute Value tokens   *****/
2937
2938 /***** Token code page aggregation *****/
2939 static const value_valuestring wbxml_nokiaprovc70_tags[] = {
2940         { 0, wbxml_nokiaprovc70_tags_cp0 },
2941         { 0, NULL }
2942 };
2943
2944 static const value_valuestring wbxml_nokiaprovc70_attrStart[] = {
2945         { 0, wbxml_nokiaprovc70_attrStart_cp0 },
2946         { 0, NULL }
2947 };
2948
2949 static const wbxml_decoding decode_nokiaprovc_70 = {
2950         "Nokia Client Provisioning 7.0",
2951         "Nokia Client Provisioning 7.0",
2952         { NULL, NULL, NULL },
2953         default_opaque_binary_tag,
2954         default_opaque_literal_tag,
2955         default_opaque_binary_attr,
2956         default_opaque_literal_attr,
2957         NULL,
2958         wbxml_nokiaprovc70_tags,
2959         wbxml_nokiaprovc70_attrStart,
2960         NULL
2961 };
2962
2963
2964
2965
2966
2967 /* UAProf [WAP-248]
2968  *
2969  * User-Agent Profile (used in profile-diff WSP header)
2970  ***************************************/
2971
2972 /*****   Global extension tokens   *****/
2973
2974 /*****         Tag tokens          *****/
2975 /* CodePage     0       RDF */
2976 static const value_string  wbxml_uaprof_tags_cp0[] = {
2977         {0x05, "rdf:RDF"},
2978         {0x06, "rdf:Description"},
2979         {0x07, "rdf:Alt"},
2980         {0x08, "rdf:Bag"},
2981         {0x09, "rdf:Seq"},
2982         {0x0A, "rdf:li"},
2983         {0x0B, "rdf:type"},
2984         {0x0C, "rdf:value"},
2985         {0x0D, "rdf:subject"},
2986         {0x0E, "rdf:predicate"},
2987         {0x0F, "rdf:object"},
2988
2989         { 0x00, NULL }
2990 };
2991
2992 /* CodePage     1       Core Vocabulary */
2993 static const value_string  wbxml_uaprof_tags_cp1[] = {
2994         {0x06, "rdf:Description"},
2995         {0x07, "rdf:Alt"},
2996         {0x08, "rdf:Bag"},
2997         {0x09, "rdf:Seq"},
2998         {0x0A, "rdf:li"},
2999         {0x0B, "rdf:type"},
3000         {0x0C, "prf:component"},
3001         {0x0D, "prf:defaults"},
3002         {0x0E, "prf:BitsPerPixel"},
3003         {0x0F, "prf:ColorCapable"},
3004         {0x10, "prf:CPU"},
3005         {0x11, "prf:ImageCapable"},
3006         {0x12, "prf:InputCharSet"},
3007         {0x13, "prf:Keyboard"},
3008         {0x15, "prf:Model"},
3009         {0x16, "prf:OutputCharSet"},
3010         {0x17, "prf:PointingResolution"},
3011         {0x18, "prf:ScreenSize"},
3012         {0x19, "prf:ScreenSizeChar"},
3013         {0x1A, "prf:NumberOfSoftKeys"},
3014         {0x1B, "prf:SoundOutputCapable"},
3015         {0x1C, "prf:TextInputCapable"},
3016         {0x1D, "prf:Vendor"},
3017         {0x1E, "prf:VoiceInputCapable"},
3018         {0x1F, "prf:AcceptDownloadableSoftware"},
3019         {0x20, "prf:AudioInputEncoder"},
3020         {0x21, "prf:DownloadableSoftwareSupport"},
3021         {0x22, "prf:JavaEnabled"},
3022         {0x23, "prf:JVMVersion"},
3023         {0x24, "prf:MexeClassmark"},
3024         {0x25, "prf:MexeSpec"},
3025         {0x26, "prf:OSName"},
3026         {0x27, "prf:OSVendor"},
3027         {0x28, "prf:OSVersion"},
3028         {0x29, "prf:RecipientAppAgent"},
3029         {0x2A, "prf:SoftwareNumber"},
3030         {0x2B, "prf:VideoInputEncoder"},
3031         {0x2C, "prf:CurrentBearerService"},
3032         {0x2D, "prf:SecuritySupport"},
3033         {0x2E, "prf:SupportedBearers"},
3034         {0x2F, "prf:WapDeviceClass"},
3035         {0x30, "prf:WapPushMsgPriority"}, /* Deprecated */
3036         {0x31, "prf:WapPushMsgSize"}, /* Deprecated */
3037         {0x32, "prf:WapVersion"},
3038         {0x33, "prf:WmlDeckSize"},
3039         {0x34, "prf:WmlScriptLibraries"},
3040         {0x35, "prf:WmlScriptVersion"},
3041         {0x36, "prf:WmlVersion"},
3042         {0x37, "prf:WtaiLibraries"},
3043         {0x38, "prf:WtaVersion"},
3044         {0x39, "prf:PixelAspectRatio"},
3045         {0x3A, "prf:StandardFontProportional"},
3046         {0x3B, "prf:WapSupportedApplications"}, /* Deprecated */
3047         {0x3C, "prf:BluetoothProfile"},
3048         {0x3D, "prf:MexeClassmarks"},
3049         {0x3E, "prf:MexeSecureDomains"},
3050
3051         { 0x00, NULL }
3052 };
3053
3054 /* CodePage     4       Core Vocabulary (continued) */
3055 static const value_string  wbxml_uaprof_tags_cp4[] = {
3056         {0x10, "prf:SupportedBluetoothVersion"},
3057         {0x11, "prf:SupportedPictogramSet"},
3058         {0x12, "prf:CcppAccept"},
3059         {0x13, "prf:CcppAccept-Charset"},
3060         {0x14, "prf:CcppAccept-Encoding"},
3061         {0x15, "prf:CcppAccept-Language"},
3062
3063         { 0x00, NULL }
3064 };
3065
3066 /* CodePage     2       BrowserUA */
3067 static const value_string  wbxml_uaprof_tags_cp2[] = {
3068         {0x05, "rdf:Description"},
3069         {0x06, "rdf:Alt"},
3070         {0x07, "rdf:Bag"},
3071         {0x08, "rdf:Seq"},
3072         {0x09, "rdf:li"},
3073         {0x0A, "rdf:type"},
3074         {0x0B, "prf:component"},
3075         {0x0C, "prf:defaults"},
3076         {0x0D, "prf:BrowserName"},
3077         {0x0E, "prf:BrowserVersion"},
3078         {0x0F, "prf:CcppAccept"}, /* Deprecated */
3079         {0x10, "prf:CcppAccept-Charset"}, /* Deprecated */
3080         {0x11, "prf:CcppAccept-Encoding"}, /* Deprecated */
3081         {0x12, "prf:CcppAccept-Language"}, /* Deprecated */
3082         {0x13, "prf:DownloadableBrowserApps"},
3083         {0x14, "prf:FramesCapable"},
3084         {0x15, "prf:HtmlVersion"},
3085         {0x16, "prf:JavaAppletEnabled"},
3086         {0x17, "prf:JavaScriptEnabled"},
3087         {0x18, "prf:JavaScriptVersion"},
3088         {0x19, "prf:PreferenceForFrames"},
3089         {0x1A, "prf:TablesCapable"},
3090         {0x1B, "Prf:XhtmlVersion"},
3091         {0x1C, "prf:XhtmlModules"},
3092
3093         { 0x00, NULL }
3094 };
3095
3096 /* CodePage     3       PushCharacteristics */
3097 static const value_string  wbxml_uaprof_tags_cp3[] = {
3098         {0x05, "rdf:Description"},
3099         {0x06, "rdf:Alt"},
3100         {0x07, "rdf:Bag"},
3101         {0x08, "rdf:Seq"},
3102         {0x09, "rdf:li"},
3103         {0x0A, "rdf:type"},
3104         {0x0B, "prf:component"},
3105         {0x0C, "prf:defaults"},
3106         {0x0D, "prf:Push-Accept"},
3107         {0x0E, "prf:Push-Accept-Charset"},
3108         {0x0F, "prf:Push-Accept-Encoding"},
3109         {0x10, "prf:Push-Accept-Language"},
3110         {0x11, "prf:Push-Accept-AppID"},
3111         {0x12, "prf:Push-MsgSize"},
3112         {0x13, "prf:Push-MaxPushReq"},
3113
3114         { 0x00, NULL }
3115 };
3116
3117 /*****    Attribute Start tokens   *****/
3118 /* CodePage     0       RDF */
3119 static const value_string  wbxml_uaprof_attrStart_cp0[] = {
3120         {0x05, "ID"},
3121         {0x06, "rdf:about"},
3122         {0x07, "rdf:aboutEach"},
3123         {0x08, "rdf:aboutEachPrefix"},
3124         {0x09, "rdf:bagID"},
3125         {0x0A, "rdf:type"},
3126         {0x0B, "rdf:resource"},
3127         {0x0C, "rdf:parseType='Literal'"},
3128         {0x0D, "rdf:parseType='Resource'"},
3129         {0x0E, "xml:lang"},
3130         {0x0F, "xmlns:prf"},
3131         {0x10, "xmlns:rdf"},
3132
3133         { 0x00, NULL }
3134 };
3135
3136 /* CodePage     1       Core Vocabulary */
3137 static const value_string  wbxml_uaprof_attrStart_cp1[] = {
3138         {0x05, "rdf:resource"},
3139         {0x06, "rdf:resource='http://www.wapforum.org/profiles/UAPROF/"
3140          "ccppschema-20010430#HardwarePlatform'"},
3141         {0x07, "rdf:resource='http://www.wapforum.org/profiles/UAPROF/"
3142          "ccppschema-20010430#SoftwarePlatform'"},
3143         {0x08, "rdf:resource='http://www.wapforum.org/profiles/UAPROF/"
3144          "ccppschema-20010430#NetworkCharacteristics'"},
3145         {0x09, "rdf:resource='http://www.wapforum.org/profiles/UAPROF/"
3146          "ccppschema-20010430#WapCharacteristics'"},
3147         {0x0A, "rdf:resource='http://www.wapforum.org/profiles/UAPROF/"
3148          "ccppschema-20010430#BrowserUA'"},
3149         {0x0B, "rdf:resource='http://www.wapforum.org/profiles/UAPROF/"
3150          "ccppschema-20010430#PushCharacteristics'"},
3151         {0x10, "prf:BitsPerPixel"},
3152         {0x11, "prf:ColorCapable='Yes'"},
3153         {0x12, "prf:ColorCapable='No'"},
3154         {0x13, "prf:CPU"},
3155         {0x14, "prf:ImageCapable='Yes'"},
3156         {0x15, "prf:ImageCapable='No'"},
3157         {0x16, "prf:InputCharSet"},
3158         {0x17, "prf:Keyboard"},
3159         {0x19, "prf:Model"},
3160         {0x1A, "prf:OutputCharSet"},
3161         {0x1B, "prf:PointingResolution"},
3162         {0x1C, "prf:ScreenSize"},
3163         {0x1D, "prf:ScreenSizeChar"},
3164         {0x1E, "prf:NumberOfSoftKeys='Yes'"},
3165         {0x20, "prf:SoundOutputCapable='Yes'"},
3166         {0x21, "prf:SoundOutputCapable='No'"},
3167         {0x22, "prf:TextInputCapable='Yes'"},
3168         {0x23, "prf:TextInputCapable='No'"},
3169         {0x24, "prf:Vendor"},
3170         {0x25, "prf:VoiceInputCapable='Yes'"},
3171         {0x26, "prf:VoiceInputCapable='No'"},
3172         {0x27, "prf:PixelAspectRatio"},
3173         {0x28, "prf:StandardFontProportional='Yes'"},
3174         {0x29, "prf:StandardFontProportional='No'"},
3175         {0x30, "prf:AcceptDownloadableSoftware='Yes'"},
3176         {0x31, "prf:AcceptDownloadableSoftware='No'"},
3177         {0x32, "prf:AudioInputEncoder"},
3178         {0x33, "prf:DownloadableSoftwareSupport"},
3179         {0x35, "prf:JavaEnabled='Yes'"},
3180         {0x36, "prf:JavaEnabled='No'"},
3181         {0x37, "prf:JVMVersion"},
3182         {0x38, "prf:MexeClassmark"},
3183         {0x39, "prf:MexeSpec"},
3184         {0x3A, "prf:OSName"},
3185         {0x3B, "prf:OSVendor"},
3186         {0x3C, "prf:OSVersion"},
3187         {0x3D, "prf:RecipientAppAgent"},
3188         {0x3E, "prf:SoftwareNumber"},
3189         {0x21, "prf:SoundOutputCapable='No'"},
3190         {0x22, "prf:TextInputCapable='Yes'"},
3191         {0x23, "prf:TextInputCapable='No'"},
3192         {0x24, "prf:Vendor"},
3193         {0x25, "prf:VoiceInputCapable='Yes'"},
3194         {0x26, "prf:VoiceInputCapable='No'"},
3195         {0x27, "prf:PixelAspectRatio"},
3196         {0x28, "prf:StandardFontProportional='Yes'"},
3197         {0x29, "prf:StandardFontProportional='No'"},
3198         {0x30, "prf:AcceptDownloadableSoftware='Yes'"},
3199         {0x31, "prf:AcceptDownloadableSoftware='No'"},
3200         {0x32, "prf:AudioInputEncoder"},
3201         {0x33, "prf:DownloadableSoftwareSupport"},
3202         {0x35, "prf:JavaEnabled='Yes'"},
3203         {0x36, "prf:JavaEnabled='No'"},
3204         {0x37, "prf:JVMVersion"},
3205         {0x38, "prf:MexeClassmark"},
3206         {0x39, "prf:MexeSpec"},
3207         {0x3A, "prf:OSName"},
3208         {0x3B, "prf:OSVendor"},
3209         {0x3C, "prf:OSVersion"},
3210         {0x3D, "prf:RecipientAppAgent"},
3211         {0x3E, "prf:SoftwareNumber"},
3212         {0x3F, "prf:VideoInputEncoder"},
3213         {0x50, "prf:CurrentBearerService"},
3214         {0x51, "prf:SecuritySupport"},
3215         {0x52, "prf:SupportedBearers"},
3216         {0x60, "prf:WapDeviceClass"},
3217         {0x61, "prf:WapPushMsgPriority"}, /* Deprecated */
3218         {0x62, "prf:WapPushMsgSize"}, /* Deprecated */
3219         {0x63, "prf:WapVersion"},
3220         {0x64, "prf:WmlDeckSize"},
3221         {0x65, "prf:WmlScriptLibraries"},
3222         {0x66, "prf:WmlScriptVersion"},
3223         {0x67, "prf:WmlVersion"},
3224         {0x68, "prf:WtaiLibraries"},
3225         {0x69, "prf:WtaVersion"},
3226         {0x70, "prf:WapSupportedApplications"}, /* Deprecated */
3227         {0x71, "prf:BluetoothProfile"},
3228         {0x72, "prf:MexeClassmarks"},
3229         {0x73, "prf:MexeSecureDomains='YES'"},
3230         {0x74, "prf:MexeSecureDomains='NO'"},
3231         {0x75, "prf:SupportedBluetoothVersion"},
3232         {0x76, "prf:SupportedPictogramSet"},
3233         {0x77, "prf:CcppAccept"},
3234         {0x78, "prf:CcppAccept-Charset"},
3235         {0x79, "prf:CcppAccept-Encoding"},
3236         {0x7F, "prf:CcppAccept-Language"},
3237
3238         { 0x00, NULL }
3239 };
3240
3241 /* CodePage     2       BrowserUA */
3242 static const value_string  wbxml_uaprof_attrStart_cp2[] = {
3243         {0x05, "prf:CcppAccept"}, /* Deprecated */
3244         {0x06, "prf:CcppAccept-Charset"}, /* Deprecated */
3245         {0x07, "prf:CcppAccept-Encoding"}, /* Deprecated */
3246         {0x08, "prf:CcppAccept-Language"}, /* Deprecated */
3247         {0x09, "prf:DownloadableBrowserApps"},
3248         {0x0A, "prf:FramesCapable='Yes'"},
3249         {0x0B, "prf:FramesCapable='No'"},
3250         {0x0C, "prf:HtmlVersion='3.2'"},
3251         {0x0D, "prf:HtmlVersion='4.0'"},
3252         {0x0E, "prf:JavaAppletEnabled='Yes'"},
3253         {0x0F, "prf:JavaAppletEnabled='No'"},
3254         {0x10, "prf:JavaScriptEnabled='Yes'"},
3255         {0x11, "prf:JavaScriptEnabled='No'"},
3256         {0x12, "prf:JavaScriptVersion"},
3257         {0x13, "prf:PreferenceForFrames='Yes'"},
3258         {0x14, "prf:PreferenceForFrames='No'"},
3259         {0x15, "prf:TablesCapable='Yes'"},
3260         {0x16, "prf:TablesCapable='No'"},
3261         {0x17, "prf:XhtmlVersion"},
3262         {0x18, "prf:XhtmlModules"},
3263         {0x19, "prf:BrowserName"},
3264         {0x1A, "prf:BrowserVersion"},
3265
3266         { 0x00, NULL }
3267 };
3268
3269 /* CodePage     3       PushCharacteristics */
3270 static const value_string  wbxml_uaprof_attrStart_cp3[] = {
3271         {0x05, "prf:Push-Accept"},
3272         {0x06, "prf:Push-Accept-Charset"},
3273         {0x07, "prf:Push-Accept-Encoding"},
3274         {0x08, "prf:Push-Accept-Language"},
3275         {0x09, "prf:Push-Accept-AppID"},
3276         {0x0A, "prf:Push-MsgSize"},
3277         {0x0B, "prf:Push-MaxPushReq"},
3278
3279         { 0x00, NULL }
3280 };
3281
3282 /*****    Attribute Value tokens   *****/
3283 /* CodePage     0       RDF */
3284 static const value_string  wbxml_uaprof_attrValue_cp0[] = {
3285         {0x85, "rdf:Statement"},
3286         {0x86, "http://"},
3287         {0x87, "http://www."},
3288         {0x88, "https://"},
3289         {0x89, "https://www."},
3290         {0x8A, "www."},
3291         {0x8B, ".com/"},
3292         {0x8C, ".edu/"},
3293         {0x8D, ".net/"},
3294         {0x8E, ".org/"},
3295
3296         { 0x00, NULL }
3297 };
3298
3299 /* CodePage     1       CoreVocabularyAttrValue */
3300 static const value_string  wbxml_uaprof_attrValue_cp1[] = {
3301         {0x85, "No"},
3302         {0x86, "Yes"},
3303
3304         { 0x00, NULL }
3305 };
3306
3307 /* CodePage     2       BrowserUAAttrValue */
3308 static const value_string  wbxml_uaprof_attrValue_cp2[] = {
3309         {0x85, "No"},
3310         {0x86, "Yes"},
3311
3312         { 0x00, NULL }
3313 };
3314
3315 /***** Token code page aggregation *****/
3316 static const value_valuestring wbxml_uaprof_tags[] = {
3317         { 0, wbxml_uaprof_tags_cp0 },
3318         { 1, wbxml_uaprof_tags_cp1 },
3319         { 2, wbxml_uaprof_tags_cp2 },
3320         { 3, wbxml_uaprof_tags_cp3 },
3321         { 4, wbxml_uaprof_tags_cp4 },
3322         { 0, NULL }
3323 };
3324
3325 static const value_valuestring wbxml_uaprof_attrStart[] = {
3326         { 0, wbxml_uaprof_attrStart_cp0 },
3327         { 1, wbxml_uaprof_attrStart_cp1 },
3328         { 2, wbxml_uaprof_attrStart_cp2 },
3329         { 3, wbxml_uaprof_attrStart_cp3 },
3330         { 0, NULL }
3331 };
3332
3333 static const value_valuestring wbxml_uaprof_attrValue[] = {
3334         { 0, wbxml_uaprof_attrValue_cp0 },
3335         { 1, wbxml_uaprof_attrValue_cp1 },
3336         { 2, wbxml_uaprof_attrValue_cp2 },
3337         { 0, NULL }
3338 };
3339
3340 static const wbxml_decoding decode_uaprof_wap_248 = {
3341         "User-Agent Profile (WAP-174, WAP-248)",
3342         "UAProf (WAP-174, WAP-248)",
3343         { NULL, NULL, NULL },
3344         default_opaque_binary_tag,
3345         default_opaque_literal_tag,
3346         default_opaque_binary_attr,
3347         default_opaque_literal_attr,
3348         NULL,
3349         wbxml_uaprof_tags,
3350         wbxml_uaprof_attrStart,
3351         wbxml_uaprof_attrValue
3352 };
3353
3354
3355
3356
3357
3358 /* WV-CSP 1.0
3359  *
3360  * Wireless Village Client Server Protocol
3361  ***************************************/
3362
3363 /*****   Global extension tokens   *****/
3364
3365 /*****         Tag tokens          *****/
3366 /* Common code page (0x00) */
3367 static const value_string wbxml_wv_csp_10_tags_cp0[] = {
3368         /* 0x00 -- 0x04 GLOBAL */
3369         { 0x05, "Acceptance" },
3370         { 0x06, "AddList" },
3371         { 0x07, "AddNickList" },
3372         { 0x08, "Attribute" },
3373         { 0x09, "AttributeList" },
3374         { 0x0A, "ClientID" },
3375         { 0x0B, "Code" },
3376         { 0x0C, "ContactList" },
3377         { 0x0D, "ContentData" },
3378         { 0x0E, "ContentEncoding" },
3379         { 0x0F, "ContentSize" },
3380         { 0x10, "ContentType" },
3381         { 0x11, "DateTime" },
3382         { 0x12, "Description" },
3383         { 0x13, "DetailedResult" },
3384         { 0x14, "EntityList" },
3385         { 0x15, "Group" },
3386         { 0x16, "GroupID" },
3387         { 0x17, "GroupList" },
3388         { 0x18, "InUse" },
3389         { 0x19, "Logo" },
3390         { 0x1A, "MessageCount" },
3391         { 0x1B, "MessageID" },
3392         { 0x1C, "MessageURI" },
3393         { 0x1D, "MSISDN" },
3394         { 0x1E, "Name" },
3395         { 0x1F, "NickList" },
3396         { 0x20, "NickName" },
3397         { 0x21, "Poll" },
3398         { 0x22, "Presence" },
3399         { 0x23, "PresenceSubList" },
3400         { 0x24, "PresenceValue" },
3401         { 0x25, "Property" },
3402         { 0x26, "Qualifier" },
3403         { 0x27, "Recipient" },
3404         { 0x28, "RemoveList" },
3405         { 0x29, "RemoveNickList" },
3406         { 0x2A, "Result" },
3407         { 0x2B, "ScreenName" },
3408         { 0x2C, "Sender" },
3409         { 0x2D, "Session" },
3410         { 0x2E, "SessionDescriptor" },
3411         { 0x2F, "SessionID" },
3412         { 0x30, "SessionType" },
3413         { 0x31, "Status" },
3414         { 0x32, "Transaction" },
3415         { 0x33, "TransactionContent" },
3416         { 0x34, "TransactionDescriptor" },
3417         { 0x35, "TransactionID" },
3418         { 0x36, "TransactionMode" },
3419         { 0x37, "URL" },
3420         { 0x38, "URLList" },
3421         { 0x39, "User" },
3422         { 0x3A, "UserID" },
3423         { 0x3B, "UserList" },
3424         { 0x3C, "Validity" },
3425         { 0x3D, "Value" },
3426         { 0x3E, "WV-CSP-Message" },
3427
3428         { 0x00, NULL }
3429 };
3430
3431 /* Access code page (0x01) */
3432 static const value_string wbxml_wv_csp_10_tags_cp1[] = {
3433         /* 0x00 -- 0x04 GLOBAL */
3434         { 0x05, "AllFunctions" },
3435         { 0x06, "AllFunctionsRequest" },
3436         { 0x07, "CancelInvite-Request" },
3437         { 0x08, "CancelInviteUser-Request" },
3438         { 0x09, "Capability" },
3439         { 0x0A, "CapabilityList" },
3440         { 0x0B, "CapabilityRequest" },
3441         { 0x0C, "ClientCapability-Request" },
3442         { 0x0D, "ClientCapability-Response" },
3443         { 0x0E, "DigestBytes" },
3444         { 0x0F, "DigestSchema" },
3445         { 0x10, "Disconnect" },
3446         { 0x11, "Functions" },
3447         { 0x12, "GetSPInfo-Request" },
3448         { 0x13, "GetSPInfo-Response" },
3449         { 0x14, "InviteID" },
3450         { 0x15, "InviteNote" },
3451         { 0x16, "Invite-Request" },
3452         { 0x17, "Invite-Response" },
3453         { 0x18, "InviteType" },
3454         { 0x19, "InviteUser-Request" },
3455         { 0x1A, "InviteUser-Response" },
3456         { 0x1B, "KeepAlive-Request" },
3457         { 0x1C, "KeepAliveTime" },
3458         { 0x1D, "Login-Request" },
3459         { 0x1E, "Login-Response" },
3460         { 0x1F, "Logout-Request" },
3461         { 0x20, "Nonce" },
3462         { 0x21, "Password" },
3463         { 0x22, "Polling-Request" },
3464         { 0x23, "ResponseNote" },
3465         { 0x24, "SearchElement" },
3466         { 0x25, "SearchFindings" },
3467         { 0x26, "SearchID" },
3468         { 0x27, "SearchIndex" },
3469         { 0x28, "SearchLimit" },
3470         { 0x29, "SearchOnlineStatus" },
3471         { 0x2A, "SearchPairList" },
3472         { 0x2B, "Search-Request" },
3473         { 0x2C, "Search-Response" },
3474         { 0x2D, "SearchResult" },
3475         { 0x2E, "Service-Request" },
3476         { 0x2F, "Service-Response" },
3477         { 0x30, "SessionCookie" },
3478         { 0x31, "StopSearch-Request" },
3479         { 0x32, "TimeToLive" },
3480
3481         { 0x00, NULL }
3482 };
3483
3484 /* Service code page (0x02) */
3485 static const value_string wbxml_wv_csp_10_tags_cp2[] = {
3486         /* 0x00 -- 0x04 GLOBAL */
3487         { 0x05, "ADDGM" },
3488         { 0x06, "AttListFunc" },
3489         { 0x07, "BLENT" },
3490         { 0x08, "CAAUT" },
3491         { 0x09, "CAINV" },
3492         { 0x0A, "CALI" },
3493         { 0x0B, "CCLI" },
3494         { 0x0C, "ContListFunc" },
3495         { 0x0D, "CREAG" },
3496         { 0x0E, "DALI" },
3497         { 0x0F, "DCLI" },
3498         { 0x10, "DELGR" },
3499         { 0x11, "FundamentalFeat" },
3500         { 0x12, "FWMSG" },
3501         { 0x13, "GALS" },
3502         { 0x14, "GCLI" },
3503         { 0x15, "GETGM" },
3504         { 0x16, "GETGP" },
3505         { 0x17, "GETLM" },
3506         { 0x18, "GETM" },
3507         { 0x19, "GETPR" },
3508         { 0x1A, "GETSPI" },
3509         { 0x1B, "GETWL" },
3510         { 0x1C, "GLBLU" },
3511         { 0x1D, "GRCHN" },
3512         { 0x1E, "GroupAuthFunc" },
3513         { 0x1F, "GroupFeat" },
3514         { 0x20, "GroupMgmtFunc" },
3515         { 0x21, "GroupUseFunc" },
3516         { 0x22, "IMAuthFunc" },
3517         { 0x23, "IMFeat" },
3518         { 0x24, "IMReceiveFunc" },
3519         { 0x25, "IMSendFunc" },
3520         { 0x26, "INVIT" },
3521         { 0x27, "InviteFunc" },
3522         { 0x28, "MBRAC" },
3523         { 0x29, "MCLS" },
3524         { 0x2A, "MDELIV" },
3525         { 0x2B, "NEWM" },
3526         { 0x2C, "NOTIF" },
3527         { 0x2D, "PresenceAuthFunc" },
3528         { 0x2E, "PresenceDeliverFunc" },
3529         { 0x2F, "PresenceFeat" },
3530         { 0x30, "REACT" },
3531         { 0x31, "REJCM" },
3532         { 0x32, "REJEC" },
3533         { 0x33, "RMVGM" },
3534         { 0x34, "SearchFunc" },
3535         { 0x35, "ServiceFunc" },
3536         { 0x36, "SETD" },
3537         { 0x37, "SETGP" },
3538         { 0x38, "SRCH" },
3539         { 0x39, "STSRC" },
3540         { 0x3A, "SUBGCN" },
3541         { 0x3B, "UPDPR" },
3542         { 0x3C, "WVCSPFeat" },
3543
3544         { 0x00, NULL }
3545 };
3546
3547 /* Client capability code page (0x03) */
3548 static const value_string wbxml_wv_csp_10_tags_cp3[] = {
3549         /* 0x00 -- 0x04 GLOBAL */
3550         { 0x05, "AcceptedCharset" },
3551         { 0x06, "AcceptedContentLength" },
3552         { 0x07, "AcceptedContentType" },
3553         { 0x08, "AcceptedTransferEncoding" },
3554         { 0x09, "AnyContent" },
3555         { 0x0A, "ClientType" },
3556         { 0x0B, "InitialDeliveryMethod" },
3557         { 0x0C, "MultiTrans" },
3558         { 0x0D, "ParserSize" },
3559         { 0x0E, "ServerPollMin" },
3560         { 0x0F, "SupportedBearer" },
3561         { 0x10, "SupportedCIRMethod" },
3562         { 0x11, "TCPAddress" },
3563         { 0x12, "TCPPort" },
3564         { 0x13, "UDPPort" },
3565
3566         { 0x00, NULL }
3567 };
3568
3569 /* Presence primitive code page (0x04) */
3570 static const value_string wbxml_wv_csp_10_tags_cp4[] = {
3571         /* 0x00 -- 0x04 GLOBAL */
3572         { 0x05, "CancelAuth-Request" },
3573         { 0x06, "ContactListProperties" },
3574         { 0x07, "CreateAttributeList-Request" },
3575         { 0x08, "CreateList-Request" },
3576         { 0x09, "DefaultAttributeList" },
3577         { 0x0A, "DefaultContactList" },
3578         { 0x0B, "DefaultList" },
3579         { 0x0C, "DeleteAttributeList-Request" },
3580         { 0x0D, "DeleteList-Request" },
3581         { 0x0E, "GetAttributeList-Request" },
3582         { 0x0F, "GetAttributeList-Response" },
3583         { 0x10, "GetList-Request" },
3584         { 0x11, "GetList-Response" },
3585         { 0x12, "GetPresence-Request" },
3586         { 0x13, "GetPresence-Response" },
3587         { 0x14, "GetWatcherList-Request" },
3588         { 0x15, "GetWatcherList-Response" },
3589         { 0x16, "ListManage-Request" },
3590         { 0x17, "ListManage-Response" },
3591         { 0x18, "Presence" },
3592         { 0x19, "PresenceAuth-Request" },
3593         { 0x1A, "PresenceAuth-Response" },
3594         { 0x1B, "PresenceNotification-Request" },
3595         { 0x1C, "PresenceValueList" },
3596         { 0x1D, "SubscribePresence-Request" },
3597         { 0x1E, "UnsubscribePresence-Request" },
3598         { 0x1F, "UpdatePresence-Request" },
3599
3600         { 0x00, NULL }
3601 };
3602
3603 /* Presence attribute code page (0x05) */
3604 static const value_string wbxml_wv_csp_10_tags_cp5[] = {
3605         /* 0x00 -- 0x04 GLOBAL */
3606         { 0x05, "Accuracy" },
3607         { 0x06, "Address" },
3608         { 0x07, "AddrPref" },
3609         { 0x08, "Alias" },
3610         { 0x09, "Altitude" },
3611         { 0x0A, "Building" },
3612         { 0x0B, "CAddr" },
3613         { 0x0C, "City" },
3614         { 0x0D, "ClientInfo" },
3615         { 0x0E, "ClientProducer" },
3616         { 0x0F, "ClientType" },
3617         { 0x10, "ClientVersion" },
3618         { 0x11, "CommC" },
3619         { 0x12, "CommCap" },
3620         { 0x13, "ContactInfo" },
3621         { 0x14, "ContainedvCard" },
3622         { 0x15, "Country" },
3623         { 0x16, "Crossing1" },
3624         { 0x17, "Crossing2" },
3625         { 0x18, "DevManufacturer" },
3626         { 0x19, "DirectContent" },
3627         { 0x1A, "FreeTextLocation" },
3628         { 0x1B, "GeoLocation" },
3629         { 0x1C, "Language" },
3630         { 0x1D, "Latitude" },
3631         { 0x1E, "Longitude" },
3632         { 0x1F, "Model" },
3633         { 0x20, "NamedArea" },
3634         { 0x21, "OnlineStatus" },
3635         { 0x22, "PLMN" },
3636         { 0x23, "PrefC" },
3637         { 0x24, "PreferredContacts" },
3638         { 0x25, "PreferredLanguage" },
3639         { 0x26, "ReferredContent" },
3640         { 0x27, "ReferredvCard" },
3641         { 0x28, "Registration" },
3642         { 0x29, "StatusContent" },
3643         { 0x2A, "StatusMood" },
3644         { 0x2B, "StatusText" },
3645         { 0x2C, "Street" },
3646         { 0x2D, "TimeZone" },
3647         { 0x2E, "UserAvailability" },
3648
3649         { 0x00, NULL }
3650 };
3651
3652 /* Messaging code page (0x06) */
3653 static const value_string wbxml_wv_csp_10_tags_cp6[] = {
3654         /* 0x00 -- 0x04 GLOBAL */
3655         { 0x05, "BlockList" },
3656         { 0x06, "BlockUser-Request" },
3657         { 0x07, "DeliveryMethod" },
3658         { 0x08, "DeliveryReport" },
3659         { 0x09, "DeliveryReport-Request" },
3660         { 0x0A, "ForwardMessage-Request" },
3661         { 0x0B, "GetBlockedList-Request" },
3662         { 0x0C, "GetBlockedList-Response" },
3663         { 0x0D, "GetMessageList-Request" },
3664         { 0x0E, "GetMessageList-Response" },
3665         { 0x0F, "GetMessage-Request" },
3666         { 0x10, "GetMessage-Response" },
3667         { 0x11, "GrantList" },
3668         { 0x12, "MessageDelivered" },
3669         { 0x13, "MessageInfo" },
3670         { 0x14, "MessageNotification" },
3671         { 0x15, "NewMessage" },
3672         { 0x16, "RejectMessage-Request" },
3673         { 0x17, "SendMessage-Request" },
3674         { 0x18, "SendMessage-Response" },
3675         { 0x19, "SetDeliveryMethod-Request" },
3676
3677         { 0x00, NULL }
3678 };
3679
3680 /* Group code page (0x07) */
3681 static const value_string wbxml_wv_csp_10_tags_cp7[] = {
3682         /* 0x00 -- 0x04 GLOBAL */
3683         { 0x05, "AddGroupMembers-Request" },
3684         { 0x06, "Admin" },
3685         { 0x07, "CreateGroup-Request" },
3686         { 0x08, "DeleteGroup-Request" },
3687         { 0x09, "GetGroupMembers-Request" },
3688         { 0x0A, "GetGroupMembers-Response" },
3689         { 0x0B, "GetGroupProps-Request" },
3690         { 0x0C, "GetGroupProps-Response" },
3691         { 0x0D, "GroupChangeNotice" },
3692         { 0x0E, "GroupProperties" },
3693         { 0x0F, "Joined" },
3694         { 0x10, "JoinedRequest" },
3695         { 0x11, "JoinGroup-Request" },
3696         { 0x12, "JoinGroup-Response" },
3697         { 0x13, "LeaveGroup-Request" },
3698         { 0x14, "LeaveGroup-Response" },
3699         { 0x15, "Left" },
3700         { 0x16, "MemberAccess-Request" },
3701         { 0x17, "Mod" },
3702         { 0x18, "OwnProperties" },
3703         { 0x19, "RejectList-Request" },
3704         { 0x1A, "RejectList-Response" },
3705         { 0x1B, "RemoveGroupMembers-Request" },
3706         { 0x1C, "SetGroupProps-Request" },
3707         { 0x1D, "SubscribeGroupNotice-Request" },
3708         { 0x1E, "SubscribeGroupNotice-Response" },
3709         { 0x1F, "Users" },
3710         { 0x20, "WelcomeNote" },
3711
3712         { 0x00, NULL }
3713 };
3714
3715 /*
3716  * Attribute start tokens
3717  */
3718 /* common code page (0x00) */
3719 static const value_string wbxml_wv_csp_10_attrStart_cp0[] = {
3720         /* 0x00 -- 0x04 GLOBAL */
3721         { 0x05, "xmlns='http://www.wireless-village.org/CSP'" },
3722         { 0x06, "xmlns='http://www.wireless-village.org/PA'" },
3723         { 0x07, "xmlns='http://www.wireless-village.org/TRC'" },
3724
3725         { 0x00, NULL }
3726 };
3727
3728 /*
3729  * Attribute value tokens
3730  */
3731 /* Common value tokens (0x00) */
3732 static const value_string wbxml_wv_csp_10_attrValue_cp0[] = {
3733         /* 0x80 -- 0x84 GLOBAL */
3734         { 0x85, "AccessType" },
3735         { 0x86, "ActiveUsers" },
3736         { 0x87, "Admin" },
3737         { 0x88, "application/" },
3738         { 0x89, "application/vnd.wap.mms-message" },
3739         { 0x8A, "application/x-sms" },
3740         { 0x8B, "BASE64" },
3741         { 0x8C, "Closed" },
3742         { 0x8D, "Default" },
3743         { 0x8E, "DisplayName" },
3744         { 0x8F, "False (No)" },
3745         { 0x90, "Get" },
3746         { 0x91, "Group (GR)" },
3747         { 0x92, "http://" },
3748         { 0x93, "https://" },
3749         { 0x94, "image/" },
3750         { 0x95, "Inband" },
3751         { 0x96, "Instant Messaging (IM)" },
3752         { 0x97, "MaxActiveUsers" },
3753         { 0x98, "Mod" },
3754         { 0x99, "Name" },
3755         { 0x9A, "None" },
3756         { 0x9B, "Notify/Get" },
3757         { 0x9C, "Open" },
3758         { 0x9D, "Outband" },
3759         { 0x9E, "Presence (PR)" },
3760         { 0x9F, "Private" },
3761         { 0xA0, "PrivateMessaging" },
3762         { 0xA1, "PrivilegeLevel" },
3763         { 0xA2, "Public" },
3764         { 0xA3, "Push" },
3765         { 0xA4, "Request" },
3766         { 0xA5, "Response" },
3767         { 0xA6, "ScreenName" },
3768         { 0xA7, "Searchable" },
3769         { 0xA8, "Set" },
3770         { 0xA9, "Shared Content (SC)" },
3771         { 0xAA, "text/" },
3772         { 0xAB, "text/plain" },
3773         { 0xAC, "text/x-vCalendar" },
3774         { 0xAD, "text/x-vCard" },
3775         { 0xAE, "Topic" },
3776         { 0xAF, "True (Yes)" },
3777         { 0xB0, "Type" },
3778         { 0xB1, "Unset" },
3779         { 0xB2, "User (US)" },
3780         { 0xB3, "www.wireless-village.org" },
3781
3782         { 0x00, NULL }
3783 };
3784
3785 /* Access value tokens (0x01) */
3786 static const value_string wbxml_wv_csp_10_attrValue_cp1[] = {
3787         /* 0x80 -- 0x84 GLOBAL */
3788         { 0x85, "GROUP_ID" },
3789         { 0x86, "GROUP_NAME" },
3790         { 0x87, "GROUP_TOPIC" },
3791         { 0x88, "GROUP_USER_ID_JOINED" },
3792         { 0x89, "HTTP" },
3793         { 0x8A, "SMS" },
3794         { 0x8B, "STCP" },
3795         { 0x8C, "SUDP" },
3796         { 0x8D, "USER_ALIAS" },
3797         { 0x8E, "USER_EMAIL_ADDRESS" },
3798         { 0x8F, "USER_FIRST_NAME" },
3799         { 0x90, "USER_ID" },
3800         { 0x91, "USER_LAST_NAME" },
3801         { 0x92, "USER_MOBILE_NUMBER" },
3802         { 0x93, "WAPSMS" },
3803         { 0x94, "WAPUDP" },
3804         { 0x95, "WSP" },
3805
3806         { 0x00, NULL }
3807 };
3808
3809 /* Presence value tokens (0x05) */
3810 static const value_string wbxml_wv_csp_10_attrValue_cp5[] = {
3811         /* 0x80 -- 0x84 GLOBAL */
3812         { 0x85, "ANGRY" },
3813         { 0x86, "ANXIOUS" },
3814         { 0x87, "ASHAMED" },
3815         { 0x88, "AUDIO_CALL" },
3816         { 0x89, "AVAILABLE" },
3817         { 0x8A, "BORED" },
3818         { 0x8B, "CALL" },
3819         { 0x8C, "CLI" },
3820         { 0x8D, "COMPUTER" },
3821         { 0x8E, "DISCREET" },
3822         { 0x8F, "EMAIL" },
3823         { 0x90, "EXCITED" },
3824         { 0x91, "HAPPY" },
3825         { 0x92, "IM" },
3826         { 0x93, "IM_OFFLINE" },
3827         { 0x94, "IM_ONLINE" },
3828         { 0x95, "IN_LOVE" },
3829         { 0x96, "INVINCIBLE" },
3830         { 0x97, "JEALOUS" },
3831         { 0x98, "MMS" },
3832         { 0x99, "MOBILE_PHONE" },
3833         { 0x9A, "NOT_AVAILABLE" },
3834         { 0x9B, "OTHER" },
3835         { 0x9C, "PDA" },
3836         { 0x9D, "SAD" },
3837         { 0x9E, "SLEEPY" },
3838         { 0x9F, "SMS" },
3839         { 0xA0, "VIDEO_CALL" },
3840         { 0xA1, "VIDEO_STREAM" },
3841
3842         { 0x00, NULL }
3843 };
3844
3845
3846 /***** Token code page aggregation *****/
3847 static const value_valuestring wbxml_wv_csp_10_tags[] = {
3848         { 0, wbxml_wv_csp_10_tags_cp0 },
3849         { 1, wbxml_wv_csp_10_tags_cp1 },
3850         { 2, wbxml_wv_csp_10_tags_cp2 },
3851         { 3, wbxml_wv_csp_10_tags_cp3 },
3852         { 4, wbxml_wv_csp_10_tags_cp4 },
3853         { 5, wbxml_wv_csp_10_tags_cp5 },
3854         { 6, wbxml_wv_csp_10_tags_cp6 },
3855         { 7, wbxml_wv_csp_10_tags_cp7 },
3856         { 0, NULL }
3857 };
3858
3859 static const value_valuestring wbxml_wv_csp_10_attrStart[] = {
3860         { 0, wbxml_wv_csp_10_attrStart_cp0 },
3861         { 0, NULL }
3862 };
3863
3864 static const value_valuestring wbxml_wv_csp_10_attrValue[] = {
3865         { 0, wbxml_wv_csp_10_attrValue_cp0 },
3866         { 1, wbxml_wv_csp_10_attrValue_cp1 },
3867         { 5, wbxml_wv_csp_10_attrValue_cp5 },
3868         { 0, NULL }
3869 };
3870
3871 static const wbxml_decoding decode_wv_cspc_10 = {
3872         "Wireless-Village Client-Server Protocol 1.0",
3873         "WV-CSP 1.0",
3874         { NULL, NULL, NULL },
3875         wv_csp10_opaque_binary_tag,
3876         wv_csp10_opaque_literal_tag,
3877         default_opaque_binary_attr,
3878         default_opaque_literal_attr,
3879         NULL,
3880         wbxml_wv_csp_10_tags,
3881         wbxml_wv_csp_10_attrStart,
3882         wbxml_wv_csp_10_attrValue
3883 };
3884
3885
3886
3887
3888
3889 /* WV-CSP 1.1
3890  *
3891  * Wireless Village Client Server Protocol
3892  ***************************************/
3893
3894 /*****   Global extension tokens   *****/
3895 static const value_string wbxml_wv_csp_11_global_cp0[] = {
3896         { 0x80, "Common Value" }, /* EXT_T_0 */
3897
3898         { 0x00, NULL }
3899 };
3900
3901 /*****         Tag tokens          *****/
3902 /* Common code page */
3903 static const value_string wbxml_wv_csp_11_tags_cp0[] = {
3904         /* 0x00 -- 0x04 GLOBAL */
3905         { 0x05, "Acceptance" },
3906         { 0x06, "AddList" },
3907         { 0x07, "AddNickList" },
3908         { 0x08, "SName" },              /* Was: Attribute */
3909         { 0x09, "WV-CSP-Message" },     /* Was: AttributeList */
3910         { 0x0A, "ClientID" },
3911         { 0x0B, "Code" },
3912         { 0x0C, "ContactList" },
3913         { 0x0D, "ContentData" },
3914         { 0x0E, "ContentEncoding" },
3915         { 0x0F, "ContentSize" },
3916         { 0x10, "ContentType" },
3917         { 0x11, "DateTime" },
3918         { 0x12, "Description" },
3919         { 0x13, "DetailedResult" },
3920         { 0x14, "EntityList" },
3921         { 0x15, "Group" },
3922         { 0x16, "GroupID" },
3923         { 0x17, "GroupList" },
3924         { 0x18, "InUse" },
3925         { 0x19, "Logo" },
3926         { 0x1A, "MessageCount" },
3927         { 0x1B, "MessageID" },
3928         { 0x1C, "MessageURI" },
3929         { 0x1D, "MSISDN" },
3930         { 0x1E, "Name" },
3931         { 0x1F, "NickList" },
3932         { 0x20, "NickName" },
3933         { 0x21, "Poll" },
3934         { 0x22, "Presence" },
3935         { 0x23, "PresenceSubList" },
3936         { 0x24, "PresenceValue" },
3937         { 0x25, "Property" },
3938         { 0x26, "Qualifier" },
3939         { 0x27, "Recipient" },
3940         { 0x28, "RemoveList" },
3941         { 0x29, "RemoveNickList" },
3942         { 0x2A, "Result" },
3943         { 0x2B, "ScreenName" },
3944         { 0x2C, "Sender" },
3945         { 0x2D, "Session" },
3946         { 0x2E, "SessionDescriptor" },
3947         { 0x2F, "SessionID" },
3948         { 0x30, "SessionType" },
3949         { 0x31, "Status" },
3950         { 0x32, "Transaction" },
3951         { 0x33, "TransactionContent" },
3952         { 0x34, "TransactionDescriptor" },
3953         { 0x35, "TransactionID" },
3954         { 0x36, "TransactionMode" },
3955         { 0x37, "URL" },
3956         { 0x38, "URLList" },
3957         { 0x39, "User" },
3958         { 0x3A, "UserID" },
3959         { 0x3B, "UserList" },
3960         { 0x3C, "Validity" },
3961         { 0x3D, "Value" },
3962         /* 0x3E - Removed: WV-CSP-Message */
3963
3964         { 0x00, NULL }
3965 };
3966
3967 /* Access code page */
3968 static const value_string wbxml_wv_csp_11_tags_cp1[] = {
3969         /* 0x00 -- 0x04 GLOBAL */
3970         { 0x05, "AllFunctions" },
3971         { 0x06, "AllFunctionsRequest" },
3972         { 0x07, "CancelInvite-Request" },
3973         { 0x08, "CancelInviteUser-Request" },
3974         { 0x09, "Capability" },
3975         { 0x0A, "CapabilityList" },
3976         { 0x0B, "CapabilityRequest" },
3977         { 0x0C, "ClientCapability-Request" },
3978         { 0x0D, "ClientCapability-Response" },
3979         { 0x0E, "DigestBytes" },
3980         { 0x0F, "DigestSchema" },
3981         { 0x10, "Disconnect" },
3982         { 0x11, "Functions" },
3983         { 0x12, "GetSPInfo-Request" },
3984         { 0x13, "GetSPInfo-Response" },
3985         { 0x14, "InviteID" },
3986         { 0x15, "InviteNote" },
3987         { 0x16, "Invite-Request" },
3988         { 0x17, "Invite-Response" },
3989         { 0x18, "InviteType" },
3990         { 0x19, "InviteUser-Request" },
3991         { 0x1A, "InviteUser-Response" },
3992         { 0x1B, "KeepAlive-Request" },
3993         { 0x1C, "KeepAliveTime" },
3994         { 0x1D, "Login-Request" },
3995         { 0x1E, "Login-Response" },
3996         { 0x1F, "Logout-Request" },
3997         { 0x20, "Nonce" },
3998         { 0x21, "Password" },
3999         { 0x22, "Polling-Request" },
4000         { 0x23, "ResponseNote" },
4001         { 0x24, "SearchElement" },
4002         { 0x25, "SearchFindings" },
4003         { 0x26, "SearchID" },
4004         { 0x27, "SearchIndex" },
4005         { 0x28, "SearchLimit" },
4006         { 0x29, "KeepAlive-Response" },
4007         { 0x2A, "SearchPairList" },
4008         { 0x2B, "Search-Request" },
4009         { 0x2C, "Search-Response" },
4010         { 0x2D, "SearchResult" },
4011         { 0x2E, "Service-Request" },
4012         { 0x2F, "Service-Response" },
4013         { 0x30, "SessionCookie" },
4014         { 0x31, "StopSearch-Request" },
4015         { 0x32, "TimeToLive" },
4016         /* New in WV-CSP 1.1 */
4017         { 0x33, "SearchString" },
4018         { 0x34, "CompletionFlag" },
4019
4020         { 0x00, NULL }
4021 };
4022
4023 /* Service code page */
4024 /* Same as cp2 of WV-CSP 1.0 */
4025 #define wbxml_wv_csp_11_tags_cp2 wbxml_wv_csp_10_tags_cp2
4026
4027 /* Client capability code page */
4028 static const value_string wbxml_wv_csp_11_tags_cp3[] = {
4029         /* 0x00 -- 0x04 GLOBAL */
4030         { 0x05, "AcceptedCharset" },
4031         { 0x06, "AcceptedContentLength" },
4032         { 0x07, "AcceptedContentType" },
4033         { 0x08, "AcceptedTransferEncoding" },
4034         { 0x09, "AnyContent" },
4035         { 0x0A, "DefaultLanguage" },    /* Was: ClientType */
4036         { 0x0B, "InitialDeliveryMethod" },
4037         { 0x0C, "MultiTrans" },
4038         { 0x0D, "ParserSize" },
4039         { 0x0E, "ServerPollMin" },
4040         { 0x0F, "SupportedBearer" },
4041         { 0x10, "SupportedCIRMethod" },
4042         { 0x11, "TCPAddress" },
4043         { 0x12, "TCPPort" },
4044         { 0x13, "UDPPort" },
4045
4046         { 0x00, NULL }
4047 };
4048
4049 /* Presence primitive code page */
4050 static const value_string wbxml_wv_csp_11_tags_cp4[] = {
4051         /* 0x00 -- 0x04 GLOBAL */
4052         { 0x05, "CancelAuth-Request" },
4053         { 0x06, "ContactListProperties" },
4054         { 0x07, "CreateAttributeList-Request" },
4055         { 0x08, "CreateList-Request" },
4056         { 0x09, "DefaultAttributeList" },
4057         { 0x0A, "DefaultContactList" },
4058         { 0x0B, "DefaultList" },
4059         { 0x0C, "DeleteAttributeList-Request" },
4060         { 0x0D, "DeleteList-Request" },
4061         { 0x0E, "GetAttributeList-Request" },
4062         { 0x0F, "GetAttributeList-Response" },
4063         { 0x10, "GetList-Request" },
4064         { 0x11, "GetList-Response" },
4065         { 0x12, "GetPresence-Request" },
4066         { 0x13, "GetPresence-Response" },
4067         { 0x14, "GetWatcherList-Request" },
4068         { 0x15, "GetWatcherList-Response" },
4069         { 0x16, "ListManage-Request" },
4070         { 0x17, "ListManage-Response" },
4071         { 0x18, "UnsubscribePresence-Request" },        /* Was: Presence */
4072         { 0x19, "PresenceAuth-Request" },
4073         { 0x1A, "PresenceAuth-User" },          /* Was: PresenceAuth-Response */
4074         { 0x1B, "PresenceNotification-Request" },
4075         { 0x1C, "UpdatePresence-Request" },     /* Was: PresenceValueList */
4076         { 0x1D, "SubscribePresence-Request" },
4077         /* 0x1E - Removed: UnsubscribePresence-Request */
4078         /* 0x1F - Removed: UpdatePresence-Request */
4079
4080         { 0x00, NULL }
4081 };
4082
4083 /* Presence attribute code page */
4084 static const value_string wbxml_wv_csp_11_tags_cp5[] = {
4085         /* 0x00 -- 0x04 GLOBAL */
4086         { 0x05, "Accuracy" },
4087         { 0x06, "Address" },
4088         { 0x07, "AddrPref" },
4089         { 0x08, "Alias" },
4090         { 0x09, "Altitude" },
4091         { 0x0A, "Building" },
4092         { 0x0B, "Caddr" },
4093         { 0x0C, "City" },
4094         { 0x0D, "ClientInfo" },
4095         { 0x0E, "ClientProducer" },
4096         { 0x0F, "ClientType" },
4097         { 0x10, "ClientVersion" },
4098         { 0x11, "CommC" },
4099         { 0x12, "CommCap" },
4100         { 0x13, "ContactInfo" },
4101         { 0x14, "ContainedvCard" },
4102         { 0x15, "Country" },
4103         { 0x16, "Crossing1" },
4104         { 0x17, "Crossing2" },
4105         { 0x18, "DevManufacturer" },
4106         { 0x19, "DirectContent" },
4107         { 0x1A, "FreeTextLocation" },
4108         { 0x1B, "GeoLocation" },
4109         { 0x1C, "Language" },
4110         { 0x1D, "Latitude" },
4111         { 0x1E, "Longitude" },
4112         { 0x1F, "Model" },
4113         { 0x20, "NamedArea" },
4114         { 0x21, "OnlineStatus" },
4115         { 0x22, "PLMN" },
4116         { 0x23, "PrefC" },
4117         { 0x24, "PreferredContacts" },
4118         { 0x25, "PreferredLanguage" },
4119         { 0x26, "ReferredContent" },
4120         { 0x27, "ReferredvCard" },
4121         { 0x28, "Registration" },
4122         { 0x29, "StatusContent" },
4123         { 0x2A, "StatusMood" },
4124         { 0x2B, "StatusText" },
4125         { 0x2C, "Street" },
4126         { 0x2D, "TimeZone" },
4127         { 0x2E, "UserAvailability" },
4128         /* New in WV-CSP 1.1 */
4129         { 0x2F, "Cap" },
4130         { 0x30, "Cname" },
4131         { 0x31, "Contact" },
4132         { 0x32, "Cpriority" },
4133         { 0x33, "Cstatus" },
4134         { 0x34, "Note" },
4135         { 0x35, "Zone" },
4136
4137         { 0x00, NULL }
4138 };
4139
4140 /* Messaging code page */
4141 static const value_string wbxml_wv_csp_11_tags_cp6[] = {
4142         /* 0x00 -- 0x04 GLOBAL */
4143         { 0x05, "BlockList" },
4144         { 0x06, "BlockUser-Request" },
4145         { 0x07, "DeliveryMethod" },
4146         { 0x08, "DeliveryReport" },
4147         { 0x09, "DeliveryReport-Request" },
4148         { 0x0A, "ForwardMessage-Request" },
4149         { 0x0B, "GetBlockedList-Request" },
4150         { 0x0C, "GetBlockedList-Response" },
4151         { 0x0D, "GetMessageList-Request" },
4152         { 0x0E, "GetMessageList-Response" },
4153         { 0x0F, "GetMessage-Request" },
4154         { 0x10, "GetMessage-Response" },
4155         { 0x11, "GrantList" },
4156         { 0x12, "MessageDelivered" },
4157         { 0x13, "MessageInfo" },
4158         { 0x14, "MessageNotification" },
4159         { 0x15, "NewMessage" },
4160         { 0x16, "RejectMessage-Request" },
4161         { 0x17, "SendMessage-Request" },
4162         { 0x18, "SendMessage-Response" },
4163         { 0x19, "SetDeliveryMethod-Request" },
4164         /* New in WV-CSP 1.1 */
4165         { 0x1A, "DeliveryTime" },
4166
4167         { 0x00, NULL }
4168 };
4169
4170 /* Group code page */
4171 static const value_string wbxml_wv_csp_11_tags_cp7[] = {
4172         /* 0x00 -- 0x04 GLOBAL */
4173         { 0x05, "AddGroupMembers-Request" },
4174         { 0x06, "Admin" },
4175         { 0x07, "CreateGroup-Request" },
4176         { 0x08, "DeleteGroup-Request" },
4177         { 0x09, "GetGroupMembers-Request" },
4178         { 0x0A, "GetGroupMembers-Response" },
4179         { 0x0B, "GetGroupProps-Request" },
4180         { 0x0C, "GetGroupProps-Response" },
4181         { 0x0D, "GroupChangeNotice" },
4182         { 0x0E, "GroupProperties" },
4183         { 0x0F, "Joined" },
4184         { 0x10, "JoinedRequest" },
4185         { 0x11, "JoinGroup-Request" },
4186         { 0x12, "JoinGroup-Response" },
4187         { 0x13, "LeaveGroup-Request" },
4188         { 0x14, "LeaveGroup-Response" },
4189         { 0x15, "Left" },
4190         { 0x16, "MemberAccess-Request" },
4191         { 0x17, "Mod" },
4192         { 0x18, "OwnProperties" },
4193         { 0x19, "RejectList-Request" },
4194         { 0x1A, "RejectList-Response" },
4195         { 0x1B, "RemoveGroupMembers-Request" },
4196         { 0x1C, "SetGroupProps-Request" },
4197         { 0x1D, "SubscribeGroupNotice-Request" },
4198         { 0x1E, "SubscribeGroupNotice-Response" },
4199         { 0x1F, "Users" },
4200         { 0x20, "WelcomeNote" },
4201         /* New in WV-CSP 1.1 */
4202         { 0x21, "JoinGroup" },
4203         { 0x22, "SubscribeNotification" },
4204         { 0x23, "SubscribeType" },
4205
4206         { 0x00, NULL }
4207 };
4208
4209 /*****    Attribute Start tokens   *****/
4210 /* Common code page */
4211 /* Same as cp0 of WV-CSP 1.0 */
4212 #define wbxml_wv_csp_11_attrStart_cp0 wbxml_wv_csp_10_attrStart_cp0
4213
4214 /*****    Attribute Value tokens   *****/
4215 /*
4216  * Element value tokens
4217  *
4218  * NOTE - WV-CSP uses the EXT_T_0 token in a peculiar way: the mb_u_int32
4219  * does *not* reference an offset in the string table, but it refers to
4220  * the index in the following value_string.
4221  *
4222  * Please note that:
4223  *  - Values 'T' and 'F' are Boolean values representing "True" and "False"
4224  *    (or "Yes" and "No" in some circumstances) respectively.
4225  *  - Values 'GR', 'IM', 'PR', 'SC', 'GM' and 'US' are enumerated values
4226  *    representing "Group", "Instant Messaging", "Presence", "Shared Content",
4227  *    "Group membership" and "User" respectively.
4228  *  - Values 'G', 'S' and 'U' are enumerated values representing "Get", "Set"
4229  *    and "Unset" respectively.
4230  *  - Values 'N' and 'P' are enumerated values representing "Notify/Get" and
4231  *    "Push" respectively.
4232  *
4233  * I repeat: this is NOT a attrValue[] array hence it is not called
4234  * wbxml_wv_XXX but vals_wv_XXX.
4235  *
4236  * Result: the attribute value token definitions from WV-CSP 1.0 are dropped.
4237  */
4238 static const value_string vals_wv_csp_11_element_value_tokens[] = {
4239         /*
4240          * Common value tokens
4241          */
4242         { 0x00, "AccessType" },
4243         { 0x01, "ActiveUsers" },
4244         { 0x02, "Admin" },
4245         { 0x03, "application/" },
4246         { 0x04, "application/vnd.wap.mms-message" },
4247         { 0x05, "application/x-sms" },
4248         { 0x06, "AutoJoin" },
4249         { 0x07, "BASE64" },
4250         { 0x08, "Closed" },
4251         { 0x09, "Default" },
4252         { 0x0A, "DisplayName" },
4253         { 0x0B, "F" },
4254         { 0x0C, "G" },
4255         { 0x0D, "GR" },
4256         { 0x0E, "http://" },
4257         { 0x0F, "https://" },
4258         { 0x10, "image/" },
4259         { 0x11, "Inband" },
4260         { 0x12, "IM" },
4261         { 0x13, "MaxActiveUsers" },
4262         { 0x14, "Mod" },
4263         { 0x15, "Name" },
4264         { 0x16, "None" },
4265         { 0x17, "N" },
4266         { 0x18, "Open" },
4267         { 0x19, "Outband" },
4268         { 0x1A, "PR" },
4269         { 0x1B, "Private" },
4270         { 0x1C, "PrivateMessaging" },
4271         { 0x1D, "PrivilegeLevel" },
4272         { 0x1E, "Public" },
4273         { 0x1F, "P" },
4274         { 0x20, "Request" },
4275         { 0x21, "Response" },
4276         { 0x22, "Restricted" },
4277         { 0x23, "ScreenName" },
4278         { 0x24, "Searchable" },
4279         { 0x25, "S" },
4280         { 0x26, "SC" },
4281         { 0x27, "text/" },
4282         { 0x28, "text/plain" },
4283         { 0x29, "text/x-vCalendar" },
4284         { 0x2A, "text/x-vCard" },
4285         { 0x2B, "Topic" },
4286         { 0x2C, "T" },
4287         { 0x2D, "Type" },
4288         { 0x2E, "U" },
4289         { 0x2F, "US" },
4290         { 0x30, "www.wireless-village.org" },
4291         /*
4292          * Access value tokens
4293          */
4294         { 0x3D, "GROUP_ID" },
4295         { 0x3E, "GROUP_NAME" },
4296         { 0x3F, "GROUP_TOPIC" },
4297         { 0x40, "GROUP_USER_ID_JOINED" },
4298         { 0x41, "GROUP_USER_ID_OWNER" },
4299         { 0x42, "HTTP" },
4300         { 0x43, "SMS" },
4301         { 0x44, "STCP" },
4302         { 0x45, "SUDP" },
4303         { 0x46, "USER_ALIAS" },
4304         { 0x47, "USER_EMAIL_ADDRESS" },
4305         { 0x48, "USER_FIRST_NAME" },
4306         { 0x49, "USER_ID" },
4307         { 0x4A, "USER_LAST_NAME" },
4308         { 0x4B, "USER_MOBILE_NUMBER" },
4309         { 0x4C, "USER_ONLINE_STATUS" },
4310         { 0x4D, "WAPSMS" },
4311         { 0x4E, "WAPUDP" },
4312         { 0x4F, "WSP" },
4313         /*
4314          * Presence value tokens
4315          */
4316         { 0x5B, "ANGRY" },
4317         { 0x5C, "ANXIOUS" },
4318         { 0x5D, "ASHAMED" },
4319         { 0x5E, "AUDIO_CALL" },
4320         { 0x5F, "AVAILABLE" },
4321         { 0x60, "BORED" },
4322         { 0x61, "CALL" },
4323         { 0x62, "CLI" },
4324         { 0x63, "COMPUTER" },
4325         { 0x64, "DISCREET" },
4326         { 0x65, "EMAIL" },
4327         { 0x66, "EXCITED" },
4328         { 0x67, "HAPPY" },
4329         { 0x68, "IM" },
4330         { 0x69, "IM_OFFLINE" },
4331         { 0x6A, "IM_ONLINE" },
4332         { 0x6B, "IN_LOVE" },
4333         { 0x6C, "INVINCIBLE" },
4334         { 0x6D, "JEALOUS" },
4335         { 0x6E, "MMS" },
4336         { 0x6F, "MOBILE_PHONE" },
4337         { 0x70, "NOT_AVAILABLE" },
4338         { 0x71, "OTHER" },
4339         { 0x72, "PDA" },
4340         { 0x73, "SAD" },
4341         { 0x74, "SLEEPY" },
4342         { 0x75, "SMS" },
4343         { 0x76, "VIDEO_CALL" },
4344         { 0x77, "VIDEO_STREAM" },
4345
4346         { 0x00, NULL }
4347 };
4348
4349
4350 /***** Token code page aggregation *****/
4351
4352 static char *
4353 ext_t_0_wv_cspc_11(tvbuff_t *tvb _U_, guint32 value, guint32 str_tbl _U_)
4354 {
4355         char *str = g_strdup_printf("Common Value: '%s'",
4356                                     val_to_str(value, vals_wv_csp_11_element_value_tokens,
4357                                                "<Unknown WV-CSP 1.1 Common Value token 0x%X>"));
4358         return str;
4359 }
4360
4361 static const value_valuestring wbxml_wv_csp_11_global[] = {
4362         { 0, wbxml_wv_csp_11_global_cp0 },
4363         { 0, NULL }
4364 };
4365
4366 static const value_valuestring wbxml_wv_csp_11_tags[] = {
4367         { 0, wbxml_wv_csp_11_tags_cp0 },
4368         { 1, wbxml_wv_csp_11_tags_cp1 },
4369         { 2, wbxml_wv_csp_11_tags_cp2 },
4370         { 3, wbxml_wv_csp_11_tags_cp3 },
4371         { 4, wbxml_wv_csp_11_tags_cp4 },
4372         { 5, wbxml_wv_csp_11_tags_cp5 },
4373         { 6, wbxml_wv_csp_11_tags_cp6 },
4374         { 7, wbxml_wv_csp_11_tags_cp7 },
4375         { 0, NULL }
4376 };
4377
4378 static const value_valuestring wbxml_wv_csp_11_attrStart[] = {
4379         { 0, wbxml_wv_csp_11_attrStart_cp0 },
4380         { 0, NULL }
4381 };
4382
4383 static const wbxml_decoding decode_wv_cspc_11 = {
4384         "Wireless-Village Client-Server Protocol 1.1",
4385         "WV-CSP 1.1",
4386         { ext_t_0_wv_cspc_11, NULL, NULL },
4387         wv_csp11_opaque_binary_tag,
4388         wv_csp11_opaque_literal_tag,
4389         default_opaque_binary_attr,
4390         default_opaque_literal_attr,
4391         wbxml_wv_csp_11_global,
4392         wbxml_wv_csp_11_tags,
4393         wbxml_wv_csp_11_attrStart,
4394         NULL
4395 };
4396
4397
4398
4399
4400
4401 /* WV-CSP 1.2
4402  *
4403  * Wireless Village Client Server Protocol
4404  ***************************************/
4405
4406 /*****   Global extension tokens   *****/
4407 /* Same as WV-CSP 1.1 */
4408
4409 /*****         Tag tokens          *****/
4410 /* Common code page */
4411 /* Same as cp0 of WV-CSP 1.1 */
4412 #define wbxml_wv_csp_12_tags_cp0 wbxml_wv_csp_11_tags_cp0
4413 /* Note that the table continues in code page 0x09 */
4414
4415 /* Access code page (0x01) */
4416 static const value_string wbxml_wv_csp_12_tags_cp1[] = {
4417         /* 0x00 -- 0x04 GLOBAL */
4418         { 0x05, "AllFunctions" },
4419         { 0x06, "AllFunctionsRequest" },
4420         { 0x07, "CancelInvite-Request" },
4421         { 0x08, "CancelInviteUser-Request" },
4422         { 0x09, "Capability" },
4423         { 0x0A, "CapabilityList" },
4424         { 0x0B, "CapabilityRequest" },
4425         { 0x0C, "ClientCapability-Request" },
4426         { 0x0D, "ClientCapability-Response" },
4427         { 0x0E, "DigestBytes" },
4428         { 0x0F, "DigestSchema" },
4429         { 0x10, "Disconnect" },
4430         { 0x11, "Functions" },
4431         { 0x12, "GetSPInfo-Request" },
4432         { 0x13, "GetSPInfo-Response" },
4433         { 0x14, "InviteID" },
4434         { 0x15, "InviteNote" },
4435         { 0x16, "Invite-Request" },
4436         { 0x17, "Invite-Response" },
4437         { 0x18, "InviteType" },
4438         { 0x19, "InviteUser-Request" },
4439         { 0x1A, "InviteUser-Response" },
4440         { 0x1B, "KeepAlive-Request" },
4441         { 0x1C, "KeepAliveTime" },
4442         { 0x1D, "Login-Request" },
4443         { 0x1E, "Login-Response" },
4444         { 0x1F, "Logout-Request" },
4445         { 0x20, "Nonce" },
4446         { 0x21, "Password" },
4447         { 0x22, "Polling-Request" },
4448         { 0x23, "ResponseNote" },
4449         { 0x24, "SearchElement" },
4450         { 0x25, "SearchFindings" },
4451         { 0x26, "SearchID" },
4452         { 0x27, "SearchIndex" },
4453         { 0x28, "SearchLimit" },
4454         { 0x29, "KeepAlive-Response" },
4455         { 0x2A, "SearchPairList" },
4456         { 0x2B, "Search-Request" },
4457         { 0x2C, "Search-Response" },
4458         { 0x2D, "SearchResult" },
4459         { 0x2E, "Service-Request" },
4460         { 0x2F, "Service-Response" },
4461         { 0x30, "SessionCookie" },
4462         { 0x31, "StopSearch-Request" },
4463         { 0x32, "TimeToLive" },
4464         /* New in WV-CSP 1.1 */
4465         { 0x33, "SearchString" },
4466         { 0x34, "CompletionFlag" },
4467         /* New in WV-CSP 1.2 */
4468         { 0x36, "ReceiveList" },
4469         { 0x37, "VerifyID-Request" },
4470         { 0x38, "Extended-Request" },
4471         { 0x39, "Extended-Response" },
4472         { 0x3A, "AgreedCapabilityList" },
4473         { 0x3B, "ExtendedData" },
4474         { 0x3C, "OtherServer" },
4475         { 0x3D, "PresenceAttributeNSName" },
4476         { 0x3E, "SessionNSName" },
4477         { 0x3F, "TransactionNSName" },
4478
4479         { 0x00, NULL }
4480 };
4481 /* Note that the table continues in code page 0x0A */
4482
4483 /* Service code page (0x02) */
4484 static const value_string wbxml_wv_csp_12_tags_cp2[] = {
4485         /* 0x00 -- 0x04 GLOBAL */
4486         { 0x05, "ADDGM" },
4487         { 0x06, "AttListFunc" },
4488         { 0x07, "BLENT" },
4489         { 0x08, "CAAUT" },
4490         { 0x09, "CAINV" },
4491         { 0x0A, "CALI" },
4492         { 0x0B, "CCLI" },
4493         { 0x0C, "ContListFunc" },
4494         { 0x0D, "CREAG" },
4495         { 0x0E, "DALI" },
4496         { 0x0F, "DCLI" },
4497         { 0x10, "DELGR" },
4498         { 0x11, "FundamentalFeat" },
4499         { 0x12, "FWMSG" },
4500         { 0x13, "GALS" },
4501         { 0x14, "GCLI" },
4502         { 0x15, "GETGM" },
4503         { 0x16, "GETGP" },
4504         { 0x17, "GETLM" },
4505         { 0x18, "GETM" },
4506         { 0x19, "GETPR" },
4507         { 0x1A, "GETSPI" },
4508         { 0x1B, "GETWL" },
4509         { 0x1C, "GLBLU" },
4510         { 0x1D, "GRCHN" },
4511         { 0x1E, "GroupAuthFunc" },
4512         { 0x1F, "GroupFeat" },
4513         { 0x20, "GroupMgmtFunc" },
4514         { 0x21, "GroupUseFunc" },
4515         { 0x22, "IMAuthFunc" },
4516         { 0x23, "IMFeat" },
4517         { 0x24, "IMReceiveFunc" },
4518         { 0x25, "IMSendFunc" },
4519         { 0x26, "INVIT" },
4520         { 0x27, "InviteFunc" },
4521         { 0x28, "MBRAC" },
4522         { 0x29, "MCLS" },
4523         { 0x2A, "MDELIV" },
4524         { 0x2B, "NEWM" },
4525         { 0x2C, "NOTIF" },
4526         { 0x2D, "PresenceAuthFunc" },
4527         { 0x2E, "PresenceDeliverFunc" },
4528         { 0x2F, "PresenceFeat" },
4529         { 0x30, "REACT" },
4530         { 0x31, "REJCM" },
4531         { 0x32, "REJEC" },
4532         { 0x33, "RMVGM" },
4533         { 0x34, "SearchFunc" },
4534         { 0x35, "ServiceFunc" },
4535         { 0x36, "SETD" },
4536         { 0x37, "SETGP" },
4537         { 0x38, "SRCH" },
4538         { 0x39, "STSRC" },
4539         { 0x3A, "SUBGCN" },
4540         { 0x3B, "UPDPR" },
4541         { 0x3C, "WVCSPFeat" },
4542         /* New in WV-CSP 1.2 */
4543         { 0x3D, "MF" },
4544         { 0x3E, "MG" },
4545         { 0x3F, "MM" },
4546
4547         { 0x00, NULL }
4548 };
4549 /* Note that the table continues in code page 0x08 */
4550
4551 /* Client capability code page (0x03) */
4552 static const value_string wbxml_wv_csp_12_tags_cp3[] = {
4553         /* 0x00 -- 0x04 GLOBAL */
4554         { 0x05, "AcceptedCharset" },
4555         { 0x06, "AcceptedContentLength" },
4556         { 0x07, "AcceptedContentType" },
4557         { 0x08, "AcceptedTransferEncoding" },
4558         { 0x09, "AnyContent" },
4559         { 0x0A, "DefaultLanguage" },
4560         { 0x0B, "InitialDeliveryMethod" },
4561         { 0x0C, "MultiTrans" },
4562         { 0x0D, "ParserSize" },
4563         { 0x0E, "ServerPollMin" },
4564         { 0x0F, "SupportedBearer" },
4565         { 0x10, "SupportedCIRMethod" },
4566         { 0x11, "TCPAddress" },
4567         { 0x12, "TCPPort" },
4568         { 0x13, "UDPPort" },
4569         { 0x14, "CIRURL" },
4570
4571         { 0x00, NULL }
4572 };
4573
4574
4575
4576 /* Presence primitive code page (0x04) */
4577 static const value_string wbxml_wv_csp_12_tags_cp4[] = {
4578         /* 0x00 -- 0x04 GLOBAL */
4579         { 0x05, "CancelAuth-Request" },
4580         { 0x06, "ContactListProperties" },
4581         { 0x07, "CreateAttributeList-Request" },
4582         { 0x08, "CreateList-Request" },
4583         { 0x09, "DefaultAttributeList" },
4584         { 0x0A, "DefaultContactList" },
4585         { 0x0B, "DefaultList" },
4586         { 0x0C, "DeleteAttributeList-Request" },
4587         { 0x0D, "DeleteList-Request" },
4588         { 0x0E, "GetAttributeList-Request" },
4589         { 0x0F, "GetAttributeList-Response" },
4590         { 0x10, "GetList-Request" },
4591         { 0x11, "GetList-Response" },
4592         { 0x12, "GetPresence-Request" },
4593         { 0x13, "GetPresence-Response" },
4594         { 0x14, "GetWatcherList-Request" },
4595         { 0x15, "GetWatcherList-Response" },
4596         { 0x16, "ListManage-Request" },
4597         { 0x17, "ListManage-Response" },
4598         { 0x18, "UnsubscribePresence-Request" },
4599         { 0x19, "PresenceAuth-Request" },
4600         { 0x1A, "PresenceAuth-User" },
4601         { 0x1B, "PresenceNotification-Request" },
4602         { 0x1C, "UpdatePresence-Request" },
4603         { 0x1D, "SubscribePresence-Request" },
4604         /* New in WV-CSP 1.2 */
4605         { 0x1E, "Auto-Subscribe" },
4606         /* 0x1E was defined in WV-CSP 1.0: UnsubscribePresence-Request */
4607         { 0x1F, "GetReactiveAuthStatus-Request" },
4608         /* 0x1F was defined in WV-CSP 1.0: UpdatePresence-Request */
4609         { 0x20, "GetReactiveAuthStatus-Response" },
4610
4611         { 0x00, NULL }
4612 };
4613
4614 /* Presence attribute code page (0x05) */
4615 static const value_string wbxml_wv_csp_12_tags_cp5[] = {
4616         /* 0x00 -- 0x04 GLOBAL */
4617         { 0x05, "Accuracy" },
4618         { 0x06, "Address" },
4619         { 0x07, "AddrPref" },
4620         { 0x08, "Alias" },
4621         { 0x09, "Altitude" },
4622         { 0x0A, "Building" },
4623         { 0x0B, "Caddr" },
4624         { 0x0C, "City" },
4625         { 0x0D, "ClientInfo" },
4626         { 0x0E, "ClientProducer" },
4627         { 0x0F, "ClientType" },
4628         { 0x10, "ClientVersion" },
4629         { 0x11, "CommC" },
4630         { 0x12, "CommCap" },
4631         { 0x13, "ContactInfo" },
4632         { 0x14, "ContainedvCard" },
4633         { 0x15, "Country" },
4634         { 0x16, "Crossing1" },
4635         { 0x17, "Crossing2" },
4636         { 0x18, "DevManufacturer" },
4637         { 0x19, "DirectContent" },
4638         { 0x1A, "FreeTextLocation" },
4639         { 0x1B, "GeoLocation" },
4640         { 0x1C, "Language" },
4641         { 0x1D, "Latitude" },
4642         { 0x1E, "Longitude" },
4643         { 0x1F, "Model" },
4644         { 0x20, "NamedArea" },
4645         { 0x21, "OnlineStatus" },
4646         { 0x22, "PLMN" },
4647         { 0x23, "PrefC" },
4648         { 0x24, "PreferredContacts" },
4649         { 0x25, "PreferredLanguage" },
4650         { 0x26, "ReferredContent" },
4651         { 0x27, "ReferredvCard" },
4652         { 0x28, "Registration" },
4653         { 0x29, "StatusContent" },
4654         { 0x2A, "StatusMood" },
4655         { 0x2B, "StatusText" },
4656         { 0x2C, "Street" },
4657         { 0x2D, "TimeZone" },
4658         { 0x2E, "UserAvailability" },
4659         /* New in WV-CSP 1.1 */
4660         { 0x2F, "Cap" },
4661         { 0x30, "Cname" },
4662         { 0x31, "Contact" },
4663         { 0x32, "Cpriority" },
4664         { 0x33, "Cstatus" },
4665         { 0x34, "Note" },
4666         { 0x35, "Zone" },
4667         /* New in WV-CSP 1.2 */
4668         { 0x36, "ContentType" },
4669         { 0x37, "Inf_link" },
4670         { 0x38, "InfoLink" },
4671         { 0x39, "Link" },
4672         { 0x3A, "Text" },
4673
4674         { 0x00, NULL }
4675 };
4676
4677 /* Messaging code page (0x06) */
4678 static const value_string wbxml_wv_csp_12_tags_cp6[] = {
4679         /* 0x00 -- 0x04 GLOBAL */
4680         { 0x05, "BlockList" },
4681         { 0x06, "BlockEntity-Request" }, /* Was: BlockUser-Request */
4682         { 0x07, "DeliveryMethod" },
4683         { 0x08, "DeliveryReport" },
4684         { 0x09, "DeliveryReport-Request" },
4685         { 0x0A, "ForwardMessage-Request" },
4686         { 0x0B, "GetBlockedList-Request" },
4687         { 0x0C, "GetBlockedList-Response" },
4688         { 0x0D, "GetMessageList-Request" },
4689         { 0x0E, "GetMessageList-Response" },
4690         { 0x0F, "GetMessage-Request" },
4691         { 0x10, "GetMessage-Response" },
4692         { 0x11, "GrantList" },
4693         { 0x12, "MessageDelivered" },
4694         { 0x13, "MessageInfo" },
4695         { 0x14, "MessageNotification" },
4696         { 0x15, "NewMessage" },
4697         { 0x16, "RejectMessage-Request" },
4698         { 0x17, "SendMessage-Request" },
4699         { 0x18, "SendMessage-Response" },
4700         { 0x19, "SetDeliveryMethod-Request" },
4701         { 0x1A, "DeliveryTime" },
4702
4703         { 0x00, NULL }
4704 };
4705
4706 /* Group code page (0x07) */
4707 static const value_string wbxml_wv_csp_12_tags_cp7[] = {
4708         /* 0x00 -- 0x04 GLOBAL */
4709         { 0x05, "AddGroupMembers-Request" },
4710         { 0x06, "Admin" },
4711         { 0x07, "CreateGroup-Request" },
4712         { 0x08, "DeleteGroup-Request" },
4713         { 0x09, "GetGroupMembers-Request" },
4714         { 0x0A, "GetGroupMembers-Response" },
4715         { 0x0B, "GetGroupProps-Request" },
4716         { 0x0C, "GetGroupProps-Response" },
4717         { 0x0D, "GroupChangeNotice" },
4718         { 0x0E, "GroupProperties" },
4719         { 0x0F, "Joined" },
4720         { 0x10, "JoinedRequest" },
4721         { 0x11, "JoinGroup-Request" },
4722         { 0x12, "JoinGroup-Response" },
4723         { 0x13, "LeaveGroup-Request" },
4724         { 0x14, "LeaveGroup-Response" },
4725         { 0x15, "Left" },
4726         { 0x16, "MemberAccess-Request" },
4727         { 0x17, "Mod" },
4728         { 0x18, "OwnProperties" },
4729         { 0x19, "RejectList-Request" },
4730         { 0x1A, "RejectList-Response" },
4731         { 0x1B, "RemoveGroupMembers-Request" },
4732         { 0x1C, "SetGroupProps-Request" },
4733         { 0x1D, "SubscribeGroupNotice-Request" },
4734         { 0x1E, "SubscribeGroupNotice-Response" },
4735         { 0x1F, "Users" },
4736         { 0x20, "WelcomeNote" },
4737         /* New in WV-CSP 1.1 */
4738         { 0x21, "JoinGroup" },
4739         { 0x22, "SubscribeNotification" },
4740         { 0x23, "SubscribeType" },
4741         /* New in WV-CSP 1.2 */
4742         { 0x24, "GetJoinedUsers-Request" },
4743         { 0x25, "GetJoinedUsers-Response" },
4744         { 0x26, "AdminMapList" },
4745         { 0x27, "AdminMapping" },
4746         { 0x28, "Mapping" },
4747         { 0x29, "ModMapping" },
4748         { 0x2A, "UserMapList" },
4749         { 0x2B, "UserMapping" },
4750
4751         { 0x00, NULL }
4752 };
4753
4754 /* Service negotiation code page - continued (0x08) */
4755 static const value_string wbxml_wv_csp_12_tags_cp8[] = {
4756         /* 0x00 -- 0x04 GLOBAL */
4757         { 0x05, "MP" },
4758         { 0x06, "GETAUT" },
4759         { 0x07, "GETJU" },
4760         { 0x08, "VRID" },
4761         { 0x09, "VerifyIDFunc" },
4762
4763         { 0x00, NULL }
4764 };
4765
4766 /* Common code page - continued (0x09) */
4767 static const value_string wbxml_wv_csp_12_tags_cp9[] = {
4768         /* 0x00 -- 0x04 GLOBAL */
4769         { 0x05, "CIR" },
4770         { 0x06, "Domain" },
4771         { 0x07, "ExtBlock" },
4772         { 0x08, "HistoryPeriod" },
4773         { 0x09, "IDList" },
4774         { 0x0A, "MaxWatcherList" },
4775         { 0x0B, "ReactiveAuthState" },
4776         { 0x0C, "ReactiveAuthStatus" },
4777         { 0x0D, "ReactiveAuthStatusList" },
4778         { 0x0E, "Watcher" },
4779         { 0x0F, "WatcherStatus" },
4780
4781         { 0x00, NULL }
4782 };
4783
4784 /* Access code page - continued (0x0A) */
4785 static const value_string wbxml_wv_csp_12_tags_cp10[] = {
4786         /* 0x00 -- 0x04 GLOBAL */
4787         { 0x05, "WV-CSP-NSDiscovery-Request" },
4788         { 0x06, "WV-CSP-NSDiscovery-Response" },
4789         { 0x07, "VersionList" },
4790
4791         { 0x00, NULL }
4792 };
4793
4794 /*****    Attribute Start tokens   *****/
4795 /* Common code page (0x00) */
4796 static const value_string wbxml_wv_csp_12_attrStart_cp0[] = {
4797         /* 0x00 -- 0x04 GLOBAL */
4798         { 0x05, "xmlns='http://www.wireless-village.org/CSP'" },
4799         { 0x06, "xmlns='http://www.wireless-village.org/PA'" },
4800         { 0x07, "xmlns='http://www.wireless-village.org/TRC'" },
4801         /* New in WV-CSP 1.2 */
4802         { 0x08, "xmlns='http://www.openmobilealliance.org/DTD/WV-CSP'" },
4803         { 0x09, "xmlns='http://www.openmobilealliance.org/DTD/WV-PA'" },
4804         { 0x0A, "xmlns http://www.openmobilealliance.org/DTD/WV-TRC'" },
4805
4806         { 0x00, NULL }
4807 };
4808
4809 /*****    Attribute Value tokens   *****/
4810 /*
4811  * Element value tokens
4812  *
4813  * NOTE - WV-CSP uses the EXT_T_0 token in a peculiar way: the mb_u_int32
4814  * does *not* reference an offset in the string table, but it refers to
4815  * the index in the following value_string.
4816  *
4817  * Please note that:
4818  *  - Values 'T' and 'F' are Boolean values representing "True" and "False"
4819  *    (or "Yes" and "No" in some circumstances) respectively.
4820  *  - Values 'GR', 'IM', 'PR', 'SC', 'GM' and 'US' are enumerated values
4821  *    representing "Group", "Instant Messaging", "Presence", "Shared Content",
4822  *    "Group membership" and "User" respectively.
4823  *  - Values 'G', 'S' and 'U' are enumerated values representing "Get", "Set"
4824  *    and "Unset" respectively.
4825  *  - Values 'N' and 'P' are enumerated values representing "Notify/Get" and
4826  *    "Push" respectively.
4827  *
4828  * I repeat: this is NOT a attrValue[] array hence it is not called
4829  * wbxml_wv_XXX but vals_wv_XXX.
4830  */
4831 static const value_string vals_wv_csp_12_element_value_tokens[] = {
4832         /*
4833          * Common value tokens
4834          */
4835         { 0x00, "AccessType" },
4836         { 0x01, "ActiveUsers" },
4837         { 0x02, "Admin" },
4838         { 0x03, "application/" },
4839         { 0x04, "application/vnd.wap.mms-message" },
4840         { 0x05, "application/x-sms" },
4841         { 0x06, "AutoJoin" },
4842         { 0x07, "BASE64" },
4843         { 0x08, "Closed" },
4844         { 0x09, "Default" },
4845         { 0x0A, "DisplayName" },
4846         { 0x0B, "F" },
4847         { 0x0C, "G" },
4848         { 0x0D, "GR" },
4849         { 0x0E, "http://" },
4850         { 0x0F, "https://" },
4851         { 0x10, "image/" },
4852         { 0x11, "Inband" },
4853         { 0x12, "IM" },
4854         { 0x13, "MaxActiveUsers" },
4855         { 0x14, "Mod" },
4856         { 0x15, "Name" },
4857         { 0x16, "None" },
4858         { 0x17, "N" },
4859         { 0x18, "Open" },
4860         { 0x19, "Outband" },
4861         { 0x1A, "PR" },
4862         { 0x1B, "Private" },
4863         { 0x1C, "PrivateMessaging" },
4864         { 0x1D, "PrivilegeLevel" },
4865         { 0x1E, "Public" },
4866         { 0x1F, "P" },
4867         { 0x20, "Request" },
4868         { 0x21, "Response" },
4869         { 0x22, "Restricted" },
4870         { 0x23, "ScreenName" },
4871         { 0x24, "Searchable" },
4872         { 0x25, "S" },
4873         { 0x26, "SC" },
4874         { 0x27, "text/" },
4875         { 0x28, "text/plain" },
4876         { 0x29, "text/x-vCalendar" },
4877         { 0x2A, "text/x-vCard" },
4878         { 0x2B, "Topic" },
4879         { 0x2C, "T" },
4880         { 0x2D, "Type" },
4881         { 0x2E, "U" },
4882         { 0x2F, "US" },
4883         { 0x30, "www.wireless-village.org" },
4884         /* New in WV-CSP 1.2 */
4885         { 0x31, "AutoDelete" },
4886         { 0x32, "GM" },
4887         { 0x33, "Validity" },
4888         { 0x34, "DENIED" },
4889         { 0x35, "GRANTED" },
4890         { 0x36, "PENDING" },
4891         { 0x37, "ShowID" },
4892
4893         /*
4894          * Access value tokens
4895          */
4896         { 0x3D, "GROUP_ID" },
4897         { 0x3E, "GROUP_NAME" },
4898         { 0x3F, "GROUP_TOPIC" },
4899         { 0x40, "GROUP_USER_ID_JOINED" },
4900         { 0x41, "GROUP_USER_ID_OWNER" },
4901         { 0x42, "HTTP" },
4902         { 0x43, "SMS" },
4903         { 0x44, "STCP" },
4904         { 0x45, "SUDP" },
4905         { 0x46, "USER_ALIAS" },
4906         { 0x47, "USER_EMAIL_ADDRESS" },
4907         { 0x48, "USER_FIRST_NAME" },
4908         { 0x49, "USER_ID" },
4909         { 0x4A, "USER_LAST_NAME" },
4910         { 0x4B, "USER_MOBILE_NUMBER" },
4911         { 0x4C, "USER_ONLINE_STATUS" },
4912         { 0x4D, "WAPSMS" },
4913         { 0x4E, "WAPUDP" },
4914         { 0x4F, "WSP" },
4915         /* New in WV-CSP 1.2 */
4916         { 0x50, "GROUP_USER_ID_AUTOJOIN" },
4917         /*
4918          * Presence value tokens
4919          */
4920         { 0x5B, "ANGRY" },
4921         { 0x5C, "ANXIOUS" },
4922         { 0x5D, "ASHAMED" },
4923         { 0x5E, "AUDIO_CALL" },
4924         { 0x5F, "AVAILABLE" },
4925         { 0x60, "BORED" },
4926         { 0x61, "CALL" },
4927         { 0x62, "CLI" },
4928         { 0x63, "COMPUTER" },
4929         { 0x64, "DISCREET" },
4930         { 0x65, "EMAIL" },
4931         { 0x66, "EXCITED" },
4932         { 0x67, "HAPPY" },
4933         /*      { 0x68, "IM" },         Obsolete */
4934         { 0x69, "IM_OFFLINE" },
4935         { 0x6A, "IM_ONLINE" },
4936         { 0x6B, "IN_LOVE" },
4937         { 0x6C, "INVINCIBLE" },
4938         { 0x6D, "JEALOUS" },
4939         { 0x6E, "MMS" },
4940         { 0x6F, "MOBILE_PHONE" },
4941         { 0x70, "NOT_AVAILABLE" },
4942         { 0x71, "OTHER" },
4943         { 0x72, "PDA" },
4944         { 0x73, "SAD" },
4945         { 0x74, "SLEEPY" },
4946         { 0x75, "SMS" },
4947         { 0x76, "VIDEO_CALL" },
4948         { 0x77, "VIDEO_STREAM" },
4949
4950         /*
4951          * Access value tokens - continued
4952          */
4953         { 0xA4, "SSMS" },
4954         { 0xA5, "SHTTP" },
4955
4956         { 0x00, NULL }
4957 };
4958
4959
4960
4961 /***** Token code page aggregation *****/
4962
4963 static char *
4964 ext_t_0_wv_cspc_12(tvbuff_t *tvb _U_, guint32 value, guint32 str_tbl _U_)
4965 {
4966         char *str = g_strdup_printf("Common Value: '%s'",
4967                                     val_to_str(value, vals_wv_csp_12_element_value_tokens,
4968                                                "<Unknown WV-CSP 1.2 Common Value token 0x%X>"));
4969         return str;
4970 }
4971
4972 #define wbxml_wv_csp_12_global wbxml_wv_csp_11_global
4973
4974 static const value_valuestring wbxml_wv_csp_12_tags[] = {
4975         {  0, wbxml_wv_csp_12_tags_cp0 },
4976         {  1, wbxml_wv_csp_12_tags_cp1 },
4977         {  2, wbxml_wv_csp_12_tags_cp2 },
4978         {  3, wbxml_wv_csp_12_tags_cp3 },
4979         {  4, wbxml_wv_csp_12_tags_cp4 },
4980         {  5, wbxml_wv_csp_12_tags_cp5 },
4981         {  6, wbxml_wv_csp_12_tags_cp6 },
4982         {  7, wbxml_wv_csp_12_tags_cp7 },
4983         {  8, wbxml_wv_csp_12_tags_cp8 },
4984         {  9, wbxml_wv_csp_12_tags_cp9 },
4985         { 10, wbxml_wv_csp_12_tags_cp10 },
4986         {  0, NULL }
4987 };
4988
4989 static const value_valuestring wbxml_wv_csp_12_attrStart[] = {
4990         { 0, wbxml_wv_csp_12_attrStart_cp0 },
4991         { 0, NULL }
4992 };
4993
4994 static const wbxml_decoding decode_wv_cspc_12 = {
4995         "Wireless-Village Client-Server Protocol 1.2",
4996         "WV-CSP 1.2",
4997         { ext_t_0_wv_cspc_12, NULL, NULL },
4998         wv_csp12_opaque_binary_tag,
4999         wv_csp12_opaque_literal_tag,
5000         default_opaque_binary_attr,
5001         default_opaque_literal_attr,
5002         wbxml_wv_csp_12_global,
5003         wbxml_wv_csp_12_tags,
5004         wbxml_wv_csp_12_attrStart,
5005         NULL
5006 };
5007
5008
5009 /* WV-CSP 1.3
5010  *
5011  * Wireless Village Client Server Protocol
5012  ***************************************/
5013
5014 /*****   Global extension tokens   *****/
5015 /* Same as WV-CSP 1.1 */
5016
5017 /*****         Tag tokens          *****/
5018 /* Common code page */
5019 static const value_string wbxml_wv_csp_13_tags_cp0[] = {
5020         /* 0x00 -- 0x04 GLOBAL */
5021         { 0x05, "Acceptance"},
5022         { 0x06, "AddList" },
5023         { 0x07, "AddNickList"},
5024         { 0x09, "WV-CSP-Message"},
5025         { 0x0A, "ClientID"},
5026         { 0x0B, "Code"},
5027         { 0x0C, "ContactList"},
5028         { 0x0D, "ContentData"},
5029         { 0x0E, "ContentEncoding"},
5030         { 0x0F, "ContentSize"   },
5031         { 0x10, "ContentType"},
5032         { 0x11, "DateTime"   },
5033         { 0x12, "Description" },
5034         { 0x13, "DetailedResult"},
5035         { 0x14, "EntityList"},
5036         { 0x15, "Group"  },
5037         { 0x16, "GroupID"},
5038         { 0x17, "GroupList"},
5039         { 0x19, "Logo"},
5040         { 0x1A, "MessageCount" },
5041         { 0x1B, "MessageID" },
5042         { 0x1C, "MessageURI"},
5043         { 0x1D, "MSISDN" },
5044         { 0x1E, "Name"},
5045         { 0x1F, "NickList"},
5046         { 0x20, "NickName"},
5047         { 0x21, "Poll"},
5048         { 0x22, "Presence"},
5049         { 0x23, "PresenceSubList" },
5050         { 0x24, "PresenceValue"},
5051         { 0x25, "Property"  },
5052         { 0x26, "Qualifier" },
5053         { 0x27, "Recipient" },
5054         { 0x28, "RemoveList"},
5055         { 0x29, "RemoveNickList"  },
5056         { 0x2A, "Result" },
5057         { 0x2B, "ScreenName"},
5058         { 0x2C, "Sender" },
5059         { 0x2D, "Session"},
5060         { 0x2E, "SessionDescriptor" },
5061         { 0x2F, "SessionID"},
5062         { 0x30, "SessionType" },
5063         { 0x08, "SName" },
5064         { 0x31, "Status"},
5065         { 0x32, "Transaction" },
5066         { 0x33, "TransactionContent"  },
5067         { 0x34, "TransactionDescriptor"},
5068         { 0x35, "TransactionID"},
5069         { 0x36, "TransactionMode" },
5070         { 0x37, "URL" },
5071         { 0x38, "URLList"},
5072         { 0x39, "User"},
5073         { 0x3A, "UserID" },
5074         { 0x3B, "UserList"  },
5075         { 0x3C, "Validity"  },
5076         { 0x3D, "Value"  },
5077
5078         { 0x00, NULL }
5079 };
5080 /* Note that the table continues in code page 0x09 */
5081
5082 /* Access code page (0x01) */
5083 static const value_string wbxml_wv_csp_13_tags_cp1[] = {
5084         /* 0x00 -- 0x04 GLOBAL */
5085         { 0x05, "AllFunctions" },
5086         { 0x06, "AllFunctionsRequest" },
5087         { 0x07, "CancelInvite-Request" },
5088         { 0x08, "CancelInviteUser-Request" },
5089         /*      { 0x09, "Capability" }, - removed in WV 1.3*/
5090         { 0x0A, "CapabilityList" },
5091         { 0x0B, "CapabilityRequest" },
5092         { 0x0C, "ClientCapability-Request" },
5093         { 0x0D, "ClientCapability-Response" },
5094         { 0x0E, "DigestBytes" },
5095         { 0x0F, "DigestSchema" },
5096         { 0x10, "Disconnect" },
5097         { 0x11, "Functions" },
5098         { 0x12, "GetSPInfo-Request" },
5099         { 0x13, "GetSPInfo-Response" },
5100         { 0x14, "InviteID" },
5101         { 0x15, "InviteNote" },
5102         { 0x16, "Invite-Request" },
5103         { 0x17, "Invite-Response" },
5104         { 0x18, "InviteType" },
5105         { 0x19, "InviteUser-Request" },
5106         { 0x1A, "InviteUser-Response" },
5107         { 0x1B, "KeepAlive-Request" },
5108         { 0x1C, "KeepAliveTime" },
5109         { 0x1D, "Login-Request" },
5110         { 0x1E, "Login-Response" },
5111         { 0x1F, "Logout-Request" },
5112         { 0x20, "Nonce" },
5113         { 0x21, "Password" },
5114         { 0x22, "Polling-Request" },
5115         { 0x23, "ResponseNote" },
5116         { 0x24, "SearchElement" },
5117         { 0x25, "SearchFindings" },
5118         { 0x26, "SearchID" },
5119         { 0x27, "SearchIndex" },
5120         { 0x28, "SearchLimit" },
5121         { 0x29, "KeepAlive-Response" },
5122         { 0x2A, "SearchPairList" },
5123         { 0x2B, "Search-Request" },
5124         { 0x2C, "Search-Response" },
5125         { 0x2D, "SearchResult" },
5126         { 0x2E, "Service-Request" },
5127         { 0x2F, "Service-Response" },
5128         { 0x30, "SessionCookie" },
5129         { 0x31, "StopSearch-Request" },
5130         { 0x32, "TimeToLive" },
5131         /* New in WV-CSP 1.1 */
5132         { 0x33, "SearchString" },
5133         { 0x34, "CompletionFlag" },
5134         /* New in WV-CSP 1.2 */
5135         { 0x36, "ReceiveList" },
5136         { 0x37, "VerifyID-Request" },
5137         { 0x38, "Extended-Request" },
5138         { 0x39, "Extended-Response" },
5139         { 0x3A, "AgreedCapabilityList" },
5140         { 0x3B, "ExtendedData" },
5141         { 0x3C, "OtherServer" },
5142         { 0x3D, "PresenceAttributeNSName" },
5143         { 0x3E, "SessionNSName" },
5144         { 0x3F, "TransactionNSName" },
5145
5146         { 0x00, NULL }
5147 };
5148 /* Note that the table continues in code page 0x0A */
5149
5150 /* Service code page (0x02) */
5151 static const value_string wbxml_wv_csp_13_tags_cp2[] = {
5152         /* 0x00 -- 0x04 GLOBAL */
5153         { 0x05, "ADDGM" },
5154         /*      { 0x06, "AttListFunc" }, removed in WV 1.3 */
5155         { 0x07, "BLENT" },
5156         /*      { 0x08, "CAAUT" }, removed in WV 1.3 */
5157         { 0x09, "CAINV" },
5158         /*      { 0x0A, "CALI" }, removed in WV 1.3 */
5159         { 0x0B, "CCLI" },
5160         { 0x0C, "ContListFunc" },
5161         { 0x0D, "CREAG" },
5162         { 0x0E, "DALI" },
5163         { 0x0F, "DCLI" },
5164         { 0x10, "DELGR" },
5165         { 0x11, "FundamentalFeat" },
5166         { 0x12, "FWMSG" },
5167         /*      { 0x13, "GALS" }, removed in WV 1.3 */
5168         { 0x14, "GCLI" },
5169         { 0x15, "GETGM" },
5170         { 0x16, "GETGP" },
5171         { 0x17, "GETLM" },
5172         { 0x18, "GETM" },
5173         { 0x19, "GETPR" },
5174         { 0x1A, "GETSPI" },
5175         { 0x1B, "GETWL" },
5176         { 0x1C, "GLBLU" },
5177         { 0x1D, "GRCHN" },
5178         { 0x1E, "GroupAuthFunc" },
5179         { 0x1F, "GroupFeat" },
5180         { 0x20, "GroupMgmtFunc" },
5181         { 0x21, "GroupUseFunc" },
5182         { 0x22, "IMAuthFunc" },
5183         { 0x23, "IMFeat" },
5184         { 0x24, "IMReceiveFunc" },
5185         { 0x25, "IMSendFunc" },
5186         { 0x26, "INVIT" },
5187         { 0x27, "InviteFunc" },
5188         { 0x28, "MBRAC" },
5189         { 0x29, "MCLS" },
5190         { 0x2A, "MDELIV" },
5191         { 0x2B, "NEWM" },
5192         { 0x2C, "NOTIF" },
5193         { 0x2D, "PresenceAuthFunc" },
5194         { 0x2E, "PresenceDeliverFunc"},
5195         { 0x2F, "PresenceFeat" },
5196         /*      { 0x30, "REACT" }, removed in WV 1.3 */
5197         { 0x31, "REJCM" },
5198         { 0x32, "REJEC" },
5199         { 0x33, "RMVGM" },
5200         { 0x34, "SearchFunc" },
5201         { 0x35, "ServiceFunc" },
5202         { 0x36, "SETD" },
5203         { 0x37, "SETGP" },
5204         { 0x38, "SRCH" },
5205         { 0x39, "STSRC" },
5206         { 0x3A, "SUBGCN" },
5207         { 0x3B, "UPDPR" },
5208         { 0x3C, "WVCSPFeat" },
5209         /* New in WV-CSP 1.2 */
5210         { 0x3D, "MF" },
5211         { 0x3E, "MG" },
5212         { 0x3F, "MM" },
5213
5214         { 0x00, NULL }
5215 };
5216 /* Note that the table continues in code page 0x08 */
5217
5218 /* Client capability code page (0x03) */
5219 static const value_string wbxml_wv_csp_13_tags_cp3[] = {
5220         /* 0x00 -- 0x04 GLOBAL */
5221         /*  {0x05, "AcceptedCharset"}, - removed in WV 1.3 */
5222         /*  { 0x06, "AcceptedContentLength"}, - removed in WV 1.3 */
5223         { 0x07, "AcceptedContentType"},
5224         { 0x08, "AcceptedTransferEncoding"},
5225         { 0x09, "AnyContent"},
5226         { 0x0A, "DefaultLanguage"},
5227         { 0x0B, "InitialDeliveryMethod"},
5228         { 0x0C, "MultiTrans"},
5229         { 0x0D, "ParserSize"},
5230         { 0x0E, "ServerPollMin"},
5231         { 0x0F, "SupportedBearer"},
5232         { 0x10, "SupportedCIRMethod"},
5233         { 0x11, "TCPAddress"},
5234         { 0x12, "TCPPort"},
5235         { 0x13, "UDPPort"},
5236         /* New in WV-CSP 1.3*/
5237         { 0x14, "CIRHTTPAddress"},
5238         { 0x15, "UDPAddress"},
5239         { 0x16, "AcceptedPullLength"},
5240         { 0x17, "AcceptedPushLength"},
5241         { 0x18, "AcceptedRichContentLength"},
5242         { 0x19, "AcceptedTextContentLength"},
5243         { 0x1A, "OfflineETEMHandling"},
5244         { 0x1B, "PlainTextCharset"},
5245         { 0x1C, "SessionPriority"},
5246         { 0x1D, "SupportedOfflineBearer"},
5247         { 0x1F, "UserSessionLimit"},
5248         { 0x20, "CIRSMSAddress"},
5249         { 0x21, "MultiTransPerMessage"},
5250         { 0x22, "OnlineETEMHandling"},
5251         { 0x23,"ContentPolicy"},
5252         { 0x24, "ContentPolicyLimit"},
5253
5254         { 0x00, NULL }
5255 };
5256
5257 /* Presence primitive code page (0x04) */
5258 static const value_string wbxml_wv_csp_13_tags_cp4[] = {
5259         /* 0x00 -- 0x04 GLOBAL */
5260         /*      { 0x05, "CancelAuth-Request" }, - removed in WV 1.3 */
5261         { 0x06, "ContactListProperties" },
5262         { 0x07, "CreateAttributeList-Request" },
5263         { 0x08, "CreateList-Request" },
5264         { 0x09, "DefaultAttributeList" },
5265         { 0x0A, "DefaultContactList" },
5266         { 0x0B, "DefaultList" },
5267         { 0x0C, "DeleteAttributeList-Request" },
5268         { 0x0D, "DeleteList-Request" },
5269         { 0x0E, "GetAttributeList-Request" },
5270         { 0x0F, "GetAttributeList-Response" },
5271         { 0x10, "GetList-Request" },
5272         { 0x11, "GetList-Response" },
5273         { 0x12, "GetPresence-Request" },
5274         { 0x13, "GetPresence-Response" },
5275         { 0x14, "GetWatcherList-Request" },
5276         { 0x15, "GetWatcherList-Response" },
5277         { 0x16, "ListManage-Request" },
5278         { 0x17, "ListManage-Response" },
5279         { 0x18, "UnsubscribePresence-Request" },
5280         { 0x19, "PresenceAuth-Request" },
5281         { 0x1A, "PresenceAuth-User" },
5282         { 0x1B, "PresenceNotification-Request" },
5283         { 0x1C, "UpdatePresence-Request" },
5284         { 0x1D, "SubscribePresence-Request" },
5285         /* New in WV-CSP 1.2 */
5286         /*      { 0x1E, "Auto-Subscribe" }, - removed in WV 1.3 */
5287         /*      { 0x1F, "GetReactiveAuthStatus-Request" }, */
5288         /*      { 0x20, "GetReactiveAuthStatus-Response" }, */
5289         /* New in WV-CSP 1.3 */
5290         { 0x21, "CreateList-Response"},
5291
5292         { 0x00, NULL }
5293 };
5294
5295 /* Presence attribute code page (0x05) */
5296 static const value_string wbxml_wv_csp_13_tags_cp5[] = {
5297         /* 0x00 -- 0x04 GLOBAL */
5298         { 0x05, "Accuracy" },
5299         { 0x06, "Address" },
5300         { 0x07, "AddrPref" },
5301         { 0x08, "Alias" },
5302         { 0x09, "Altitude" },
5303         { 0x0A, "Building" },
5304         { 0x0B, "Caddr" },
5305         { 0x0C, "City" },
5306         { 0x0D, "ClientInfo" },
5307         { 0x0E, "ClientProducer" },
5308         { 0x0F, "ClientType" },
5309         { 0x10, "ClientVersion" },
5310         { 0x11, "CommC" },
5311         { 0x12, "CommCap" },
5312         { 0x13, "ContactInfo" },
5313         { 0x14, "ContainedvCard" },
5314         { 0x15, "Country" },
5315         { 0x16, "Crossing1" },
5316         { 0x17, "Crossing2" },
5317         { 0x18, "DevManufacturer" },
5318         { 0x19, "DirectContent" },
5319         { 0x1A, "FreeTextLocation" },
5320         { 0x1B, "GeoLocation" },
5321         { 0x1C, "Language" },
5322         { 0x1D, "Latitude" },
5323         { 0x1E, "Longitude" },
5324         { 0x1F, "Model" },
5325         { 0x20, "NamedArea" },
5326         { 0x21, "OnlineStatus" },
5327         { 0x22, "PLMN" },
5328         { 0x23, "PrefC" },
5329         { 0x24, "PreferredContacts" },
5330         { 0x25, "PreferredLanguage" },
5331         { 0x26, "ReferredContent" },
5332         { 0x27, "ReferredvCard" },
5333         { 0x28, "Registration" },
5334         { 0x29, "StatusContent" },
5335         { 0x2A, "StatusMood" },
5336         { 0x2B, "StatusText" },
5337         { 0x2C, "Street" },
5338         { 0x2D, "TimeZone" },
5339         { 0x2E, "UserAvailability" },
5340         /* New in WV-CSP 1.1 */
5341         { 0x2F, "Cap" },
5342         { 0x30, "Cname" },
5343         { 0x31, "Contact" },
5344         { 0x32, "Cpriority" },
5345         { 0x33, "Cstatus" },
5346         { 0x34, "Note" },
5347         { 0x35, "Zone" },
5348         /* New in WV-CSP 1.2 */
5349         { 0x36, "ContentType" },
5350         { 0x37, "Inf_link" },
5351         { 0x38, "InfoLink" },
5352         { 0x39, "Link" },
5353         { 0x3A, "Text" },
5354         /* New in WV-CSP 1.3 */
5355         { 0x3B, "ClientContentLimit"},
5356         { 0x3C, "ClientIMPriority"},
5357         { 0x3D, "MaxPullLength"},
5358         { 0x3E, "MaxPushLength"},
5359
5360         { 0x00, NULL }
5361 };
5362
5363 /* Messaging code page (0x06) */
5364 static const value_string wbxml_wv_csp_13_tags_cp6[] = {
5365         /* 0x00 -- 0x04 GLOBAL */
5366         { 0x05, "BlockList" },
5367         { 0x06, "BlockEntity-Request" }, /* Was: BlockUser-Request */
5368         { 0x07, "DeliveryMethod" },
5369         { 0x08, "DeliveryReport" },
5370         { 0x09, "DeliveryReport-Request" },
5371         { 0x0A, "ForwardMessage-Request" },
5372         { 0x0B, "GetBlockedList-Request" },
5373         { 0x0C, "GetBlockedList-Response" },
5374         { 0x0D, "GetMessageList-Request" },
5375         { 0x0E, "GetMessageList-Response" },
5376         { 0x0F, "GetMessage-Request" },
5377         { 0x10, "GetMessage-Response" },
5378         { 0x11, "GrantList" },
5379         { 0x12, "MessageDelivered" },
5380         { 0x13, "MessageInfo" },
5381         { 0x14, "MessageNotification" },
5382         { 0x15, "NewMessage" },
5383         { 0x16, "RejectMessage-Request" },
5384         { 0x17, "SendMessage-Request" },
5385         { 0x18, "SendMessage-Response" },
5386         { 0x19, "SetDeliveryMethod-Request" },
5387         { 0x1A, "DeliveryTime" },
5388         /* New in WV-CSP 1.3 */
5389         { 0x20, "MessageInfoList"},
5390         { 0x21, "ForwardMessage-Response"},
5391
5392         { 0x00, NULL }
5393 };
5394
5395 /* Group code page (0x07) */
5396 static const value_string wbxml_wv_csp_13_tags_cp7[] = {
5397         /* 0x00 -- 0x04 GLOBAL */
5398         { 0x05, "AddGroupMembers-Request" },
5399         { 0x06, "Admin" },
5400         { 0x07, "CreateGroup-Request" },
5401         { 0x08, "DeleteGroup-Request" },
5402         { 0x09, "GetGroupMembers-Request" },
5403         { 0x0A, "GetGroupMembers-Response" },
5404         { 0x0B, "GetGroupProps-Request" },
5405         { 0x0C, "GetGroupProps-Response" },
5406         { 0x0D, "GroupChangeNotice" },
5407         { 0x0E, "GroupProperties" },
5408         { 0x0F, "Joined" },
5409         { 0x10, "JoinedRequest" },
5410         { 0x11, "JoinGroup-Request" },
5411         { 0x12, "JoinGroup-Response" },
5412         { 0x13, "LeaveGroup-Request" },
5413         { 0x14, "LeaveGroup-Response" },
5414         { 0x15, "Left" },
5415         { 0x16, "MemberAccess-Request" },
5416         { 0x17, "Mod" },
5417         { 0x18, "OwnProperties" },
5418         { 0x19, "RejectList-Request" },
5419         { 0x1A, "RejectList-Response" },
5420         { 0x1B, "RemoveGroupMembers-Request" },
5421         { 0x1C, "SetGroupProps-Request" },
5422         { 0x1D, "SubscribeGroupNotice-Request" },
5423         { 0x1E, "SubscribeGroupNotice-Response" },
5424         /*      { 0x1F, "Users" },  - removed in WV 1.3 */
5425         { 0x20, "WelcomeNote" },
5426         /* New in WV-CSP 1.1 */
5427         { 0x21, "JoinGroup" },
5428         { 0x22, "SubscribeNotification" },
5429         { 0x23, "SubscribeType" },
5430         /* New in WV-CSP 1.2 */
5431         { 0x24, "GetJoinedUsers-Request" },
5432         { 0x25, "GetJoinedUsers-Response" },
5433         { 0x26, "AdminMapList" },
5434         { 0x27, "AdminMapping" },
5435         { 0x28, "Mapping" },
5436         { 0x29, "ModMapping" },
5437         { 0x2A, "UserMapList" },
5438         { 0x2B, "UserMapping" },
5439         /* New in WV-CSP 1.3 */
5440         { 0x2C, "JoinedBlocked" },
5441         { 0x2D, "LeftBlocked" },
5442
5443         { 0x00, NULL }
5444 };
5445
5446 /* Service negotiation code page - continued (0x08) */
5447 static const value_string wbxml_wv_csp_13_tags_cp8[] = {
5448         /* 0x00 -- 0x04 GLOBAL */
5449         /* New in WV-CSP 1.2 */
5450         { 0x05, "MP" },
5451         { 0x06, "GETAUT" },
5452         { 0x07, "GETJU" },
5453         { 0x08, "VRID" },
5454         { 0x09, "VerifyIDFunc" },
5455         /* New in WV-CSP 1.3 */
5456         { 0x0A, "GETMAP" },
5457         { 0x0B, "SGMNT" },
5458         { 0x0C, "EXCON" },
5459         { 0x0D, "OFFNOTIF" },
5460         { 0x0E, "ADVSR" },
5461
5462         { 0x00, NULL }
5463 };
5464
5465 /* Common code page - continued (0x09) */
5466 static const value_string wbxml_wv_csp_13_tags_cp9[] = {
5467         /* 0x00 -- 0x04 GLOBAL */
5468         /* New in WV-CSP 1.2 */
5469         { 0x05, "CIR" },
5470         { 0x06, "Domain" },
5471         { 0x07, "ExtBlock" },
5472         { 0x08, "HistoryPeriod" },
5473         { 0x09, "IDList" },
5474         { 0x0A, "MaxWatcherList" },
5475         /*      { 0x0B, "ReactiveAuthState" }, - removed in WV 1.3 */
5476         /*      { 0x0C, "ReactiveAuthStatus" }, - removed in WV 1.3 */
5477         /*      { 0x0D, "ReactiveAuthStatusList" }, - removed in WV 1.3 */
5478         { 0x0E, "Watcher" },
5479         { 0x0F, "WatcherStatus" },
5480         /* New in WV-CSP 1.3 */
5481         { 0x1B, "AnswerOption"},
5482         { 0x1C, "AnswerOptionID" },
5483         { 0x1D, "AnswerOptions"},
5484         { 0x0B, "AnswerOptionText"},
5485         { 0x1E, "ApplicationID"},
5486         { 0x1F, "AuthorizeAndGrant"},
5487         { 0x20, "ChosenOptionID"},
5488         { 0x19, "ClearPublicProfile"},
5489         { 0x13, "Color"},
5490         { 0x21, "ContactListNotify"},
5491         { 0x14, "ContentName"},
5492         { 0x22, "DefaultNotify"},
5493         { 0x39, "ExtBlockETEM"},
5494         { 0x36, "ExtendConversationID"},
5495         { 0x23, "ExtendConversationUser"},
5496         { 0x10, "Font"},
5497         { 0x18, "FriendlyName"},
5498         { 0x34 , "GetMap-Request"},
5499         { 0x35, "GetMap-Response"},
5500         { 0x3A, "GroupContentLimit" },
5501         { 0x24, "InText"},
5502         { 0x15, "Map"},
5503         { 0x3B, "MessageTotalCount"},
5504         { 0x16, "NotificationType"},
5505         { 0x17, "NotificationTypeList"},
5506         { 0x1A, "PublicProfile"},
5507         { 0x38, "RequiresResponse"},
5508         { 0x25, "SegmentCount"},
5509         { 0x26, "SegmentID"     },
5510         { 0x27, "SegmentInfo"},
5511         { 0x28, "SegmentReference"},
5512         { 0x11, "Size"},
5513         { 0x12, "Style" },
5514         { 0x29, "SystemMessage"},
5515         { 0x2A, "SystemMessageID"},
5516         { 0x2B, "SystemMessageList"},
5517         { 0x2C, "SystemMessageResponse"},
5518         { 0x2D, "SystemMessageResponseList" },
5519         { 0x2F, "SystemMessageText"},
5520         { 0x30, "TryAgainTimeout"},
5521         { 0x3C, "UnrecognizedUserID"},
5522         { 0x3F , "UserIDList"},
5523         { 0x3D, "UserIDPair"},
5524         { 0x31, "UserNotify"},
5525         { 0x3E, "ValidUserID"},
5526         { 0x32, "VerificationKey"},
5527         { 0x33, "VerificationMechanism"},
5528         { 0x37, "WatcherCount"},
5529
5530         { 0x00, NULL }
5531 };
5532
5533 /* Access code page - continued (0x0A) */
5534 static const value_string wbxml_wv_csp_13_tags_cp10[] = {
5535         /* 0x00 -- 0x04 GLOBAL */
5536         /* New in WV-CSP 1.2 */
5537         { 0x05, "WV-CSP-NSDiscovery-Request" },
5538         { 0x06, "WV-CSP-NSDiscovery-Response" },
5539         { 0x07, "VersionList"},
5540         /* New in WV-CSP 1.3 */
5541         { 0x08, "SubscribeNotification-Request" },
5542         { 0x09, "UnsubscribeNotification-Request" },
5543         { 0x0A, "Notification-Request" },
5544         { 0x0B, "AdvancedCriteria" },
5545         { 0x0C, "PairID" },
5546         { 0x0D, "GetPublicProfile-Request" },
5547         { 0x0E, "GetPublicProfile-Response" },
5548         { 0x0F, "UpdatePublicProfile-Request" },
5549         { 0x10, "DropSegment-Request" },
5550         { 0x11, "ExtendConversation-Response" },
5551         { 0x12, "ExtendConversation-Request" },
5552         { 0x13, "GetSegment-Request" },
5553         { 0x14, "GetSegment-Response" },
5554         { 0x15, "SystemMessage-Request" },
5555         { 0x16, "SystemMessage-User" },
5556         { 0x17, "SearchPair" },
5557         { 0x18, "SegmentContent" },
5558
5559         { 0x00, NULL }
5560 };
5561
5562 /* Common code page \96 continued (0x0B) */
5563 static const value_string wbxml_wv_csp_13_tags_cp11[] = {
5564         /* 0x00 -- 0x04 GLOBAL */
5565         /* New in WV-CSP 1.3 */
5566         { 0x05, "GrantListInUse" },
5567         { 0x06, "BlockListInUse" },
5568         { 0x07, "ContactListIDList" },
5569         { 0x08, "AnswerOptionsText" },
5570
5571         { 0x00, NULL }
5572 };
5573
5574
5575 /*****    Attribute Start tokens   *****/
5576 /* Common code page (0x00) */
5577 static const value_string wbxml_wv_csp_13_attrStart_cp0[] = {
5578         /* 0x00 -- 0x04 GLOBAL */
5579         { 0x05, "xmlns='http://www.wireless-village.org/CSP'" },
5580         { 0x06, "xmlns='http://www.wireless-village.org/PA'" },
5581         { 0x07, "xmlns='http://www.wireless-village.org/TRC'" },
5582         /* New in WV-CSP 1.2 */
5583         { 0x08, "xmlns='http://www.openmobilealliance.org/DTD/WV-CSP'" },
5584         { 0x09, "xmlns='http://www.openmobilealliance.org/DTD/WV-PA'" },
5585         { 0x0A, "xmlns='http://www.openmobilealliance.org/DTD/WV-TRC'" },
5586         /* New in WV-CSP 1.3 */
5587         { 0x0B, "xmlns='http://www.openmobilealliance.org/DTD/IMPS-CSP'" },
5588         { 0x0C, "xmlns='http://www.openmobilealliance.org/DTD/IMPS-PA'" },
5589         { 0x0D, "xmlns='http://www.openmobilealliance.org/DTD/IMPS-TRC'" },
5590
5591         { 0x00, NULL }
5592 };
5593
5594 /*****    Attribute Value tokens   *****/
5595 /*
5596  * Element value tokens
5597  */
5598 static const value_string vals_wv_csp_13_element_value_tokens[] = {
5599         /*
5600          * Common value tokens
5601          */
5602         { 0x52, "AC" },
5603         { 0x00, "AccessType" },
5604         { 0x01, "ActiveUsers" },
5605         { 0x02, "Admin" },
5606         { 0x3C, "ANC" },
5607         { 0x51, "AND" },
5608         { 0x5A, "ANU" },
5609         { 0x68, "AP" },
5610         { 0x03, "application/" },
5611         { 0x04, "application/vnd.wap.mms-message" },
5612         { 0x05, "application/x-sms" },
5613         { 0x8F, "Aqua" },
5614         { 0x90, "ATCL" },
5615         { 0x31, "AutoDelete" },
5616         { 0x06, "AutoJoin" },
5617         { 0x07, "BASE64" },
5618         { 0x7B, "Big" },
5619         { 0x80, "Black" },
5620         { 0x53, "BLC" },
5621         { 0x54, "BLUC" },
5622         { 0x8D, "Blue" },
5623         { 0x7D, "Bold" },
5624         { 0xBC, "C" },
5625         { 0x91, "CLC" },
5626         { 0x55, "CLCR" },
5627         { 0x56, "CLD" },
5628         { 0x08, "Closed" },
5629         { 0xBD, "CURRENT_SUBSCRIBER" },
5630         { 0x09, "Default" },
5631         { 0x34, "DENIED" },
5632         { 0xAB, "DETECT" },
5633         { 0x0A, "DisplayName" },
5634         { 0xA6, "DoNotNotify" },
5635         { 0xA0, "EC" },
5636         { 0xBA, "EG" },
5637         { 0x0B, "F" },
5638         { 0xAC, "FORKALL" },
5639         { 0xBE, "FORMER_SUBSCRIBER" },
5640         { 0x87, "Fuchsia" },
5641         { 0x0C, "G" },
5642         { 0x57, "GC" },
5643         { 0x58, "GD" },
5644         { 0x59, "GLC" },
5645         { 0xA1, "GLUC" },
5646         { 0x32, "GM" },
5647         { 0xA7, "GMAU" },
5648         { 0xA8, "GMG" },
5649         { 0xA9, "GMR" },
5650         { 0xAA, "GMU" },
5651         { 0x0D, "GR" },
5652         { 0x35, "GRANTED" },
5653         { 0x82, "Gray" },
5654         { 0x88, "Green" },
5655         { 0x3D, "History" },
5656         { 0x0E, "http://" },
5657         { 0x0F, "https://" },
5658         { 0x7C, "Huge" },
5659         { 0xA2, "IA" },
5660         { 0xA3, "IC" },
5661         { 0x10, "image/" },
5662         { 0x11, "Inband" },
5663         { 0x12, "IM" },
5664         { 0x9F, "IR" },
5665         { 0x7E, "Italic" },
5666         { 0x89, "Lime" },
5667         { 0x84, "Maroon" },
5668         { 0x13, "MaxActiveUsers" },
5669         { 0x7A, "Medium" },
5670         { 0xBB, "MinimumAge" },
5671         { 0x14, "Mod" },
5672         { 0x15, "Name" },
5673         { 0x8C, "Navy" },
5674         { 0x16, "None" },
5675         { 0x17, "N" },
5676         { 0xAD, "OEU" },
5677         { 0x8A, "Olive" },
5678         { 0x18, "Open" },
5679         { 0x19, "Outband" },
5680         { 0x36, "PENDING" },
5681         { 0x3A, "PPU" },
5682         { 0x1A, "PR" },
5683         { 0xBF, "PRESENCE_ACCESS" },
5684         { 0x1B, "Private" },
5685         { 0x1C, "PrivateMessaging" },
5686         { 0x1D, "PrivilegeLevel" },
5687         { 0x1E, "Public" },
5688         { 0x86, "Purple" },
5689         { 0x1F, "P" },
5690         { 0xC0, "R" },
5691         { 0x85, "Red" },
5692         { 0x20, "Request" },
5693         { 0x21, "Response" },
5694         { 0x22, "Restricted" },
5695         { 0x38, "RequireInvitation" },
5696         { 0x23, "ScreenName" },
5697         { 0x24, "Searchable" },
5698         { 0x25, "S" },
5699         { 0x26, "SC" },
5700         { 0xAE, "SERVERLOGIC" },
5701         { 0x37, "ShowID" },
5702         { 0x81, "Silver" },
5703         { 0x79, "Small" },
5704         { 0x3B, "SPA" },
5705         { 0x8E, "Teal" },
5706         { 0x27, "text/" },
5707         { 0x28, "text/plain" },
5708         { 0x29, "text/x-vCalendar" },
5709         { 0x2A, "text/x-vCard" },
5710         { 0x39, "Tiny" },
5711         { 0x2B, "Topic" },
5712         { 0x2C, "T" },
5713         { 0x2D, "Type" },
5714         { 0x2E, "U" },
5715         { 0x7F, "Underline" },
5716         { 0x2F, "US" },
5717         { 0x33, "Validity" },
5718         { 0x83, "White" },
5719         { 0x78, "www.openmobilealliance.org" },
5720         { 0x30, "www.wireless-village.org" },
5721         { 0x8B, "Yellow" },
5722         /*
5723          * Access value tokens
5724          */
5725         { 0x3D, "GROUP_ID" },
5726         { 0x3E, "GROUP_NAME" },
5727         { 0x3F, "GROUP_TOPIC" },
5728         { 0x40, "GROUP_USER_ID_JOINED" },
5729         { 0x41, "GROUP_USER_ID_OWNER" },
5730         { 0x42, "HTTP" },
5731         { 0x43, "SMS" },
5732         { 0x44, "STCP" },
5733         { 0x45, "SUDP" },
5734         { 0x46, "USER_ALIAS" },
5735         { 0x47, "USER_EMAIL_ADDRESS" },
5736         { 0x48, "USER_FIRST_NAME" },
5737         { 0x49, "USER_ID" },
5738         { 0x4A, "USER_LAST_NAME" },
5739         { 0x4B, "USER_MOBILE_NUMBER" },
5740         { 0x4C, "USER_ONLINE_STATUS" },
5741         { 0x4D, "WAPSMS" },
5742         { 0x4E, "WAPUDP" },
5743         { 0x4F, "WSP" },
5744         { 0x50, "GROUP_USER_ID_AUTOJOIN" },
5745         /*
5746          * Presence value tokens
5747          */
5748         { 0x5B, "ANGRY" },
5749         { 0x5C, "ANXIOUS" },
5750         { 0x5D, "ASHAMED" },
5751         { 0x5F, "AVAILABLE" },
5752         { 0x60, "BORED" },
5753         { 0x61, "CALL" },
5754         { 0x62, "CLI" },
5755         { 0x63, "COMPUTER" },
5756         { 0x64, "DISCREET" },
5757         { 0x65, "EMAIL" },
5758         { 0x66, "EXCITED" },
5759         { 0x67, "HAPPY" },
5760         { 0x6B, "IN_LOVE" },
5761         { 0x6C, "INVINCIBLE" },
5762         { 0x6D, "JEALOUS" },
5763         { 0x6E, "MMS" },
5764         { 0x6F, "MOBILE_PHONE" },
5765         { 0x70, "NOT_AVAILABLE" },
5766         { 0x71, "OTHER" },
5767         { 0x72, "PDA" },
5768         { 0x73, "SAD" },
5769         { 0x74, "SLEEPY" },
5770         { 0x75, "SMS" },
5771         /*
5772          * Access value tokens - continued
5773          */
5774         { 0x93, "USER_CITY" },
5775         { 0x94, "USER_COUNTRY" },
5776         { 0x95, "USER_FRIENDLY_NAME" },
5777         { 0x96, "USER_GENDER" },
5778         { 0x97, "USER_INTENTION" },
5779         { 0x98, "USER_INTERESTS_HOBBIES" },
5780         { 0x99, "USER_MARITAL_STATUS" },
5781         { 0x9A, "PRIORITYREJECT" },
5782         { 0x9B, "PRIORITYSTORE" },
5783         { 0x9C, "REJECT" },
5784         { 0x9D, "SENDREJECT" },
5785         { 0x9E, "SENDSTORE" },
5786         { 0xA4, "SSMS" },
5787         { 0xA5, "SHTTP" },
5788         { 0xAF, "PP_AGE" },
5789         { 0xB0, "PP_CITY" },
5790         { 0xB1, "PP_COUNTRY" },
5791         { 0xB2, "PP_FRIENDLY_NAME" },
5792         { 0xB3, "PP_FREE_TEXT" },
5793         { 0xB4, "PP_GENDER" },
5794         { 0xB5, "PP_INTENTION" },
5795         { 0xB6, "PP_INTERESTS" },
5796         { 0xB7, "PP_MARITAL_STATUS" },
5797         { 0xB8, "USER_AGE_MAX" },
5798         { 0xB9, "USER_AGE_MIN" },
5799
5800         { 0x00, NULL }
5801 };
5802
5803 /***** Token code page aggregation *****/
5804 static char *
5805 ext_t_0_wv_cspc_13(tvbuff_t *tvb _U_, guint32 value, guint32 str_tbl _U_)
5806 {
5807         char *str = g_strdup_printf("Common Value: '%s'",
5808                                     val_to_str(value, vals_wv_csp_13_element_value_tokens,
5809                                                "<Unknown WV-CSP 1.3 Common Value token 0x%X>"));
5810         return str;
5811 }
5812
5813 #define wbxml_wv_csp_13_global wbxml_wv_csp_12_global           /*TODO*/
5814
5815 static const value_valuestring wbxml_wv_csp_13_tags[] = {
5816         {  0, wbxml_wv_csp_13_tags_cp0 },
5817         {  1, wbxml_wv_csp_13_tags_cp1 },
5818         {  2, wbxml_wv_csp_13_tags_cp2 },
5819         {  3, wbxml_wv_csp_13_tags_cp3 },
5820         {  4, wbxml_wv_csp_13_tags_cp4 },
5821         {  5, wbxml_wv_csp_13_tags_cp5 },
5822         {  6, wbxml_wv_csp_13_tags_cp6 },
5823         {  7, wbxml_wv_csp_13_tags_cp7 },
5824         {  8, wbxml_wv_csp_13_tags_cp8 },
5825         {  9, wbxml_wv_csp_13_tags_cp9 },
5826         { 10, wbxml_wv_csp_13_tags_cp10 },
5827         { 11, wbxml_wv_csp_13_tags_cp11 },
5828         {  0, NULL }
5829 };
5830
5831 static const value_valuestring wbxml_wv_csp_13_attrStart[] = {
5832         { 0, wbxml_wv_csp_13_attrStart_cp0 },
5833         { 0, NULL }
5834 };
5835
5836 static const wbxml_decoding decode_wv_cspc_13 = {
5837         "Wireless-Village Client-Server Protocol 1.3",
5838         "WV-CSP 1.3",
5839         { ext_t_0_wv_cspc_13, NULL, NULL },
5840         wv_csp13_opaque_binary_tag,
5841         wv_csp13_opaque_literal_tag,
5842         default_opaque_binary_attr,
5843         default_opaque_literal_attr,
5844         wbxml_wv_csp_13_global,
5845         wbxml_wv_csp_13_tags,
5846         wbxml_wv_csp_13_attrStart,
5847         NULL
5848 };
5849
5850
5851
5852
5853
5854 /****************************** Discriminators ******************************/
5855 /* Discriminator for WV-CSP; allows version detection based on parsing parts
5856  * of the start of the WBXML body.
5857  */
5858 static const wbxml_decoding *
5859 wv_csp_discriminator(tvbuff_t *tvb, guint32 offset)
5860 {
5861         guint32 magic_1 = tvb_get_ntohl(tvb, offset + 0);
5862         guint16 magic_2 = tvb_get_ntohs(tvb, offset + 4);
5863
5864         if (magic_1 == 0xFE050331 && magic_2 == 0x2e30)
5865                 {
5866                         /* FE 05 03 31 2E 30 --> WV-CSP 1.0 */
5867                         return &decode_wv_cspc_10;
5868                 }
5869         else if (magic_1 == 0xC9050331 && magic_2 == 0x2e31)
5870                 {
5871                         /* C9 05 03 31 2E 31 --> WV-CSP 1.1 */
5872                         return &decode_wv_cspc_11;
5873                 }
5874         else if (magic_1 == 0xC9080331 && magic_2 == 0x2e32)
5875                 {
5876                         /* C9 08 03 31 2E 32 --> WV-CSP 1.2 */
5877                         return &decode_wv_cspc_12;
5878                 }
5879         else if ( magic_1 == 0xC90B0331 && magic_2 == 0x2E33)
5880                 {
5881                         /* C9 0B 03 31 2E 33 --> WV-CSP 1.3 */
5882                         return &decode_wv_cspc_13;
5883                 }
5884
5885
5886         /* Default: WV-CSP 1.2 */
5887         return &decode_wv_cspc_12;
5888 }
5889
5890 /********************** WBXML token mapping aggregation **********************/
5891
5892 static const wbxml_decoding *get_wbxml_decoding_from_public_id (guint32 publicid);
5893 static const wbxml_decoding *get_wbxml_decoding_from_content_type (
5894                                                                    const char *content_type, tvbuff_t *tvb, guint32 offset);
5895
5896
5897 /**
5898  ** Aggregation of content type and aggregated code pages
5899  ** Content type map lookup will stop at the 1st entry with 3rd member = FALSE
5900  **/
5901
5902 /*
5903  * The following map contains entries registered with a registered WBXML
5904  * public ID. See WAP WINA or OMA OMNA for registered values:
5905  * http://www.openmobilealliance.org/tech/omna/ */
5906  static const wbxml_integer_list well_known_public_id_list[] = {
5907          /* 0x00 - Unknown or missing Public ID */
5908          /* 0x01 - LITERAL PublicID - see String Table */
5909          { 0x02,        &decode_wmlc_10 },      /* WML 1.0 */
5910          /* 0x03 - WTA 1.0 */
5911          { 0x04,        &decode_wmlc_11 },      /* WML 1.1 */
5912          { 0x05,        &decode_sic_10 },       /* SI 1.0 */
5913          { 0x06,        &decode_slc_10 },       /* SL 1.0 */
5914          { 0x07,        &decode_coc_10 },       /* CO 1.0 */
5915          { 0x08,        &decode_channelc_10 },  /* CHANNEL 1.0 */
5916          { 0x09,        &decode_wmlc_12 },      /* WML 1.2 */
5917          { 0x0A,        &decode_wmlc_13 },      /* WML 1.3 */
5918          { 0x0B,        &decode_provc_10 },     /* PROV 1.0 */
5919          /* 0x0C - WTA-WML 1.2 */
5920          { 0x0D,        &decode_emnc_10 },      /* EMN 1.0 */
5921          /* 0x0E - DRMREL 1.0 */
5922          { 0x0F,        &decode_wv_cspc_10 },   /* WV-CSP 1.0 */
5923          { 0x10,        &decode_wv_cspc_11 },   /* WV-CSP 1.1 */
5924          /*See http://www.openmobilealliance.org/tech/omna/omna-wbxml-public-docid.htm */
5925          { 0x11,        &decode_wv_cspc_12 },   /* OMA IMPS - CSP protocol DTD v1.2 */
5926          { 0x12,        &decode_wv_cspc_13 },   /* OMA IMPS - CSP protocol DTD v1.3 */
5927          { 0x020B,      &decode_nokiaprovc_70 },/* Nokia OTA Provisioning 7.0 */
5928          { 0x0FD1,      &decode_syncmlc_10 },   /* SyncML 1.0 */
5929          { 0x0FD3,      &decode_syncmlc_11 },   /* SyncML 1.1 */
5930          /* Note: I assumed WML+ 1.x would be not that different from WML 1.x,
5931           *       the real mapping should come from Phone.com (OpenWave)! */
5932          { 0x1108,      &decode_wmlc_11 },      /* Phone.com WMLC+ 1.1 - not 100% correct */
5933          { 0x110D,      &decode_wmlc_13 },      /* Phone.com WMLC+ 1.3 - not 100% correct */
5934
5935          { 0x00,        NULL }
5936  };
5937
5938 /* The following map contains entries only registered with a literal media
5939  * type. */
5940 static const wbxml_literal_list content_type_list[] = {
5941         {       "application/x-wap-prov.browser-settings",
5942                 NULL,
5943                 &decode_nokiaprovc_70
5944         },
5945         {       "application/x-wap-prov.browser-bookmarks",
5946                 NULL,
5947                 &decode_nokiaprovc_70
5948         },
5949         {       "application/vnd.wv.csp.wbxml",
5950                 wv_csp_discriminator,
5951                 &decode_wv_cspc_11
5952         },
5953         {       NULL, NULL, NULL }
5954 };
5955
5956
5957 /* Returns a pointer to the WBXML token map for the given WBXML public
5958  * identifier value (see WINA for a table with defined identifiers). */
5959 static const wbxml_decoding *get_wbxml_decoding_from_public_id (guint32 public_id)
5960 {
5961         const wbxml_decoding *map = NULL;
5962
5963         DebugLog(("get_wbxml_decoding_from_public_id: public_id = %u\n",
5964                   public_id));
5965         if (public_id >= 2) {
5966                 const wbxml_integer_list *item = well_known_public_id_list;
5967
5968                 while (item && item->public_id && item->map) {
5969                         if (item->public_id == public_id) {
5970                                 map = item->map;
5971                                 break;
5972                         }
5973                         item++;
5974                 }
5975         }
5976         return map;
5977 }
5978
5979 static const wbxml_decoding *get_wbxml_decoding_from_content_type (
5980                                                                    const char *content_type, tvbuff_t *tvb, guint32 offset)
5981 {
5982         const wbxml_decoding *map = NULL;
5983
5984         DebugLog(("get_wbxml_decoding_from_content_type: content_type = [%s]\n",
5985                   content_type));
5986         if (content_type && content_type[0]) {
5987                 const wbxml_literal_list *item = content_type_list;
5988
5989                 while (item && item->content_type) {
5990                         if (g_ascii_strcasecmp(content_type, item->content_type) == 0) {
5991                                 /* Try the discriminator */
5992                                 if (item->discriminator != NULL) {
5993                                         map = item->discriminator(tvb, offset);
5994                                 }
5995                                 if (map == NULL) {
5996                                         map = item->map;
5997                                 }
5998                                 break;
5999                         }
6000                         item++;
6001                 }
6002         }
6003         return map;
6004 }
6005
6006
6007 /* WBXML content token mapping depends on the following parameters:
6008  *   - Content type (guint32)
6009  *   - Token type (global, tags, attrStart, attrValue)
6010  *   - Code page for tag and attribute
6011  *
6012  * This results in the following steps:
6013  *   1. Retrieve content type mapping
6014  *   2. If exists, retrieve token type mapping
6015  *   3. If exists, retrieve required code page
6016  *   4. If exists, retrieve token mapping
6017  */
6018
6019 #define wbxml_UNDEFINED_TOKEN                                   \
6020         "(Requested token not defined for this content type)"
6021 #define wbxml_UNDEFINED_TOKEN_CODE_PAGE                                 \
6022         "(Requested token code page not defined for this content type)"
6023 #define wbxml_UNDEFINED_TOKEN_MAP                                       \
6024         "(Requested token map not defined for this content type)"
6025 /* Return token mapping for a given content mapping entry. */
6026 static const char *
6027 map_token (const value_valuestring *token_map, guint8 codepage, guint8 token) {
6028         const value_string *vs;
6029         const char *s;
6030
6031         if (token_map) { /* Found map */
6032                 if ((vs = val_to_valstr (codepage, token_map))) {
6033                         /* Found codepage map */
6034                         s = match_strval (token, vs);
6035                         if (s) { /* Found valid token */
6036                                 DebugLog(("map_token(codepage = %u, token = %u: [%s]\n", codepage, token, s));
6037                                 return s;
6038                         }
6039                         /* No valid token mapping in specified code page of token map */
6040                         DebugLog(("map_token(codepage = %u, token = %u: "
6041                                   wbxml_UNDEFINED_TOKEN "\n", codepage, token));
6042                         return wbxml_UNDEFINED_TOKEN;
6043                 }
6044                 /* There is no token map entry for the requested code page */
6045                 DebugLog(("map_token(codepage = %u, token = %u: "
6046                           wbxml_UNDEFINED_TOKEN_CODE_PAGE "\n", codepage, token));
6047                 return wbxml_UNDEFINED_TOKEN_CODE_PAGE;
6048         }
6049         /* The token map does not exist */
6050         DebugLog(("map_token(codepage = %u, token = %u: "
6051                   wbxml_UNDEFINED_TOKEN_MAP "\n", codepage, token));
6052         return wbxml_UNDEFINED_TOKEN_MAP;
6053 }
6054
6055
6056
6057
6058
6059 /************************** Function prototypes **************************/
6060
6061
6062 static void
6063 dissect_wbxml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
6064
6065 static void
6066 dissect_uaprof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
6067
6068 static void
6069 dissect_wbxml_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
6070                      const wbxml_decoding *override_content_map);
6071
6072 void
6073 proto_register_wbxml(void);
6074
6075 /* Parse and display the WBXML string table */
6076 static void
6077 show_wbxml_string_table (proto_tree *tree, tvbuff_t *tvb, guint32 str_tbl,
6078                          guint32 str_tbl_len);
6079
6080 /* Parse data while in STAG state */
6081 static guint32
6082 parse_wbxml_tag (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
6083                  guint32 str_tbl, guint8 *level, guint8 *codepage_stag, guint8 *codepage_attr);
6084
6085 /* Parse data while in STAG state;
6086  * interpret tokens as defined by content type */
6087 static guint32
6088 parse_wbxml_tag_defined (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
6089                          guint32 str_tbl, guint8 *level, guint8 *codepage_stag, guint8 *codepage_attr,
6090                          const wbxml_decoding *map);
6091
6092 /* Parse data while in ATTR state */
6093 static guint32
6094 parse_wbxml_attribute_list (proto_tree *tree, tvbuff_t *tvb,
6095                             guint32 offset, guint32 str_tbl, guint8 level, guint8 *codepage_attr);
6096
6097 /* Parse data while in ATTR state;
6098  * interpret tokens as defined by content type */
6099 static guint32
6100 parse_wbxml_attribute_list_defined (proto_tree *tree, tvbuff_t *tvb,
6101                                     guint32 offset, guint32 str_tbl, guint8 level, guint8 *codepage_attr,
6102                                     const wbxml_decoding *map);
6103
6104
6105 /****************** WBXML protocol dissection functions ******************/
6106
6107
6108 static void
6109 dissect_wbxml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
6110 {
6111         dissect_wbxml_common(tvb, pinfo, tree, NULL);
6112 }
6113
6114 static void
6115 dissect_uaprof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
6116 {
6117         dissect_wbxml_common(tvb, pinfo, tree, &decode_uaprof_wap_248);
6118 }
6119
6120 /* Code to actually dissect the packets */
6121 static void
6122 dissect_wbxml_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
6123                      const wbxml_decoding *override_content_map)
6124 {
6125         /* Set up structures needed to add the protocol subtree and manage it */
6126         proto_item *ti;
6127         proto_tree *wbxml_tree; /* Main WBXML tree */
6128         proto_tree *wbxml_str_tbl_tree; /* String table subtree */
6129         proto_tree *wbxml_content_tree; /* Content subtree */
6130         guint8 version;
6131         guint offset = 0;
6132         guint32 len;
6133         guint32 charset = 0;
6134         guint32 charset_len = 0;
6135         guint32 publicid;
6136         guint32 publicid_index = 0;
6137         guint32 publicid_len;
6138         guint32 str_tbl;
6139         guint32 str_tbl_len;
6140         guint32 str_tbl_len_len = 0;
6141         guint8 level = 0; /* WBXML recursion level */
6142         const wbxml_decoding *content_map = NULL;
6143         gchar *summary = NULL;
6144         guint8 codepage_stag = 0;
6145         guint8 codepage_attr = 0;
6146
6147         DebugLog(("dissect_wbxml: Dissecting packet %u\n", pinfo->fd->num));
6148         /* WBXML format
6149          *
6150          * Version 1.0: version publicid         strtbl BODY
6151          * Version 1.x: version publicid charset strtbl BODY
6152          *
6153          * Last valid format: WBXML 1.3
6154          */
6155         switch ( version = tvb_get_guint8 (tvb, 0) ) {
6156         case 0x00: /* WBXML/1.0 */
6157                 break;
6158
6159         case 0x01: /* WBXML/1.1 */
6160         case 0x02: /* WBXML/1.2 */
6161         case 0x03: /* WBXML/1.3 */
6162                 break;
6163
6164         default:
6165                 return;
6166         }
6167
6168         /* In order to properly construct the packet summary,
6169          * I need to read the entire WBXML header
6170          * up to the string table length.
6171          */
6172
6173         /* Public ID */
6174         publicid = tvb_get_guintvar(tvb, 1, &publicid_len);
6175         if (! publicid) {
6176                 /* Public identifier in string table */
6177                 publicid_index = tvb_get_guintvar (tvb, 1+publicid_len, &len);
6178                 publicid_len += len;
6179         }
6180         offset = 1 + publicid_len;
6181
6182         /* Version-specific handling of Charset */
6183         switch ( version ) {
6184         case 0x00: /* WBXML/1.0 */
6185                 /* No charset */
6186                 break;
6187
6188         case 0x01: /* WBXML/1.1 */
6189         case 0x02: /* WBXML/1.2 */
6190         case 0x03: /* WBXML/1.3 */
6191                 /* Get charset */
6192                 charset = tvb_get_guintvar (tvb, offset, &charset_len);
6193                 offset += charset_len;
6194                 break;
6195
6196         default: /* Impossible since we returned already earlier */
6197                 g_error("%s:%u: WBXML version octet 0x%02X only partly supported!\n"
6198                         "Please report this as a bug.\n", __FILE__, __LINE__, version);
6199                 DISSECTOR_ASSERT_NOT_REACHED();
6200                 break;
6201         }
6202
6203         /* String table: read string table length in bytes */
6204         str_tbl_len = tvb_get_guintvar (tvb, offset, &str_tbl_len_len);
6205         str_tbl = offset + str_tbl_len_len; /* Start of 1st string in string table */
6206
6207         /* Compose the summary line */
6208         if ( publicid ) {
6209                 summary = g_strdup_printf("%s, Public ID: \"%s\"",
6210                                           val_to_str (version, vals_wbxml_versions, "(unknown 0x%x)"),
6211                                           val_to_str (publicid, vals_wbxml_public_ids, "(unknown 0x%x)"));
6212         } else {
6213                 /* Read length of Public ID from string table */
6214                 len = tvb_strsize (tvb, str_tbl + publicid_index);
6215                 summary = g_strdup_printf("%s, Public ID: \"%s\"",
6216                                           val_to_str (version, vals_wbxml_versions, "(unknown 0x%x)"),
6217                                           tvb_format_text (tvb, str_tbl + publicid_index, len - 1));
6218         }
6219
6220         /* Add summary to INFO column if it is enabled */
6221         if (check_col(pinfo->cinfo, COL_INFO))
6222                 col_append_fstr(pinfo->cinfo, COL_INFO, " (WBXML %s)", summary);
6223
6224         /* create display subtree for the protocol */
6225         ti = proto_tree_add_item (tree, proto_wbxml, tvb, 0, -1, FALSE);
6226         proto_item_append_text(ti, ", Version: %s", summary);
6227         g_free(summary);
6228         /*
6229          * Now show the protocol subtree, if tree is set.
6230          */
6231         if ( tree ) {
6232                 wbxml_tree = proto_item_add_subtree(ti, ett_wbxml);
6233
6234                 /* WBXML Version */
6235                 proto_tree_add_uint (wbxml_tree, hf_wbxml_version,
6236                                      tvb, 0, 1, version);
6237
6238                 /* Public ID */
6239                 if (publicid) { /* Known Public ID */
6240                         proto_tree_add_uint(wbxml_tree, hf_wbxml_public_id_known,
6241                                             tvb, 1, publicid_len, publicid);
6242                 } else { /* Public identifier in string table */
6243                         proto_tree_add_item (wbxml_tree, hf_wbxml_public_id_literal,
6244                                              tvb, 1, publicid_len, FALSE);
6245                 }
6246                 offset = 1 + publicid_len;
6247
6248                 if ( version ) { /* Charset */
6249                         proto_tree_add_uint (wbxml_tree, hf_wbxml_charset,
6250                                              tvb, 1 + publicid_len, charset_len, charset);
6251                         offset += charset_len;
6252                 }
6253
6254                 str_tbl_len = tvb_get_guintvar (tvb, offset, &len);
6255                 str_tbl = offset + len; /* Start of 1st string in string table */
6256
6257                 /* String Table */
6258                 ti = proto_tree_add_text(wbxml_tree,
6259                                          tvb, offset, len + str_tbl_len, "String table: %u bytes",
6260                                          str_tbl_len);
6261
6262                 if (wbxml_tree && str_tbl_len) { /* Display string table as subtree */
6263                         wbxml_str_tbl_tree = proto_item_add_subtree (ti,
6264                                                                      ett_wbxml_str_tbl);
6265                         show_wbxml_string_table (wbxml_str_tbl_tree, tvb,
6266                                                  str_tbl, str_tbl_len);
6267                 }
6268
6269                 /* Data starts HERE */
6270                 offset += len + str_tbl_len;
6271
6272                 /* The WBXML BODY starts here */
6273                 if (disable_wbxml_token_parsing) {
6274                         ti = proto_tree_add_text (wbxml_tree, tvb, offset, -1,
6275                                                   "Data representation not shown "
6276                                                   "(edit WBXML preferences to show)");
6277                         return;
6278                 } /* Else: render the WBXML tokens */
6279                 ti = proto_tree_add_text (wbxml_tree, tvb, offset, -1,
6280                                           "Data representation");
6281                 wbxml_content_tree = proto_item_add_subtree (ti, ett_wbxml_content);
6282
6283                 /* The parse_wbxml_X() functions will process the content correctly,
6284                  * irrespective of the WBXML version used. For the WBXML body, this
6285                  * means that there is a different processing for the global token
6286                  * RESERVED_2 (WBXML 1.0) or OPAQUE (WBXML 1.x with x > 0).  */
6287                 if (wbxml_tree) { /* Show only if visible */
6288                         if (override_content_map != NULL) {
6289                                 content_map = override_content_map;
6290                                 proto_item_append_text(ti,
6291                                                        " is based on: %s",
6292                                                        content_map->name);
6293                         } else {
6294                                 /* Retrieve the content token mapping if available */
6295                                 content_map = get_wbxml_decoding_from_public_id (publicid);
6296                                 if (! content_map) {
6297                                         content_map = get_wbxml_decoding_from_content_type(
6298                                                                                            pinfo->match_string, tvb, offset);
6299                                         if (! content_map) {
6300                                                 proto_tree_add_text (wbxml_content_tree,
6301                                                                      tvb, offset, -1,
6302                                                                      "[Rendering of this content type"
6303                                                                      " not (yet) supported]");
6304                                         } else {
6305                                                 proto_item_append_text(ti,
6306                                                                        " is based on Content-Type: %s "
6307                                                                        "(chosen decoding: %s)",
6308                                                                        pinfo->match_string, content_map->name);
6309                                         }
6310                                 }
6311                         }
6312                         if (content_map && skip_wbxml_token_mapping) {
6313                                 proto_tree_add_text (wbxml_content_tree,
6314                                                      tvb, offset, -1,
6315                                                      "[Rendering of this content type"
6316                                                      " has been disabled "
6317                                                      "(edit WBXML preferences to enable)]");
6318                                 content_map = NULL;
6319                         }
6320                         proto_tree_add_text (wbxml_content_tree, tvb,
6321                                              offset, -1,
6322                                              "Level | State | Codepage "
6323                                              "| WBXML Token Description         "
6324                                              "| Rendering");
6325                         if (content_map) {
6326                                 len = parse_wbxml_tag_defined (wbxml_content_tree,
6327                                                                tvb, offset, str_tbl, &level, &codepage_stag,
6328                                                                &codepage_attr, content_map);
6329                         } else {
6330                                 /* Default: WBXML only, no interpretation of the content */
6331                                 len = parse_wbxml_tag (wbxml_content_tree, tvb, offset,
6332                                                        str_tbl, &level, &codepage_stag, &codepage_attr);
6333                         }
6334                 }
6335                 return;
6336         }
6337 }
6338
6339
6340 /* Parse and display the WBXML string table (in a 3-column table format).
6341  * This function displays:
6342  *  - the offset in the string table,
6343  *  - the length of the string
6344  *  - the string.
6345  */
6346 static void
6347 show_wbxml_string_table (proto_tree *tree, tvbuff_t *tvb, guint32 str_tbl,
6348                          guint32 str_tbl_len)
6349 {
6350         guint32 off = str_tbl;
6351         guint32 len = 0;
6352         guint32 end = str_tbl + str_tbl_len;
6353
6354         proto_tree_add_text (tree, tvb, off, end,
6355                              "Start  | Length | String");
6356         while (off < end) {
6357                 len = tvb_strsize (tvb, off);
6358                 proto_tree_add_text (tree, tvb, off, len,
6359                                      "%6d | %6d | '%s'",
6360                                      off - str_tbl, len,
6361                                      tvb_format_text (tvb, off, len-1));
6362                 off += len;
6363         }
6364 }
6365
6366
6367 /* Indentation code is based on a static const array of space characters.
6368  * At least one single space is returned */
6369 static const char indent_buffer[514] = " "
6370         "                                                                "
6371         "                                                                "
6372         "                                                                "
6373         "                                                                "
6374         "                                                                "
6375         "                                                                "
6376         "                                                                "
6377         "                                                                "
6378         ; /* Generate XML indentation (length = 1 + 2 * 256 + 1 for '\0') */
6379
6380 static const char * Indent (guint8 level) {
6381         return indent_buffer + (512 - 2 * (level));
6382 }
6383
6384
6385 /********************
6386  * WBXML tag tokens *
6387  ********************
6388  *
6389  * Bit Mask  : Example
6390  * -------------------
6391  * 00.. .... : <tag />
6392  *
6393  * 01.. .... : <tag>
6394  *               CONTENT
6395  *             </tag>
6396  *
6397  * 10.. .... : <tag
6398  *               atrtribute1="value1"
6399  *               atrtribute2="value2"
6400  *             />
6401  *
6402  * 11.. .... : <tag
6403  *               atrtribute1="value1"
6404  *               atrtribute2="value2"
6405  *             >
6406  *               CONTENT
6407  *             </tag>
6408  *
6409  * NOTES
6410  *   - An XML PI is parsed as an attribute list (same syntax).
6411  *   - A code page switch only applies to the single token that follows.
6412  */
6413
6414
6415 /* This function parses the WBXML and maps known token interpretations
6416  * to the WBXML tokens. As a result, the original XML document can be
6417  * recreated. Indentation is generated in order to ease reading.
6418  *
6419  * Attribute parsing is done in parse_wbxml_attribute_list_defined().
6420  *
6421  * The wbxml_decoding entry *map contains the actual token mapping.
6422  *
6423  * NOTE: In order to parse the content, some recursion is required.
6424  *       However, for performance reasons, recursion has been avoided
6425  *       where possible (tags without content within tags with content).
6426  *       This is achieved by means of the parsing_tag_content and tag_save*
6427  *       variables.
6428  *
6429  * NOTE: See above for known token mappings.
6430  *
6431  * NOTE: As tags can be opened and closed, a tag representation lookup
6432  *       may happen once or twice for a given tag. For efficiency reasons,
6433  *       the literal tag value is stored and used throughout the code.
6434  *       With the introduction of code page support, this solution is robust
6435  *       as the lookup only occurs once, removing the need for storage of
6436  *       the used code page.
6437  */
6438 static guint32
6439 parse_wbxml_tag_defined (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
6440                          guint32 str_tbl, guint8 *level, guint8 *codepage_stag, guint8 *codepage_attr,
6441                          const wbxml_decoding *map)
6442 {
6443         guint32 tvb_len = tvb_reported_length (tvb);
6444         guint32 off = offset;
6445         guint32 len;
6446         guint str_len;
6447         guint32 ent;
6448         guint32 index;
6449         guint8 peek;
6450         guint32 tag_len; /* Length of the index (uintvar) from a LITERAL tag */
6451         guint8 tag_save_known = 0; /* Will contain peek & 0x3F (tag identity) */
6452         guint8 tag_new_known = 0; /* Will contain peek & 0x3F (tag identity) */
6453         const char *tag_save_literal; /* Will contain the LITERAL tag identity */
6454         const char *tag_new_literal; /* Will contain the LITERAL tag identity */
6455         guint8 parsing_tag_content = FALSE; /* Are we parsing content from a
6456                                                tag with content: <x>Content</x>
6457
6458                                                The initial state is FALSE.
6459                                                This state will trigger recursion. */
6460         tag_save_literal = NULL; /* Prevents compiler warning */
6461
6462         DebugLog(("parse_wbxml_tag_defined (level = %u, offset = %u)\n", *level, offset));
6463         while (off < tvb_len) {
6464                 peek = tvb_get_guint8 (tvb, off);
6465                 DebugLog(("STAG: (top of while) level = %3u, peek = 0x%02X, off = %u, tvb_len = %u\n", *level, peek, off, tvb_len));
6466                 if ((peek & 0x3F) < 4) switch (peek) { /* Global tokens in state = STAG
6467                                                           but not the LITERAL tokens */
6468                 case 0x00: /* SWITCH_PAGE */
6469                         *codepage_stag = tvb_get_guint8 (tvb, off+1);
6470                         proto_tree_add_text (tree, tvb, off, 2,
6471                                              "      | Tag   | T -->%3d "
6472                                              "| SWITCH_PAGE (Tag code page)     "
6473                                              "|",
6474                                              *codepage_stag);
6475                         off += 2;
6476                         break;
6477                 case 0x01: /* END: only possible for Tag with Content */
6478                         if (tag_save_known) { /* Known TAG */
6479                                 proto_tree_add_text (tree, tvb, off, 1,
6480                                                      "  %3d | Tag   | T %3d    "
6481                                                      "| END (Known Tag 0x%02X)            "
6482                                                      "| %s</%s>",
6483                                                      *level, *codepage_stag,
6484                                                      tag_save_known, Indent (*level),
6485                                                      tag_save_literal); /* We already looked it up! */
6486                         } else { /* Literal TAG */
6487                                 proto_tree_add_text (tree, tvb, off, 1,
6488                                                      "  %3d | Tag   | T %3d    "
6489                                                      "| END (Literal Tag)               "
6490                                                      "| %s</%s>",
6491                                                      *level, *codepage_stag, Indent (*level),
6492                                                      tag_save_literal ? tag_save_literal : "");
6493                         }
6494                         (*level)--;
6495                         off++;
6496                         /* Reset code page: not needed as return from recursion */
6497                         DebugLog(("STAG: level = %u, Return: len = %u\n", *level, off - offset));
6498                         return (off - offset);
6499                         break;
6500                 case 0x02: /* ENTITY */
6501                         ent = tvb_get_guintvar (tvb, off+1, &len);
6502                         proto_tree_add_text (tree, tvb, off, 1+len,
6503                                              "  %3d | Tag   | T %3d    "
6504                                              "| ENTITY                          "
6505                                              "| %s'&#%u;'",
6506                                              *level, *codepage_stag, Indent (*level), ent);
6507                         off += 1+len;
6508                         break;
6509                 case 0x03: /* STR_I */
6510                         len = tvb_strsize (tvb, off+1);
6511                         proto_tree_add_text (tree, tvb, off, 1+len,
6512                                              "  %3d | Tag   | T %3d    "
6513                                              "| STR_I (Inline string)           "
6514                                              "| %s\'%s\'",
6515                                              *level, *codepage_stag, Indent(*level),
6516                                              tvb_format_text (tvb, off+1, len-1));
6517                         off += 1+len;
6518                         break;
6519                 case 0x40: /* EXT_I_0 */
6520                 case 0x41: /* EXT_I_1 */
6521                 case 0x42: /* EXT_I_2 */
6522                         /* Extension tokens */
6523                         len = tvb_strsize (tvb, off+1);
6524                         proto_tree_add_text (tree, tvb, off, 1+len,
6525                                              "  %3d | Tag   | T %3d    "
6526                                              "| EXT_I_%1x    (Extension Token)    "
6527                                              "| %s(%s: \'%s\')",
6528                                              *level, *codepage_stag,
6529                                              peek & 0x0f, Indent (*level),
6530                                              map_token (map->global, 0, peek),
6531                                              tvb_format_text (tvb, off+1, len-1));
6532                         off += 1+len;
6533                         break;
6534                 case 0x43: /* PI */
6535                         proto_tree_add_text (tree, tvb, off, 1,
6536                                              "  %3d | Tag   | T %3d    "
6537                                              "| PI (XML Processing Instruction) "
6538                                              "| %s<?xml",
6539                                              *level, *codepage_stag, Indent (*level));
6540                         len = parse_wbxml_attribute_list_defined (tree, tvb, off,
6541                                                                   str_tbl, *level, codepage_attr, map);
6542                         /* Check that there is still room in packet */
6543                         off += len;
6544                         if (off >= tvb_len) {
6545                                 DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n", *level, off - offset));
6546                                 /*
6547                                  * TODO - Do we need to free g_malloc()ed memory?
6548                                  */
6549                                 THROW(ReportedBoundsError);
6550                         }
6551                         proto_tree_add_text (tree, tvb, off-1, 1,
6552                                              "  %3d | Tag   | T %3d    "
6553                                              "| END (PI)                        "
6554                                              "| %s?>",
6555                                              *level, *codepage_stag, Indent (*level));
6556                         break;
6557                 case 0x80: /* EXT_T_0 */
6558                 case 0x81: /* EXT_T_1 */
6559                 case 0x82: /* EXT_T_2 */
6560                         /* Extension tokens */
6561                         index = tvb_get_guintvar (tvb, off+1, &len);
6562                         {   char *s;
6563                                 if (map->ext_t[peek & 0x03])
6564                                         s = (map->ext_t[peek & 0x03])(tvb, index, str_tbl);
6565                                 else
6566                                         s = g_strdup_printf("EXT_T_%1x (%s)", peek & 0x03,
6567                                                             map_token (map->global, 0, peek));
6568                                 proto_tree_add_text (tree, tvb, off, 1+len,
6569                                                      "  %3d | Tag   | T %3d    "
6570                                                      "| EXT_T_%1x    (Extension Token)    "
6571                                                      "| %s%s",
6572                                                      *level, *codepage_stag, peek & 0x0f, Indent (*level),
6573                                                      s);
6574                                 g_free(s);
6575                         }
6576                         off += 1+len;
6577                         break;
6578                 case 0x83: /* STR_T */
6579                         index = tvb_get_guintvar (tvb, off+1, &len);
6580                         str_len = tvb_strsize (tvb, str_tbl+index);
6581                         proto_tree_add_text (tree, tvb, off, 1+len,
6582                                              "  %3d | Tag   | T %3d    "
6583                                              "| STR_T (Tableref string)         "
6584                                              "| %s\'%s\'",
6585                                              *level, *codepage_stag, Indent (*level),
6586                                              tvb_format_text (tvb, str_tbl+index, str_len-1));
6587                         off += 1+len;
6588                         break;
6589                 case 0xC0: /* EXT_0 */
6590                 case 0xC1: /* EXT_1 */
6591                 case 0xC2: /* EXT_2 */
6592                         /* Extension tokens */
6593                         proto_tree_add_text (tree, tvb, off, 1,
6594                                              "  %3d | Tag   | T %3d    "
6595                                              "| EXT_%1x      (Extension Token)    "
6596                                              "| %s(%s)",
6597                                              *level, *codepage_stag, peek & 0x0f, Indent (*level),
6598                                              map_token (map->global, 0, peek));
6599                         off++;
6600                         break;
6601                 case 0xC3: /* OPAQUE - WBXML 1.1 and newer */
6602                         if (tvb_get_guint8 (tvb, 0)) { /* WBXML 1.x (x > 0) */
6603                                 char *str;
6604                                 if (tag_save_known) { /* Knwon tag */
6605                                         if (map->opaque_binary_tag) {
6606                                                 str = map->opaque_binary_tag(tvb, off + 1,
6607                                                                              tag_save_known, *codepage_stag, &len);
6608                                         } else {
6609                                                 str = default_opaque_binary_tag(tvb, off + 1,
6610                                                                                 tag_save_known, *codepage_stag, &len);
6611                                         }
6612                                 } else { /* lITERAL tag */
6613                                         if (map->opaque_literal_tag) {
6614                                                 str = map->opaque_literal_tag(tvb, off + 1,
6615                                                                               tag_save_literal, *codepage_stag, &len);
6616                                         } else {
6617                                                 str = default_opaque_literal_tag(tvb, off + 1,
6618                                                                                  tag_save_literal, *codepage_stag, &len);
6619                                         }
6620                                 }
6621                                 proto_tree_add_text (tree, tvb, off, 1 + len,
6622                                                      "  %3d | Tag   | T %3d    "
6623                                                      "| OPAQUE (Opaque data)            "
6624                                                      "| %s%s",
6625                                                      *level, *codepage_stag, Indent (*level), str);
6626                                 g_free(str);
6627                                 off += 1 + len;
6628                         } else { /* WBXML 1.0 - RESERVED_2 token (invalid) */
6629                                 proto_tree_add_text (tree, tvb, off, 1,
6630                                                      "  %3d | Tag   | T %3d    "
6631                                                      "| RESERVED_2     (Invalid Token!) "
6632                                                      "| WBXML 1.0 parsing stops here.",
6633                                                      *level, *codepage_stag);
6634                                 /* Stop processing as it is impossible to parse now */
6635                                 off = tvb_len;
6636                                 DebugLog(("STAG: level = %u, Return: len = %u\n", *level, off - offset));
6637                                 return (off - offset);
6638                         }
6639                         break;
6640
6641                         /* No default clause, as all cases have been treated */
6642                 } else { /* LITERAL or Known TAG */
6643                         /* We must store the initial tag, and also retrieve the new tag.
6644                          * For efficiency reasons, we store the literal tag representation
6645                          * for known tags too, so we can easily close the tag without the
6646                          * need of a new lookup and avoiding storage of token codepage.
6647                          *
6648                          * There are 4 possibilities:
6649                          *
6650                          *  1. Known tag followed by a known tag
6651                          *  2. Known tag followed by a LITERAL tag
6652                          *  3. LITERAL tag followed by Known tag
6653                          *  4. LITERAL tag followed by LITERAL tag
6654                          */
6655
6656                         /* Store the new tag */
6657                         tag_len = 0;
6658                         if ((peek & 0x3F) == 4) { /* LITERAL */
6659                                 DebugLog(("STAG: LITERAL tag (peek = 0x%02X, off = %u) - TableRef follows!\n", peek, off));
6660                                 index = tvb_get_guintvar (tvb, off+1, &tag_len);
6661                                 str_len = tvb_strsize (tvb, str_tbl+index);
6662                                 tag_new_literal = (gchar*)tvb_get_ptr (tvb, str_tbl+index, str_len);
6663                                 tag_new_known = 0; /* invalidate known tag_new */
6664                         } else { /* Known tag */
6665                                 tag_new_known = peek & 0x3F;
6666                                 tag_new_literal = map_token (map->tags, *codepage_stag,
6667                                                              tag_new_known);
6668                                 /* Stored looked up tag name string */
6669                         }
6670
6671                         /* Parsing of TAG starts HERE */
6672                         if (peek & 0x40) { /* Content present */
6673                                 /* Content follows
6674                                  * [!] An explicit END token is expected in these cases!
6675                                  * ==> Recursion possible if we encounter a tag with content;
6676                                  *     recursion will return at the explicit END token.
6677                                  */
6678                                 if (parsing_tag_content) { /* Recurse */
6679                                         DebugLog(("STAG: Tag in Tag - RECURSE! (off = %u)\n", off));
6680                                         /* Do not process the attribute list:
6681                                          * recursion will take care of it */
6682                                         (*level)++;
6683                                         len = parse_wbxml_tag_defined (tree, tvb, off, str_tbl,
6684                                                                        level, codepage_stag, codepage_attr, map);
6685                                         off += len;
6686                                 } else { /* Now we will have content to parse */
6687                                         /* Save the start tag so we can properly close it later. */
6688                                         if ((peek & 0x3F) == 4) { /* Literal tag */
6689                                                 tag_save_literal = tag_new_literal;
6690                                                 tag_save_known = 0;
6691                                         } else { /* Known tag */
6692                                                 tag_save_known = tag_new_known;
6693                                                 tag_save_literal = tag_new_literal;
6694                                                 /* The last statement avoids needless lookups */
6695                                         }
6696                                         /* Process the attribute list if present */
6697                                         if (peek & 0x80) { /* Content and Attribute list present */
6698                                                 if (tag_new_known) { /* Known tag */
6699                                                         proto_tree_add_text (tree, tvb, off, 1,
6700                                                                              "  %3d | Tag   | T %3d    "
6701                                                                              "|   Known Tag 0x%02X           (AC) "
6702                                                                              "| %s<%s",
6703                                                                              *level, *codepage_stag, tag_new_known,
6704                                                                              Indent (*level), tag_new_literal);
6705                                                         /* Tag string already looked up earlier! */
6706                                                         off++;
6707                                                 } else { /* LITERAL tag */
6708                                                         proto_tree_add_text (tree, tvb, off, 1,
6709                                                                              "  %3d | Tag   | T %3d    "
6710                                                                              "| LITERAL_AC (Literal tag)   (AC) "
6711                                                                              "| %s<%s",
6712                                                                              *level, *codepage_stag, Indent (*level), tag_new_literal);
6713                                                         off += 1 + tag_len;
6714                                                 }
6715                                                 len = parse_wbxml_attribute_list_defined (tree, tvb,
6716                                                                                           off, str_tbl, *level, codepage_attr, map);
6717                                                 /* Check that there is still room in packet */
6718                                                 off += len;
6719                                                 if (off >= tvb_len) {
6720                                                         DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n",
6721                                                                   *level, off - offset));
6722                                                         /*
6723                                                          * TODO - Do we need to free g_malloc()ed memory?
6724                                                          */
6725                                                         THROW(ReportedBoundsError);
6726                                                 }
6727                                                 proto_tree_add_text (tree, tvb, off-1, 1,
6728                                                                      "  %3d | Tag   | T %3d    "
6729                                                                      "| END (attribute list)            "
6730                                                                      "| %s>",
6731                                                                      *level, *codepage_stag, Indent (*level));
6732                                         } else { /* Content, no Attribute list */
6733                                                 if (tag_new_known) { /* Known tag */
6734                                                         proto_tree_add_text (tree, tvb, off, 1,
6735                                                                              "  %3d | Tag   | T %3d    "
6736                                                                              "|   Known Tag 0x%02X           (.C) "
6737                                                                              "| %s<%s>",
6738                                                                              *level, *codepage_stag, tag_new_known,
6739                                                                              Indent (*level), tag_new_literal);
6740                                                         /* Tag string already looked up earlier! */
6741                                                         off++;
6742                                                 } else { /* LITERAL tag */
6743                                                         proto_tree_add_text (tree, tvb, off, 1,
6744                                                                              "  %3d | Tag   | T %3d    "
6745                                                                              "| LITERAL_C  (Literal Tag)   (.C) "
6746                                                                              "| %s<%s>",
6747                                                                              *level, *codepage_stag, Indent (*level),
6748                                                                              tag_new_literal);
6749                                                         off += 1 + tag_len;
6750                                                 }
6751                                         }
6752                                         /* The data that follows in the parsing process
6753                                          * represents content for the opening tag
6754                                          * we've just processed in the lines above.
6755                                          * Next time we encounter a tag with content: recurse
6756                                          */
6757                                         parsing_tag_content = TRUE;
6758                                         DebugLog(("Tag in Tag - No recursion this time! (off = %u)\n", off));
6759                                 }
6760                         } else { /* No Content */
6761                                 DebugLog(("<Tag/> in Tag - No recursion! (off = %u)\n", off));
6762                                 (*level)++;
6763                                 if (peek & 0x80) { /* No Content, Attribute list present */
6764                                         if (tag_new_known) { /* Known tag */
6765                                                 proto_tree_add_text (tree, tvb, off, 1,
6766                                                                      "  %3d | Tag   | T %3d    "
6767                                                                      "|   Known Tag 0x%02X           (A.) "
6768                                                                      "| %s<%s",
6769                                                                      *level, *codepage_stag, tag_new_known,
6770                                                                      Indent (*level), tag_new_literal);
6771                                                 /* Tag string already looked up earlier! */
6772                                                 off++;
6773                                                 len = parse_wbxml_attribute_list_defined (tree, tvb,
6774                                                                                           off, str_tbl, *level, codepage_attr, map);
6775                                                 /* Check that there is still room in packet */
6776                                                 off += len;
6777                                                 if (off > tvb_len) {
6778                                                         DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n", *level, off - offset));
6779                                                         /*
6780                                                          * TODO - Do we need to free g_malloc()ed memory?
6781                                                          */
6782                                                         THROW(ReportedBoundsError);
6783                                                 }
6784                                                 proto_tree_add_text (tree, tvb, off-1, 1,
6785                                                                      "  %3d | Tag   | T %3d    "
6786                                                                      "| END (Known Tag)                 "
6787                                                                      "| %s/>",
6788                                                                      *level, *codepage_stag, Indent (*level));
6789                                         } else { /* LITERAL tag */
6790                                                 proto_tree_add_text (tree, tvb, off, 1,
6791                                                                      "  %3d | Tag   | T %3d    "
6792                                                                      "| LITERAL_A  (Literal Tag)   (A.) "
6793                                                                      "| %s<%s",
6794                                                                      *level, *codepage_stag, Indent (*level), tag_new_literal);
6795                                                 off += 1 + tag_len;
6796                                                 len = parse_wbxml_attribute_list_defined (tree, tvb,
6797                                                                                           off, str_tbl, *level, codepage_attr, map);
6798                                                 /* Check that there is still room in packet */
6799                                                 off += len;
6800                                                 if (off >= tvb_len) {
6801                                                         DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n", *level, off - offset));
6802                                                         /*
6803                                                          * TODO - Do we need to free g_malloc()ed memory?
6804                                                          */
6805                                                         THROW(ReportedBoundsError);
6806                                                 }
6807                                                 proto_tree_add_text (tree, tvb, off-1, 1,
6808                                                                      "  %3d | Tag   | T %3d    "
6809                                                                      "| END (Literal Tag)               "
6810                                                                      "| %s/>",
6811                                                                      *level, *codepage_stag, Indent (*level));
6812                                         }
6813                                 } else { /* No Content, No Attribute list */
6814                                         if (tag_new_known) { /* Known tag */
6815                                                 proto_tree_add_text (tree, tvb, off, 1,
6816                                                                      "  %3d | Tag   | T %3d    "
6817                                                                      "|   Known Tag 0x%02x           (..) "
6818                                                                      "| %s<%s />",
6819                                                                      *level, *codepage_stag, tag_new_known,
6820                                                                      Indent (*level), tag_new_literal);
6821                                                 /* Tag string already looked up earlier! */
6822                                                 off++;
6823                                         } else { /* LITERAL tag */
6824                                                 proto_tree_add_text (tree, tvb, off, 1,
6825                                                                      "  %3d | Tag   | T %3d    "
6826                                                                      "| LITERAL    (Literal Tag)   (..) "
6827                                                                      "| %s<%s />",
6828                                                                      *level, *codepage_stag, Indent (*level),
6829                                                                      tag_new_literal);
6830                                                 off += 1 + tag_len;
6831                                         }
6832                                 }
6833                                 (*level)--;
6834                                 /* TODO: Do I have to reset code page here? */
6835                         }
6836                 } /* if (tag & 0x3F) >= 5 */
6837         } /* while */
6838         DebugLog(("STAG: level = %u, Return: len = %u (end of function body)\n", *level, off - offset));
6839         return (off - offset);
6840 }
6841
6842
6843 /* This function performs the WBXML decoding as in parse_wbxml_tag_defined()
6844  * but this time no WBXML mapping is performed.
6845  *
6846  * Attribute parsing is done in parse_wbxml_attribute_list().
6847  */
6848 static guint32
6849 parse_wbxml_tag (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
6850                  guint32 str_tbl, guint8 *level,
6851                  guint8 *codepage_stag, guint8 *codepage_attr)
6852 {
6853         guint32 tvb_len = tvb_reported_length (tvb);
6854         guint32 off = offset;
6855         guint32 len;
6856         guint str_len;
6857         guint32 ent;
6858         guint32 index;
6859         guint8 peek;
6860         guint32 tag_len; /* Length of the index (uintvar) from a LITERAL tag */
6861         guint8 tag_save_known = 0; /* Will contain peek & 0x3F (tag identity) */
6862         guint8 tag_new_known = 0; /* Will contain peek & 0x3F (tag identity) */
6863         const char *tag_save_literal; /* Will contain the LITERAL tag identity */
6864         const char *tag_new_literal; /* Will contain the LITERAL tag identity */
6865         char *tag_save_buf=NULL; /* Will contain "tag_0x%02X" */
6866         char *tag_new_buf=NULL; /* Will contain "tag_0x%02X" */
6867         guint8 parsing_tag_content = FALSE; /* Are we parsing content from a
6868                                                tag with content: <x>Content</x>
6869
6870                                                The initial state is FALSE.
6871                                                This state will trigger recursion. */
6872         tag_save_literal = NULL; /* Prevents compiler warning */
6873
6874         DebugLog(("parse_wbxml_tag (level = %u, offset = %u)\n", *level, offset));
6875         while (off < tvb_len) {
6876                 peek = tvb_get_guint8 (tvb, off);
6877                 DebugLog(("STAG: (top of while) level = %3u, peek = 0x%02X, off = %u, tvb_len = %u\n", *level, peek, off, tvb_len));
6878                 if ((peek & 0x3F) < 4) switch (peek) { /* Global tokens in state = STAG
6879                                                           but not the LITERAL tokens */
6880                 case 0x00: /* SWITCH_PAGE */
6881                         *codepage_stag = tvb_get_guint8 (tvb, off+1);
6882                         proto_tree_add_text (tree, tvb, off, 2,
6883                                              "      | Tag   | T -->%3d "
6884                                              "| SWITCH_PAGE (Tag code page)     "
6885                                              "|",
6886                                              *codepage_stag);
6887                         off += 2;
6888                         break;
6889                 case 0x01: /* END: only possible for Tag with Content */
6890                         if (tag_save_known) { /* Known TAG */
6891                                 proto_tree_add_text (tree, tvb, off, 1,
6892                                                      "  %3d | Tag   | T %3d    "
6893                                                      "| END (Known Tag 0x%02X)            "
6894                                                      "| %s</%s>",
6895                                                      *level, *codepage_stag, tag_save_known,
6896                                                      Indent (*level),
6897                                                      tag_save_literal); /* We already looked it up! */
6898                         } else { /* Literal TAG */
6899                                 proto_tree_add_text (tree, tvb, off, 1,
6900                                                      "  %3d | Tag   | T %3d    "
6901                                                      "| END (Literal Tag)               "
6902                                                      "| %s</%s>",
6903                                                      *level, *codepage_stag, Indent (*level),
6904                                                      tag_save_literal ? tag_save_literal : "");
6905                         }
6906                         (*level)--;
6907                         off++;
6908                         /* Reset code page: not needed as return from recursion */
6909                         DebugLog(("STAG: level = %u, Return: len = %u\n",
6910                                   *level, off - offset));
6911                         return (off - offset);
6912                         break;
6913                 case 0x02: /* ENTITY */
6914                         ent = tvb_get_guintvar (tvb, off+1, &len);
6915                         proto_tree_add_text (tree, tvb, off, 1+len,
6916                                              "  %3d | Tag   | T %3d    "
6917                                              "| ENTITY                          "
6918                                              "| %s'&#%u;'",
6919                                              *level, *codepage_stag, Indent (*level), ent);
6920                         off += 1+len;
6921                         break;
6922                 case 0x03: /* STR_I */
6923                         len = tvb_strsize (tvb, off+1);
6924                         proto_tree_add_text (tree, tvb, off, 1+len,
6925                                              "  %3d | Tag   | T %3d    "
6926                                              "| STR_I (Inline string)           "
6927                                              "| %s\'%s\'",
6928                                              *level, *codepage_stag, Indent(*level),
6929                                              tvb_format_text (tvb, off+1, len-1));
6930                         off += 1+len;
6931                         break;
6932                 case 0x40: /* EXT_I_0 */
6933                 case 0x41: /* EXT_I_1 */
6934                 case 0x42: /* EXT_I_2 */
6935                         /* Extension tokens */
6936                         len = tvb_strsize (tvb, off+1);
6937                         proto_tree_add_text (tree, tvb, off, 1+len,
6938                                              "  %3d | Tag   | T %3d    "
6939                                              "| EXT_I_%1x    (Extension Token)    "
6940                                              "| %s(Inline string extension: \'%s\')",
6941                                              *level, *codepage_stag, peek & 0x0f, Indent (*level),
6942                                              tvb_format_text (tvb, off+1, len-1));
6943                         off += 1+len;
6944                         break;
6945                 case 0x43: /* PI */
6946                         proto_tree_add_text (tree, tvb, off, 1,
6947                                              "  %3d | Tag   | T %3d    "
6948                                              "| PI (XML Processing Instruction) "
6949                                              "| %s<?xml",
6950                                              *level, *codepage_stag, Indent (*level));
6951                         len = parse_wbxml_attribute_list (tree, tvb, off, str_tbl,
6952                                                           *level, codepage_attr);
6953                         /* Check that there is still room in packet */
6954                         off += len;
6955                         if (off >= tvb_len) {
6956                                 DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n",
6957                                           *level, off - offset));
6958                                 /*
6959                                  * TODO - Do we need to free g_malloc()ed memory?
6960                                  */
6961                                 THROW(ReportedBoundsError);
6962                         }
6963                         proto_tree_add_text (tree, tvb, off-1, 1,
6964                                              "  %3d | Tag   | T %3d    "
6965                                              "| END (PI)                        "
6966                                              "| %s?>",
6967                                              *level, *codepage_stag, Indent (*level));
6968                         break;
6969                 case 0x80: /* EXT_T_0 */
6970                 case 0x81: /* EXT_T_1 */
6971                 case 0x82: /* EXT_T_2 */
6972                         /* Extension tokens */
6973                         index = tvb_get_guintvar (tvb, off+1, &len);
6974                         proto_tree_add_text (tree, tvb, off, 1+len,
6975                                              "  %3d | Tag   | T %3d    "
6976                                              "| EXT_T_%1x    (Extension Token)    "
6977                                              "| %s(Extension Token, integer value: %u)",
6978                                              *level, *codepage_stag, peek & 0x0f, Indent (*level),
6979                                              index);
6980                         off += 1+len;
6981                         break;
6982                 case 0x83: /* STR_T */
6983                         index = tvb_get_guintvar (tvb, off+1, &len);
6984                         str_len = tvb_strsize (tvb, str_tbl+index);
6985                         proto_tree_add_text (tree, tvb, off, 1+len,
6986                                              "  %3d | Tag   | T %3d    "
6987                                              "| STR_T (Tableref string)         "
6988                                              "| %s\'%s\'",
6989                                              *level, *codepage_stag, Indent (*level),
6990                                              tvb_format_text (tvb, str_tbl+index, str_len-1));
6991                         off += 1+len;
6992                         break;
6993                 case 0xC0: /* EXT_0 */
6994                 case 0xC1: /* EXT_1 */
6995                 case 0xC2: /* EXT_2 */
6996                         /* Extension tokens */
6997                         proto_tree_add_text (tree, tvb, off, 1,
6998                                              "  %3d | Tag   | T %3d    "
6999                                              "| EXT_%1x      (Extension Token)    "
7000                                              "| %s(Single-byte extension)",
7001                                              *level, *codepage_stag, peek & 0x0f, Indent (*level));
7002                         off++;
7003                         break;
7004                 case 0xC3: /* OPAQUE - WBXML 1.1 and newer */
7005                         if (tvb_get_guint8 (tvb, 0)) { /* WBXML 1.x (x > 0) */
7006                                 index = tvb_get_guintvar (tvb, off+1, &len);
7007                                 proto_tree_add_text (tree, tvb, off, 1 + len + index,
7008                                                      "  %3d | Tag   | T %3d    "
7009                                                      "| OPAQUE (Opaque data)            "
7010                                                      "| %s(%d bytes of opaque data)",
7011                                                      *level, *codepage_stag, Indent (*level), index);
7012                                 off += 1+len+index;
7013                         } else { /* WBXML 1.0 - RESERVED_2 token (invalid) */
7014                                 proto_tree_add_text (tree, tvb, off, 1,
7015                                                      "  %3d | Tag   | T %3d    "
7016                                                      "| RESERVED_2     (Invalid Token!) "
7017                                                      "| WBXML 1.0 parsing stops here.",
7018                                                      *level, *codepage_stag);
7019                                 /* Stop processing as it is impossible to parse now */
7020                                 off = tvb_len;
7021                                 DebugLog(("STAG: level = %u, Return: len = %u\n",
7022                                           *level, off - offset));
7023                                 return (off - offset);
7024                         }
7025                         break;
7026
7027                         /* No default clause, as all cases have been treated */
7028                 } else { /* LITERAL or Known TAG */
7029                         /* We must store the initial tag, and also retrieve the new tag.
7030                          * For efficiency reasons, we store the literal tag representation
7031                          * for known tags too, so we can easily close the tag without the
7032                          * need of a new lookup and avoiding storage of token codepage.
7033                          *
7034                          * There are 4 possibilities:
7035                          *
7036                          *  1. Known tag followed by a known tag
7037                          *  2. Known tag followed by a LITERAL tag
7038                          *  3. LITERAL tag followed by Known tag
7039                          *  4. LITERAL tag followed by LITERAL tag
7040                          */
7041
7042                         /* Store the new tag */
7043                         tag_len = 0;
7044                         if ((peek & 0x3F) == 4) { /* LITERAL */
7045                                 DebugLog(("STAG: LITERAL tag (peek = 0x%02X, off = %u)"
7046                                           " - TableRef follows!\n", peek, off));
7047                                 index = tvb_get_guintvar (tvb, off+1, &tag_len);
7048                                 str_len = tvb_strsize (tvb, str_tbl+index);
7049                                 tag_new_literal = (gchar*)tvb_get_ptr (tvb, str_tbl+index, str_len);
7050                                 tag_new_known = 0; /* invalidate known tag_new */
7051                         } else { /* Known tag */
7052                                 tag_new_known = peek & 0x3F;
7053                                 tag_new_buf=ep_alloc(10);
7054                                 g_snprintf (tag_new_buf, 10, "Tag_0x%02X",
7055                                             tag_new_known);
7056                                 tag_new_literal = tag_new_buf;
7057                                 /* Stored looked up tag name string */
7058                         }
7059
7060                         /* Parsing of TAG starts HERE */
7061                         if (peek & 0x40) { /* Content present */
7062                                 /* Content follows
7063                                  * [!] An explicit END token is expected in these cases!
7064                                  * ==> Recursion possible if we encounter a tag with content;
7065                                  *     recursion will return at the explicit END token.
7066                                  */
7067                                 if (parsing_tag_content) { /* Recurse */
7068                                         DebugLog(("STAG: Tag in Tag - RECURSE! (off = %u)\n", off));
7069                                         /* Do not process the attribute list:
7070                                          * recursion will take care of it */
7071                                         (*level)++;
7072                                         len = parse_wbxml_tag (tree, tvb, off, str_tbl, level,
7073                                                                codepage_stag, codepage_attr);
7074                                         off += len;
7075                                 } else { /* Now we will have content to parse */
7076                                         /* Save the start tag so we can properly close it later. */
7077                                         if ((peek & 0x3F) == 4) { /* Literal tag */
7078                                                 tag_save_literal = tag_new_literal;
7079                                                 tag_save_known = 0;
7080                                         } else { /* Known tag */
7081                                                 tag_save_known = tag_new_known;
7082                                                 tag_save_buf=ep_alloc(10);
7083                                                 g_snprintf (tag_save_buf, 10, "Tag_0x%02X",
7084                                                             tag_new_known);
7085                                                 tag_save_literal = tag_save_buf;
7086                                                 /* The last statement avoids needless lookups */
7087                                         }
7088                                         /* Process the attribute list if present */
7089                                         if (peek & 0x80) { /* Content and Attribute list present */
7090                                                 if (tag_new_known) { /* Known tag */
7091                                                         proto_tree_add_text (tree, tvb, off, 1,
7092                                                                              "  %3d | Tag   | T %3d    "
7093                                                                              "|   Known Tag 0x%02X           (AC) "
7094                                                                              "| %s<%s",
7095                                                                              *level, *codepage_stag, tag_new_known,
7096                                                                              Indent (*level), tag_new_literal);
7097                                                         /* Tag string already looked up earlier! */
7098                                                         off++;
7099                                                 } else { /* LITERAL tag */
7100                                                         proto_tree_add_text (tree, tvb, off, 1,
7101                                                                              "  %3d | Tag   | T %3d    "
7102                                                                              "| LITERAL_AC (Literal tag)   (AC) "
7103                                                                              "| %s<%s",
7104                                                                              *level, *codepage_stag, Indent (*level),
7105                                                                              tag_new_literal);
7106                                                         off += 1 + tag_len;
7107                                                 }
7108                                                 len = parse_wbxml_attribute_list (tree, tvb,
7109                                                                                   off, str_tbl, *level, codepage_attr);
7110                                                 /* Check that there is still room in packet */
7111                                                 off += len;
7112                                                 if (off >= tvb_len) {
7113                                                         DebugLog(("STAG: level = %u, ThrowException: "
7114                                                                   "len = %u (short frame)\n",
7115                                                                   *level, off - offset));
7116                                                         /*
7117                                                          * TODO - Do we need to free g_malloc()ed memory?
7118                                                          */
7119                                                         THROW(ReportedBoundsError);
7120                                                 }
7121                                                 proto_tree_add_text (tree, tvb, off-1, 1,
7122                                                                      "  %3d | Tag   | T %3d    "
7123                                                                      "| END (attribute list)            "
7124                                                                      "| %s>",
7125                                                                      *level, *codepage_stag, Indent (*level));
7126                                         } else { /* Content, no Attribute list */
7127                                                 if (tag_new_known) { /* Known tag */
7128                                                         proto_tree_add_text (tree, tvb, off, 1,
7129                                                                              "  %3d | Tag   | T %3d    "
7130                                                                              "|   Known Tag 0x%02X           (.C) "
7131                                                                              "| %s<%s>",
7132                                                                              *level, *codepage_stag, tag_new_known,
7133                                                                              Indent (*level), tag_new_literal);
7134                                                         /* Tag string already looked up earlier! */
7135                                                         off++;
7136                                                 } else { /* LITERAL tag */
7137                                                         proto_tree_add_text (tree, tvb, off, 1,
7138                                                                              "  %3d | Tag   | T %3d    "
7139                                                                              "| LITERAL_C  (Literal Tag)   (.C) "
7140                                                                              "| %s<%s>",
7141                                                                              *level, *codepage_stag, Indent (*level),
7142                                                                              tag_new_literal);
7143                                                         off += 1 + tag_len;
7144                                                 }
7145                                         }
7146                                         /* The data that follows in the parsing process
7147                                          * represents content for the opening tag
7148                                          * we've just processed in the lines above.
7149                                          * Next time we encounter a tag with content: recurse
7150                                          */
7151                                         parsing_tag_content = TRUE;
7152                                         DebugLog(("Tag in Tag - No recursion this time! "
7153                                                   "(off = %u)\n", off));
7154                                 }
7155                         } else { /* No Content */
7156                                 DebugLog(("<Tag/> in Tag - No recursion! (off = %u)\n", off));
7157                                 (*level)++;
7158                                 if (peek & 0x80) { /* No Content, Attribute list present */
7159                                         if (tag_new_known) { /* Known tag */
7160                                                 proto_tree_add_text (tree, tvb, off, 1,
7161                                                                      "  %3d | Tag   | T %3d    "
7162                                                                      "|   Known Tag 0x%02X           (A.) "
7163                                                                      "| %s<%s",
7164                                                                      *level, *codepage_stag, tag_new_known,
7165                                                                      Indent (*level), tag_new_literal);
7166                                                 /* Tag string already looked up earlier! */
7167                                                 off++;
7168                                                 len = parse_wbxml_attribute_list (tree, tvb,
7169                                                                                   off, str_tbl, *level, codepage_attr);
7170                                                 /* Check that there is still room in packet */
7171                                                 off += len;
7172                                                 if (off >= tvb_len) {
7173                                                         DebugLog(("STAG: level = %u, ThrowException: "
7174                                                                   "len = %u (short frame)\n",
7175                                                                   *level, off - offset));
7176                                                         /*
7177                                                          * TODO - Do we need to free g_malloc()ed memory?
7178                                                          */
7179                                                         THROW(ReportedBoundsError);
7180                                                 }
7181                                                 proto_tree_add_text (tree, tvb, off-1, 1,
7182                                                                      "  %3d | Tag   | T %3d    "
7183                                                                      "| END (Known Tag)                 "
7184                                                                      "| %s/>",
7185                                                                      *level, *codepage_stag, Indent (*level));
7186                                         } else { /* LITERAL tag */
7187                                                 proto_tree_add_text (tree, tvb, off, 1,
7188                                                                      "  %3d | Tag   | T %3d    "
7189                                                                      "| LITERAL_A  (Literal Tag)   (A.) "
7190                                                                      "| %s<%s",
7191                                                                      *level, *codepage_stag, Indent (*level),
7192                                                                      tag_new_literal);
7193                                                 off += 1 + tag_len;
7194                                                 len = parse_wbxml_attribute_list (tree, tvb,
7195                                                                                   off, str_tbl, *level, codepage_attr);
7196                                                 /* Check that there is still room in packet */
7197                                                 off += len;
7198                                                 if (off >= tvb_len) {
7199                                                         DebugLog(("STAG: level = %u, ThrowException: "
7200                                                                   "len = %u (short frame)\n",
7201                                                                   *level, off - offset));
7202                                                         /*
7203                                                          * TODO - Do we need to free g_malloc()ed memory?
7204                                                          */
7205                                                         THROW(ReportedBoundsError);
7206                                                 }
7207                                                 proto_tree_add_text (tree, tvb, off-1, 1,
7208                                                                      "  %3d | Tag   | T %3d    "
7209                                                                      "| END (Literal Tag)               "
7210                                                                      "| %s/>",
7211                                                                      *level, *codepage_stag, Indent (*level));
7212                                         }
7213                                 } else { /* No Content, No Attribute list */
7214                                         if (tag_new_known) { /* Known tag */
7215                                                 proto_tree_add_text (tree, tvb, off, 1,
7216                                                                      "  %3d | Tag   | T %3d    "
7217                                                                      "|   Known Tag 0x%02x           (..) "
7218                                                                      "| %s<%s />",
7219                                                                      *level, *codepage_stag, tag_new_known,
7220                                                                      Indent (*level), tag_new_literal);
7221                                                 /* Tag string already looked up earlier! */
7222                                                 off++;
7223                                         } else { /* LITERAL tag */
7224                                                 proto_tree_add_text (tree, tvb, off, 1,
7225                                                                      "  %3d | Tag   | T %3d    "
7226                                                                      "| LITERAL    (Literal Tag)   (..) "
7227                                                                      "| %s<%s />",
7228                                                                      *level, *codepage_stag, Indent (*level),
7229                                                                      tag_new_literal);
7230                                                 off += 1 + tag_len;
7231                                         }
7232                                 }
7233                                 (*level)--;
7234                                 /* TODO: Do I have to reset code page here? */
7235                         }
7236                 } /* if (tag & 0x3F) >= 5 */
7237         } /* while */
7238         DebugLog(("STAG: level = %u, Return: len = %u (end of function body)\n",
7239                   *level, off - offset));
7240         return (off - offset);
7241 }
7242
7243
7244 /**************************
7245  * WBXML Attribute tokens *
7246  **************************
7247  * Bit Mask  : Example
7248  * -------------------
7249  * 0... .... : attr=             (attribute name)
7250  *             href='http://'    (attribute name with start of attribute value)
7251  * 1... .... : 'www.'            (attribute value, or part of it)
7252  *
7253  */
7254
7255
7256 /* This function parses the WBXML and maps known token interpretations
7257  * to the WBXML tokens. As a result, the original XML document can be
7258  * recreated. Indentation is generated in order to ease reading.
7259  *
7260  * This function performs attribute list parsing.
7261  *
7262  * The wbxml_decoding entry *map contains the actual token mapping.
7263  *
7264  * NOTE: See above for known token mappings.
7265  */
7266 static guint32
7267 parse_wbxml_attribute_list_defined (proto_tree *tree, tvbuff_t *tvb,
7268                                     guint32 offset, guint32 str_tbl, guint8 level, guint8 *codepage_attr,
7269                                     const wbxml_decoding *map)
7270 {
7271         guint32 tvb_len = tvb_reported_length (tvb);
7272         guint32 off = offset;
7273         guint32 len;
7274         guint str_len;
7275         guint32 ent;
7276         guint32 index;
7277         guint8 peek;
7278         guint8 attr_save_known = 0; /* Will contain peek & 0x3F (attr identity) */
7279         const char *attr_save_literal = NULL; /* Will contain the LITERAL attr identity */
7280
7281         DebugLog(("parse_wbxml_attr_defined (level = %u, offset = %u)\n",
7282                   level, offset));
7283         /* Parse attributes */
7284         while (off < tvb_len) {
7285                 peek = tvb_get_guint8 (tvb, off);
7286                 DebugLog(("ATTR: (top of while) level = %3u, peek = 0x%02X, "
7287                           "off = %u, tvb_len = %u\n", level, peek, off, tvb_len));
7288                 if ((peek & 0x3F) < 5) switch (peek) { /* Global tokens
7289                                                           in state = ATTR */
7290                 case 0x00: /* SWITCH_PAGE */
7291                         *codepage_attr = tvb_get_guint8 (tvb, off+1);
7292                         proto_tree_add_text (tree, tvb, off, 2,
7293                                              "      |  Attr | A -->%3d "
7294                                              "| SWITCH_PAGE (Attr code page)    |",
7295                                              *codepage_attr);
7296                         off += 2;
7297                         break;
7298                 case 0x01: /* END */
7299                         /* BEWARE
7300                          *   The Attribute END token means either ">" or "/>"
7301                          *   and as a consequence both must be treated separately.
7302                          *   This is done in the TAG state parser.
7303                          */
7304                         off++;
7305                         DebugLog(("ATTR: level = %u, Return: len = %u\n",
7306                                   level, off - offset));
7307                         return (off - offset);
7308                 case 0x02: /* ENTITY */
7309                         ent = tvb_get_guintvar (tvb, off+1, &len);
7310                         proto_tree_add_text (tree, tvb, off, 1+len,
7311                                              "  %3d |  Attr | A %3d    "
7312                                              "| ENTITY                          "
7313                                              "|     %s'&#%u;'",
7314                                              level, *codepage_attr, Indent (level), ent);
7315                         off += 1+len;
7316                         break;
7317                 case 0x03: /* STR_I */
7318                         len = tvb_strsize (tvb, off+1);
7319                         proto_tree_add_text (tree, tvb, off, 1+len,
7320                                              "  %3d |  Attr | A %3d    "
7321                                              "| STR_I (Inline string)           "
7322                                              "|     %s\'%s\'",
7323                                              level, *codepage_attr, Indent (level),
7324                                              tvb_format_text (tvb, off+1, len-1));
7325                         off += 1+len;
7326                         break;
7327                 case 0x04: /* LITERAL */
7328                         /* ALWAYS means the start of a new attribute,
7329                          * and may only contain the NAME of the attribute.
7330                          */
7331                         index = tvb_get_guintvar (tvb, off+1, &len);
7332                         str_len = tvb_strsize (tvb, str_tbl+index);
7333                         attr_save_known = 0;
7334                         attr_save_literal = tvb_format_text (tvb,
7335                                                              str_tbl+index, str_len-1);
7336                         proto_tree_add_text (tree, tvb, off, 1+len,
7337                                              "  %3d |  Attr | A %3d    "
7338                                              "| LITERAL (Literal Attribute)     "
7339                                              "|   %s<%s />",
7340                                              level, *codepage_attr, Indent (level),
7341                                              attr_save_literal);
7342                         off += 1+len;
7343                         break;
7344                 case 0x40: /* EXT_I_0 */
7345                 case 0x41: /* EXT_I_1 */
7346                 case 0x42: /* EXT_I_2 */
7347                         /* Extension tokens */
7348                         len = tvb_strsize (tvb, off+1);
7349                         proto_tree_add_text (tree, tvb, off, 1+len,
7350                                              "  %3d |  Attr | A %3d    "
7351                                              "| EXT_I_%1x    (Extension Token)    "
7352                                              "|     %s(%s: \'%s\')",
7353                                              level, *codepage_attr, peek & 0x0f, Indent (level),
7354                                              map_token (map->global, 0, peek),
7355                                              tvb_format_text (tvb, off+1, len-1));
7356                         off += 1+len;
7357                         break;
7358                         /* 0x43 impossible in ATTR state */
7359                         /* 0x44 impossible in ATTR state */
7360                 case 0x80: /* EXT_T_0 */
7361                 case 0x81: /* EXT_T_1 */
7362                 case 0x82: /* EXT_T_2 */
7363                         /* Extension tokens */
7364                         index = tvb_get_guintvar (tvb, off+1, &len);
7365                         {   char *s;
7366
7367                                 if (map->ext_t[peek & 0x03])
7368                                         s = (map->ext_t[peek & 0x03])(tvb, index, str_tbl);
7369                                 else
7370                                         s = g_strdup_printf("EXT_T_%1x (%s)", peek & 0x03,
7371                                                             map_token (map->global, 0, peek));
7372
7373                                 proto_tree_add_text (tree, tvb, off, 1+len,
7374                                                      "  %3d | Tag   | T %3d    "
7375                                                      "| EXT_T_%1x    (Extension Token)    "
7376                                                      "| %s%s)",
7377                                                      level, *codepage_attr, peek & 0x0f, Indent (level),
7378                                                      s);
7379                                 g_free(s);
7380                         }
7381                         off += 1+len;
7382                         break;
7383                 case 0x83: /* STR_T */
7384                         index = tvb_get_guintvar (tvb, off+1, &len);
7385                         str_len = tvb_strsize (tvb, str_tbl+index);
7386                         proto_tree_add_text (tree, tvb, off, 1+len,
7387                                              "  %3d |  Attr | A %3d    "
7388                                              "| STR_T (Tableref string)         "
7389                                              "|     %s\'%s\'",
7390                                              level, *codepage_attr, Indent (level),
7391                                              tvb_format_text (tvb, str_tbl+index, str_len-1));
7392                         off += 1+len;
7393                         break;
7394                         /* 0x84 impossible in ATTR state */
7395                 case 0xC0: /* EXT_0 */
7396                 case 0xC1: /* EXT_1 */
7397                 case 0xC2: /* EXT_2 */
7398                         /* Extension tokens */
7399                         proto_tree_add_text (tree, tvb, off, 1,
7400                                              "  %3d |  Attr | A %3d    "
7401                                              "| EXT_%1x      (Extension Token)    "
7402                                              "|     %s(%s)",
7403                                              level, *codepage_attr, peek & 0x0f, Indent (level),
7404                                              map_token (map->global, 0, peek));
7405                         off++;
7406                         break;
7407                 case 0xC3: /* OPAQUE - WBXML 1.1 and newer */
7408                         if (tvb_get_guint8 (tvb, 0)) { /* WBXML 1.x (x > 0) */
7409                                 char *str;
7410                                 if (attr_save_known) { /* Knwon attribute */
7411                                         if (map->opaque_binary_attr) {
7412                                                 str = map->opaque_binary_attr(tvb, off + 1,
7413                                                                               attr_save_known, *codepage_attr, &len);
7414                                         } else {
7415                                                 str = default_opaque_binary_attr(tvb, off + 1,
7416                                                                                  attr_save_known, *codepage_attr, &len);
7417                                         }
7418                                 } else { /* lITERAL attribute */
7419                                         if (map->opaque_literal_tag) {
7420                                                 str = map->opaque_literal_attr(tvb, off + 1,
7421                                                                                attr_save_literal, *codepage_attr, &len);
7422                                         } else {
7423                                                 str = default_opaque_literal_attr(tvb, off + 1,
7424                                                                                   attr_save_literal, *codepage_attr, &len);
7425                                         }
7426                                 }
7427                                 proto_tree_add_text (tree, tvb, off, 1 + len,
7428                                                      "  %3d |  Attr | A %3d    "
7429                                                      "| OPAQUE (Opaque data)            "
7430                                                      "|       %s%s",
7431                                                      level, *codepage_attr, Indent (level), str);
7432                                 g_free(str);
7433                                 off += 1 + len;
7434                         } else { /* WBXML 1.0 - RESERVED_2 token (invalid) */
7435                                 proto_tree_add_text (tree, tvb, off, 1,
7436                                                      "  %3d |  Attr | A %3d    "
7437                                                      "| RESERVED_2     (Invalid Token!) "
7438                                                      "| WBXML 1.0 parsing stops here.",
7439                                                      level, *codepage_attr);
7440                                 /* Stop processing as it is impossible to parse now */
7441                                 off = tvb_len;
7442                                 DebugLog(("ATTR: level = %u, Return: len = %u\n",
7443                                           level, off - offset));
7444                                 return (off - offset);
7445                         }
7446                         break;
7447                         /* 0xC4 impossible in ATTR state */
7448                 default:
7449                         proto_tree_add_text (tree, tvb, off, 1,
7450                                              "  %3d |  Attr | A %3d    "
7451                                              "| %-10s     (Invalid Token!) "
7452                                              "| WBXML parsing stops here.",
7453                                              level, *codepage_attr,
7454                                              val_to_str (peek, vals_wbxml1x_global_tokens, "(unknown 0x%x)"));
7455                         /* Move to end of buffer */
7456                         off = tvb_len;
7457                         break;
7458                 } else { /* Known atribute token */
7459                         if (peek & 0x80) { /* attrValue */
7460                                 proto_tree_add_text (tree, tvb, off, 1,
7461                                                      "  %3d |  Attr | A %3d    "
7462                                                      "|   Known attrValue 0x%02X          "
7463                                                      "|       %s%s",
7464                                                      level, *codepage_attr, peek & 0x7f, Indent (level),
7465                                                      map_token (map->attrValue, *codepage_attr, peek));
7466                                 off++;
7467                         } else { /* attrStart */
7468                                 attr_save_known = peek & 0x7f;
7469                                 proto_tree_add_text (tree, tvb, off, 1,
7470                                                      "  %3d |  Attr | A %3d    "
7471                                                      "|   Known attrStart 0x%02X          "
7472                                                      "|   %s%s",
7473                                                      level, *codepage_attr, attr_save_known, Indent (level),
7474                                                      map_token (map->attrStart, *codepage_attr, peek));
7475                                 off++;
7476                         }
7477                 }
7478         } /* End WHILE */
7479         DebugLog(("ATTR: level = %u, Return: len = %u (end of function body)\n",
7480                   level, off - offset));
7481         return (off - offset);
7482 }
7483
7484
7485 /* This function performs the WBXML attribute decoding as in
7486  * parse_wbxml_attribute_list_defined() but this time no WBXML mapping
7487  * is performed.
7488  *
7489  * This function performs attribute list parsing.
7490  *
7491  * NOTE: Code page switches not yet processed in the code!
7492  */
7493 static guint32
7494 parse_wbxml_attribute_list (proto_tree *tree, tvbuff_t *tvb,
7495                             guint32 offset, guint32 str_tbl, guint8 level, guint8 *codepage_attr)
7496 {
7497         guint32 tvb_len = tvb_reported_length (tvb);
7498         guint32 off = offset;
7499         guint32 len;
7500         guint str_len;
7501         guint32 ent;
7502         guint32 index;
7503         guint8 peek;
7504
7505         DebugLog(("parse_wbxml_attr (level = %u, offset = %u)\n", level, offset));
7506         /* Parse attributes */
7507         while (off < tvb_len) {
7508                 peek = tvb_get_guint8 (tvb, off);
7509                 DebugLog(("ATTR: (top of while) level = %3u, peek = 0x%02X, "
7510                           "off = %u, tvb_len = %u\n", level, peek, off, tvb_len));
7511                 if ((peek & 0x3F) < 5) switch (peek) { /* Global tokens
7512                                                           in state = ATTR */
7513                 case 0x00: /* SWITCH_PAGE */
7514                         *codepage_attr = tvb_get_guint8 (tvb, off+1);
7515                         proto_tree_add_text (tree, tvb, off, 2,
7516                                              "      |  Attr | A -->%3d "
7517                                              "| SWITCH_PAGE (Attr code page)    |",
7518                                              *codepage_attr);
7519                         off += 2;
7520                         break;
7521                 case 0x01: /* END */
7522                         /* BEWARE
7523                          *   The Attribute END token means either ">" or "/>"
7524                          *   and as a consequence both must be treated separately.
7525                          *   This is done in the TAG state parser.
7526                          */
7527                         off++;
7528                         DebugLog(("ATTR: level = %u, Return: len = %u\n",
7529                                   level, off - offset));
7530                         return (off - offset);
7531                 case 0x02: /* ENTITY */
7532                         ent = tvb_get_guintvar (tvb, off+1, &len);
7533                         proto_tree_add_text (tree, tvb, off, 1+len,
7534                                              "  %3d |  Attr | A %3d    "
7535                                              "| ENTITY                          "
7536                                              "|     %s'&#%u;'",
7537                                              level, *codepage_attr, Indent (level), ent);
7538                         off += 1+len;
7539                         break;
7540                 case 0x03: /* STR_I */
7541                         len = tvb_strsize (tvb, off+1);
7542                         proto_tree_add_text (tree, tvb, off, 1+len,
7543                                              "  %3d |  Attr | A %3d    "
7544                                              "| STR_I (Inline string)           "
7545                                              "|     %s\'%s\'",
7546                                              level, *codepage_attr, Indent (level),
7547                                              tvb_format_text (tvb, off+1, len-1));
7548                         off += 1+len;
7549                         break;
7550                 case 0x04: /* LITERAL */
7551                         index = tvb_get_guintvar (tvb, off+1, &len);
7552                         str_len = tvb_strsize (tvb, str_tbl+index);
7553                         proto_tree_add_text (tree, tvb, off, 1+len,
7554                                              "  %3d |  Attr | A %3d    "
7555                                              "| LITERAL (Literal Attribute)     "
7556                                              "|   %s<%s />",
7557                                              level, *codepage_attr, Indent (level),
7558                                              tvb_format_text (tvb, str_tbl+index, str_len-1));
7559                         off += 1+len;
7560                         break;
7561                 case 0x40: /* EXT_I_0 */
7562                 case 0x41: /* EXT_I_1 */
7563                 case 0x42: /* EXT_I_2 */
7564                         /* Extension tokens */
7565                         len = tvb_strsize (tvb, off+1);
7566                         proto_tree_add_text (tree, tvb, off, 1+len,
7567                                              "  %3d |  Attr | A %3d    "
7568                                              "| EXT_I_%1x    (Extension Token)    "
7569                                              "|     %s(Inline string extension: \'%s\')",
7570                                              level, *codepage_attr, peek & 0x0f, Indent (level),
7571                                              tvb_format_text (tvb, off+1, len-1));
7572                         off += 1+len;
7573                         break;
7574                         /* 0x43 impossible in ATTR state */
7575                         /* 0x44 impossible in ATTR state */
7576                 case 0x80: /* EXT_T_0 */
7577                 case 0x81: /* EXT_T_1 */
7578                 case 0x82: /* EXT_T_2 */
7579                         /* Extension tokens */
7580                         index = tvb_get_guintvar (tvb, off+1, &len);
7581                         proto_tree_add_text (tree, tvb, off, 1+len,
7582                                              "  %3d |  Attr | A %3d    "
7583                                              "| EXT_T_%1x    (Extension Token)    "
7584                                              "|     %s(Extension Token, integer value: %u)",
7585                                              level, *codepage_attr, peek & 0x0f, Indent (level),
7586                                              index);
7587                         off += 1+len;
7588                         break;
7589                 case 0x83: /* STR_T */
7590                         index = tvb_get_guintvar (tvb, off+1, &len);
7591                         str_len = tvb_strsize (tvb, str_tbl+index);
7592                         proto_tree_add_text (tree, tvb, off, 1+len,
7593                                              "  %3d |  Attr | A %3d    "
7594                                              "| STR_T (Tableref string)         "
7595                                              "|     %s\'%s\'",
7596                                              level, *codepage_attr, Indent (level),
7597                                              tvb_format_text (tvb, str_tbl+index, str_len-1));
7598                         off += 1+len;
7599                         break;
7600                         /* 0x84 impossible in ATTR state */
7601                 case 0xC0: /* EXT_0 */
7602                 case 0xC1: /* EXT_1 */
7603                 case 0xC2: /* EXT_2 */
7604                         /* Extension tokens */
7605                         proto_tree_add_text (tree, tvb, off, 1,
7606                                              "  %3d |  Attr | A %3d    "
7607                                              "| EXT_%1x      (Extension Token)    "
7608                                              "|     %s(Single-byte extension)",
7609                                              level, *codepage_attr, peek & 0x0f, Indent (level));
7610                         off++;
7611                         break;
7612                 case 0xC3: /* OPAQUE - WBXML 1.1 and newer */
7613                         if (tvb_get_guint8 (tvb, 0)) { /* WBXML 1.x (x > 0) */
7614                                 index = tvb_get_guintvar (tvb, off+1, &len);
7615                                 proto_tree_add_text (tree, tvb, off, 1 + len + index,
7616                                                      "  %3d |  Attr | A %3d    "
7617                                                      "| OPAQUE (Opaque data)            "
7618                                                      "|       %s(%d bytes of opaque data)",
7619                                                      level, *codepage_attr, Indent (level), index);
7620                                 off += 1+len+index;
7621                         } else { /* WBXML 1.0 - RESERVED_2 token (invalid) */
7622                                 proto_tree_add_text (tree, tvb, off, 1,
7623                                                      "  %3d |  Attr | A %3d    "
7624                                                      "| RESERVED_2     (Invalid Token!) "
7625                                                      "| WBXML 1.0 parsing stops here.",
7626                                                      level, *codepage_attr);
7627                                 /* Stop processing as it is impossible to parse now */
7628                                 off = tvb_len;
7629                                 DebugLog(("ATTR: level = %u, Return: len = %u\n",
7630                                           level, off - offset));
7631                                 return (off - offset);
7632                         }
7633                         break;
7634                         /* 0xC4 impossible in ATTR state */
7635                 default:
7636                         proto_tree_add_text (tree, tvb, off, 1,
7637                                              "  %3d |  Attr | A %3d    "
7638                                              "| %-10s     (Invalid Token!) "
7639                                              "| WBXML parsing stops here.",
7640                                              level, *codepage_attr,
7641                                              val_to_str (peek, vals_wbxml1x_global_tokens, "(unknown 0x%x)"));
7642                         /* Move to end of buffer */
7643                         off = tvb_len;
7644                         break;
7645                 } else { /* Known atribute token */
7646                         if (peek & 0x80) { /* attrValue */
7647                                 proto_tree_add_text (tree, tvb, off, 1,
7648                                                      "  %3d |  Attr | A %3d    "
7649                                                      "|   Known attrValue 0x%02X          "
7650                                                      "|       %sattrValue_0x%02X",
7651                                                      level, *codepage_attr, peek & 0x7f, Indent (level),
7652                                                      peek);
7653                                 off++;
7654                         } else { /* attrStart */
7655                                 proto_tree_add_text (tree, tvb, off, 1,
7656                                                      "  %3d |  Attr | A %3d    "
7657                                                      "|   Known attrStart 0x%02X          "
7658                                                      "|   %sattrStart_0x%02X",
7659                                                      level, *codepage_attr, peek & 0x7f, Indent (level),
7660                                                      peek);
7661                                 off++;
7662                         }
7663                 }
7664         } /* End WHILE */
7665         DebugLog(("ATTR: level = %u, Return: len = %u (end of function body)\n",
7666                   level, off - offset));
7667         return (off - offset);
7668 }
7669
7670
7671 /****************** Register the protocol with Wireshark ******************/
7672
7673
7674 /* This format is required because a script is used to build the C function
7675  * that calls the protocol registration. */
7676
7677 void
7678 proto_register_wbxml(void)
7679 {
7680         module_t *wbxml_module; /* WBXML Preferences */
7681
7682         /* Setup list of header fields. */
7683         static hf_register_info hf[] = {
7684                 { &hf_wbxml_version,
7685                   { "Version",
7686                     "wbxml.version",
7687                     FT_UINT8, BASE_HEX,
7688                     VALS ( vals_wbxml_versions ), 0x00,
7689                     "WBXML Version", HFILL }
7690                 },
7691                 { &hf_wbxml_public_id_known,
7692                   { "Public Identifier (known)",
7693                     "wbxml.public_id.known",
7694                     FT_UINT32, BASE_HEX,
7695                     VALS ( vals_wbxml_public_ids ), 0x00,
7696                     "WBXML Known Public Identifier (integer)", HFILL }
7697                 },
7698                 { &hf_wbxml_public_id_literal,
7699                   { "Public Identifier (literal)",
7700                     "wbxml.public_id.literal",
7701                     FT_STRING, BASE_NONE,
7702                     NULL, 0x00,
7703                     "WBXML Literal Public Identifier (text string)", HFILL }
7704                 },
7705                 { &hf_wbxml_charset,
7706                   { "Character Set",
7707                     "wbxml.charset",
7708                     FT_UINT32, BASE_HEX,
7709                     VALS ( vals_character_sets ), 0x00,
7710                     "WBXML Character Set", HFILL }
7711                 },
7712         };
7713
7714         /* Setup protocol subtree array */
7715         static gint *ett[] = {
7716                 &ett_wbxml,
7717                 &ett_wbxml_str_tbl,
7718                 &ett_wbxml_content,
7719         };
7720
7721         /* Register the protocol name and description */
7722         proto_wbxml = proto_register_protocol(
7723                                               "WAP Binary XML",
7724                                               "WBXML",
7725                                               "wbxml"
7726                                               );
7727
7728         /* Required function calls to register the header fields
7729          * and subtrees used */
7730         proto_register_field_array(proto_wbxml, hf, array_length(hf));
7731         proto_register_subtree_array(ett, array_length(ett));
7732
7733         /* Preferences */
7734         wbxml_module = prefs_register_protocol(proto_wbxml, NULL);
7735         prefs_register_bool_preference(wbxml_module,
7736                                        "skip_wbxml_token_mapping",
7737                                        "Skip the mapping of WBXML tokens to media type tokens.",
7738                                        "Enable this preference if you want to view the WBXML "
7739                                        "tokens without the representation in a media type "
7740                                        "(e.g., WML). Tokens will show up as Tag_0x12, "
7741                                        "attrStart_0x08 or attrValue_0x0B for example.",
7742                                        &skip_wbxml_token_mapping);
7743         prefs_register_bool_preference(wbxml_module,
7744                                        "disable_wbxml_token_parsing",
7745                                        "Disable the parsing of the WBXML tokens.",
7746                                        "Enable this preference if you want to skip the "
7747                                        "parsing of the WBXML tokens that constitute the body "
7748                                        "of the WBXML document. Only the WBXML header will be "
7749                                        "dissected (and visualized) then.",
7750                                        &disable_wbxml_token_parsing);
7751
7752         register_dissector("wbxml", dissect_wbxml, proto_wbxml);
7753         register_dissector("wbxml-uaprof", dissect_uaprof, proto_wbxml);
7754 }
7755
7756
7757 void
7758 proto_reg_handoff_wbxml(void)
7759 {
7760         dissector_handle_t wbxml_handle;
7761
7762         /* Heuristic dissectors would be declared by means of:
7763          * heur_dissector_add("wsp", dissect_wbxml_heur, proto_wbxml);
7764          */
7765
7766         wbxml_handle = create_dissector_handle(dissect_wbxml, proto_wbxml);
7767
7768         /* Register the WSP content types (defined as protocol port)
7769          * for WBXML dissection.
7770          *
7771          * See http://www.wapforum.org/wina/wsp-content-type.htm
7772          *
7773          * As the media types for WSP and HTTP are the same, the WSP dissector
7774          * uses the same string dissector table as the HTTP protocol.
7775          */
7776
7777         /**** Well-known WBXML WSP Content-Type values ****/
7778
7779         dissector_add_string("media_type",
7780                              "application/vnd.wap.wmlc", wbxml_handle);
7781         dissector_add_string("media_type",
7782                              "application/vnd.wap.wta-eventc", wbxml_handle);
7783         dissector_add_string("media_type",
7784                              "application/vnd.wap.wbxml", wbxml_handle);
7785         dissector_add_string("media_type",
7786                              "application/vnd.wap.sic", wbxml_handle);
7787         dissector_add_string("media_type",
7788                              "application/vnd.wap.slc", wbxml_handle);
7789         dissector_add_string("media_type",
7790                              "application/vnd.wap.coc", wbxml_handle);
7791         dissector_add_string("media_type",
7792                              "application/vnd.wap.connectivity-wbxml", wbxml_handle);
7793         dissector_add_string("media_type",
7794                              "application/vnd.wap.locc+wbxml", wbxml_handle);
7795         dissector_add_string("media_type",
7796                              "application/vnd.syncml+wbxml", wbxml_handle);
7797         dissector_add_string("media_type",
7798                              "application/vnd.syncml.dm+wbxml", wbxml_handle);
7799         dissector_add_string("media_type",
7800                              "application/vnd.oma.drm.rights+wbxml", wbxml_handle);
7801         dissector_add_string("media_type",
7802                              "application/vnd.wv.csp.wbxml", wbxml_handle);
7803
7804         /**** Registered WBXML WSP Content-Type values ****/
7805
7806         dissector_add_string("media_type",
7807                              "application/vnd.uplanet.cacheop-wbxml", wbxml_handle);
7808         dissector_add_string("media_type",
7809                              "application/vnd.uplanet.alert-wbxml", wbxml_handle);
7810         dissector_add_string("media_type",
7811                              "application/vnd.uplanet.list-wbxml", wbxml_handle);
7812         dissector_add_string("media_type",
7813                              "application/vnd.uplanet.listcmd-wbxml", wbxml_handle);
7814         dissector_add_string("media_type",
7815                              "application/vnd.uplanet.channel-wbxml", wbxml_handle);
7816         dissector_add_string("media_type",
7817                              "application/vnd.uplanet.bearer-choice-wbxml", wbxml_handle);
7818         dissector_add_string("media_type",
7819                              "application/vnd.phonecom.mmc-wbxml", wbxml_handle);
7820         dissector_add_string("media_type",
7821                              "application/vnd.nokia.syncset+wbxml", wbxml_handle);
7822
7823         /***** Content types that only have a textual representation *****/
7824         dissector_add_string("media_type",
7825                              "application/x-wap-prov.browser-bookmarks", wbxml_handle);
7826         dissector_add_string("media_type",
7827                              "application/x-wap-prov.browser-settings", wbxml_handle);
7828         /* Same as application/vnd.nokia.syncset+wbxml */
7829         dissector_add_string("media_type",
7830                              "application/x-prov.syncset+wbxml", wbxml_handle);
7831 }
7832
7833 /*
7834  * Editor modelines
7835  *
7836  * Local Variables:
7837  * c-basic-offset: 8
7838  * tab-width: 8
7839  * indent-tabs-mode: tabs
7840  * End:
7841  *
7842  * ex: set shiftwidth=8 tabstop=8 noexpandtab
7843  * :indentSize=8:tabSize=8:noTabs=false:
7844  */