3 * Routines for WAP Binary XML dissection
4 * Copyright 2003, 2004, Olivier Biot.
6 * $Id: packet-wbxml.c,v 1.31 2004/03/17 19:50:05 obiot Exp $
8 * Refer to the AUTHORS file or the AUTHORS section in the man page
9 * for contacting the author(s) of this file.
11 * Ethereal - Network traffic analyzer
12 * By Gerald Combs <gerald@ethereal.com>
13 * Copyright 1998 Gerald Combs
15 * WAP Binary XML decoding functionality provided by Olivier Biot.
17 * The WAP specifications are found at the WAP Forum:
18 * http://www.wapforum.org/what/Technical.htm
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version 2
23 * of the License, or (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 /* Edit this file with 4-space tabulation */
47 #ifdef NEED_SNPRINTF_H
48 # include "snprintf.h"
51 #include <epan/packet.h>
53 /* We need the function tvb_get_guintvar() */
54 #include "packet-wap.h"
56 /* General-purpose debug logger.
57 * Requires double parentheses because of variable arguments of printf().
59 * Enable debug logging for WBXML by defining AM_FLAGS
60 * so that it contains "-DDEBUG_wbxml"
64 printf("%s:%u: ", __FILE__, __LINE__); \
71 /* The code in this source file dissects the WAP Binary XML content,
72 * and if possible renders it. WBXML mappings are defined in the
73 * "wbxml_decoding" structure.
77 * - Some WBXML content is *not* backwards compatible across minor versions.
78 * This painful remark is true for:
79 * o WMLC 1.0 with respect to later WMLC 1.x
80 * o All WV-CSP versions (never backwards compatible)
81 * The only way of correctly rendering the WBXML is to let the end-user
82 * choose from the possible renderings. This only aaplies to the case when
83 * the WBXML DocType is not included in the WBXML header.
85 * - Some WBXML content uses EXT_T_* in a non-tableref manner. This is the
86 * case with WV-CSP 1.1 and up, where the index points to a value_string
87 * containing WV-CSP specific token values. This is allowed as it is not
88 * explicitly forbidden in the WBXML specifications. Hence the global token
89 * map for content must also contain a function pointer if no tableref
92 * - Code page switches only apply to the following token. In the WBXML/1.x
93 * ABNF notation, it can be proven that the switch_page can only precede
94 * the following tokens:
95 * o stag : TAG | LITERAL | LITERAL_A | LITERAL_C | LITERAL_AC
96 * o attr : ATTRSTART | ATTRVALUE
97 * o extension : EXT_I | EXT_T | EXT
98 * Code page switches are displayed in a separate column.
100 * - The WBXML spec states that code pages are static to both the tag and the
101 * attribute state parser. A SWITCH_PAGE within a state switches the code
102 * page of the active state only. Note that code page 255 is reserved for
103 * application-specific (read: testing) purposes.
105 * - In order to render the XML content, recursion is inevitable at some
106 * point (when a tag with content occurs in the content of a tag with
107 * content). The code will however not recurse if this is not strictly
108 * required (e.g., tag without content in the content of a tag with
111 * - I found it useful to display the XML nesting level as a first "column",
112 * followed by the abbreviated WBXML token interpretation. When a mapping
113 * is defined for the parsed WBXML content, then the XML rendering is
114 * displayed with appropriate indentation (maximum nesting level = 255,
115 * after which the nesting and level will safely roll-over to 0).
117 * - The WAP Forum defines the order of precedence for finding out the
118 * WBXML content type (same rules for charset) as follows:
119 * 1. Look in the Content-Type WSP header
120 * 2. Look in the WBXML header
121 * Currently there is no means of using content type parameters:
123 * o Charset=<charset_of_the_content>
124 * So it is possible some WBXML content types are incorrectly parsed.
125 * This would only be the case when the content type declaration in the
126 * WSP Content-Type header would be different (or would have parameters
127 * which are relevant to the WBXML decoding) from the content type
128 * identifier specified in the WBXML header.
129 * TODO: investigate this and provide correct decoding at all times.
132 typedef struct _value_valuestring {
134 const value_string *valstrptr;
137 /* Tries to match val against each element in the value_value_string array vvs.
138 * Returns the associated value_string ptr on a match, or NULL on failure. */
139 static const value_string *
140 val_to_valstr(guint32 val, const value_valuestring *vvs)
144 while (vvs[i].valstrptr) {
145 if (vvs[i].value == val)
146 return(vvs[i].valstrptr);
153 /* Note on Token mapping
154 * ---------------------
156 * The WBXML dissector will try mapping the token decoding to their textual
157 * representation if the media type has a defined token representation. The
158 * following logic applies:
160 * a. Inspect the WBXML PublicID
161 * This means that I need a list { PublicID, decoding }
163 * b. Inspect the literal media type
164 * This requires a list { "media/type", discriminator, { decodings } }
166 * b.1. Use a discriminator to choose an appropriate token mapping;
167 * The disciminator needs a small number of bytes from the data tvbuf_t.
170 * b.2. Provide a list to the end-user with all possible token mappings.
172 * c. If none match then only show the tokens without mapping.
176 /* ext_t_func_ptr is a pointer to a function handling the EXT_T_i tokens:
178 * char * ext_t_function(tvbuff_t *tvb, guint32 value, guint32 strtbl);
180 typedef char * (* ext_t_func_ptr)(tvbuff_t *, guint32, guint32);
182 typedef struct _wbxml_decoding {
185 ext_t_func_ptr ext_t[3];
186 const value_valuestring *global;
187 const value_valuestring *tags;
188 const value_valuestring *attrStart;
189 const value_valuestring *attrValue;
192 typedef wbxml_decoding * (* discriminator_func_ptr)(tvbuff_t *);
194 /* For the decoding lists based on the known WBXML public ID */
195 typedef struct _wbxml_integer_list {
197 const wbxml_decoding *map;
198 } wbxml_integer_list;
200 /* For the decoding lists on the literal content type */
201 typedef struct _wbxml_literal_list {
202 const char *content_type;
203 discriminator_func_ptr discriminator; /* TODO */
204 const wbxml_decoding *map;
205 } wbxml_literal_list;
207 /************************** Variable declarations **************************/
210 /* Initialize the protocol and registered fields */
211 static int proto_wbxml = -1;
212 static int hf_wbxml_version = -1;
213 static int hf_wbxml_public_id_known = -1;
214 static int hf_wbxml_public_id_literal = -1;
215 static int hf_wbxml_charset = -1;
217 /* Initialize the subtree pointers */
218 static gint ett_wbxml = -1;
219 static gint ett_wbxml_str_tbl = -1;
220 static gint ett_wbxml_content = -1;
223 /**************** WBXML related declarations and definitions ****************/
226 /* WBXML public ID mappings. For an up-to-date list, see
227 * http://www.openmobilealliance.org/tech/omna/ */
228 static const value_string vals_wbxml_public_ids[] = {
229 /* 0x00 = literal public identifier */
230 { 0x01, "Unknown / missing Public Identifier" },
231 { 0x02, "-//WAPFORUM//DTD WML 1.0//EN (WML 1.0)" },
232 { 0x03, "-//WAPFORUM//DTD WTA 1.0//EN (WTA Event 1.0) - Deprecated" },
233 { 0x04, "-//WAPFORUM//DTD WML 1.1//EN (WML 1.1)" },
234 { 0x05, "-//WAPFORUM//DTD SI 1.0//EN (Service Indication 1.0)" },
235 { 0x06, "-//WAPFORUM//DTD SL 1.0//EN (Service Loading 1.0)" },
236 { 0x07, "-//WAPFORUM//DTD CO 1.0//EN (Cache Operation 1.0)" },
237 { 0x08, "-//WAPFORUM//DTD CHANNEL 1.0//EN (Channel 1.1)" },
238 { 0x09, "-//WAPFORUM//DTD WML 1.2//EN (WML 1.2)" },
239 { 0x0a, "-//WAPFORUM//DTD WML 1.3//EN (WML 1.3)" },
240 { 0x0b, "-//WAPFORUM//DTD PROV 1.0//EN (Provisioning 1.0)" },
241 { 0x0c, "-//WAPFORUM//DTD WTA-WML 1.2//EN (WTA-WML 1.2)" },
242 { 0x0d, "-//WAPFORUM//DTD EMN 1.0//EN (Email Notification 1.0)" },
243 { 0x0e, "-//WAPFORUM//DTD DRMREL 1.0//EN (DRMREL 1.0)" },
244 { 0x0f, "-//WIRELESSVILLAGE//DTD CSP 1.0//EN"
245 " (Wireless Village Client-Server Protocol DTD v1.0)" },
246 { 0x10, "-//WIRELESSVILLAGE//DTD CSP 1.1//EN"
247 " (Wireless Village Client-Server Protocol DTD v1.1)" },
249 /* Registered values - www.syncml.org */
250 { 0x0fd1, "-//SYNCML//DTD SyncML 1.0//EN (SyncML 1.0)" },
251 { 0x0fd3, "-//SYNCML//DTD SyncML 1.1//EN (SyncML 1.1)" },
253 /* Registered values - www.wapforum.org/wina/ */
254 { 0x1100, "-//PHONE.COM//DTD ALERT 1.0//EN" },
255 { 0x1101, "-//PHONE.COM//DTD CACHE-OPERATION 1.0//EN" },
256 { 0x1102, "-//PHONE.COM//DTD SIGNAL 1.0//EN" },
257 { 0x1103, "-//PHONE.COM//DTD LIST 1.0//EN" },
258 { 0x1104, "-//PHONE.COM//DTD LISTCMD 1.0//EN" },
259 { 0x1105, "-//PHONE.COM//DTD CHANNEL 1.0//EN" },
260 { 0x1106, "-//PHONE.COM//DTD MMC 1.0//EN" },
261 { 0x1107, "-//PHONE.COM//DTD BEARER-CHOICE 1.0//EN" },
262 { 0x1108, "-//PHONE.COM//DTD WML 1.1//EN (WML+ 1.1)" },
263 { 0x1109, "-//PHONE.COM//DTD CHANNEL 1.1//EN" },
264 { 0x110a, "-//PHONE.COM//DTD LIST 1.1//EN" },
265 { 0x110b, "-//PHONE.COM//DTD LISTCMD 1.1//EN" },
266 { 0x110c, "-//PHONE.COM//DTD MMC 1.1//EN" },
267 { 0x110d, "-//PHONE.COM//DTD WML 1.3//EN (WML+ 1.3)" },
268 { 0x110e, "-//PHONE.COM//DTD MMC 2.0//EN" },
269 /* 0x110F -- 0x11FF: unassigned */
270 { 0x1200, "-//3GPP2.COM//DTD IOTA 1.0//EN" },
275 static const value_string vals_wbxml_versions[] = {
276 { 0x00, "1.0" }, /* WAP-104-WBXML */
277 { 0x01, "1.1" }, /* WAP-135-WBXML */
278 { 0x02, "1.2" }, /* WAP-154-WBXML */
279 { 0x03, "1.3" }, /* WAP-192-WBXML */
284 /* WBXML 1.0 global tokens: WAP-104-WBXML
285 * Same token mapping as in vals_wbxml1x_global_tokens, but:
286 * { 0xC3, "RESERVED_2" }
289 /* WBXML 1.x (x>0) global tokens: WAP-135-WBXML, WAP-154-WBXML, WAP-192-WBXML
291 static const value_string vals_wbxml1x_global_tokens[] = {
292 { 0x00, "SWITCH_PAGE" },
302 { 0x44, "LITERAL_C" },
308 { 0x84, "LITERAL_A" },
314 { 0xC4, "LITERAL_AC" },
323 /********************** WBXML token mapping definition **********************/
326 * NOTE: Please make sure the Attribute Start values all contain an equal sign
327 * even in cases where they do not contain the start of an Attribute
334 * Wireless Markup Language
335 ***************************************/
337 ext_t_0_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
339 gint str_len = tvb_strsize (tvb, str_tbl + value);
340 char *str = g_strdup_printf("Variable substitution - escaped: '%s'",
341 tvb_get_ptr(tvb, str_tbl + value, str_len));
346 ext_t_1_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
348 gint str_len = tvb_strsize (tvb, str_tbl + value);
349 char *str = g_strdup_printf("Variable substitution - unescaped: '%s'",
350 tvb_get_ptr(tvb, str_tbl + value, str_len));
355 ext_t_2_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
357 gint str_len = tvb_strsize (tvb, str_tbl + value);
358 char *str = g_strdup_printf("Variable substitution - no transformation: '%s'",
359 tvb_get_ptr(tvb, str_tbl + value, str_len));
362 /***** Global extension tokens *****/
363 static const value_string wbxml_wmlc10_global_cp0[] = {
364 { 0x40, "Variable substitution - escaped" },
365 { 0x41, "Variable substitution - unescaped" },
366 { 0x42, "Variable substitution - no transformation" },
367 { 0x80, "Variable substitution - escaped" },
368 { 0x81, "Variable substitution - unescaped" },
369 { 0x82, "Variable substitution - no transformation" },
370 { 0xC0, "Reserved" },
371 { 0xC1, "Reserved" },
372 { 0xC2, "Reserved" },
377 /***** Tag tokens *****/
378 static const value_string wbxml_wmlc10_tags_cp0[] = {
379 /* 0x00 -- 0x04 GLOBAL */
389 { 0x2A, "FIELDSET" },
399 { 0x34, "OPTGROUP" },
406 { 0x3B, "TEMPLATE" },
415 /***** Attribute Start tokens *****/
416 static const value_string wbxml_wmlc10_attrStart_cp0[] = {
417 /* 0x00 -- 0x04 GLOBAL */
418 { 0x05, "ACCEPT-CHARSET=" },
419 { 0x06, "ALIGN='BOTTOM'" },
420 { 0x07, "ALIGN='CENTER'" },
421 { 0x08, "ALIGN='LEFT'" },
422 { 0x09, "ALIGN='MIDDLE'" },
423 { 0x0A, "ALIGN='RIGHT'" },
424 { 0x0B, "ALIGN='TOP'" },
426 { 0x0D, "CONTENT=" },
427 { 0x0E, "DEFAULT=" },
429 { 0x10, "EMPTYOK='FALSE'" },
430 { 0x11, "EMPTYOK='TRUE'" },
434 { 0x15, "IDEFAULT=" },
438 { 0x19, "LOCALSRC=" },
439 { 0x1A, "MAXLENGTH=" },
440 { 0x1B, "METHOD='GET'" },
441 { 0x1C, "METHOD='POST'" },
442 { 0x1D, "MODE='NOWRAP'" },
443 { 0x1E, "MODE='WRAP'" },
444 { 0x1F, "MULTIPLE='FALSE'" },
445 { 0x20, "MULTIPLE='TRUE'" },
447 { 0x22, "NEWCONTEXT='FALSE'" },
448 { 0x23, "NEWCONTEXT='TRUE'" },
449 { 0x24, "ONCLICK=" },
450 { 0x25, "ONENTERBACKWARD=" },
451 { 0x26, "ONENTERFORWARD=" },
452 { 0x27, "ONTIMER=" },
453 { 0x28, "OPTIONAL='FALSE'" },
454 { 0x29, "OPTIONAL='TRUE'" },
456 { 0x2B, "POSTDATA=" },
457 { 0x2C, "PUBLIC='FALSE'" },
458 { 0x2D, "PUBLIC='TRUE'" },
460 { 0x2F, "SENDREFERER='FALSE'" },
461 { 0x30, "SENDREFERER='TRUE'" },
464 { 0x33, "STYLE='LIST'" },
465 { 0x34, "STYLE='SET'" },
466 { 0x35, "TABINDEX=" },
469 { 0x38, "TYPE='ACCEPT'" },
470 { 0x39, "TYPE='DELETE'" },
471 { 0x3A, "TYPE='HELP'" },
472 { 0x3B, "TYPE='PASSWORD'" },
473 { 0x3C, "TYPE='ONCLICK'" },
474 { 0x3D, "TYPE='ONENTERBACKWARD'" },
475 { 0x3E, "TYPE='ONENTERFORWARD'" },
476 { 0x3F, "TYPE='ONTIMER'" },
477 /* 0x40 -- 0x44 GLOBAL */
478 { 0x45, "TYPE='OPTIONS'" },
479 { 0x46, "TYPE='PREV'" },
480 { 0x47, "TYPE='RESET'" },
481 { 0x48, "TYPE='TEXT'" },
482 { 0x49, "TYPE='vnd.'" },
484 { 0x4B, "URL='http://'" },
485 { 0x4C, "URL='https://'" },
486 { 0x4D, "USER-AGENT=" },
490 { 0x51, "xml:lang=" },
495 /***** Attribute Value tokens *****/
496 static const value_string wbxml_wmlc10_attrValue_cp0[] = {
497 /* 0x80 -- 0x84 GLOBAL */
502 { 0x89, "'ACCEPT'" },
503 { 0x8A, "'BOTTOM'" },
505 { 0x8C, "'DELETE'" },
507 { 0x8E, "'http://'" },
508 { 0x8F, "'http://www.'" },
509 { 0x90, "'https://'" },
510 { 0x91, "'https://www.'" },
512 { 0x93, "'MIDDLE'" },
513 { 0x94, "'NOWRAP'" },
514 { 0x95, "'ONCLICK'" },
515 { 0x96, "'ONENTERBACKWARD'" },
516 { 0x97, "'ONENTERFORWARD'" },
517 { 0x98, "'ONTIMER'" },
518 { 0x99, "'OPTIONS'" },
519 { 0x9A, "'PASSWORD'" },
524 { 0x9F, "'UNKNOWN'" },
531 /***** Token code page aggregation *****/
532 static const value_valuestring wbxml_wmlc10_global[] = {
533 { 0, wbxml_wmlc10_global_cp0 },
537 static const value_valuestring wbxml_wmlc10_tags[] = {
538 { 0, wbxml_wmlc10_tags_cp0 },
542 static const value_valuestring wbxml_wmlc10_attrStart[] = {
543 { 0, wbxml_wmlc10_attrStart_cp0 },
547 static const value_valuestring wbxml_wmlc10_attrValue[] = {
548 { 0, wbxml_wmlc10_attrValue_cp0 },
552 static const wbxml_decoding decode_wmlc_10 = {
553 "Wireless Markup Language 1.0",
555 { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
558 wbxml_wmlc10_attrStart,
559 wbxml_wmlc10_attrValue
567 * Wireless Markup Language
568 ***************************************/
570 /***** Global extension tokens *****/
571 /* Same as in WML 1.0 */
573 /***** Tag tokens *****/
574 static const value_string wbxml_wmlc11_tags_cp0[] = {
575 /* 0x00 -- 0x04 GLOBAL */
582 { 0x21, "postfield" },
591 { 0x2A, "fieldset" },
601 { 0x34, "optgroup" },
608 { 0x3B, "template" },
617 /***** Attribute Start tokens *****/
618 static const value_string wbxml_wmlc11_attrStart_cp0[] = {
619 /* 0x00 -- 0x04 GLOBAL */
620 { 0x05, "accept-charset=" },
621 { 0x06, "align='bottom'" },
622 { 0x07, "align='center'" },
623 { 0x08, "align='left'" },
624 { 0x09, "align='middle'" },
625 { 0x0A, "align='right'" },
626 { 0x0B, "align='top'" },
628 { 0x0D, "content=" },
631 { 0x10, "emptyok='false'" },
632 { 0x11, "emptyok='true'" },
640 { 0x19, "localsrc=" },
641 { 0x1A, "maxlength=" },
642 { 0x1B, "method='get'" },
643 { 0x1C, "method='post'" },
644 { 0x1D, "mode='nowrap'" },
645 { 0x1E, "mode='wrap'" },
646 { 0x1F, "multiple='false'" },
647 { 0x20, "multiple='true'" },
649 { 0x22, "newcontext='false'" },
650 { 0x23, "newcontext='true'" },
652 { 0x25, "onenterbackward=" },
653 { 0x26, "onenterforward=" },
654 { 0x27, "ontimer=" },
655 { 0x28, "optional='false'" },
656 { 0x29, "optional='true'" },
660 { 0x2F, "sendreferer='false'" },
661 { 0x30, "sendreferer='true'" },
664 { 0x33, "ordered='false'" },
665 { 0x34, "ordered='true'" },
666 { 0x35, "tabindex=" },
669 { 0x38, "type='accept'" },
670 { 0x39, "type='delete'" },
671 { 0x3A, "type='help'" },
672 { 0x3B, "type='password'" },
673 { 0x3C, "type='onpick'" },
674 { 0x3D, "type='onenterbackward'" },
675 { 0x3E, "type='onenterforward'" },
676 { 0x3F, "type='ontimer'" },
677 /* 0x40 -- 0x44 GLOBAL */
678 { 0x45, "type='options'" },
679 { 0x46, "type='prev'" },
680 { 0x47, "type='reset'" },
681 { 0x48, "type='text'" },
682 { 0x49, "type='vnd.'" },
684 { 0x4B, "href='http://'" },
685 { 0x4C, "href='https://'" },
689 { 0x50, "xml:lang=" },
692 { 0x53, "columns=" },
695 { 0x56, "forua='false'" },
696 { 0x57, "forua='true'" },
697 { 0x58, "src='http://'" },
698 { 0x59, "src='https://'" },
699 { 0x5A, "http-equiv=" },
700 { 0x5B, "http-equiv='Content-Type'" },
701 { 0x5C, "content='application/vnd.wap.wmlc;charset='" },
702 { 0x5D, "http-equiv='Expires'" },
707 /***** Attribute Value tokens *****/
708 static const value_string wbxml_wmlc11_attrValue_cp0[] = {
709 /* 0x80 -- 0x84 GLOBAL */
714 { 0x89, "'accept'" },
715 { 0x8A, "'bottom'" },
717 { 0x8C, "'delete'" },
719 { 0x8E, "'http://'" },
720 { 0x8F, "'http://www.'" },
721 { 0x90, "'https://'" },
722 { 0x91, "'https://www.'" },
724 { 0x93, "'middle'" },
725 { 0x94, "'nowrap'" },
726 { 0x95, "'onpick'" },
727 { 0x96, "'onenterbackward'" },
728 { 0x97, "'onenterforward'" },
729 { 0x98, "'ontimer'" },
730 { 0x99, "'options'" },
731 { 0x9A, "'password'" },
736 { 0x9F, "'unknown'" },
743 /***** Token code page aggregation *****/
744 static const value_valuestring wbxml_wmlc11_global[] = {
745 { 0, wbxml_wmlc10_global_cp0 }, /* Same as WML 1.0 */
749 static const value_valuestring wbxml_wmlc11_tags[] = {
750 { 0, wbxml_wmlc11_tags_cp0 },
754 static const value_valuestring wbxml_wmlc11_attrStart[] = {
755 { 0, wbxml_wmlc11_attrStart_cp0 },
759 static const value_valuestring wbxml_wmlc11_attrValue[] = {
760 { 0, wbxml_wmlc11_attrValue_cp0 },
764 static const wbxml_decoding decode_wmlc_11 = {
765 "Wireless Markup Language 1.1",
767 { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
770 wbxml_wmlc11_attrStart,
771 wbxml_wmlc11_attrValue
780 * Wireless Markup Language
781 ***************************************/
783 /***** Global extension tokens *****/
784 /* Same as in WML 1.0 */
786 /***** Tag tokens *****/
787 static const value_string wbxml_wmlc12_tags_cp0[] = {
788 /* 0x00 -- 0x04 GLOBAL */
796 { 0x21, "postfield" },
805 { 0x2A, "fieldset" },
815 { 0x34, "optgroup" },
822 { 0x3B, "template" },
831 /***** Attribute Start tokens *****/
832 static const value_string wbxml_wmlc12_attrStart_cp0[] = {
833 /* 0x00 -- 0x04 GLOBAL */
834 { 0x05, "accept-charset=" },
835 { 0x06, "align='bottom'" },
836 { 0x07, "align='center'" },
837 { 0x08, "align='left'" },
838 { 0x09, "align='middle'" },
839 { 0x0A, "align='right'" },
840 { 0x0B, "align='top'" },
842 { 0x0D, "content=" },
845 { 0x10, "emptyok='false'" },
846 { 0x11, "emptyok='true'" },
854 { 0x19, "localsrc=" },
855 { 0x1A, "maxlength=" },
856 { 0x1B, "method='get'" },
857 { 0x1C, "method='post'" },
858 { 0x1D, "mode='nowrap'" },
859 { 0x1E, "mode='wrap'" },
860 { 0x1F, "multiple='false'" },
861 { 0x20, "multiple='true'" },
863 { 0x22, "newcontext='false'" },
864 { 0x23, "newcontext='true'" },
866 { 0x25, "onenterbackward=" },
867 { 0x26, "onenterforward=" },
868 { 0x27, "ontimer=" },
869 { 0x28, "optional='false'" },
870 { 0x29, "optional='true'" },
874 { 0x2F, "sendreferer='false'" },
875 { 0x30, "sendreferer='true'" },
878 { 0x33, "ordered='false'" },
879 { 0x34, "ordered='true'" },
880 { 0x35, "tabindex=" },
883 { 0x38, "type='accept'" },
884 { 0x39, "type='delete'" },
885 { 0x3A, "type='help'" },
886 { 0x3B, "type='password'" },
887 { 0x3C, "type='onpick'" },
888 { 0x3D, "type='onenterbackward'" },
889 { 0x3E, "type='onenterforward'" },
890 { 0x3F, "type='ontimer'" },
891 /* 0x40 -- 0x44 GLOBAL */
892 { 0x45, "type='options'" },
893 { 0x46, "type='prev'" },
894 { 0x47, "type='reset'" },
895 { 0x48, "type='text'" },
896 { 0x49, "type='vnd.'" },
898 { 0x4B, "href='http://'" },
899 { 0x4C, "href='https://'" },
903 { 0x50, "xml:lang=" },
906 { 0x53, "columns=" },
909 { 0x56, "forua='false'" },
910 { 0x57, "forua='true'" },
911 { 0x58, "src='http://'" },
912 { 0x59, "src='https://'" },
913 { 0x5A, "http-equiv=" },
914 { 0x5B, "http-equiv='Content-Type'" },
915 { 0x5C, "content='application/vnd.wap.wmlc;charset='" },
916 { 0x5D, "http-equiv='Expires'" },
917 { 0x5E, "accesskey=" },
918 { 0x5F, "enctype=" },
919 { 0x60, "enctype='application/x-www-form-urlencoded'" },
920 { 0x61, "enctype='multipart/form-data'" },
925 /***** Attribute Value tokens *****/
926 /* Same as in WML 1.1 */
928 /***** Token code page aggregation *****/
929 static const value_valuestring wbxml_wmlc12_global[] = {
930 { 0, wbxml_wmlc10_global_cp0 }, /* Same as WML 1.0 */
934 static const value_valuestring wbxml_wmlc12_tags[] = {
935 { 0, wbxml_wmlc12_tags_cp0 },
939 static const value_valuestring wbxml_wmlc12_attrStart[] = {
940 { 0, wbxml_wmlc12_attrStart_cp0 },
944 static const value_valuestring wbxml_wmlc12_attrValue[] = {
945 { 0, wbxml_wmlc11_attrValue_cp0 }, /* Same as WML 1.1 */
949 static const wbxml_decoding decode_wmlc_12 = {
950 "Wireless Markup Language 1.2",
952 { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
955 wbxml_wmlc12_attrStart,
956 wbxml_wmlc12_attrValue
965 * Wireless Markup Language
966 ***************************************/
968 /***** Global extension tokens *****/
969 /* Same as in WML 1.0 */
971 /***** Tag tokens *****/
972 /* Same as in WML 1.2 */
974 /***** Attribute Start tokens *****/
975 static const value_string wbxml_wmlc13_attrStart_cp0[] = {
976 /* 0x00 -- 0x04 GLOBAL */
977 { 0x05, "accept-charset=" },
978 { 0x06, "align='bottom'" },
979 { 0x07, "align='center'" },
980 { 0x08, "align='left'" },
981 { 0x09, "align='middle'" },
982 { 0x0A, "align='right'" },
983 { 0x0B, "align='top'" },
985 { 0x0D, "content=" },
988 { 0x10, "emptyok='false'" },
989 { 0x11, "emptyok='true'" },
997 { 0x19, "localsrc=" },
998 { 0x1A, "maxlength=" },
999 { 0x1B, "method='get'" },
1000 { 0x1C, "method='post'" },
1001 { 0x1D, "mode='nowrap'" },
1002 { 0x1E, "mode='wrap'" },
1003 { 0x1F, "multiple='false'" },
1004 { 0x20, "multiple='true'" },
1006 { 0x22, "newcontext='false'" },
1007 { 0x23, "newcontext='true'" },
1008 { 0x24, "onpick=" },
1009 { 0x25, "onenterbackward=" },
1010 { 0x26, "onenterforward=" },
1011 { 0x27, "ontimer=" },
1012 { 0x28, "optional='false'" },
1013 { 0x29, "optional='true'" },
1016 { 0x2E, "scheme=" },
1017 { 0x2F, "sendreferer='false'" },
1018 { 0x30, "sendreferer='true'" },
1021 { 0x33, "ordered='false'" },
1022 { 0x34, "ordered='true'" },
1023 { 0x35, "tabindex=" },
1026 { 0x38, "type='accept'" },
1027 { 0x39, "type='delete'" },
1028 { 0x3A, "type='help'" },
1029 { 0x3B, "type='password'" },
1030 { 0x3C, "type='onpick'" },
1031 { 0x3D, "type='onenterbackward'" },
1032 { 0x3E, "type='onenterforward'" },
1033 { 0x3F, "type='ontimer'" },
1034 /* 0x40 -- 0x44 GLOBAL */
1035 { 0x45, "type='options'" },
1036 { 0x46, "type='prev'" },
1037 { 0x47, "type='reset'" },
1038 { 0x48, "type='text'" },
1039 { 0x49, "type='vnd.'" },
1041 { 0x4B, "href='http://'" },
1042 { 0x4C, "href='https://'" },
1044 { 0x4E, "vspace=" },
1046 { 0x50, "xml:lang=" },
1049 { 0x53, "columns=" },
1052 { 0x56, "forua='false'" },
1053 { 0x57, "forua='true'" },
1054 { 0x58, "src='http://'" },
1055 { 0x59, "src='https://'" },
1056 { 0x5A, "http-equiv=" },
1057 { 0x5B, "http-equiv='Content-Type'" },
1058 { 0x5C, "content='application/vnd.wap.wmlc;charset='" },
1059 { 0x5D, "http-equiv='Expires'" },
1060 { 0x5E, "accesskey=" },
1061 { 0x5F, "enctype=" },
1062 { 0x60, "enctype='application/x-www-form-urlencoded'" },
1063 { 0x61, "enctype='multipart/form-data'" },
1064 { 0x62, "xml:space='preserve'" },
1065 { 0x63, "xml:space='default'" },
1066 { 0x64, "cache-control='no-cache'" },
1071 /***** Attribute Value tokens *****/
1072 /* Same as in WML 1.1 */
1074 /***** Token code page aggregation *****/
1075 static const value_valuestring wbxml_wmlc13_global[] = {
1076 { 0, wbxml_wmlc10_global_cp0 }, /* Same as WML 1.0 */
1080 static const value_valuestring wbxml_wmlc13_tags[] = {
1081 { 0, wbxml_wmlc12_tags_cp0 },
1085 static const value_valuestring wbxml_wmlc13_attrStart[] = {
1086 { 0, wbxml_wmlc13_attrStart_cp0 },
1090 static const value_valuestring wbxml_wmlc13_attrValue[] = {
1091 { 0, wbxml_wmlc11_attrValue_cp0 }, /* Same as WML 1.1 */
1095 static const wbxml_decoding decode_wmlc_13 = {
1096 "Wireless Markup Language 1.3",
1098 { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
1099 wbxml_wmlc13_global,
1101 wbxml_wmlc13_attrStart,
1102 wbxml_wmlc13_attrValue
1111 * Service Indication
1112 ***************************************/
1114 /***** Global extension tokens *****/
1116 /***** Tag tokens *****/
1117 static const value_string wbxml_sic10_tags_cp0[] = {
1118 /* 0x00 -- 0x04 GLOBAL */
1120 { 0x06, "indication" },
1127 /***** Attribute Start tokens *****/
1128 static const value_string wbxml_sic10_attrStart_cp0[] = {
1129 /* 0x00 -- 0x04 GLOBAL */
1130 { 0x05, "action='signal-none'" },
1131 { 0x06, "action='signal-low'" },
1132 { 0x07, "action='signal-medium'" },
1133 { 0x08, "action='signal-high'" },
1134 { 0x09, "action='delete'" },
1135 { 0x0a, "created=" },
1137 { 0x0c, "href='http://'" },
1138 { 0x0d, "href='http://www.'" },
1139 { 0x0e, "href='https://'" },
1140 { 0x0f, "href='https://www.'" },
1141 { 0x10, "si-expires=" },
1148 /***** Attribute Value tokens *****/
1149 static const value_string wbxml_sic10_attrValue_cp0[] = {
1150 /* 0x80 -- 0x84 GLOBAL */
1151 { 0x85, "'.com/'" },
1152 { 0x86, "'.edu/'" },
1153 { 0x87, "'.net/'" },
1154 { 0x88, "'.org/'" },
1159 /***** Token code page aggregation *****/
1160 static const value_valuestring wbxml_sic10_tags[] = {
1161 { 0, wbxml_sic10_tags_cp0 },
1165 static const value_valuestring wbxml_sic10_attrStart[] = {
1166 { 0, wbxml_sic10_attrStart_cp0 },
1170 static const value_valuestring wbxml_sic10_attrValue[] = {
1171 { 0, wbxml_sic10_attrValue_cp0 },
1175 static const wbxml_decoding decode_sic_10 = {
1176 "Service Indication 1.0",
1178 { NULL, NULL, NULL },
1181 wbxml_sic10_attrStart,
1182 wbxml_sic10_attrValue
1192 ***************************************/
1194 /***** Global extension tokens *****/
1196 /***** Tag tokens *****/
1197 static const value_string wbxml_slc10_tags_cp0[] = {
1198 /* 0x00 -- 0x04 GLOBAL */
1204 /***** Attribute Start tokens *****/
1205 static const value_string wbxml_slc10_attrStart_cp0[] = {
1206 /* 0x00 -- 0x04 GLOBAL */
1207 { 0x05, "action='execute-low'" },
1208 { 0x06, "action='execute-high'" },
1209 { 0x07, "action='cache'" },
1211 { 0x09, "href='http://'" },
1212 { 0x0a, "href='http://www.'" },
1213 { 0x0b, "href='https://'" },
1214 { 0x0c, "href='https://www.'" },
1219 /***** Attribute Value tokens *****/
1220 /* Same as in SI 1.0 */
1222 /***** Token code page aggregation *****/
1223 static const value_valuestring wbxml_slc10_tags[] = {
1224 { 0, wbxml_slc10_tags_cp0 },
1228 static const value_valuestring wbxml_slc10_attrStart[] = {
1229 { 0, wbxml_slc10_attrStart_cp0 },
1233 static const value_valuestring wbxml_slc10_attrValue[] = {
1234 { 0, wbxml_sic10_attrValue_cp0 }, /* Same as SI 1.0 */
1238 static const wbxml_decoding decode_slc_10 = {
1239 "Service Loading 1.0",
1241 { NULL, NULL, NULL },
1244 wbxml_slc10_attrStart,
1245 wbxml_slc10_attrValue
1255 ***************************************/
1257 /***** Global extension tokens *****/
1259 /***** Tag tokens *****/
1260 static const value_string wbxml_coc10_tags_cp0[] = {
1261 /* 0x00 -- 0x04 GLOBAL */
1263 { 0x06, "invalidate-object" },
1264 { 0x07, "invalidate-service" },
1269 /***** Attribute Start tokens *****/
1270 static const value_string wbxml_coc10_attrStart_cp0[] = {
1271 /* 0x00 -- 0x04 GLOBAL */
1273 { 0x06, "uri='http://'" },
1274 { 0x07, "uri='http://www.'" },
1275 { 0x08, "uri='https://'" },
1276 { 0x09, "uri='https://www.'" },
1281 /***** Attribute Value tokens *****/
1282 /* Same as in SI 1.0 */
1284 /***** Token code page aggregation *****/
1285 static const value_valuestring wbxml_coc10_tags[] = {
1286 { 0, wbxml_coc10_tags_cp0 },
1290 static const value_valuestring wbxml_coc10_attrStart[] = {
1291 { 0, wbxml_coc10_attrStart_cp0 },
1295 static const value_valuestring wbxml_coc10_attrValue[] = {
1296 { 0, wbxml_sic10_attrValue_cp0 }, /* Same as SI 1.0 */
1300 static const wbxml_decoding decode_coc_10 = {
1301 "Cache Operation 1.0",
1303 { NULL, NULL, NULL },
1306 wbxml_coc10_attrStart,
1307 wbxml_coc10_attrValue
1316 * Client Provisioning
1317 ***************************************/
1319 /***** Global extension tokens *****/
1321 /***** Tag tokens *****/
1322 static const value_string wbxml_provc10_tags_cp0[] = {
1323 /* 0x00 -- 0x04 GLOBAL */
1324 { 0x05, "wap-provisioningdoc" },
1325 { 0x06, "characteristic" },
1330 static const value_string wbxml_provc10_tags_cp1[] = {
1331 /* 0x00 -- 0x04 GLOBAL */
1333 { 0x06, "characteristic" },
1339 /***** Attribute Start tokens *****/
1340 static const value_string wbxml_provc10_attrStart_cp0[] = {
1341 /* 0x00 -- 0x04 GLOBAL */
1344 { 0x07, "name='NAME'" },
1345 { 0x08, "name='NAP-ADDRESS'" },
1346 { 0x09, "name='NAP-ADDRTYPE'" },
1347 { 0x0A, "name='CALLTYPE'" },
1348 { 0x0B, "name='VALIDUNTIL'" },
1349 { 0x0C, "name='AUTHTYPE'" },
1350 { 0x0D, "name='AUTHNAME'" },
1351 { 0x0E, "name='AUTHSECRET'" },
1352 { 0x0F, "name='LINGER'" },
1353 { 0x10, "name='BEARER'" },
1354 { 0x11, "name='NAPID'" },
1355 { 0x12, "name='COUNTRY'" },
1356 { 0x13, "name='NETWORK'" },
1357 { 0x14, "name='INTERNET'" },
1358 { 0x15, "name='PROXY-ID'" },
1359 { 0x16, "name='PROXY-PROVIDER-ID'" },
1360 { 0x17, "name='DOMAIN'" },
1361 { 0x18, "name='PROVURL'" },
1362 { 0x19, "name='PXAUTH-TYPE'" },
1363 { 0x1A, "name='PXAUTH-ID'" },
1364 { 0x1B, "name='PXAUTH-PW'" },
1365 { 0x1C, "name='STARTPAGE'" },
1366 { 0x1D, "name='BASAUTH-ID'" },
1367 { 0x1E, "name='BASAUTH-PW'" },
1368 { 0x1F, "name='PUSHENABLED'" },
1369 { 0x20, "name='PXADDR'" },
1370 { 0x21, "name='PXADDRTYPE'" },
1371 { 0x22, "name='TO-NAPID'" },
1372 { 0x23, "name='PORTNBR'" },
1373 { 0x24, "name='SERVICE'" },
1374 { 0x25, "name='LINKSPEED'" },
1375 { 0x26, "name='DNLINKSPEED'" },
1376 { 0x27, "name='LOCAL-ADDR'" },
1377 { 0x28, "name='LOCAL-ADDRTYPE'" },
1378 { 0x29, "name='CONTEXT-ALLOW'" },
1379 { 0x2A, "name='TRUST'" },
1380 { 0x2B, "name='MASTER'" },
1381 { 0x2C, "name='SID'" },
1382 { 0x2D, "name='SOC'" },
1383 { 0x2E, "name='WSP-VERSION'" },
1384 { 0x2F, "name='PHYSICAL-PROXY-ID'" },
1385 { 0x30, "name='CLIENT-ID'" },
1386 { 0x31, "name='DELIVERY-ERR-SDU'" },
1387 { 0x32, "name='DELIVERY-ORDER'" },
1388 { 0x33, "name='TRAFFIC-CLASS'" },
1389 { 0x34, "name='MAX-SDU-SIZE'" },
1390 { 0x35, "name='MAX-BITRATE-UPLINK'" },
1391 { 0x36, "name='MAX-BITRATE-DNLINK'" },
1392 { 0x37, "name='RESIDUAL-BER'" },
1393 { 0x38, "name='SDU-ERROR-RATIO'" },
1394 { 0x39, "name='TRAFFIC-HANDL-PRIO'" },
1395 { 0x3A, "name='TRANSFER-DELAY'" },
1396 { 0x3B, "name='GUARANTEED-BITRATE-UPLINK'" },
1397 { 0x3C, "name='GUARANTEED-BITRATE-DNLINK'" },
1398 { 0x3D, "name='PXADDR-FQDN'" },
1399 { 0x3E, "name='PROXY-PW'" },
1400 { 0x3F, "name='PPGAUTH-TYPE'" },
1401 /* 0x40 -- 0x44 GLOBAL */
1402 { 0x45, "version=" },
1403 { 0x46, "version='1.0'" },
1404 { 0x47, "name='PULLENABLED'" },
1405 { 0x48, "name='DNS-ADDR'" },
1406 { 0x49, "name='MAX-NUM-RETRY'" },
1407 { 0x4A, "name='FIRST-RETRY-TIMEOUT'" },
1408 { 0x4B, "name='REREG-THRESHOLD'" },
1409 { 0x4C, "name='T-BIT'" },
1411 { 0x4E, "name='AUTH-ENTITY'" },
1412 { 0x4F, "name='SPI'" },
1414 { 0x51, "type='PXLOGICAL'" },
1415 { 0x52, "type='PXPHYSICAL'" },
1416 { 0x53, "type='PORT'" },
1417 { 0x54, "type='VALIDITY'" },
1418 { 0x55, "type='NAPDEF'" },
1419 { 0x56, "type='BOOTSTRAP'" },
1420 { 0x57, "type='VENDORCONFIG'" },
1421 { 0x58, "type='CLIENTIDENTITY'" },
1422 { 0x59, "type='PXAUTHINFO'" },
1423 { 0x5A, "type='NAPAUTHINFO'" },
1424 { 0x5B, "type='ACCESS'" },
1428 static const value_string wbxml_provc10_attrStart_cp1[] = {
1429 /* 0x00 -- 0x04 GLOBAL */
1431 { 0x07, "name='NAME'" },
1433 { 0x14, "name='INTERNET'" },
1435 { 0x1C, "name='STARTPAGE'" },
1437 { 0x22, "name='TO-NAPID'" },
1438 { 0x23, "name='PORTNBR'" },
1439 { 0x24, "name='SERVICE'" },
1441 { 0x2E, "name='AACCEPT'" },
1442 { 0x2F, "name='AAUTHDATA'" },
1443 { 0x30, "name='AAUTHLEVEL'" },
1444 { 0x31, "name='AAUTHNAME'" },
1445 { 0x32, "name='AAUTHSECRET'" },
1446 { 0x33, "name='AAUTHTYPE'" },
1447 { 0x34, "name='ADDR'" },
1448 { 0x35, "name='ADDRTYPE'" },
1449 { 0x36, "name='APPID'" },
1450 { 0x37, "name='APROTOCOL'" },
1451 { 0x38, "name='PROVIDER-ID'" },
1452 { 0x39, "name='TO-PROXY'" },
1453 { 0x3A, "name='URI'" },
1454 { 0x3B, "name='RULE'" },
1456 /* 0x40 -- 0x44 GLOBAL */
1460 { 0x53, "type='PORT'" },
1462 { 0x55, "type='APPLICATION'" },
1463 { 0x56, "type='APPADDR'" },
1464 { 0x57, "type='APPAUTH'" },
1465 { 0x58, "type='CLIENTIDENTITY'" },
1466 { 0x59, "type='RESOURCE'" },
1472 /***** Attribute Start tokens *****/
1473 static const value_string wbxml_provc10_attrValue_cp0[] = {
1474 /* 0x80 -- 0x84 GLOBAL */
1478 { 0x88, "'ALPHA'" },
1480 { 0x8A, "'SCODE'" },
1481 { 0x8B, "'TETRA-ITSI'" },
1484 { 0x90, "'ANALOG-MODEM'" },
1485 { 0x91, "'V.120'" },
1486 { 0x92, "'V.110'" },
1488 { 0x94, "'BIT-TRANSPARENT'" },
1489 { 0x95, "'DIRECT-ASYNCHRONOUS-DATA-SERVICE'" },
1493 { 0x9C, "'HTTP-BASIC'" },
1494 { 0x9D, "'HTTP-DIGEST'" },
1495 { 0x9E, "'WTLS-SS'" },
1498 { 0xA2, "'GSM-USSD'" },
1499 { 0xA3, "'GSM-SMS'" },
1500 { 0xA4, "'ANSI-136-GUTS'" },
1501 { 0xA5, "'IS-95-CDMA-SMS'" },
1502 { 0xA6, "'IS-95-CDMA-CSD'" },
1503 { 0xA7, "'IS-95-CDMA-PACKET'" },
1504 { 0xA8, "'ANSI-136-CSD'" },
1505 { 0xA9, "'ANSI-136-GPRS'" },
1506 { 0xAA, "'GSM-CSD'" },
1507 { 0xAB, "'GSM-GPRS'" },
1508 { 0xAC, "'AMPS-CDPD'" },
1509 { 0xAD, "'PDC-CSD'" },
1510 { 0xAE, "'PDC-PACKET'" },
1511 { 0xAF, "'IDEN-SMS'" },
1512 { 0xB0, "'IDEN-CSD'" },
1513 { 0xB1, "'IDEN-PACKET'" },
1514 { 0xB2, "'FLEX/REFLEX'" },
1515 { 0xB3, "'PHS-SMS'" },
1516 { 0xB4, "'PHS-CSD'" },
1517 { 0xB5, "'TETRA-SDS'" },
1518 { 0xB6, "'TETRA-PACKET'" },
1519 { 0xB7, "'ANSI-136-GHOST'" },
1520 { 0xB8, "'MOBITEX-MPAK'" },
1521 { 0xB9, "'CDMA2000-IX-SIMPLE-IP'" },
1522 { 0xBA, "'CDMA2000-IX-MOBILE-IP'" },
1524 /* 0xC0 -- 0xC4 GLOBAL */
1525 { 0xC5, "'AUTOBAUDING'" },
1527 { 0xCA, "'CL-WSP'" },
1528 { 0xCB, "'CO-WSP'" },
1529 { 0xCC, "'CL-SEC-WSP'" },
1530 { 0xCD, "'CO-SEC-WSP'" },
1531 { 0xCE, "'CL-SEC-WTA'" },
1532 { 0xCF, "'CO-SEC-WTA'" },
1533 { 0xD0, "'OTA-HTTP-TO'" },
1534 { 0xD1, "'OTA-HTTP-TLS-TO'" },
1535 { 0xD2, "'OTA-HTTP-PO'" },
1536 { 0xD3, "'OTA-HTTP-TLS-PO'" },
1541 static const value_string wbxml_provc10_attrValue_cp1[] = {
1542 /* 0x80 -- 0x84 GLOBAL */
1546 { 0x88, "'ALPHA'" },
1547 { 0x8D, "'APPSRV'" },
1551 /* XXX - Errors that require a fix in the OMA/WAP Client Provisioning specs:
1553 { 0xXXX, "'HTTP-'" },
1554 { 0xXXX, "'BASIC'" },
1555 { 0xXXX, "'DIGEST'" },
1564 /***** Token code page aggregation *****/
1565 static const value_valuestring wbxml_provc10_tags[] = {
1566 { 0, wbxml_provc10_tags_cp0 },
1567 { 1, wbxml_provc10_tags_cp1 },
1571 static const value_valuestring wbxml_provc10_attrStart[] = {
1572 { 0, wbxml_provc10_attrStart_cp0 },
1573 { 1, wbxml_provc10_attrStart_cp1 },
1577 static const value_valuestring wbxml_provc10_attrValue[] = {
1578 { 0, wbxml_provc10_attrValue_cp0 },
1579 { 1, wbxml_provc10_attrValue_cp1 },
1583 static const wbxml_decoding decode_provc_10 = {
1584 "WAP Client Provisioning Document 1.0",
1585 "WAP ProvisioningDoc 1.0",
1586 { NULL, NULL, NULL },
1589 wbxml_provc10_attrStart,
1590 wbxml_provc10_attrValue
1599 * Email Notification
1600 ***************************************/
1602 /***** Global extension tokens *****/
1604 /***** Tag tokens *****/
1605 static const value_string wbxml_emnc10_tags_cp0[] = {
1606 /* 0x00 -- 0x04 GLOBAL */
1612 /***** Attribute Start tokens *****/
1613 static const value_string wbxml_emnc10_attrStart_cp0[] = {
1614 /* 0x00 -- 0x04 GLOBAL */
1615 { 0x05, "timestamp=" },
1616 { 0x06, "mailbox=" },
1617 { 0x07, "mailbox='mailat:'" },
1618 { 0x08, "mailbox='pop://'" },
1619 { 0x09, "mailbox='imap://'" },
1620 { 0x0a, "mailbox='http://'" },
1621 { 0x0b, "mailbox='http://www.'" },
1622 { 0x0c, "mailbox='https://'" },
1623 { 0x0D, "mailbox='https://www.'" },
1628 /***** Attribute Value tokens *****/
1629 /* Same as in SI 1.0 */
1631 /***** Token code page aggregation *****/
1632 static const value_valuestring wbxml_emnc10_tags[] = {
1633 { 0, wbxml_emnc10_tags_cp0 },
1637 static const value_valuestring wbxml_emnc10_attrStart[] = {
1638 { 0, wbxml_emnc10_attrStart_cp0 },
1642 static const value_valuestring wbxml_emnc10_attrValue[] = {
1643 { 0, wbxml_sic10_attrValue_cp0 }, /* Same as SI 1.0 */
1647 static const wbxml_decoding decode_emnc_10 = {
1648 "E-Mail Notification 1.0",
1650 { NULL, NULL, NULL },
1653 wbxml_emnc10_attrStart,
1654 wbxml_emnc10_attrValue
1663 * SyncML Representation Protocol
1664 ***************************************/
1666 /***** Global extension tokens *****/
1668 /***** Tag tokens *****/
1669 static const value_string wbxml_syncmlc10_tags_cp0[] = { /* SyncML 1.0 */
1670 /* 0x00 -- 0x04 GLOBAL */
1673 { 0x07, "Archive" },
1688 { 0x16, "LocName" },
1691 { 0x19, "MapItem" },
1696 { 0x1E, "NoResults" },
1698 { 0x20, "Replace" },
1699 { 0x21, "RespURI" },
1700 { 0x22, "Results" },
1702 { 0x24, "Sequence" },
1703 { 0x25, "SessionID" },
1706 { 0x28, "SourceRef" },
1709 { 0x2B, "SyncBody" },
1710 { 0x2C, "SyncHdr" },
1713 { 0x2F, "TargetRef" },
1714 /* 0x30 - Reserved */
1716 { 0x32, "VerProto" },
1721 static const value_string wbxml_syncmlc10_tags_cp1[] = { /* MetInf 1.0 */
1722 /* 0x00 -- 0x04 GLOBAL */
1727 { 0x09, "FreeMem" },
1730 { 0x0C, "MaxMsgSize" },
1734 { 0x10, "NextNonce" },
1735 { 0x11, "SharedMem" },
1738 { 0x14, "Version" },
1743 /***** Attribute Start tokens *****/
1745 /***** Attribute Value tokens *****/
1747 /***** Token code page aggregation *****/
1748 static const value_valuestring wbxml_syncmlc10_tags[] = {
1749 { 0, wbxml_syncmlc10_tags_cp0 }, /* -//SYNCML//DTD SyncML 1.0//EN */
1750 { 1, wbxml_syncmlc10_tags_cp1 }, /* -//SYNCML//DTD MetInf 1.0//EN */
1754 static const wbxml_decoding decode_syncmlc_10 = {
1755 "SyncML Representation Protocol 1.0",
1757 { NULL, NULL, NULL },
1759 wbxml_syncmlc10_tags,
1770 * SyncML Representation Protocol
1771 ***************************************/
1773 /***** Global extension tokens *****/
1775 /***** Tag tokens *****/
1776 static const value_string wbxml_syncmlc11_tags_cp0[] = { /* SyncML 1.1 */
1777 /* 0x00 -- 0x04 GLOBAL */
1780 { 0x07, "Archive" },
1795 { 0x16, "LocName" },
1798 { 0x19, "MapItem" },
1803 { 0x1e, "NoResults" },
1805 { 0x20, "Replace" },
1806 { 0x21, "RespURI" },
1807 { 0x22, "Results" },
1809 { 0x24, "Sequence" },
1810 { 0x25, "SessionID" },
1813 { 0x28, "SourceRef" },
1816 { 0x2b, "SyncBody" },
1817 { 0x2c, "SyncHdr" },
1820 { 0x2f, "TargetRef" },
1821 /* 0x30 - Reserved */
1823 { 0x32, "VerProto" },
1824 { 0x33, "NumberOfChanges" },
1825 { 0x34, "MoreData" },
1830 static const value_string wbxml_syncmlc11_tags_cp1[] = { /* MetInf 1.1 */
1831 /* 0x00 -- 0x04 GLOBAL */
1836 { 0x09, "FreeMem" },
1839 { 0x0C, "MaxMsgSize" },
1843 { 0x10, "NextNonce" },
1844 { 0x11, "SharedMem" },
1847 { 0x14, "Version" },
1848 { 0x15, "MaxObjSize" },
1853 /***** Attribute Start tokens *****/
1855 /***** Attribute Value tokens *****/
1857 /***** Token code page aggregation *****/
1858 static const value_valuestring wbxml_syncmlc11_tags[] = {
1859 { 0, wbxml_syncmlc11_tags_cp0 }, /* -//SYNCML//DTD SyncML 1.1//EN */
1860 { 1, wbxml_syncmlc11_tags_cp1 }, /* -//SYNCML//DTD MetInf 1.1//EN */
1864 static const wbxml_decoding decode_syncmlc_11 = {
1865 "SyncML Representation Protocol 1.1",
1867 { NULL, NULL, NULL },
1869 wbxml_syncmlc11_tags,
1881 ***************************************/
1883 /***** Global extension tokens *****/
1885 /***** Tag tokens *****/
1886 static const value_string wbxml_channelc10_tags_cp0[] = {
1887 /* 0x00 -- 0x04 GLOBAL */
1888 { 0x05, "channel" },
1890 { 0x07, "abstract" },
1891 { 0x08, "resource" },
1896 /***** Attribute Start tokens *****/
1897 static const value_string wbxml_channelc10_attrStart_cp0[] = {
1898 /* 0x00 -- 0x04 GLOBAL */
1899 { 0x05, "maxspace=" },
1902 { 0x08, "href='http://'" },
1903 { 0x09, "href='https://'" },
1904 { 0x0A, "lastmod=" },
1907 { 0x0D, "success=" },
1908 { 0x0E, "success='http://'" },
1909 { 0x0F, "success='https://'" },
1910 { 0x10, "failure=" },
1911 { 0x11, "failure='http://'" },
1912 { 0x12, "failure='https://'" },
1913 { 0x13, "EventId=" },
1918 /***** Attribute Value tokens *****/
1920 /***** Token code page aggregation *****/
1921 static const value_valuestring wbxml_channelc10_tags[] = {
1922 { 0, wbxml_channelc10_tags_cp0 },
1926 static const value_valuestring wbxml_channelc10_attrStart[] = {
1927 { 0, wbxml_channelc10_attrStart_cp0 },
1931 static const wbxml_decoding decode_channelc_10 = {
1932 "Wireless Telephony Application (WTA) Channel 1.0",
1934 { NULL, NULL, NULL },
1936 wbxml_channelc10_tags,
1937 wbxml_channelc10_attrStart,
1945 /* application/x-wap-prov.browser-settings
1946 * application/x-wap-prov.browser-bookmarks
1948 * Nokia OTA Provisioning document format
1949 ***************************************/
1951 /***** Global extension tokens *****/
1953 /***** Tag tokens *****/
1954 static const value_string wbxml_nokiaprovc70_tags_cp0[] = {
1955 /* 0x00 -- 0x04 GLOBAL */
1956 { 0x05, "CHARACTERISTIC-LIST" },
1957 { 0x06, "CHARACTERISTIC" },
1963 /***** Attribute Start tokens *****/
1964 static const value_string wbxml_nokiaprovc70_attrStart_cp0[] = {
1965 /* 0x00 -- 0x04 GLOBAL */
1966 { 0x06, "TYPE='ADDRESS'" },
1967 { 0x07, "TYPE='URL'" },
1968 { 0x08, "TYPE='NAME'" },
1971 { 0x12, "NAME='BEARER'" },
1972 { 0x13, "NAME='PROXY'" },
1973 { 0x14, "NAME='PORT'" },
1974 { 0x15, "NAME='NAME'" },
1975 { 0x16, "NAME='PROXY_TYPE'" },
1976 { 0x17, "NAME='URL'" },
1977 { 0x18, "NAME='PROXY_AUTHNAME'" },
1978 { 0x19, "NAME='PROXY_AUTHSECRET'" },
1979 { 0x1A, "NAME='SMS_SMSC_ADDRESS'" },
1980 { 0x1B, "NAME='USSD_SERVICE_CODE'" },
1981 { 0x1C, "NAME='GPRS_ACCESSPOINTNAME'" },
1982 { 0x1D, "NAME='PPP_LOGINTYPE'" },
1983 { 0x1E, "NAME='PROXY_LOGINTYPE'" },
1984 { 0x21, "NAME='CSD_DIALSTRING'" },
1985 { 0x22, "NAME='PPP_AUTHTYPE'" },
1986 { 0x23, "NAME='PPP_AUTHNAME'" },
1987 { 0x24, "NAME='PPP_AUTHSECRET'" },
1988 { 0x28, "NAME='CSD_CALLTYPE'" },
1989 { 0x29, "NAME='CSD_CALLSPEED'" },
1990 { 0x45, "VALUE='GSM/CSD'" },
1991 { 0x46, "VALUE='GSM/SMS'" },
1992 { 0x47, "VALUE='GSM/USSD'" },
1993 { 0x48, "VALUE='IS-136/CSD'" },
1994 { 0x49, "VALUE='GPRS'" },
1995 { 0x60, "VALUE='9200'" },
1996 { 0x61, "VALUE='9201'" },
1997 { 0x62, "VALUE='9202'" },
1998 { 0x63, "VALUE='9203'" },
1999 { 0x64, "VALUE='AUTOMATIC'" },
2000 { 0x65, "VALUE='MANUAL'" },
2001 { 0x6A, "VALUE='AUTO'" },
2002 { 0x6B, "VALUE='9600'" },
2003 { 0x6C, "VALUE='14400'" },
2004 { 0x6D, "VALUE='19200'" },
2005 { 0x6E, "VALUE='28800'" },
2006 { 0x6F, "VALUE='38400'" },
2007 { 0x70, "VALUE='PAP'" },
2008 { 0x71, "VALUE='CHAP'" },
2009 { 0x72, "VALUE='ANALOGUE'" },
2010 { 0x73, "VALUE='ISDN'" },
2011 { 0x74, "VALUE='43200'" },
2012 { 0x75, "VALUE='57600'" },
2013 { 0x76, "VALUE='MSISDN_NO'" },
2014 { 0x77, "VALUE='IPV4'" },
2015 { 0x78, "VALUE='MS_CHAP'" },
2016 { 0x7C, "TYPE='MMSURL'" },
2017 { 0x7D, "TYPE='ID'" },
2018 { 0x7E, "NAME='ISP_NAME'" },
2019 { 0x7F, "TYPE='BOOKMARK'" },
2024 /***** Attribute Value tokens *****/
2026 /***** Token code page aggregation *****/
2027 static const value_valuestring wbxml_nokiaprovc70_tags[] = {
2028 { 0, wbxml_nokiaprovc70_tags_cp0 },
2032 static const value_valuestring wbxml_nokiaprovc70_attrStart[] = {
2033 { 0, wbxml_nokiaprovc70_attrStart_cp0 },
2037 static const wbxml_decoding decode_nokiaprovc_70 = {
2038 "Nokia Client Provisioning 7.0",
2039 "Nokia Client Provisioning 7.0",
2040 { NULL, NULL, NULL },
2042 wbxml_nokiaprovc70_tags,
2043 wbxml_nokiaprovc70_attrStart,
2053 * Wireless Village Client Server Protocol
2054 ***************************************/
2056 /***** Global extension tokens *****/
2058 /***** Tag tokens *****/
2059 /* Common code page (0x00) */
2060 static const value_string wbxml_wv_csp_10_tags_cp0[] = {
2061 /* 0x00 -- 0x04 GLOBAL */
2062 { 0x05, "Acceptance" },
2063 { 0x06, "AddList" },
2064 { 0x07, "AddNickList" },
2065 { 0x08, "Attribute" },
2066 { 0x09, "AttributeList" },
2067 { 0x0A, "ClientID" },
2069 { 0x0C, "ContactList" },
2070 { 0x0D, "ContentData" },
2071 { 0x0E, "ContentEncoding" },
2072 { 0x0F, "ContentSize" },
2073 { 0x10, "ContentType" },
2074 { 0x11, "DateTime" },
2075 { 0x12, "Description" },
2076 { 0x13, "DetailedResult" },
2077 { 0x14, "EntityList" },
2079 { 0x16, "GroupID" },
2080 { 0x17, "GroupList" },
2083 { 0x1A, "MessageCount" },
2084 { 0x1B, "MessageID" },
2085 { 0x1C, "MessageURI" },
2088 { 0x1F, "NickList" },
2089 { 0x20, "NickName" },
2091 { 0x22, "Presence" },
2092 { 0x23, "PresenceSubList" },
2093 { 0x24, "PresenceValue" },
2094 { 0x25, "Property" },
2095 { 0x26, "Qualifier" },
2096 { 0x27, "Recipient" },
2097 { 0x28, "RemoveList" },
2098 { 0x29, "RemoveNickList" },
2100 { 0x2B, "ScreenName" },
2102 { 0x2D, "Session" },
2103 { 0x2E, "SessionDescriptor" },
2104 { 0x2F, "SessionID" },
2105 { 0x30, "SessionType" },
2107 { 0x32, "Transaction" },
2108 { 0x33, "TransactionContent" },
2109 { 0x34, "TransactionDescriptor" },
2110 { 0x35, "TransactionID" },
2111 { 0x36, "TransactionMode" },
2113 { 0x38, "URLList" },
2116 { 0x3B, "UserList" },
2117 { 0x3C, "Validity" },
2119 { 0x3E, "WV-CSP-Message" },
2124 /* Access code page (0x01) */
2125 static const value_string wbxml_wv_csp_10_tags_cp1[] = {
2126 /* 0x00 -- 0x04 GLOBAL */
2127 { 0x05, "AllFunctions" },
2128 { 0x06, "AllFunctionsRequest" },
2129 { 0x07, "CancelInvite-Request" },
2130 { 0x08, "CancelInviteUser-Request" },
2131 { 0x09, "Capability" },
2132 { 0x0A, "CapabilityList" },
2133 { 0x0B, "CapabilityRequest" },
2134 { 0x0C, "ClientCapability-Request" },
2135 { 0x0D, "ClientCapability-Response" },
2136 { 0x0E, "DigestBytes" },
2137 { 0x0F, "DigestSchema" },
2138 { 0x10, "Disconnect" },
2139 { 0x11, "Functions" },
2140 { 0x12, "GetSPInfo-Request" },
2141 { 0x13, "GetSPInfo-Response" },
2142 { 0x14, "InviteID" },
2143 { 0x15, "InviteNote" },
2144 { 0x16, "Invite-Request" },
2145 { 0x17, "Invite-Response" },
2146 { 0x18, "InviteType" },
2147 { 0x19, "InviteUser-Request" },
2148 { 0x1A, "InviteUser-Response" },
2149 { 0x1B, "KeepAlive-Request" },
2150 { 0x1C, "KeepAliveTime" },
2151 { 0x1D, "Login-Request" },
2152 { 0x1E, "Login-Response" },
2153 { 0x1F, "Logout-Request" },
2155 { 0x21, "Password" },
2156 { 0x22, "Polling-Request" },
2157 { 0x23, "ResponseNote" },
2158 { 0x24, "SearchElement" },
2159 { 0x25, "SearchFindings" },
2160 { 0x26, "SearchID" },
2161 { 0x27, "SearchIndex" },
2162 { 0x28, "SearchLimit" },
2163 { 0x29, "SearchOnlineStatus" },
2164 { 0x2A, "SearchPairList" },
2165 { 0x2B, "Search-Request" },
2166 { 0x2C, "Search-Response" },
2167 { 0x2D, "SearchResult" },
2168 { 0x2E, "Service-Request" },
2169 { 0x2F, "Service-Response" },
2170 { 0x30, "SessionCookie" },
2171 { 0x31, "StopSearch-Request" },
2172 { 0x32, "TimeToLive" },
2177 /* Service code page (0x02) */
2178 static const value_string wbxml_wv_csp_10_tags_cp2[] = {
2179 /* 0x00 -- 0x04 GLOBAL */
2181 { 0x06, "AttListFunc" },
2187 { 0x0C, "ContListFunc" },
2192 { 0x11, "FundamentalFeat" },
2205 { 0x1E, "GroupAuthFunc" },
2206 { 0x1F, "GroupFeat" },
2207 { 0x20, "GroupMgmtFunc" },
2208 { 0x21, "GroupUseFunc" },
2209 { 0x22, "IMAuthFunc" },
2211 { 0x24, "IMReceiveFunc" },
2212 { 0x25, "IMSendFunc" },
2214 { 0x27, "InviteFunc" },
2220 { 0x2D, "PresenceAuthFunc" },
2221 { 0x2E, "PresenceDeliverFunc" },
2222 { 0x2F, "PresenceFeat" },
2227 { 0x34, "SearchFunc" },
2228 { 0x35, "ServiceFunc" },
2235 { 0x3C, "WVCSPFeat" },
2240 /* Client capability code page (0x03) */
2241 static const value_string wbxml_wv_csp_10_tags_cp3[] = {
2242 /* 0x00 -- 0x04 GLOBAL */
2243 { 0x05, "AcceptedCharset" },
2244 { 0x06, "AcceptedContentLength" },
2245 { 0x07, "AcceptedContentType" },
2246 { 0x08, "AcceptedTransferEncoding" },
2247 { 0x09, "AnyContent" },
2248 { 0x0A, "ClientType" },
2249 { 0x0B, "InitialDeliveryMethod" },
2250 { 0x0C, "MultiTrans" },
2251 { 0x0D, "ParserSize" },
2252 { 0x0E, "ServerPollMin" },
2253 { 0x0F, "SupportedBearer" },
2254 { 0x10, "SupportedCIRMethod" },
2255 { 0x11, "TCPAddress" },
2256 { 0x12, "TCPPort" },
2257 { 0x13, "UDPPort" },
2262 /* Presence primitive code page (0x04) */
2263 static const value_string wbxml_wv_csp_10_tags_cp4[] = {
2264 /* 0x00 -- 0x04 GLOBAL */
2265 { 0x05, "CancelAuth-Request" },
2266 { 0x06, "ContactListProperties" },
2267 { 0x07, "CreateAttributeList-Request" },
2268 { 0x08, "CreateList-Request" },
2269 { 0x09, "DefaultAttributeList" },
2270 { 0x0A, "DefaultContactList" },
2271 { 0x0B, "DefaultList" },
2272 { 0x0C, "DeleteAttributeList-Request" },
2273 { 0x0D, "DeleteList-Request" },
2274 { 0x0E, "GetAttributeList-Request" },
2275 { 0x0F, "GetAttributeList-Response" },
2276 { 0x10, "GetList-Request" },
2277 { 0x11, "GetList-Response" },
2278 { 0x12, "GetPresence-Request" },
2279 { 0x13, "GetPresence-Response" },
2280 { 0x14, "GetWatcherList-Request" },
2281 { 0x15, "GetWatcherList-Response" },
2282 { 0x16, "ListManage-Request" },
2283 { 0x17, "ListManage-Response" },
2284 { 0x18, "Presence" },
2285 { 0x19, "PresenceAuth-Request" },
2286 { 0x1A, "PresenceAuth-Response" },
2287 { 0x1B, "PresenceNotification-Request" },
2288 { 0x1C, "PresenceValueList" },
2289 { 0x1D, "SubscribePresence-Request" },
2290 { 0x1E, "UnsubscribePresence-Request" },
2291 { 0x1F, "UpdatePresence-Request" },
2296 /* Presence attribute code page (0x05) */
2297 static const value_string wbxml_wv_csp_10_tags_cp5[] = {
2298 /* 0x00 -- 0x04 GLOBAL */
2299 { 0x05, "Accuracy" },
2300 { 0x06, "Address" },
2301 { 0x07, "AddrPref" },
2303 { 0x09, "Altitude" },
2304 { 0x0A, "Building" },
2307 { 0x0D, "ClientInfo" },
2308 { 0x0E, "ClientProducer" },
2309 { 0x0F, "ClientType" },
2310 { 0x10, "ClientVersion" },
2312 { 0x12, "CommCap" },
2313 { 0x13, "ContactInfo" },
2314 { 0x14, "ContainedvCard" },
2315 { 0x15, "Country" },
2316 { 0x16, "Crossing1" },
2317 { 0x17, "Crossing2" },
2318 { 0x18, "DevManufacturer" },
2319 { 0x19, "DirectContent" },
2320 { 0x1A, "FreeTextLocation" },
2321 { 0x1B, "GeoLocation" },
2322 { 0x1C, "Language" },
2323 { 0x1D, "Latitude" },
2324 { 0x1E, "Longitude" },
2326 { 0x20, "NamedArea" },
2327 { 0x21, "OnlineStatus" },
2330 { 0x24, "PreferredContacts" },
2331 { 0x25, "PreferredLanguage" },
2332 { 0x26, "ReferredContent" },
2333 { 0x27, "ReferredvCard" },
2334 { 0x28, "Registration" },
2335 { 0x29, "StatusContent" },
2336 { 0x2A, "StatusMood" },
2337 { 0x2B, "StatusText" },
2339 { 0x2D, "TimeZone" },
2340 { 0x2E, "UserAvailability" },
2345 /* Messaging code page (0x06) */
2346 static const value_string wbxml_wv_csp_10_tags_cp6[] = {
2347 /* 0x00 -- 0x04 GLOBAL */
2348 { 0x05, "BlockList" },
2349 { 0x06, "BlockUser-Request" },
2350 { 0x07, "DeliveryMethod" },
2351 { 0x08, "DeliveryReport" },
2352 { 0x09, "DeliveryReport-Request" },
2353 { 0x0A, "ForwardMessage-Request" },
2354 { 0x0B, "GetBlockedList-Request" },
2355 { 0x0C, "GetBlockedList-Response" },
2356 { 0x0D, "GetMessageList-Request" },
2357 { 0x0E, "GetMessageList-Response" },
2358 { 0x0F, "GetMessage-Request" },
2359 { 0x10, "GetMessage-Response" },
2360 { 0x11, "GrantList" },
2361 { 0x12, "MessageDelivered" },
2362 { 0x13, "MessageInfo" },
2363 { 0x14, "MessageNotification" },
2364 { 0x15, "NewMessage" },
2365 { 0x16, "RejectMessage-Request" },
2366 { 0x17, "SendMessage-Request" },
2367 { 0x18, "SendMessage-Response" },
2368 { 0x19, "SetDeliveryMethod-Request" },
2373 /* Group code page (0x07) */
2374 static const value_string wbxml_wv_csp_10_tags_cp7[] = {
2375 /* 0x00 -- 0x04 GLOBAL */
2376 { 0x05, "AddGroupMembers-Request" },
2378 { 0x07, "CreateGroup-Request" },
2379 { 0x08, "DeleteGroup-Request" },
2380 { 0x09, "GetGroupMembers-Request" },
2381 { 0x0A, "GetGroupMembers-Response" },
2382 { 0x0B, "GetGroupProps-Request" },
2383 { 0x0C, "GetGroupProps-Response" },
2384 { 0x0D, "GroupChangeNotice" },
2385 { 0x0E, "GroupProperties" },
2387 { 0x10, "JoinedRequest" },
2388 { 0x11, "JoinGroup-Request" },
2389 { 0x12, "JoinGroup-Response" },
2390 { 0x13, "LeaveGroup-Request" },
2391 { 0x14, "LeaveGroup-Response" },
2393 { 0x16, "MemberAccess-Request" },
2395 { 0x18, "OwnProperties" },
2396 { 0x19, "RejectList-Request" },
2397 { 0x1A, "RejectList-Response" },
2398 { 0x1B, "RemoveGroupMembers-Request" },
2399 { 0x1C, "SetGroupProps-Request" },
2400 { 0x1D, "SubscribeGroupNotice-Request" },
2401 { 0x1E, "SubscribeGroupNotice-Response" },
2403 { 0x20, "WelcomeNote" },
2409 * Attribute start tokens
2411 /* common code page (0x00) */
2412 static const value_string wbxml_wv_csp_10_attrStart_cp0[] = {
2413 /* 0x00 -- 0x04 GLOBAL */
2414 { 0x05, "xmlns='http://www.wireless-village.org/CSP'" },
2415 { 0x06, "xmlns='http://www.wireless-village.org/PA'" },
2416 { 0x07, "xmlns='http://www.wireless-village.org/TRC'" },
2422 * Attribute value tokens
2424 /* Common value tokens (0x00) */
2425 static const value_string wbxml_wv_csp_10_attrValue_cp0[] = {
2426 /* 0x80 -- 0x84 GLOBAL */
2427 { 0x85, "AccessType" },
2428 { 0x86, "ActiveUsers" },
2430 { 0x88, "application/" },
2431 { 0x89, "application/vnd.wap.mms-message" },
2432 { 0x8A, "application/x-sms" },
2435 { 0x8D, "Default" },
2436 { 0x8E, "DisplayName" },
2437 { 0x8F, "False (No)" },
2439 { 0x91, "Group (GR)" },
2440 { 0x92, "http://" },
2441 { 0x93, "https://" },
2444 { 0x96, "Instant Messaging (IM)" },
2445 { 0x97, "MaxActiveUsers" },
2449 { 0x9B, "Notify/Get" },
2451 { 0x9D, "Outband" },
2452 { 0x9E, "Presence (PR)" },
2453 { 0x9F, "Private" },
2454 { 0xA0, "PrivateMessaging" },
2455 { 0xA1, "PrivilegeLevel" },
2458 { 0xA4, "Request" },
2459 { 0xA5, "Response" },
2460 { 0xA6, "ScreenName" },
2461 { 0xA7, "Searchable" },
2463 { 0xA9, "Shared Content (SC)" },
2465 { 0xAB, "text/plain" },
2466 { 0xAC, "text/x-vCalendar" },
2467 { 0xAD, "text/x-vCard" },
2469 { 0xAF, "True (Yes)" },
2472 { 0xB2, "User (US)" },
2473 { 0xB3, "www.wireless-village.org" },
2478 /* Access value tokens (0x01) */
2479 static const value_string wbxml_wv_csp_10_attrValue_cp1[] = {
2480 /* 0x80 -- 0x84 GLOBAL */
2481 { 0x85, "GROUP_ID" },
2482 { 0x86, "GROUP_NAME" },
2483 { 0x87, "GROUP_TOPIC" },
2484 { 0x88, "GROUP_USER_ID_JOINED" },
2489 { 0x8D, "USER_ALIAS" },
2490 { 0x8E, "USER_EMAIL_ADDRESS" },
2491 { 0x8F, "USER_FIRST_NAME" },
2492 { 0x90, "USER_ID" },
2493 { 0x91, "USER_LAST_NAME" },
2494 { 0x92, "USER_MOBILE_NUMBER" },
2502 /* Presence value tokens (0x05) */
2503 static const value_string wbxml_wv_csp_10_attrValue_cp5[] = {
2504 /* 0x80 -- 0x84 GLOBAL */
2506 { 0x86, "ANXIOUS" },
2507 { 0x87, "ASHAMED" },
2508 { 0x88, "AUDIO_CALL" },
2509 { 0x89, "AVAILABLE" },
2513 { 0x8D, "COMPUTER" },
2514 { 0x8E, "DISCREET" },
2516 { 0x90, "EXCITED" },
2519 { 0x93, "IM_OFFLINE" },
2520 { 0x94, "IM_ONLINE" },
2521 { 0x95, "IN_LOVE" },
2522 { 0x96, "INVINCIBLE" },
2523 { 0x97, "JEALOUS" },
2525 { 0x99, "MOBILE_PHONE" },
2526 { 0x9A, "NOT_AVAILABLE" },
2532 { 0xA0, "VIDEO_CALL" },
2533 { 0xA1, "VIDEO_STREAM" },
2539 /***** Token code page aggregation *****/
2540 static const value_valuestring wbxml_wv_csp_10_tags[] = {
2541 { 0, wbxml_wv_csp_10_tags_cp0 },
2542 { 1, wbxml_wv_csp_10_tags_cp1 },
2543 { 2, wbxml_wv_csp_10_tags_cp2 },
2544 { 3, wbxml_wv_csp_10_tags_cp3 },
2545 { 4, wbxml_wv_csp_10_tags_cp4 },
2546 { 5, wbxml_wv_csp_10_tags_cp5 },
2547 { 6, wbxml_wv_csp_10_tags_cp6 },
2548 { 7, wbxml_wv_csp_10_tags_cp7 },
2552 static const value_valuestring wbxml_wv_csp_10_attrStart[] = {
2553 { 0, wbxml_wv_csp_10_attrStart_cp0 },
2557 static const value_valuestring wbxml_wv_csp_10_attrValue[] = {
2558 { 0, wbxml_wv_csp_10_attrValue_cp0 },
2559 { 1, wbxml_wv_csp_10_attrValue_cp1 },
2560 { 5, wbxml_wv_csp_10_attrValue_cp5 },
2564 static const wbxml_decoding decode_wv_cspc_10 = {
2565 "Wireless-Village Client-Server Protocol 1.0",
2567 { NULL, NULL, NULL },
2569 wbxml_wv_csp_10_tags,
2570 wbxml_wv_csp_10_attrStart,
2571 wbxml_wv_csp_10_attrValue
2580 * Wireless Village Client Server Protocol
2581 ***************************************/
2583 /***** Global extension tokens *****/
2584 static const value_string wbxml_wv_csp_11_global_cp0[] = {
2585 { 0x80, "Common Value" }, /* EXT_T_0 */
2590 /***** Tag tokens *****/
2591 /* Common code page */
2592 static const value_string wbxml_wv_csp_11_tags_cp0[] = {
2593 /* 0x00 -- 0x04 GLOBAL */
2594 { 0x05, "Acceptance" },
2595 { 0x06, "AddList" },
2596 { 0x07, "AddNickList" },
2597 { 0x08, "SName" }, /* Was: Attribute */
2598 { 0x09, "WV-CSP-Message" }, /* Was: AttributeList */
2599 { 0x0A, "ClientID" },
2601 { 0x0C, "ContactList" },
2602 { 0x0D, "ContentData" },
2603 { 0x0E, "ContentEncoding" },
2604 { 0x0F, "ContentSize" },
2605 { 0x10, "ContentType" },
2606 { 0x11, "DateTime" },
2607 { 0x12, "Description" },
2608 { 0x13, "DetailedResult" },
2609 { 0x14, "EntityList" },
2611 { 0x16, "GroupID" },
2612 { 0x17, "GroupList" },
2615 { 0x1A, "MessageCount" },
2616 { 0x1B, "MessageID" },
2617 { 0x1C, "MessageURI" },
2620 { 0x1F, "NickList" },
2621 { 0x20, "NickName" },
2623 { 0x22, "Presence" },
2624 { 0x23, "PresenceSubList" },
2625 { 0x24, "PresenceValue" },
2626 { 0x25, "Property" },
2627 { 0x26, "Qualifier" },
2628 { 0x27, "Recipient" },
2629 { 0x28, "RemoveList" },
2630 { 0x29, "RemoveNickList" },
2632 { 0x2B, "ScreenName" },
2634 { 0x2D, "Session" },
2635 { 0x2E, "SessionDescriptor" },
2636 { 0x2F, "SessionID" },
2637 { 0x30, "SessionType" },
2639 { 0x32, "Transaction" },
2640 { 0x33, "TransactionContent" },
2641 { 0x34, "TransactionDescriptor" },
2642 { 0x35, "TransactionID" },
2643 { 0x36, "TransactionMode" },
2645 { 0x38, "URLList" },
2648 { 0x3B, "UserList" },
2649 { 0x3C, "Validity" },
2651 /* 0x3E - Removed: WV-CSP-Message */
2656 /* Access code page */
2657 static const value_string wbxml_wv_csp_11_tags_cp1[] = {
2658 /* 0x00 -- 0x04 GLOBAL */
2659 { 0x05, "AllFunctions" },
2660 { 0x06, "AllFunctionsRequest" },
2661 { 0x07, "CancelInvite-Request" },
2662 { 0x08, "CancelInviteUser-Request" },
2663 { 0x09, "Capability" },
2664 { 0x0A, "CapabilityList" },
2665 { 0x0B, "CapabilityRequest" },
2666 { 0x0C, "ClientCapability-Request" },
2667 { 0x0D, "ClientCapability-Response" },
2668 { 0x0E, "DigestBytes" },
2669 { 0x0F, "DigestSchema" },
2670 { 0x10, "Disconnect" },
2671 { 0x11, "Functions" },
2672 { 0x12, "GetSPInfo-Request" },
2673 { 0x13, "GetSPInfo-Response" },
2674 { 0x14, "InviteID" },
2675 { 0x15, "InviteNote" },
2676 { 0x16, "Invite-Request" },
2677 { 0x17, "Invite-Response" },
2678 { 0x18, "InviteType" },
2679 { 0x19, "InviteUser-Request" },
2680 { 0x1A, "InviteUser-Response" },
2681 { 0x1B, "KeepAlive-Request" },
2682 { 0x1C, "KeepAliveTime" },
2683 { 0x1D, "Login-Request" },
2684 { 0x1E, "Login-Response" },
2685 { 0x1F, "Logout-Request" },
2687 { 0x21, "Password" },
2688 { 0x22, "Polling-Request" },
2689 { 0x23, "ResponseNote" },
2690 { 0x24, "SearchElement" },
2691 { 0x25, "SearchFindings" },
2692 { 0x26, "SearchID" },
2693 { 0x27, "SearchIndex" },
2694 { 0x28, "SearchLimit" },
2695 { 0x29, "KeepAlive-Response" }, /* Was: SearchOnlineStatus */
2696 { 0x2A, "SearchPairList" },
2697 { 0x2B, "Search-Request" },
2698 { 0x2C, "Search-Response" },
2699 { 0x2D, "SearchResult" },
2700 { 0x2E, "Service-Request" },
2701 { 0x2F, "Service-Response" },
2702 { 0x30, "SessionCookie" },
2703 { 0x31, "StopSearch-Request" },
2704 { 0x32, "TimeToLive" },
2705 /* New in WV-CSP 1.1 */
2706 { 0x33, "SearchString" },
2707 { 0x34, "CompletionFlag" },
2712 /* Service code page */
2713 /* Same as cp2 of WV-CSP 1.0 */
2714 #define wbxml_wv_csp_11_tags_cp2 wbxml_wv_csp_10_tags_cp2
2716 /* Client capability code page */
2717 static const value_string wbxml_wv_csp_11_tags_cp3[] = {
2718 /* 0x00 -- 0x04 GLOBAL */
2719 { 0x05, "AcceptedCharset" },
2720 { 0x06, "AcceptedContentLength" },
2721 { 0x07, "AcceptedContentType" },
2722 { 0x08, "AcceptedTransferEncoding" },
2723 { 0x09, "AnyContent" },
2724 { 0x0A, "DefaultLanguage" }, /* Was: ClientType */
2725 { 0x0B, "InitialDeliveryMethod" },
2726 { 0x0C, "MultiTrans" },
2727 { 0x0D, "ParserSize" },
2728 { 0x0E, "ServerPollMin" },
2729 { 0x0F, "SupportedBearer" },
2730 { 0x10, "SupportedCIRMethod" },
2731 { 0x11, "TCPAddress" },
2732 { 0x12, "TCPPort" },
2733 { 0x13, "UDPPort" },
2738 /* Presence primitive code page */
2739 static const value_string wbxml_wv_csp_11_tags_cp4[] = {
2740 /* 0x00 -- 0x04 GLOBAL */
2741 { 0x05, "CancelAuth-Request" },
2742 { 0x06, "ContactListProperties" },
2743 { 0x07, "CreateAttributeList-Request" },
2744 { 0x08, "CreateList-Request" },
2745 { 0x09, "DefaultAttributeList" },
2746 { 0x0A, "DefaultContactList" },
2747 { 0x0B, "DefaultList" },
2748 { 0x0C, "DeleteAttributeList-Request" },
2749 { 0x0D, "DeleteList-Request" },
2750 { 0x0E, "GetAttributeList-Request" },
2751 { 0x0F, "GetAttributeList-Response" },
2752 { 0x10, "GetList-Request" },
2753 { 0x11, "GetList-Response" },
2754 { 0x12, "GetPresence-Request" },
2755 { 0x13, "GetPresence-Response" },
2756 { 0x14, "GetWatcherList-Request" },
2757 { 0x15, "GetWatcherList-Response" },
2758 { 0x16, "ListManage-Request" },
2759 { 0x17, "ListManage-Response" },
2760 { 0x18, "UnsubscribePresence-Request" }, /* Was: Presence */
2761 { 0x19, "PresenceAuth-Request" },
2762 { 0x1A, "PresenceAuth-User" }, /* Was: PresenceAuth-Response */
2763 { 0x1B, "PresenceNotification-Request" },
2764 { 0x1C, "UpdatePresence-Request" }, /* Was: PresenceValueList */
2765 { 0x1D, "SubscribePresence-Request" },
2766 /* 0x1E - Removed: UnsubscribePresence-Request */
2767 /* 0x1F - Removed: UpdatePresence-Request */
2772 /* Presence attribute code page */
2773 static const value_string wbxml_wv_csp_11_tags_cp5[] = {
2774 /* 0x00 -- 0x04 GLOBAL */
2775 { 0x05, "Accuracy" },
2776 { 0x06, "Address" },
2777 { 0x07, "AddrPref" },
2779 { 0x09, "Altitude" },
2780 { 0x0A, "Building" },
2783 { 0x0D, "ClientInfo" },
2784 { 0x0E, "ClientProducer" },
2785 { 0x0F, "ClientType" },
2786 { 0x10, "ClientVersion" },
2788 { 0x12, "CommCap" },
2789 { 0x13, "ContactInfo" },
2790 { 0x14, "ContainedvCard" },
2791 { 0x15, "Country" },
2792 { 0x16, "Crossing1" },
2793 { 0x17, "Crossing2" },
2794 { 0x18, "DevManufacturer" },
2795 { 0x19, "DirectContent" },
2796 { 0x1A, "FreeTextLocation" },
2797 { 0x1B, "GeoLocation" },
2798 { 0x1C, "Language" },
2799 { 0x1D, "Latitude" },
2800 { 0x1E, "Longitude" },
2802 { 0x20, "NamedArea" },
2803 { 0x21, "OnlineStatus" },
2806 { 0x24, "PreferredContacts" },
2807 { 0x25, "PreferredLanguage" },
2808 { 0x26, "ReferredContent" },
2809 { 0x27, "ReferredvCard" },
2810 { 0x28, "Registration" },
2811 { 0x29, "StatusContent" },
2812 { 0x2A, "StatusMood" },
2813 { 0x2B, "StatusText" },
2815 { 0x2D, "TimeZone" },
2816 { 0x2E, "UserAvailability" },
2817 /* New in WV-CSP 1.1 */
2820 { 0x31, "Contact" },
2821 { 0x32, "Cpriority" },
2822 { 0x33, "Cstatus" },
2829 /* Messaging code page */
2830 static const value_string wbxml_wv_csp_11_tags_cp6[] = {
2831 /* 0x00 -- 0x04 GLOBAL */
2832 { 0x05, "BlockList" },
2833 { 0x06, "BlockUser-Request" },
2834 { 0x07, "DeliveryMethod" },
2835 { 0x08, "DeliveryReport" },
2836 { 0x09, "DeliveryReport-Request" },
2837 { 0x0A, "ForwardMessage-Request" },
2838 { 0x0B, "GetBlockedList-Request" },
2839 { 0x0C, "GetBlockedList-Response" },
2840 { 0x0D, "GetMessageList-Request" },
2841 { 0x0E, "GetMessageList-Response" },
2842 { 0x0F, "GetMessage-Request" },
2843 { 0x10, "GetMessage-Response" },
2844 { 0x11, "GrantList" },
2845 { 0x12, "MessageDelivered" },
2846 { 0x13, "MessageInfo" },
2847 { 0x14, "MessageNotification" },
2848 { 0x15, "NewMessage" },
2849 { 0x16, "RejectMessage-Request" },
2850 { 0x17, "SendMessage-Request" },
2851 { 0x18, "SendMessage-Response" },
2852 { 0x19, "SetDeliveryMethod-Request" },
2853 /* New in WV-CSP 1.1 */
2854 { 0x1A, "DeliveryTime" },
2859 /* Group code page */
2860 static const value_string wbxml_wv_csp_11_tags_cp7[] = {
2861 /* 0x00 -- 0x04 GLOBAL */
2862 { 0x05, "AddGroupMembers-Request" },
2864 { 0x07, "CreateGroup-Request" },
2865 { 0x08, "DeleteGroup-Request" },
2866 { 0x09, "GetGroupMembers-Request" },
2867 { 0x0A, "GetGroupMembers-Response" },
2868 { 0x0B, "GetGroupProps-Request" },
2869 { 0x0C, "GetGroupProps-Response" },
2870 { 0x0D, "GroupChangeNotice" },
2871 { 0x0E, "GroupProperties" },
2873 { 0x10, "JoinedRequest" },
2874 { 0x11, "JoinGroup-Request" },
2875 { 0x12, "JoinGroup-Response" },
2876 { 0x13, "LeaveGroup-Request" },
2877 { 0x14, "LeaveGroup-Response" },
2879 { 0x16, "MemberAccess-Request" },
2881 { 0x18, "OwnProperties" },
2882 { 0x19, "RejectList-Request" },
2883 { 0x1A, "RejectList-Response" },
2884 { 0x1B, "RemoveGroupMembers-Request" },
2885 { 0x1C, "SetGroupProps-Request" },
2886 { 0x1D, "SubscribeGroupNotice-Request" },
2887 { 0x1E, "SubscribeGroupNotice-Response" },
2889 { 0x20, "WelcomeNote" },
2890 /* New in WV-CSP 1.1 */
2891 { 0x21, "JoinGroup" },
2892 { 0x22, "SubscribeNotification" },
2893 { 0x23, "SubscribeType" },
2898 /***** Attribute Start tokens *****/
2899 /* Common code page */
2900 /* Same as cp0 of WV-CSP 1.0 */
2901 #define wbxml_wv_csp_11_attrStart_cp0 wbxml_wv_csp_10_attrStart_cp0
2903 /***** Attribute Value tokens *****/
2905 * Element value tokens
2907 * NOTE - WV-CSP uses the EXT_T_0 token in a peculiar way: the mb_u_int32
2908 * does *not* reference an offset in the string table, but it refers to
2909 * the index in the following value_string.
2912 * - Values 'T' and 'F' are Boolean values representing "True" and "False"
2913 * (or "Yes" and "No" in some circumstances) respectively.
2914 * - Values 'GR', 'IM', 'PR', 'SC', 'GM' and 'US' are enumerated values
2915 * representing "Group", "Instant Messaging", "Presence", "Shared Content",
2916 * "Group membership" and "User" respectively.
2917 * - Values 'G', 'S' and 'U' are enumerated values representing "Get", "Set"
2918 * and "Unset" respectively.
2919 * - Values 'N' and 'P' are enumerated values representing "Notify/Get" and
2920 * "Push" respectively.
2922 * I repeat: this is NOT a attrValue[] array hence it is not called
2923 * wbxml_wv_XXX but vals_wv_XXX.
2925 * Result: the attribute value token definitions from WV-CSP 1.0 are dropped.
2927 static const value_string vals_wv_csp_11_element_value_tokens[] = {
2929 * Common value tokens
2931 { 0x00, "AccessType" },
2932 { 0x01, "ActiveUsers" },
2934 { 0x03, "application/" },
2935 { 0x04, "application/vnd.wap.mms-message" },
2936 { 0x05, "application/x-sms" },
2937 { 0x06, "AutoJoin" },
2940 { 0x09, "Default" },
2941 { 0x0A, "DisplayName" },
2945 { 0x0E, "http://" },
2946 { 0x0F, "https://" },
2950 { 0x13, "MaxActiveUsers" },
2956 { 0x19, "Outband" },
2958 { 0x1B, "Private" },
2959 { 0x1C, "PrivateMessaging" },
2960 { 0x1D, "PrivilegeLevel" },
2963 { 0x20, "Request" },
2964 { 0x21, "Response" },
2965 { 0x22, "Restricted" },
2966 { 0x23, "ScreenName" },
2967 { 0x24, "Searchable" },
2971 { 0x28, "text/plain" },
2972 { 0x29, "text/x-vCalendar" },
2973 { 0x2A, "text/x-vCard" },
2979 { 0x30, "www.wireless-village.org" },
2981 * Access value tokens
2983 { 0x3D, "GROUP_ID" },
2984 { 0x3E, "GROUP_NAME" },
2985 { 0x3F, "GROUP_TOPIC" },
2986 { 0x40, "GROUP_USER_ID_JOINED" },
2987 { 0x41, "GROUP_USER_ID_OWNER" },
2992 { 0x46, "USER_ALIAS" },
2993 { 0x47, "USER_EMAIL_ADDRESS" },
2994 { 0x48, "USER_FIRST_NAME" },
2995 { 0x49, "USER_ID" },
2996 { 0x4A, "USER_LAST_NAME" },
2997 { 0x4B, "USER_MOBILE_NUMBER" },
2998 { 0x4C, "USER_ONLINE_STATUS" },
3003 * Presence value tokens
3006 { 0x5C, "ANXIOUS" },
3007 { 0x5D, "ASHAMED" },
3008 { 0x5E, "AUDIO_CALL" },
3009 { 0x5F, "AVAILABLE" },
3013 { 0x63, "COMPUTER" },
3014 { 0x64, "DISCREET" },
3016 { 0x66, "EXCITED" },
3019 { 0x69, "IM_OFFLINE" },
3020 { 0x6A, "IM_ONLINE" },
3021 { 0x6B, "IN_LOVE" },
3022 { 0x6C, "INVINCIBLE" },
3023 { 0x6D, "JEALOUS" },
3025 { 0x6F, "MOBILE_PHONE" },
3026 { 0x70, "NOT_AVAILABLE" },
3032 { 0x76, "VIDEO_CALL" },
3033 { 0x77, "VIDEO_STREAM" },
3039 /***** Token code page aggregation *****/
3042 ext_t_0_wv_cspc_11(tvbuff_t *tvb _U_, guint32 value, guint32 str_tbl _U_)
3044 char *str = g_strdup_printf("Common Value: '%s'",
3045 val_to_str(value, vals_wv_csp_11_element_value_tokens,
3046 "<Unknown WV-CSP 1.1 Common Value token 0x%X>"));
3050 static const value_valuestring wbxml_wv_csp_11_global[] = {
3051 { 0, wbxml_wv_csp_11_global_cp0 },
3055 static const value_valuestring wbxml_wv_csp_11_tags[] = {
3056 { 0, wbxml_wv_csp_11_tags_cp0 },
3057 { 1, wbxml_wv_csp_11_tags_cp1 },
3058 { 2, wbxml_wv_csp_11_tags_cp2 },
3059 { 3, wbxml_wv_csp_11_tags_cp3 },
3060 { 4, wbxml_wv_csp_11_tags_cp4 },
3061 { 5, wbxml_wv_csp_11_tags_cp5 },
3062 { 6, wbxml_wv_csp_11_tags_cp6 },
3063 { 7, wbxml_wv_csp_11_tags_cp7 },
3067 static const value_valuestring wbxml_wv_csp_11_attrStart[] = {
3068 { 0, wbxml_wv_csp_11_attrStart_cp0 },
3072 static const wbxml_decoding decode_wv_cspc_11 = {
3073 "Wireless-Village Client-Server Protocol 1.1",
3075 { ext_t_0_wv_cspc_11, NULL, NULL },
3076 wbxml_wv_csp_11_global,
3077 wbxml_wv_csp_11_tags,
3078 wbxml_wv_csp_11_attrStart,
3088 * Wireless Village Client Server Protocol
3089 ***************************************/
3090 #ifdef Remove_this_comment_when_WV_CSP_will_be_an_approved_spec
3092 /***** Global extension tokens *****/
3093 /* Same as WV-CSP 1.1 */
3095 /***** Tag tokens *****/
3096 /* Common code page */
3097 /* Same as cp0 of WV-CSP 1.1 */
3098 #define wbxml_wv_csp_12_tags_cp0 wbxml_wv_csp_11_tags_cp0
3099 /* Note that the table continues in code page 0x09 */
3101 /* Access code page (0x01) */
3102 static const value_string wbxml_wv_csp_12_tags_cp1[] = {
3103 /* 0x00 -- 0x04 GLOBAL */
3104 { 0x05, "AllFunctions" },
3105 { 0x06, "AllFunctionsRequest" },
3106 { 0x07, "CancelInvite-Request" },
3107 { 0x08, "CancelInviteUser-Request" },
3108 { 0x09, "Capability" },
3109 { 0x0A, "CapabilityList" },
3110 { 0x0B, "CapabilityRequest" },
3111 { 0x0C, "ClientCapability-Request" },
3112 { 0x0D, "ClientCapability-Response" },
3113 { 0x0E, "DigestBytes" },
3114 { 0x0F, "DigestSchema" },
3115 { 0x10, "Disconnect" },
3116 { 0x11, "Functions" },
3117 { 0x12, "GetSPInfo-Request" },
3118 { 0x13, "GetSPInfo-Response" },
3119 { 0x14, "InviteID" },
3120 { 0x15, "InviteNote" },
3121 { 0x16, "Invite-Request" },
3122 { 0x17, "Invite-Response" },
3123 { 0x18, "InviteType" },
3124 { 0x19, "InviteUser-Request" },
3125 { 0x1A, "InviteUser-Response" },
3126 { 0x1B, "KeepAlive-Request" },
3127 { 0x1C, "KeepAliveTime" },
3128 { 0x1D, "Login-Request" },
3129 { 0x1E, "Login-Response" },
3130 { 0x1F, "Logout-Request" },
3132 { 0x21, "Password" },
3133 { 0x22, "Polling-Request" },
3134 { 0x23, "ResponseNote" },
3135 { 0x24, "SearchElement" },
3136 { 0x25, "SearchFindings" },
3137 { 0x26, "SearchID" },
3138 { 0x27, "SearchIndex" },
3139 { 0x28, "SearchLimit" },
3140 { 0x29, "KeepAlive-Response" },
3141 { 0x2A, "SearchPairList" },
3142 { 0x2B, "Search-Request" },
3143 { 0x2C, "Search-Response" },
3144 { 0x2D, "SearchResult" },
3145 { 0x2E, "Service-Request" },
3146 { 0x2F, "Service-Response" },
3147 { 0x30, "SessionCookie" },
3148 { 0x31, "StopSearch-Request" },
3149 { 0x32, "TimeToLive" },
3150 /* New in WV-CSP 1.1 */
3151 { 0x33, "SearchString" },
3152 { 0x34, "CompletionFlag" },
3153 /* New in WV-CSP 1.2 */
3154 { 0x36, "ReceiveList" },
3155 { 0x37, "VerifyID-Request" },
3156 { 0x38, "Extended-Request" },
3157 { 0x39, "Extended-Response" },
3158 { 0x3A, "AgreedCapabilityList" },
3159 { 0x3B, "ExtendedData" },
3160 { 0x3C, "OtherServer" },
3161 { 0x3D, "PresenceAttributeNSName" },
3162 { 0x3E, "SessionNSName" },
3163 { 0x3F, "TransactionNSName" },
3167 /* Note that the table continues in code page 0x0A */
3169 /* Service code page (0x02) */
3170 static const value_string wbxml_wv_csp_12_tags_cp2[] = {
3171 /* 0x00 -- 0x04 GLOBAL */
3173 { 0x06, "AttListFunc" },
3179 { 0x0C, "ContListFunc" },
3184 { 0x11, "FundamentalFeat" },
3197 { 0x1E, "GroupAuthFunc" },
3198 { 0x1F, "GroupFeat" },
3199 { 0x20, "GroupMgmtFunc" },
3200 { 0x21, "GroupUseFunc" },
3201 { 0x22, "IMAuthFunc" },
3203 { 0x24, "IMReceiveFunc" },
3204 { 0x25, "IMSendFunc" },
3206 { 0x27, "InviteFunc" },
3212 { 0x2D, "PresenceAuthFunc" },
3213 { 0x2E, "PresenceDeliverFunc" },
3214 { 0x2F, "PresenceFeat" },
3219 { 0x34, "SearchFunc" },
3220 { 0x35, "ServiceFunc" },
3227 { 0x3C, "WVCSPFeat" },
3228 /* New in WV-CSP 1.2 */
3231 { 0x3E, "VRID" }, /* Duplicate, and cp2 is full --> Will move to cp8? */
3236 /* Note that the table continues in code page 0x08 */
3238 /* Client capability code page (0x03) */
3239 /* Same as cp3 of WV-CSP 1.0 */
3240 #define wbxml_wv_csp_12_tags_cp3 wbxml_wv_csp_10_tags_cp3
3242 /* Presence primitive code page (0x04) */
3243 static const value_string wbxml_wv_csp_12_tags_cp4[] = {
3244 /* 0x00 -- 0x04 GLOBAL */
3245 { 0x05, "CancelAuth-Request" },
3246 { 0x06, "ContactListProperties" },
3247 { 0x07, "CreateAttributeList-Request" },
3248 { 0x08, "CreateList-Request" },
3249 { 0x09, "DefaultAttributeList" },
3250 { 0x0A, "DefaultContactList" },
3251 { 0x0B, "DefaultList" },
3252 { 0x0C, "DeleteAttributeList-Request" },
3253 { 0x0D, "DeleteList-Request" },
3254 { 0x0E, "GetAttributeList-Request" },
3255 { 0x0F, "GetAttributeList-Response" },
3256 { 0x10, "GetList-Request" },
3257 { 0x11, "GetList-Response" },
3258 { 0x12, "GetPresence-Request" },
3259 { 0x13, "GetPresence-Response" },
3260 { 0x14, "GetWatcherList-Request" },
3261 { 0x15, "GetWatcherList-Response" },
3262 { 0x16, "ListManage-Request" },
3263 { 0x17, "ListManage-Response" },
3264 { 0x18, "UnsubscribePresence-Request" },
3265 { 0x19, "PresenceAuth-Request" },
3266 { 0x1A, "PresenceAuth-User" },
3267 { 0x1B, "PresenceNotification-Request" },
3268 { 0x1C, "UpdatePresence-Request" },
3269 { 0x1D, "SubscribePresence-Request" },
3270 /* New in WV-CSP 1.2 */
3271 { 0x1E, "Auto-Subscribe" },
3272 /* 0x1E was defined in WV-CSP 1.0: UnsubscribePresence-Request */
3273 { 0x1F, "GetReactiveAuthStatus-Request" },
3274 /* 0x1F was defined in WV-CSP 1.0: UpdatePresence-Request */
3275 { 0x20, "GetReactiveAuthStatus-Response" },
3280 /* Presence attribute code page (0x05) */
3281 static const value_string wbxml_wv_csp_12_tags_cp5[] = {
3282 /* 0x00 -- 0x04 GLOBAL */
3283 { 0x05, "Accuracy" },
3284 { 0x06, "Address" },
3285 { 0x07, "AddrPref" },
3287 { 0x09, "Altitude" },
3288 { 0x0A, "Building" },
3291 { 0x0D, "ClientInfo" },
3292 { 0x0E, "ClientProducer" },
3293 { 0x0F, "ClientType" },
3294 { 0x10, "ClientVersion" },
3296 { 0x12, "CommCap" },
3297 { 0x13, "ContactInfo" },
3298 { 0x14, "ContainedvCard" },
3299 { 0x15, "Country" },
3300 { 0x16, "Crossing1" },
3301 { 0x17, "Crossing2" },
3302 { 0x18, "DevManufacturer" },
3303 { 0x19, "DirectContent" },
3304 { 0x1A, "FreeTextLocation" },
3305 { 0x1B, "GeoLocation" },
3306 { 0x1C, "Language" },
3307 { 0x1D, "Latitude" },
3308 { 0x1E, "Longitude" },
3310 { 0x20, "NamedArea" },
3311 { 0x21, "OnlineStatus" },
3314 { 0x24, "PreferredContacts" },
3315 { 0x25, "PreferredLanguage" },
3316 { 0x26, "ReferredContent" },
3317 { 0x27, "ReferredvCard" },
3318 { 0x28, "Registration" },
3319 { 0x29, "StatusContent" },
3320 { 0x2A, "StatusMood" },
3321 { 0x2B, "StatusText" },
3323 { 0x2D, "TimeZone" },
3324 { 0x2E, "UserAvailability" },
3325 /* New in WV-CSP 1.1 */
3328 { 0x31, "Contact" },
3329 { 0x32, "Cpriority" },
3330 { 0x33, "Cstatus" },
3333 /* New in WV-CSP 1.2 */
3334 { 0x36, "ContentType" },
3335 { 0x37, "Inf_link" },
3336 { 0x38, "InfoLink" },
3343 /* Messaging code page (0x06) */
3344 static const value_string wbxml_wv_csp_12_tags_cp6[] = {
3345 /* 0x00 -- 0x04 GLOBAL */
3346 { 0x05, "BlockList" },
3347 { 0x06, "BlockEntity-Request" }, /* Was: BlockUser-Request */
3348 { 0x07, "DeliveryMethod" },
3349 { 0x08, "DeliveryReport" },
3350 { 0x09, "DeliveryReport-Request" },
3351 { 0x0A, "ForwardMessage-Request" },
3352 { 0x0B, "GetBlockedList-Request" },
3353 { 0x0C, "GetBlockedList-Response" },
3354 { 0x0D, "GetMessageList-Request" },
3355 { 0x0E, "GetMessageList-Response" },
3356 { 0x0F, "GetMessage-Request" },
3357 { 0x10, "GetMessage-Response" },
3358 { 0x11, "GrantList" },
3359 { 0x12, "MessageDelivered" },
3360 { 0x13, "MessageInfo" },
3361 { 0x14, "MessageNotification" },
3362 { 0x15, "NewMessage" },
3363 { 0x16, "RejectMessage-Request" },
3364 { 0x17, "SendMessage-Request" },
3365 { 0x18, "SendMessage-Response" },
3366 { 0x19, "SetDeliveryMethod-Request" },
3367 { 0x1A, "DeliveryTime" },
3372 /* Group code page (0x07) */
3373 static const value_string wbxml_wv_csp_12_tags_cp7[] = {
3374 /* 0x00 -- 0x04 GLOBAL */
3375 { 0x05, "AddGroupMembers-Request" },
3377 { 0x07, "CreateGroup-Request" },
3378 { 0x08, "DeleteGroup-Request" },
3379 { 0x09, "GetGroupMembers-Request" },
3380 { 0x0A, "GetGroupMembers-Response" },
3381 { 0x0B, "GetGroupProps-Request" },
3382 { 0x0C, "GetGroupProps-Response" },
3383 { 0x0D, "GroupChangeNotice" },
3384 { 0x0E, "GroupProperties" },
3386 { 0x10, "JoinedRequest" },
3387 { 0x11, "JoinGroup-Request" },
3388 { 0x12, "JoinGroup-Response" },
3389 { 0x13, "LeaveGroup-Request" },
3390 { 0x14, "LeaveGroup-Response" },
3392 { 0x16, "MemberAccess-Request" },
3394 { 0x18, "OwnProperties" },
3395 { 0x19, "RejectList-Request" },
3396 { 0x1A, "RejectList-Response" },
3397 { 0x1B, "RemoveGroupMembers-Request" },
3398 { 0x1C, "SetGroupProps-Request" },
3399 { 0x1D, "SubscribeGroupNotice-Request" },
3400 { 0x1E, "SubscribeGroupNotice-Response" },
3402 { 0x20, "WelcomeNote" },
3403 /* New in WV-CSP 1.1 */
3404 { 0x21, "JoinGroup" },
3405 { 0x22, "SubscribeNotification" },
3406 { 0x23, "SubscribeType" },
3407 /* New in WV-CSP 1.2 */
3408 { 0x24, "GetJoinedUsers-Request" },
3409 { 0x25, "GetJoinedUsers-Response" },
3410 { 0x26, "AdminMapList" },
3411 { 0x27, "AdminMapping" },
3412 { 0x28, "Mapping" },
3413 { 0x29, "ModMapping" },
3414 { 0x2A, "UserMapList" },
3415 { 0x2B, "UserMapping" },
3420 /* Service negotiation code page - continued (0x08) */
3421 /* Same as cp8 of WV-CSP 1.1, but a new token is likely to be added. - XXX */
3422 static const value_string wbxml_wv_csp_12_tags_cp8[] = {
3423 /* 0x00 -- 0x04 GLOBAL */
3431 /* Common code page - continued (0x09) */
3432 static const value_string wbxml_wv_csp_12_tags_cp9[] = {
3433 /* 0x00 -- 0x04 GLOBAL */
3436 { 0x07, "ExtBlock" },
3437 { 0x08, "HistoryPeriod" },
3439 { 0x0A, "MaxWatcherList" },
3440 { 0x0B, "ReactiveAuthState" },
3441 { 0x0C, "ReactiveAuthStatus" },
3442 { 0x0D, "ReactiveAuthStatusList" },
3443 { 0x0E, "Watcher" },
3444 { 0x0C, "WatcherStatus" }, /* Duplicate --> Will move to 0x0F? */
3449 /* Access code page - continued (0x0A) */
3450 static const value_string wbxml_wv_csp_12_tags_cp10[] = {
3451 /* 0x00 -- 0x04 GLOBAL */
3452 { 0x05, "WV-CSP-NSDiscovery-Request" },
3453 { 0x06, "WV-CSP-NSDiscovery-Response" },
3458 /***** Attribute Start tokens *****/
3459 /* Common code page (0x00) */
3460 static const value_string wbxml_wv_csp_12_attrStart_cp0[] = {
3461 /* 0x00 -- 0x04 GLOBAL */
3462 { 0x05, "xmlns='http://www.wireless-village.org/CSP'" },
3463 { 0x06, "xmlns='http://www.wireless-village.org/PA'" },
3464 { 0x07, "xmlns='http://www.wireless-village.org/TRC'" },
3465 /* New in WV-CSP 1.2 */
3466 { 0x08, "xmlns='http://www.openmobilealliance.org/DTD/WV-CSP'" },
3467 { 0x09, "xmlns='http://www.openmobilealliance.org/DTD/WV-PA'" },
3468 { 0x0A, "xmlns http://www.openmobilealliance.org/DTD/WV-TRC'" },
3473 /***** Attribute Value tokens *****/
3475 * Element value tokens
3477 * NOTE - WV-CSP uses the EXT_T_0 token in a peculiar way: the mb_u_int32
3478 * does *not* reference an offset in the string table, but it refers to
3479 * the index in the following value_string.
3482 * - Values 'T' and 'F' are Boolean values representing "True" and "False"
3483 * (or "Yes" and "No" in some circumstances) respectively.
3484 * - Values 'GR', 'IM', 'PR', 'SC', 'GM' and 'US' are enumerated values
3485 * representing "Group", "Instant Messaging", "Presence", "Shared Content",
3486 * "Group membership" and "User" respectively.
3487 * - Values 'G', 'S' and 'U' are enumerated values representing "Get", "Set"
3488 * and "Unset" respectively.
3489 * - Values 'N' and 'P' are enumerated values representing "Notify/Get" and
3490 * "Push" respectively.
3492 * I repeat: this is NOT a attrValue[] array hence it is not called
3493 * wbxml_wv_XXX but vals_wv_XXX.
3495 static const value_string vals_wv_csp_12_element_value_tokens[] = {
3497 * Common value tokens
3499 { 0x00, "AccessType" },
3500 { 0x01, "ActiveUsers" },
3502 { 0x03, "application/" },
3503 { 0x04, "application/vnd.wap.mms-message" },
3504 { 0x05, "application/x-sms" },
3505 { 0x06, "AutoJoin" },
3508 { 0x09, "Default" },
3509 { 0x0A, "DisplayName" },
3513 { 0x0E, "http://" },
3514 { 0x0F, "https://" },
3518 { 0x13, "MaxActiveUsers" },
3524 { 0x19, "Outband" },
3526 { 0x1B, "Private" },
3527 { 0x1C, "PrivateMessaging" },
3528 { 0x1D, "PrivilegeLevel" },
3531 { 0x20, "Request" },
3532 { 0x21, "Response" },
3533 { 0x22, "Restricted" },
3534 { 0x23, "ScreenName" },
3535 { 0x24, "Searchable" },
3539 { 0x28, "text/plain" },
3540 { 0x29, "text/x-vCalendar" },
3541 { 0x2A, "text/x-vCard" },
3547 { 0x30, "www.wireless-village.org" },
3548 /* New in WV-CSP 1.2 */
3549 { 0x31, "AutoDelete" },
3551 { 0x33, "Validity" },
3552 { 0x34, "DENIED" }, /* Duplicate */
3553 { 0x34, "ShowID" }, /* Duplicate */
3554 { 0x35, "GRANTED" },
3555 { 0x36, "PENDING" },
3557 * Access value tokens
3559 { 0x3D, "GROUP_ID" },
3560 { 0x3E, "GROUP_NAME" },
3561 { 0x3F, "GROUP_TOPIC" },
3562 { 0x40, "GROUP_USER_ID_JOINED" },
3563 { 0x41, "GROUP_USER_ID_OWNER" },
3568 { 0x46, "USER_ALIAS" },
3569 { 0x47, "USER_EMAIL_ADDRESS" },
3570 { 0x48, "USER_FIRST_NAME" },
3571 { 0x49, "USER_ID" },
3572 { 0x4A, "USER_LAST_NAME" },
3573 { 0x4B, "USER_MOBILE_NUMBER" },
3574 { 0x4C, "USER_ONLINE_STATUS" },
3578 /* New in WV-CSP 1.2 */
3579 { 0x50, "GROUP_USER_ID_AUTOJOIN" },
3581 * Presence value tokens
3584 { 0x5C, "ANXIOUS" },
3585 { 0x5D, "ASHAMED" },
3586 { 0x5E, "AUDIO_CALL" },
3587 { 0x5F, "AVAILABLE" },
3591 { 0x63, "COMPUTER" },
3592 { 0x64, "DISCREET" },
3594 { 0x66, "EXCITED" },
3597 { 0x69, "IM_OFFLINE" },
3598 { 0x6A, "IM_ONLINE" },
3599 { 0x6B, "IN_LOVE" },
3600 { 0x6C, "INVINCIBLE" },
3601 { 0x6D, "JEALOUS" },
3603 { 0x6F, "MOBILE_PHONE" },
3604 { 0x70, "NOT_AVAILABLE" },
3610 { 0x76, "VIDEO_CALL" },
3611 { 0x77, "VIDEO_STREAM" },
3618 /***** Token code page aggregation *****/
3621 ext_t_0_wv_cspc_12(tvbuff_t *tvb _U_, guint32 value, guint32 str_tbl _U_)
3623 char *str = g_strdup_printf("Common Value: '%s'",
3624 val_to_str(value, vals_wv_csp_12_element_value_tokens,
3625 "<Unknown WV-CSP 1.2 Common Value token 0x%X>"));
3629 #define wbxml_wv_csp_12_global wbxml_wv_csp_11_global
3631 static const value_valuestring wbxml_wv_csp_12_tags[] = {
3632 { 0, wbxml_wv_csp_12_tags_cp0 },
3633 { 1, wbxml_wv_csp_12_tags_cp1 },
3634 { 2, wbxml_wv_csp_12_tags_cp2 },
3635 { 3, wbxml_wv_csp_12_tags_cp3 },
3636 { 4, wbxml_wv_csp_12_tags_cp4 },
3637 { 5, wbxml_wv_csp_12_tags_cp5 },
3638 { 6, wbxml_wv_csp_12_tags_cp6 },
3639 { 7, wbxml_wv_csp_12_tags_cp7 },
3640 { 8, wbxml_wv_csp_12_tags_cp8 },
3641 { 9, wbxml_wv_csp_12_tags_cp9 },
3642 { 10, wbxml_wv_csp_12_tags_cp10 },
3646 static const value_valuestring wbxml_wv_csp_12_attrStart[] = {
3647 { 0, wbxml_wv_csp_12_attrStart_cp0 },
3651 static const wbxml_decoding decode_wv_cspc_12 = {
3652 "Wireless-Village Client-Server Protocol 1.2",
3654 { ext_t_0_wv_cspc_12, NULL, NULL },
3655 wbxml_wv_csp_12_global,
3656 wbxml_wv_csp_12_tags,
3657 wbxml_wv_csp_12_attrStart,
3660 #endif /* Remove_this_comment_when_WV_CSP_will_be_an_approved_spec */
3666 /********************** WBXML token mapping aggregation **********************/
3668 static const wbxml_decoding *get_wbxml_decoding_from_public_id (guint32 publicid);
3669 static const wbxml_decoding *get_wbxml_decoding_from_content_type (
3670 const char *content_type);
3674 ** Aggregation of content type and aggregated code pages
3675 ** Content type map lookup will stop at the 1st entry with 3rd member = FALSE
3679 * The following map contains entries registered with a registered WBXML
3680 * public ID. See WAP WINA or OMA OMNA for registered values:
3681 * http://www.openmobilealliance.org/tech/omna/ */
3682 static const wbxml_integer_list well_known_public_id_list[] = {
3683 /* 0x00 - Unknown or missing Public ID */
3684 /* 0x01 - LITERAL PublicID - see String Table */
3685 { 0x02, &decode_wmlc_10 }, /* WML 1.0 */
3686 /* 0x03 - WTA 1.0 */
3687 { 0x04, &decode_wmlc_11 }, /* WML 1.1 */
3688 { 0x05, &decode_sic_10 }, /* SI 1.0 */
3689 { 0x06, &decode_slc_10 }, /* SL 1.0 */
3690 { 0x07, &decode_coc_10 }, /* CO 1.0 */
3691 { 0x08, &decode_channelc_10 }, /* CHANNEL 1.0 */
3692 { 0x09, &decode_wmlc_12 }, /* WML 1.2 */
3693 { 0x0A, &decode_wmlc_13 }, /* WML 1.3 */
3694 { 0x0B, &decode_provc_10 }, /* PROV 1.0 */
3695 /* 0x0C - WTA-WML 1.2 */
3696 { 0x0D, &decode_emnc_10 }, /* EMN 1.0 */
3697 /* 0x0E - DRMREL 1.0 */
3698 { 0x0F, &decode_wv_cspc_10 }, /* WV-CSP 1.0 */
3699 { 0x10, &decode_wv_cspc_11 }, /* WV-CSP 1.1 */
3701 { 0x020B, &decode_nokiaprovc_70 },/* Nokia OTA Provisioning 7.0 */
3702 { 0x0FD1, &decode_syncmlc_10 }, /* SyncML 1.0 */
3703 { 0x0FD3, &decode_syncmlc_11 }, /* SyncML 1.1 */
3704 /* Note: I assumed WML+ 1.x would be not that different from WML 1.x,
3705 * the real mapping should come from Phone.com (OpenWave)! */
3706 { 0x1108, &decode_wmlc_11 }, /* Phone.com WMLC+ 1.1 - not 100% correct */
3707 { 0x110D, &decode_wmlc_13 }, /* Phone.com WMLC+ 1.3 - not 100% correct */
3712 /* The following map contains entries only registered with a literal media
3714 static const wbxml_literal_list content_type_list[] = {
3715 { "application/x-wap-prov.browser-settings",
3717 &decode_nokiaprovc_70
3719 { "application/x-wap-prov.browser-bookmarks",
3721 &decode_nokiaprovc_70
3723 { "application/vnd.wv.csp.wbxml",
3727 { NULL, NULL, NULL }
3731 /* Returns a pointer to the WBXML token map for the given WBXML public
3732 * identifier value (see WINA for a table with defined identifiers). */
3733 static const wbxml_decoding *get_wbxml_decoding_from_public_id (guint32 public_id)
3735 const wbxml_decoding *map = NULL;
3737 DebugLog(("get_wbxml_decoding_from_public_id: public_id = %u\n",
3739 if (public_id >= 2) {
3740 const wbxml_integer_list *item = well_known_public_id_list;
3742 while (item && item->public_id && item->map) {
3743 if (item->public_id == public_id) {
3753 static const wbxml_decoding *get_wbxml_decoding_from_content_type (
3754 const char *content_type)
3756 const wbxml_decoding *map = NULL;
3758 DebugLog(("get_wbxml_decoding_from_content_type: content_type = [%s]\n",
3760 if (content_type && content_type[0]) {
3761 const wbxml_literal_list *item = content_type_list;
3763 while (item && item->content_type) {
3764 if (strcasecmp(content_type, item->content_type) == 0) {
3775 /* WBXML content token mapping depends on the following parameters:
3776 * - Content type (guint32)
3777 * - Token type (global, tags, attrStart, attrValue)
3778 * - Code page for tag and attribute
3780 * This results in the following steps:
3781 * 1. Retrieve content type mapping
3782 * 2. If exists, retrieve token type mapping
3783 * 3. If exists, retrieve required code page
3784 * 4. If exists, retrieve token mapping
3787 #define wbxml_UNDEFINED_TOKEN \
3788 "(Requested token not defined for this content type)"
3789 #define wbxml_UNDEFINED_TOKEN_CODE_PAGE \
3790 "(Requested token code page not defined for this content type)"
3791 #define wbxml_UNDEFINED_TOKEN_MAP \
3792 "(Requested token map not defined for this content type)"
3793 /* Return token mapping for a given content mapping entry. */
3795 map_token (const value_valuestring *token_map, guint8 codepage, guint8 token) {
3796 const value_string *vs;
3799 if (token_map) { /* Found map */
3800 if ((vs = val_to_valstr (codepage, token_map))) {
3801 /* Found codepage map */
3802 s = match_strval (token, vs);
3803 if (s) { /* Found valid token */
3804 DebugLog(("map_token(codepage = %u, token = %u: [%s]\n", codepage, token, s));
3807 /* No valid token mapping in specified code page of token map */
3808 DebugLog(("map_token(codepage = %u, token = %u: "
3809 wbxml_UNDEFINED_TOKEN "\n", codepage, token));
3810 return wbxml_UNDEFINED_TOKEN;
3812 /* There is no token map entry for the requested code page */
3813 DebugLog(("map_token(codepage = %u, token = %u: "
3814 wbxml_UNDEFINED_TOKEN_CODE_PAGE "\n", codepage, token));
3815 return wbxml_UNDEFINED_TOKEN_CODE_PAGE;
3817 /* The token map does not exist */
3818 DebugLog(("map_token(codepage = %u, token = %u: "
3819 wbxml_UNDEFINED_TOKEN_MAP "\n", codepage, token));
3820 return wbxml_UNDEFINED_TOKEN_MAP;
3827 /************************** Function prototypes **************************/
3831 dissect_wbxml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
3834 proto_register_wbxml(void);
3836 /* Parse and display the WBXML string table */
3838 show_wbxml_string_table (proto_tree *tree, tvbuff_t *tvb, guint32 str_tbl,
3839 guint32 str_tbl_len);
3841 /* Parse data while in STAG state */
3843 parse_wbxml_tag (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
3844 guint32 str_tbl, guint8 *level, guint8 *codepage_stag, guint8 *codepage_attr);
3846 /* Parse data while in STAG state;
3847 * interpret tokens as defined by content type */
3849 parse_wbxml_tag_defined (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
3850 guint32 str_tbl, guint8 *level, guint8 *codepage_stag, guint8 *codepage_attr,
3851 const wbxml_decoding *map);
3853 /* Parse data while in ATTR state */
3855 parse_wbxml_attribute_list (proto_tree *tree, tvbuff_t *tvb,
3856 guint32 offset, guint32 str_tbl, guint8 level, guint8 *codepage_attr);
3858 /* Parse data while in ATTR state;
3859 * interpret tokens as defined by content type */
3861 parse_wbxml_attribute_list_defined (proto_tree *tree, tvbuff_t *tvb,
3862 guint32 offset, guint32 str_tbl, guint8 level, guint8 *codepage_attr,
3863 const wbxml_decoding *map);
3866 /****************** WBXML protocol dissection functions ******************/
3869 /* Code to actually dissect the packets */
3871 dissect_wbxml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3873 /* Set up structures needed to add the protocol subtree and manage it */
3875 proto_tree *wbxml_tree; /* Main WBXML tree */
3876 proto_tree *wbxml_str_tbl_tree; /* String table subtree */
3877 proto_tree *wbxml_content_tree; /* Content subtree */
3881 guint32 charset = 0;
3882 guint32 charset_len = 0;
3884 guint32 publicid_index = 0;
3885 guint32 publicid_len;
3887 guint32 str_tbl_len;
3888 guint32 str_tbl_len_len = 0;
3889 guint8 level = 0; /* WBXML recursion level */
3890 const wbxml_decoding *content_map = NULL;
3891 gchar *summary = NULL;
3892 guint8 codepage_stag = 0;
3893 guint8 codepage_attr = 0;
3895 DebugLog(("dissect_wbxml: Dissecting packet %u\n", pinfo->fd->num));
3898 * Version 1.0: version publicid strtbl BODY
3899 * Version 1.x: version publicid charset strtbl BODY
3901 * Last valid format: WBXML 1.3
3903 switch ( version = tvb_get_guint8 (tvb, 0) ) {
3904 case 0x00: /* WBXML/1.0 */
3907 case 0x01: /* WBXML/1.1 */
3908 case 0x02: /* WBXML/1.2 */
3909 case 0x03: /* WBXML/1.3 */
3916 /* In order to properly construct the packet summary,
3917 * I need to read the entire WBXML header
3918 * up to the string table length.
3922 publicid = tvb_get_guintvar(tvb, 1, &publicid_len);
3924 /* Public identifier in string table */
3925 publicid_index = tvb_get_guintvar (tvb, 1+publicid_len, &len);
3926 publicid_len += len;
3928 offset = 1 + publicid_len;
3930 /* Version-specific handling of Charset */
3931 switch ( version ) {
3932 case 0x00: /* WBXML/1.0 */
3936 case 0x01: /* WBXML/1.1 */
3937 case 0x02: /* WBXML/1.2 */
3938 case 0x03: /* WBXML/1.3 */
3940 charset = tvb_get_guintvar (tvb, offset, &charset_len);
3941 offset += charset_len;
3944 default: /* Impossible since we returned already earlier */
3945 g_error("%s:%u: WBXML version octet 0x%02X only partly supported!\n"
3946 "Please report this as a bug.\n", __FILE__, __LINE__, version);
3947 g_assert_not_reached();
3951 /* String table: read string table length in bytes */
3952 str_tbl_len = tvb_get_guintvar (tvb, offset, &str_tbl_len_len);
3953 str_tbl = offset + str_tbl_len_len; /* Start of 1st string in string table */
3955 /* Compose the summary line */
3957 summary = g_strdup_printf("%s, Public ID: \"%s\"",
3958 match_strval (version, vals_wbxml_versions),
3959 match_strval (publicid, vals_wbxml_public_ids));
3961 /* Read length of Public ID from string table */
3962 len = tvb_strsize (tvb, str_tbl + publicid_index);
3963 summary = g_strdup_printf("%s, Public ID: \"%s\"",
3964 match_strval (version, vals_wbxml_versions),
3965 tvb_format_text (tvb, str_tbl + publicid_index, len - 1));
3968 /* Add summary to INFO column if it is enabled */
3969 if (check_col(pinfo->cinfo, COL_INFO))
3970 col_append_fstr(pinfo->cinfo, COL_INFO, " (WBXML %s)", summary);
3972 /* create display subtree for the protocol */
3973 ti = proto_tree_add_item (tree, proto_wbxml, tvb, 0, -1, FALSE);
3974 proto_item_append_text(ti, ", Version: %s", summary);
3977 * Now show the protocol subtree, if tree is set.
3980 wbxml_tree = proto_item_add_subtree(ti, ett_wbxml);
3983 proto_tree_add_uint (wbxml_tree, hf_wbxml_version,
3984 tvb, 0, 1, version);
3987 if (publicid) { /* Known Public ID */
3988 proto_tree_add_uint(wbxml_tree, hf_wbxml_public_id_known,
3989 tvb, 1, publicid_len, publicid);
3990 } else { /* Public identifier in string table */
3991 proto_tree_add_item (wbxml_tree, hf_wbxml_public_id_literal,
3992 tvb, 1, publicid_len, FALSE);
3994 offset = 1 + publicid_len;
3996 if ( version ) { /* Charset */
3997 proto_tree_add_uint (wbxml_tree, hf_wbxml_charset,
3998 tvb, 1 + publicid_len, charset_len, charset);
3999 offset += charset_len;
4002 str_tbl_len = tvb_get_guintvar (tvb, offset, &len);
4003 str_tbl = offset + len; /* Start of 1st string in string table */
4006 ti = proto_tree_add_text(wbxml_tree,
4007 tvb, offset, len + str_tbl_len, "String table: %u bytes",
4010 if (wbxml_tree && str_tbl_len) { /* Display string table as subtree */
4011 wbxml_str_tbl_tree = proto_item_add_subtree (ti,
4013 show_wbxml_string_table (wbxml_str_tbl_tree, tvb,
4014 str_tbl, str_tbl_len);
4017 /* Data starts HERE */
4018 offset += len + str_tbl_len;
4020 /* The WBXML BODY starts here */
4021 ti = proto_tree_add_text (wbxml_tree, tvb, offset, -1,
4022 "Data representation");
4023 wbxml_content_tree = proto_item_add_subtree (ti, ett_wbxml_content);
4025 /* The parse_wbxml_X() functions will process the content correctly,
4026 * irrespective of the WBXML version used. For the WBXML body, this
4027 * means that there is a different processing for the global token
4028 * RESERVED_2 (WBXML 1.0) or OPAQUE (WBXML 1.x with x > 0). */
4029 if (wbxml_tree) { /* Show only if visible */
4030 /* Retrieve the content token mapping if available */
4031 content_map = get_wbxml_decoding_from_public_id (publicid);
4032 if (! content_map) {
4033 content_map = get_wbxml_decoding_from_content_type (pinfo->match_string);
4034 if (! content_map) {
4035 proto_tree_add_text (wbxml_content_tree, tvb,
4037 "[Rendering of this content type"
4038 " not (yet) supported]");
4040 proto_item_append_text(ti,
4041 " is based on Content-Type: %s (chosen decoding: %s)",
4042 pinfo->match_string, content_map->name);
4045 proto_tree_add_text (wbxml_content_tree, tvb,
4047 "Level | State | Codepage "
4048 "| WBXML Token Description "
4051 len = parse_wbxml_tag_defined (wbxml_content_tree,
4052 tvb, offset, str_tbl, &level, &codepage_stag,
4053 &codepage_attr, content_map);
4055 /* Default: WBXML only, no interpretation of the content */
4056 len = parse_wbxml_tag (wbxml_content_tree, tvb, offset,
4057 str_tbl, &level, &codepage_stag, &codepage_attr);
4065 /* Parse and display the WBXML string table (in a 3-column table format).
4066 * This function displays:
4067 * - the offset in the string table,
4068 * - the length of the string
4072 show_wbxml_string_table (proto_tree *tree, tvbuff_t *tvb, guint32 str_tbl,
4073 guint32 str_tbl_len)
4075 guint32 off = str_tbl;
4077 guint32 end = str_tbl + str_tbl_len;
4079 proto_tree_add_text (tree, tvb, off, end,
4080 "Start | Length | String");
4082 len = tvb_strsize (tvb, off);
4083 proto_tree_add_text (tree, tvb, off, len,
4086 tvb_format_text (tvb, off, len-1));
4092 /* Indentation code is based on a static const array of space characters.
4093 * At least one single space is returned */
4094 static const char indent_buffer[514] = " "
4103 ; /* Generate XML indentation (length = 1 + 2 * 256 + 1 for '\0') */
4105 static const char * Indent (guint8 level) {
4106 return indent_buffer + (512 - 2 * (level));
4110 /********************
4111 * WBXML tag tokens *
4112 ********************
4114 * Bit Mask : Example
4115 * -------------------
4116 * 00.. .... : <tag />
4123 * atrtribute1="value1"
4124 * atrtribute2="value2"
4128 * atrtribute1="value1"
4129 * atrtribute2="value2"
4135 * - An XML PI is parsed as an attribute list (same syntax).
4136 * - A code page switch only applies to the single token that follows.
4140 /* This function parses the WBXML and maps known token interpretations
4141 * to the WBXML tokens. As a result, the original XML document can be
4142 * recreated. Indentation is generated in order to ease reading.
4144 * Attribute parsing is done in parse_wbxml_attribute_list_defined().
4146 * The wbxml_decoding entry *map contains the actual token mapping.
4148 * NOTE: In order to parse the content, some recursion is required.
4149 * However, for performance reasons, recursion has been avoided
4150 * where possible (tags without content within tags with content).
4151 * This is achieved by means of the parsing_tag_content and tag_save*
4154 * NOTE: See above for known token mappings.
4156 * NOTE: As tags can be opened and closed, a tag representation lookup
4157 * may happen once or twice for a given tag. For efficiency reasons,
4158 * the literal tag value is stored and used throughout the code.
4159 * With the introduction of code page support, this solution is robust
4160 * as the lookup only occurs once, removing the need for storage of
4161 * the used code page.
4164 parse_wbxml_tag_defined (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
4165 guint32 str_tbl, guint8 *level, guint8 *codepage_stag, guint8 *codepage_attr,
4166 const wbxml_decoding *map)
4168 guint32 tvb_len = tvb_reported_length (tvb);
4169 guint32 off = offset;
4175 guint32 tag_len; /* Length of the index (uintvar) from a LITERAL tag */
4176 guint8 tag_save_known = 0; /* Will contain peek & 0x3F (tag identity) */
4177 guint8 tag_new_known = 0; /* Will contain peek & 0x3F (tag identity) */
4178 const char *tag_save_literal; /* Will contain the LITERAL tag identity */
4179 const char *tag_new_literal; /* Will contain the LITERAL tag identity */
4180 guint8 parsing_tag_content = FALSE; /* Are we parsing content from a
4181 tag with content: <x>Content</x>
4183 The initial state is FALSE.
4184 This state will trigger recursion. */
4185 tag_save_literal = NULL; /* Prevents compiler warning */
4187 DebugLog(("parse_wbxml_tag_defined (level = %u, offset = %u)\n", *level, offset));
4188 while (off < tvb_len) {
4189 peek = tvb_get_guint8 (tvb, off);
4190 DebugLog(("STAG: (top of while) level = %3u, peek = 0x%02X, off = %u, tvb_len = %u\n", *level, peek, off, tvb_len));
4191 if ((peek & 0x3F) < 4) switch (peek) { /* Global tokens in state = STAG
4192 but not the LITERAL tokens */
4193 case 0x00: /* SWITCH_PAGE */
4194 *codepage_stag = tvb_get_guint8 (tvb, off+1);
4195 proto_tree_add_text (tree, tvb, off, 2,
4196 " | Tag | T -->%3d "
4197 "| SWITCH_PAGE (Tag code page) "
4202 case 0x01: /* END: only possible for Tag with Content */
4203 if (tag_save_known) { /* Known TAG */
4204 proto_tree_add_text (tree, tvb, off, 1,
4205 " %3d | Tag | T %3d "
4206 "| END (Known Tag 0x%02X) "
4208 *level, *codepage_stag,
4209 tag_save_known, Indent (*level),
4210 tag_save_literal); /* We already looked it up! */
4211 } else { /* Literal TAG */
4212 proto_tree_add_text (tree, tvb, off, 1,
4213 " %3d | Tag | T %3d "
4214 "| END (Literal Tag) "
4216 *level, *codepage_stag, Indent (*level),
4221 /* Reset code page: not needed as return from recursion */
4222 DebugLog(("STAG: level = %u, Return: len = %u\n", *level, off - offset));
4223 return (off - offset);
4225 case 0x02: /* ENTITY */
4226 ent = tvb_get_guintvar (tvb, off+1, &len);
4227 proto_tree_add_text (tree, tvb, off, 1+len,
4228 " %3d | Tag | T %3d "
4231 *level, *codepage_stag, Indent (*level), ent);
4234 case 0x03: /* STR_I */
4235 len = tvb_strsize (tvb, off+1);
4236 proto_tree_add_text (tree, tvb, off, 1+len,
4237 " %3d | Tag | T %3d "
4238 "| STR_I (Inline string) "
4240 *level, *codepage_stag, Indent(*level),
4241 tvb_format_text (tvb, off+1, len-1));
4244 case 0x40: /* EXT_I_0 */
4245 case 0x41: /* EXT_I_1 */
4246 case 0x42: /* EXT_I_2 */
4247 /* Extension tokens */
4248 len = tvb_strsize (tvb, off+1);
4249 proto_tree_add_text (tree, tvb, off, 1+len,
4250 " %3d | Tag | T %3d "
4251 "| EXT_I_%1x (Extension Token) "
4253 *level, *codepage_stag,
4254 peek & 0x0f, Indent (*level),
4255 map_token (map->global, 0, peek),
4256 tvb_format_text (tvb, off+1, len-1));
4260 proto_tree_add_text (tree, tvb, off, 1,
4261 " %3d | Tag | T %3d "
4262 "| PI (XML Processing Instruction) "
4264 *level, *codepage_stag, Indent (*level));
4265 len = parse_wbxml_attribute_list_defined (tree, tvb, off,
4266 str_tbl, *level, codepage_attr, map);
4267 /* Check that there is still room in packet */
4269 if (off >= tvb_len) {
4270 DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n", *level, off - offset));
4272 * TODO - Do we need to free g_malloc()ed memory?
4274 THROW(ReportedBoundsError);
4276 proto_tree_add_text (tree, tvb, off-1, 1,
4277 " %3d | Tag | T %3d "
4280 *level, *codepage_stag, Indent (*level));
4282 case 0x80: /* EXT_T_0 */
4283 case 0x81: /* EXT_T_1 */
4284 case 0x82: /* EXT_T_2 */
4285 /* Extension tokens */
4286 index = tvb_get_guintvar (tvb, off+1, &len);
4287 str_len = tvb_strsize (tvb, str_tbl+index);
4289 if (map->ext_t[peek & 0x03])
4290 s = (map->ext_t[peek & 0x03])(tvb, index, str_tbl);
4292 s = g_strdup_printf("EXT_T_%1x (%s)", peek & 0x03,
4293 map_token (map->global, 0, peek));
4294 proto_tree_add_text (tree, tvb, off, 1+len,
4295 " %3d | Tag | T %3d "
4296 "| EXT_T_%1x (Extension Token) "
4298 *level, *codepage_stag, peek & 0x0f, Indent (*level),
4304 case 0x83: /* STR_T */
4305 index = tvb_get_guintvar (tvb, off+1, &len);
4306 str_len = tvb_strsize (tvb, str_tbl+index);
4307 proto_tree_add_text (tree, tvb, off, 1+len,
4308 " %3d | Tag | T %3d "
4309 "| STR_T (Tableref string) "
4311 *level, *codepage_stag, Indent (*level),
4312 tvb_format_text (tvb, str_tbl+index, str_len-1));
4315 case 0xC0: /* EXT_0 */
4316 case 0xC1: /* EXT_1 */
4317 case 0xC2: /* EXT_2 */
4318 /* Extension tokens */
4319 proto_tree_add_text (tree, tvb, off, 1,
4320 " %3d | Tag | T %3d "
4321 "| EXT_%1x (Extension Token) "
4323 *level, *codepage_stag, peek & 0x0f, Indent (*level),
4324 map_token (map->global, 0, peek));
4327 case 0xC3: /* OPAQUE - WBXML 1.1 and newer */
4328 if (tvb_get_guint8 (tvb, 0)) { /* WBXML 1.x (x > 0) */
4329 index = tvb_get_guintvar (tvb, off+1, &len);
4330 proto_tree_add_text (tree, tvb, off, 1 + len + index,
4331 " %3d | Tag | T %3d "
4332 "| OPAQUE (Opaque data) "
4333 "| %s(%d bytes of opaque data)",
4334 *level, *codepage_stag, Indent (*level), index);
4336 } else { /* WBXML 1.0 - RESERVED_2 token (invalid) */
4337 proto_tree_add_text (tree, tvb, off, 1,
4338 " %3d | Tag | T %3d "
4339 "| RESERVED_2 (Invalid Token!) "
4340 "| WBXML 1.0 parsing stops here.",
4341 *level, *codepage_stag);
4342 /* Stop processing as it is impossible to parse now */
4344 DebugLog(("STAG: level = %u, Return: len = %u\n", *level, off - offset));
4345 return (off - offset);
4349 /* No default clause, as all cases have been treated */
4350 } else { /* LITERAL or Known TAG */
4351 /* We must store the initial tag, and also retrieve the new tag.
4352 * For efficiency reasons, we store the literal tag representation
4353 * for known tags too, so we can easily close the tag without the
4354 * need of a new lookup and avoiding storage of token codepage.
4356 * There are 4 possibilities:
4358 * 1. Known tag followed by a known tag
4359 * 2. Known tag followed by a LITERAL tag
4360 * 3. LITERAL tag followed by Known tag
4361 * 4. LITERAL tag followed by LITERAL tag
4364 /* Store the new tag */
4366 if ((peek & 0x3F) == 4) { /* LITERAL */
4367 DebugLog(("STAG: LITERAL tag (peek = 0x%02X, off = %u) - TableRef follows!\n", peek, off));
4368 index = tvb_get_guintvar (tvb, off+1, &tag_len);
4369 str_len = tvb_strsize (tvb, str_tbl+index);
4370 tag_new_literal = tvb_get_ptr (tvb, str_tbl+index, str_len);
4371 tag_new_known = 0; /* invalidate known tag_new */
4372 } else { /* Known tag */
4373 tag_new_known = peek & 0x3F;
4374 tag_new_literal = map_token (map->tags, *codepage_stag,
4376 /* Stored looked up tag name string */
4379 /* Parsing of TAG starts HERE */
4380 if (peek & 0x40) { /* Content present */
4382 * [!] An explicit END token is expected in these cases!
4383 * ==> Recursion possible if we encounter a tag with content;
4384 * recursion will return at the explicit END token.
4386 if (parsing_tag_content) { /* Recurse */
4387 DebugLog(("STAG: Tag in Tag - RECURSE! (off = %u)\n", off));
4388 /* Do not process the attribute list:
4389 * recursion will take care of it */
4391 len = parse_wbxml_tag_defined (tree, tvb, off, str_tbl,
4392 level, codepage_stag, codepage_attr, map);
4394 } else { /* Now we will have content to parse */
4395 /* Save the start tag so we can properly close it later. */
4396 if ((peek & 0x3F) == 4) { /* Literal tag */
4397 tag_save_literal = tag_new_literal;
4399 } else { /* Known tag */
4400 tag_save_known = tag_new_known;
4401 tag_save_literal = tag_new_literal;
4402 /* The last statement avoids needless lookups */
4404 /* Process the attribute list if present */
4405 if (peek & 0x80) { /* Content and Attribute list present */
4406 if (tag_new_known) { /* Known tag */
4407 proto_tree_add_text (tree, tvb, off, 1,
4408 " %3d | Tag | T %3d "
4409 "| Known Tag 0x%02X (AC) "
4411 *level, *codepage_stag, tag_new_known,
4412 Indent (*level), tag_new_literal);
4413 /* Tag string already looked up earlier! */
4415 } else { /* LITERAL tag */
4416 proto_tree_add_text (tree, tvb, off, 1,
4417 " %3d | Tag | T %3d "
4418 "| LITERAL_AC (Literal tag) (AC) "
4420 *level, *codepage_stag, Indent (*level), tag_new_literal);
4423 len = parse_wbxml_attribute_list_defined (tree, tvb,
4424 off, str_tbl, *level, codepage_attr, map);
4425 /* Check that there is still room in packet */
4427 if (off >= tvb_len) {
4428 DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n",
4429 *level, off - offset));
4431 * TODO - Do we need to free g_malloc()ed memory?
4433 THROW(ReportedBoundsError);
4435 proto_tree_add_text (tree, tvb, off-1, 1,
4436 " %3d | Tag | T %3d "
4437 "| END (attribute list) "
4439 *level, *codepage_stag, Indent (*level));
4440 } else { /* Content, no Attribute list */
4441 if (tag_new_known) { /* Known tag */
4442 proto_tree_add_text (tree, tvb, off, 1,
4443 " %3d | Tag | T %3d "
4444 "| Known Tag 0x%02X (.C) "
4446 *level, *codepage_stag, tag_new_known,
4447 Indent (*level), tag_new_literal);
4448 /* Tag string already looked up earlier! */
4450 } else { /* LITERAL tag */
4451 proto_tree_add_text (tree, tvb, off, 1,
4452 " %3d | Tag | T %3d "
4453 "| LITERAL_C (Literal Tag) (.C) "
4455 *level, *codepage_stag, Indent (*level),
4460 /* The data that follows in the parsing process
4461 * represents content for the opening tag
4462 * we've just processed in the lines above.
4463 * Next time we encounter a tag with content: recurse
4465 parsing_tag_content = TRUE;
4466 DebugLog(("Tag in Tag - No recursion this time! (off = %u)\n", off));
4468 } else { /* No Content */
4469 DebugLog(("<Tag/> in Tag - No recursion! (off = %u)\n", off));
4471 if (peek & 0x80) { /* No Content, Attribute list present */
4472 if (tag_new_known) { /* Known tag */
4473 proto_tree_add_text (tree, tvb, off, 1,
4474 " %3d | Tag | T %3d "
4475 "| Known Tag 0x%02X (A.) "
4477 *level, *codepage_stag, tag_new_known,
4478 Indent (*level), tag_new_literal);
4479 /* Tag string already looked up earlier! */
4481 len = parse_wbxml_attribute_list_defined (tree, tvb,
4482 off, str_tbl, *level, codepage_attr, map);
4483 /* Check that there is still room in packet */
4485 if (off >= tvb_len) {
4486 DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n", *level, off - offset));
4488 * TODO - Do we need to free g_malloc()ed memory?
4490 THROW(ReportedBoundsError);
4492 proto_tree_add_text (tree, tvb, off-1, 1,
4493 " %3d | Tag | T %3d "
4494 "| END (Known Tag) "
4496 *level, *codepage_stag, Indent (*level));
4497 } else { /* LITERAL tag */
4498 proto_tree_add_text (tree, tvb, off, 1,
4499 " %3d | Tag | T %3d "
4500 "| LITERAL_A (Literal Tag) (A.) "
4502 *level, *codepage_stag, Indent (*level), tag_new_literal);
4504 len = parse_wbxml_attribute_list_defined (tree, tvb,
4505 off, str_tbl, *level, codepage_attr, map);
4506 /* Check that there is still room in packet */
4508 if (off >= tvb_len) {
4509 DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n", *level, off - offset));
4511 * TODO - Do we need to free g_malloc()ed memory?
4513 THROW(ReportedBoundsError);
4515 proto_tree_add_text (tree, tvb, off-1, 1,
4516 " %3d | Tag | T %3d "
4517 "| END (Literal Tag) "
4519 *level, *codepage_stag, Indent (*level));
4521 } else { /* No Content, No Attribute list */
4522 if (tag_new_known) { /* Known tag */
4523 proto_tree_add_text (tree, tvb, off, 1,
4524 " %3d | Tag | T %3d "
4525 "| Known Tag 0x%02x (..) "
4527 *level, *codepage_stag, tag_new_known,
4528 Indent (*level), tag_new_literal);
4529 /* Tag string already looked up earlier! */
4531 } else { /* LITERAL tag */
4532 proto_tree_add_text (tree, tvb, off, 1,
4533 " %3d | Tag | T %3d "
4534 "| LITERAL (Literal Tag) (..) "
4536 *level, *codepage_stag, Indent (*level),
4542 /* TODO: Do I have to reset code page here? */
4544 } /* if (tag & 0x3F) >= 5 */
4546 DebugLog(("STAG: level = %u, Return: len = %u (end of function body)\n", *level, off - offset));
4547 return (off - offset);
4551 /* This function performs the WBXML decoding as in parse_wbxml_tag_defined()
4552 * but this time no WBXML mapping is performed.
4554 * Attribute parsing is done in parse_wbxml_attribute_list().
4557 parse_wbxml_tag (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
4558 guint32 str_tbl, guint8 *level,
4559 guint8 *codepage_stag, guint8 *codepage_attr)
4561 guint32 tvb_len = tvb_reported_length (tvb);
4562 guint32 off = offset;
4568 guint32 tag_len; /* Length of the index (uintvar) from a LITERAL tag */
4569 guint8 tag_save_known = 0; /* Will contain peek & 0x3F (tag identity) */
4570 guint8 tag_new_known = 0; /* Will contain peek & 0x3F (tag identity) */
4571 const char *tag_save_literal; /* Will contain the LITERAL tag identity */
4572 const char *tag_new_literal; /* Will contain the LITERAL tag identity */
4573 char tag_save_buf[10]; /* Will contain "tag_0x%02X" */
4574 char tag_new_buf[10]; /* Will contain "tag_0x%02X" */
4575 guint8 parsing_tag_content = FALSE; /* Are we parsing content from a
4576 tag with content: <x>Content</x>
4578 The initial state is FALSE.
4579 This state will trigger recursion. */
4580 tag_save_literal = NULL; /* Prevents compiler warning */
4582 DebugLog(("parse_wbxml_tag (level = %u, offset = %u)\n", *level, offset));
4583 while (off < tvb_len) {
4584 peek = tvb_get_guint8 (tvb, off);
4585 DebugLog(("STAG: (top of while) level = %3u, peek = 0x%02X, off = %u, tvb_len = %u\n", *level, peek, off, tvb_len));
4586 if ((peek & 0x3F) < 4) switch (peek) { /* Global tokens in state = STAG
4587 but not the LITERAL tokens */
4588 case 0x00: /* SWITCH_PAGE */
4589 *codepage_stag = tvb_get_guint8 (tvb, off+1);
4590 proto_tree_add_text (tree, tvb, off, 2,
4591 " | Tag | T -->%3d "
4592 "| SWITCH_PAGE (Tag code page) "
4597 case 0x01: /* END: only possible for Tag with Content */
4598 if (tag_save_known) { /* Known TAG */
4599 proto_tree_add_text (tree, tvb, off, 1,
4600 " %3d | Tag | T %3d "
4601 "| END (Known Tag 0x%02X) "
4603 *level, *codepage_stag, tag_save_known,
4605 tag_save_literal); /* We already looked it up! */
4606 } else { /* Literal TAG */
4607 proto_tree_add_text (tree, tvb, off, 1,
4608 " %3d | Tag | T %3d "
4609 "| END (Literal Tag) "
4611 *level, *codepage_stag, Indent (*level),
4616 /* Reset code page: not needed as return from recursion */
4617 DebugLog(("STAG: level = %u, Return: len = %u\n",
4618 *level, off - offset));
4619 return (off - offset);
4621 case 0x02: /* ENTITY */
4622 ent = tvb_get_guintvar (tvb, off+1, &len);
4623 proto_tree_add_text (tree, tvb, off, 1+len,
4624 " %3d | Tag | T %3d "
4627 *level, *codepage_stag, Indent (*level), ent);
4630 case 0x03: /* STR_I */
4631 len = tvb_strsize (tvb, off+1);
4632 proto_tree_add_text (tree, tvb, off, 1+len,
4633 " %3d | Tag | T %3d "
4634 "| STR_I (Inline string) "
4636 *level, *codepage_stag, Indent(*level),
4637 tvb_format_text (tvb, off+1, len-1));
4640 case 0x40: /* EXT_I_0 */
4641 case 0x41: /* EXT_I_1 */
4642 case 0x42: /* EXT_I_2 */
4643 /* Extension tokens */
4644 len = tvb_strsize (tvb, off+1);
4645 proto_tree_add_text (tree, tvb, off, 1+len,
4646 " %3d | Tag | T %3d "
4647 "| EXT_I_%1x (Extension Token) "
4648 "| %s(Inline string extension: \'%s\')",
4649 *level, *codepage_stag, peek & 0x0f, Indent (*level),
4650 tvb_format_text (tvb, off+1, len-1));
4654 proto_tree_add_text (tree, tvb, off, 1,
4655 " %3d | Tag | T %3d "
4656 "| PI (XML Processing Instruction) "
4658 *level, *codepage_stag, Indent (*level));
4659 len = parse_wbxml_attribute_list (tree, tvb, off, str_tbl,
4660 *level, codepage_attr);
4661 /* Check that there is still room in packet */
4663 if (off >= tvb_len) {
4664 DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n",
4665 *level, off - offset));
4667 * TODO - Do we need to free g_malloc()ed memory?
4669 THROW(ReportedBoundsError);
4671 proto_tree_add_text (tree, tvb, off-1, 1,
4672 " %3d | Tag | T %3d "
4675 *level, *codepage_stag, Indent (*level));
4677 case 0x80: /* EXT_T_0 */
4678 case 0x81: /* EXT_T_1 */
4679 case 0x82: /* EXT_T_2 */
4680 /* Extension tokens */
4681 index = tvb_get_guintvar (tvb, off+1, &len);
4682 str_len = tvb_strsize (tvb, str_tbl+index);
4683 proto_tree_add_text (tree, tvb, off, 1+len,
4684 " %3d | Tag | T %3d "
4685 "| EXT_T_%1x (Extension Token) "
4686 "| %s(Extension Token, integer value: %u)",
4687 *level, *codepage_stag, peek & 0x0f, Indent (*level),
4691 case 0x83: /* STR_T */
4692 index = tvb_get_guintvar (tvb, off+1, &len);
4693 str_len = tvb_strsize (tvb, str_tbl+index);
4694 proto_tree_add_text (tree, tvb, off, 1+len,
4695 " %3d | Tag | T %3d "
4696 "| STR_T (Tableref string) "
4698 *level, *codepage_stag, Indent (*level),
4699 tvb_format_text (tvb, str_tbl+index, str_len-1));
4702 case 0xC0: /* EXT_0 */
4703 case 0xC1: /* EXT_1 */
4704 case 0xC2: /* EXT_2 */
4705 /* Extension tokens */
4706 proto_tree_add_text (tree, tvb, off, 1,
4707 " %3d | Tag | T %3d "
4708 "| EXT_%1x (Extension Token) "
4709 "| %s(Single-byte extension)",
4710 *level, *codepage_stag, peek & 0x0f, Indent (*level));
4713 case 0xC3: /* OPAQUE - WBXML 1.1 and newer */
4714 if (tvb_get_guint8 (tvb, 0)) { /* WBXML 1.x (x > 0) */
4715 index = tvb_get_guintvar (tvb, off+1, &len);
4716 proto_tree_add_text (tree, tvb, off, 1 + len + index,
4717 " %3d | Tag | T %3d "
4718 "| OPAQUE (Opaque data) "
4719 "| %s(%d bytes of opaque data)",
4720 *level, *codepage_stag, Indent (*level), index);
4722 } else { /* WBXML 1.0 - RESERVED_2 token (invalid) */
4723 proto_tree_add_text (tree, tvb, off, 1,
4724 " %3d | Tag | T %3d "
4725 "| RESERVED_2 (Invalid Token!) "
4726 "| WBXML 1.0 parsing stops here.",
4727 *level, *codepage_stag);
4728 /* Stop processing as it is impossible to parse now */
4730 DebugLog(("STAG: level = %u, Return: len = %u\n",
4731 *level, off - offset));
4732 return (off - offset);
4736 /* No default clause, as all cases have been treated */
4737 } else { /* LITERAL or Known TAG */
4738 /* We must store the initial tag, and also retrieve the new tag.
4739 * For efficiency reasons, we store the literal tag representation
4740 * for known tags too, so we can easily close the tag without the
4741 * need of a new lookup and avoiding storage of token codepage.
4743 * There are 4 possibilities:
4745 * 1. Known tag followed by a known tag
4746 * 2. Known tag followed by a LITERAL tag
4747 * 3. LITERAL tag followed by Known tag
4748 * 4. LITERAL tag followed by LITERAL tag
4751 /* Store the new tag */
4753 if ((peek & 0x3F) == 4) { /* LITERAL */
4754 DebugLog(("STAG: LITERAL tag (peek = 0x%02X, off = %u)"
4755 " - TableRef follows!\n", peek, off));
4756 index = tvb_get_guintvar (tvb, off+1, &tag_len);
4757 str_len = tvb_strsize (tvb, str_tbl+index);
4758 tag_new_literal = tvb_get_ptr (tvb, str_tbl+index, str_len);
4759 tag_new_known = 0; /* invalidate known tag_new */
4760 } else { /* Known tag */
4761 tag_new_known = peek & 0x3F;
4762 sprintf (tag_new_buf, "Tag_0x%02X",
4764 tag_new_literal = tag_new_buf;
4765 /* Stored looked up tag name string */
4768 /* Parsing of TAG starts HERE */
4769 if (peek & 0x40) { /* Content present */
4771 * [!] An explicit END token is expected in these cases!
4772 * ==> Recursion possible if we encounter a tag with content;
4773 * recursion will return at the explicit END token.
4775 if (parsing_tag_content) { /* Recurse */
4776 DebugLog(("STAG: Tag in Tag - RECURSE! (off = %u)\n", off));
4777 /* Do not process the attribute list:
4778 * recursion will take care of it */
4780 len = parse_wbxml_tag (tree, tvb, off, str_tbl, level,
4781 codepage_stag, codepage_attr);
4783 } else { /* Now we will have content to parse */
4784 /* Save the start tag so we can properly close it later. */
4785 if ((peek & 0x3F) == 4) { /* Literal tag */
4786 tag_save_literal = tag_new_literal;
4788 } else { /* Known tag */
4789 tag_save_known = tag_new_known;
4790 sprintf (tag_save_buf, "Tag_0x%02X",
4792 tag_save_literal = tag_save_buf;
4793 /* The last statement avoids needless lookups */
4795 /* Process the attribute list if present */
4796 if (peek & 0x80) { /* Content and Attribute list present */
4797 if (tag_new_known) { /* Known tag */
4798 proto_tree_add_text (tree, tvb, off, 1,
4799 " %3d | Tag | T %3d "
4800 "| Known Tag 0x%02X (AC) "
4802 *level, *codepage_stag, tag_new_known,
4803 Indent (*level), tag_new_literal);
4804 /* Tag string already looked up earlier! */
4806 } else { /* LITERAL tag */
4807 proto_tree_add_text (tree, tvb, off, 1,
4808 " %3d | Tag | T %3d "
4809 "| LITERAL_AC (Literal tag) (AC) "
4811 *level, *codepage_stag, Indent (*level),
4815 len = parse_wbxml_attribute_list (tree, tvb,
4816 off, str_tbl, *level, codepage_attr);
4817 /* Check that there is still room in packet */
4819 if (off >= tvb_len) {
4820 DebugLog(("STAG: level = %u, ThrowException: "
4821 "len = %u (short frame)\n",
4822 *level, off - offset));
4824 * TODO - Do we need to free g_malloc()ed memory?
4826 THROW(ReportedBoundsError);
4828 proto_tree_add_text (tree, tvb, off-1, 1,
4829 " %3d | Tag | T %3d "
4830 "| END (attribute list) "
4832 *level, *codepage_stag, Indent (*level));
4833 } else { /* Content, no Attribute list */
4834 if (tag_new_known) { /* Known tag */
4835 proto_tree_add_text (tree, tvb, off, 1,
4836 " %3d | Tag | T %3d "
4837 "| Known Tag 0x%02X (.C) "
4839 *level, *codepage_stag, tag_new_known,
4840 Indent (*level), tag_new_literal);
4841 /* Tag string already looked up earlier! */
4843 } else { /* LITERAL tag */
4844 proto_tree_add_text (tree, tvb, off, 1,
4845 " %3d | Tag | T %3d "
4846 "| LITERAL_C (Literal Tag) (.C) "
4848 *level, *codepage_stag, Indent (*level),
4853 /* The data that follows in the parsing process
4854 * represents content for the opening tag
4855 * we've just processed in the lines above.
4856 * Next time we encounter a tag with content: recurse
4858 parsing_tag_content = TRUE;
4859 DebugLog(("Tag in Tag - No recursion this time! "
4860 "(off = %u)\n", off));
4862 } else { /* No Content */
4863 DebugLog(("<Tag/> in Tag - No recursion! (off = %u)\n", off));
4865 if (peek & 0x80) { /* No Content, Attribute list present */
4866 if (tag_new_known) { /* Known tag */
4867 proto_tree_add_text (tree, tvb, off, 1,
4868 " %3d | Tag | T %3d "
4869 "| Known Tag 0x%02X (A.) "
4871 *level, *codepage_stag, tag_new_known,
4872 Indent (*level), tag_new_literal);
4873 /* Tag string already looked up earlier! */
4875 len = parse_wbxml_attribute_list (tree, tvb,
4876 off, str_tbl, *level, codepage_attr);
4877 /* Check that there is still room in packet */
4879 if (off >= tvb_len) {
4880 DebugLog(("STAG: level = %u, ThrowException: "
4881 "len = %u (short frame)\n",
4882 *level, off - offset));
4884 * TODO - Do we need to free g_malloc()ed memory?
4886 THROW(ReportedBoundsError);
4888 proto_tree_add_text (tree, tvb, off-1, 1,
4889 " %3d | Tag | T %3d "
4890 "| END (Known Tag) "
4892 *level, *codepage_stag, Indent (*level));
4893 } else { /* LITERAL tag */
4894 proto_tree_add_text (tree, tvb, off, 1,
4895 " %3d | Tag | T %3d "
4896 "| LITERAL_A (Literal Tag) (A.) "
4898 *level, *codepage_stag, Indent (*level),
4901 len = parse_wbxml_attribute_list (tree, tvb,
4902 off, str_tbl, *level, codepage_attr);
4903 /* Check that there is still room in packet */
4905 if (off >= tvb_len) {
4906 DebugLog(("STAG: level = %u, ThrowException: "
4907 "len = %u (short frame)\n",
4908 *level, off - offset));
4910 * TODO - Do we need to free g_malloc()ed memory?
4912 THROW(ReportedBoundsError);
4914 proto_tree_add_text (tree, tvb, off-1, 1,
4915 " %3d | Tag | T %3d "
4916 "| END (Literal Tag) "
4918 *level, *codepage_stag, Indent (*level));
4920 } else { /* No Content, No Attribute list */
4921 if (tag_new_known) { /* Known tag */
4922 proto_tree_add_text (tree, tvb, off, 1,
4923 " %3d | Tag | T %3d "
4924 "| Known Tag 0x%02x (..) "
4926 *level, *codepage_stag, tag_new_known,
4927 Indent (*level), tag_new_literal);
4928 /* Tag string already looked up earlier! */
4930 } else { /* LITERAL tag */
4931 proto_tree_add_text (tree, tvb, off, 1,
4932 " %3d | Tag | T %3d "
4933 "| LITERAL (Literal Tag) (..) "
4935 *level, *codepage_stag, Indent (*level),
4941 /* TODO: Do I have to reset code page here? */
4943 } /* if (tag & 0x3F) >= 5 */
4945 DebugLog(("STAG: level = %u, Return: len = %u (end of function body)\n",
4946 *level, off - offset));
4947 return (off - offset);
4951 /**************************
4952 * WBXML Attribute tokens *
4953 **************************
4954 * Bit Mask : Example
4955 * -------------------
4956 * 0... .... : attr= (attribute name)
4957 * href='http://' (attribute name with start of attribute value)
4958 * 1... .... : 'www.' (attribute value, or part of it)
4963 /* This function parses the WBXML and maps known token interpretations
4964 * to the WBXML tokens. As a result, the original XML document can be
4965 * recreated. Indentation is generated in order to ease reading.
4967 * This function performs attribute list parsing.
4969 * The wbxml_decoding entry *map contains the actual token mapping.
4971 * NOTE: See above for known token mappings.
4974 parse_wbxml_attribute_list_defined (proto_tree *tree, tvbuff_t *tvb,
4975 guint32 offset, guint32 str_tbl, guint8 level, guint8 *codepage_attr,
4976 const wbxml_decoding *map)
4978 guint32 tvb_len = tvb_reported_length (tvb);
4979 guint32 off = offset;
4986 DebugLog(("parse_wbxml_attr_defined (level = %u, offset = %u)\n",
4988 /* Parse attributes */
4989 while (off < tvb_len) {
4990 peek = tvb_get_guint8 (tvb, off);
4991 DebugLog(("ATTR: (top of while) level = %3u, peek = 0x%02X, "
4992 "off = %u, tvb_len = %u\n", level, peek, off, tvb_len));
4993 if ((peek & 0x3F) < 5) switch (peek) { /* Global tokens
4995 case 0x00: /* SWITCH_PAGE */
4996 *codepage_attr = tvb_get_guint8 (tvb, off+1);
4997 proto_tree_add_text (tree, tvb, off, 2,
4998 " | Attr | A -->%3d "
4999 "| SWITCH_PAGE (Attr code page) |",
5003 case 0x01: /* END */
5005 * The Attribute END token means either ">" or "/>"
5006 * and as a consequence both must be treated separately.
5007 * This is done in the TAG state parser.
5010 DebugLog(("ATTR: level = %u, Return: len = %u\n",
5011 level, off - offset));
5012 return (off - offset);
5013 case 0x02: /* ENTITY */
5014 ent = tvb_get_guintvar (tvb, off+1, &len);
5015 proto_tree_add_text (tree, tvb, off, 1+len,
5016 " %3d | Attr | A %3d "
5019 level, *codepage_attr, Indent (level), ent);
5022 case 0x03: /* STR_I */
5023 len = tvb_strsize (tvb, off+1);
5024 proto_tree_add_text (tree, tvb, off, 1+len,
5025 " %3d | Attr | A %3d "
5026 "| STR_I (Inline string) "
5028 level, *codepage_attr, Indent (level),
5029 tvb_format_text (tvb, off+1, len-1));
5032 case 0x04: /* LITERAL */
5033 index = tvb_get_guintvar (tvb, off+1, &len);
5034 str_len = tvb_strsize (tvb, str_tbl+index);
5035 proto_tree_add_text (tree, tvb, off, 1+len,
5036 " %3d | Attr | A %3d "
5037 "| LITERAL (Literal Attribute) "
5039 level, *codepage_attr, Indent (level),
5040 tvb_format_text (tvb, str_tbl+index, str_len-1));
5043 case 0x40: /* EXT_I_0 */
5044 case 0x41: /* EXT_I_1 */
5045 case 0x42: /* EXT_I_2 */
5046 /* Extension tokens */
5047 len = tvb_strsize (tvb, off+1);
5048 proto_tree_add_text (tree, tvb, off, 1+len,
5049 " %3d | Attr | A %3d "
5050 "| EXT_I_%1x (Extension Token) "
5052 level, *codepage_attr, peek & 0x0f, Indent (level),
5053 map_token (map->global, 0, peek),
5054 tvb_format_text (tvb, off+1, len-1));
5057 /* 0x43 impossible in ATTR state */
5058 /* 0x44 impossible in ATTR state */
5059 case 0x80: /* EXT_T_0 */
5060 case 0x81: /* EXT_T_1 */
5061 case 0x82: /* EXT_T_2 */
5062 /* Extension tokens */
5063 index = tvb_get_guintvar (tvb, off+1, &len);
5064 str_len = tvb_strsize (tvb, str_tbl+index);
5067 if (map->ext_t[peek & 0x03])
5068 s = (map->ext_t[peek & 0x03])(tvb, index, str_tbl);
5070 s = g_strdup_printf("EXT_T_%1x (%s)", peek & 0x03,
5071 map_token (map->global, 0, peek));
5073 proto_tree_add_text (tree, tvb, off, 1+len,
5074 " %3d | Tag | T %3d "
5075 "| EXT_T_%1x (Extension Token) "
5077 level, *codepage_attr, peek & 0x0f, Indent (level),
5081 proto_tree_add_text (tree, tvb, off, 1+len,
5082 " %3d | Attr | A %3d "
5083 "| EXT_T_%1x (Extension Token) "
5085 level, *codepage_attr, peek & 0x0f, Indent (level),
5086 map_token (map->global, 0, peek),
5087 tvb_format_text (tvb, str_tbl+index, str_len-1));
5090 case 0x83: /* STR_T */
5091 index = tvb_get_guintvar (tvb, off+1, &len);
5092 str_len = tvb_strsize (tvb, str_tbl+index);
5093 proto_tree_add_text (tree, tvb, off, 1+len,
5094 " %3d | Attr | A %3d "
5095 "| STR_T (Tableref string) "
5097 level, *codepage_attr, Indent (level),
5098 tvb_format_text (tvb, str_tbl+index, str_len-1));
5101 /* 0x84 impossible in ATTR state */
5102 case 0xC0: /* EXT_0 */
5103 case 0xC1: /* EXT_1 */
5104 case 0xC2: /* EXT_2 */
5105 /* Extension tokens */
5106 proto_tree_add_text (tree, tvb, off, 1,
5107 " %3d | Attr | A %3d "
5108 "| EXT_%1x (Extension Token) "
5110 level, *codepage_attr, peek & 0x0f, Indent (level),
5111 map_token (map->global, 0, peek));
5114 case 0xC3: /* OPAQUE - WBXML 1.1 and newer */
5115 if (tvb_get_guint8 (tvb, 0)) { /* WBXML 1.x (x > 0) */
5116 index = tvb_get_guintvar (tvb, off+1, &len);
5117 proto_tree_add_text (tree, tvb, off, 1 + len + index,
5118 " %3d | Attr | A %3d "
5119 "| OPAQUE (Opaque data) "
5120 "| %s(%d bytes of opaque data)",
5121 level, *codepage_attr, Indent (level), index);
5123 } else { /* WBXML 1.0 - RESERVED_2 token (invalid) */
5124 proto_tree_add_text (tree, tvb, off, 1,
5125 " %3d | Attr | A %3d "
5126 "| RESERVED_2 (Invalid Token!) "
5127 "| WBXML 1.0 parsing stops here.",
5128 level, *codepage_attr);
5129 /* Stop processing as it is impossible to parse now */
5131 DebugLog(("ATTR: level = %u, Return: len = %u\n",
5132 level, off - offset));
5133 return (off - offset);
5136 /* 0xC4 impossible in ATTR state */
5138 proto_tree_add_text (tree, tvb, off, 1,
5139 " %3d | Attr | A %3d "
5140 "| %-10s (Invalid Token!) "
5141 "| WBXML parsing stops here.",
5142 level, *codepage_attr,
5143 match_strval (peek, vals_wbxml1x_global_tokens));
5144 /* Move to end of buffer */
5147 } else { /* Known atribute token */
5148 if (peek & 0x80) { /* attrValue */
5149 proto_tree_add_text (tree, tvb, off, 1,
5150 " %3d | Attr | A %3d "
5151 "| Known attrValue 0x%02X "
5153 level, *codepage_attr, peek & 0x7f, Indent (level),
5154 map_token (map->attrValue, *codepage_attr, peek));
5156 } else { /* attrStart */
5157 proto_tree_add_text (tree, tvb, off, 1,
5158 " %3d | Attr | A %3d "
5159 "| Known attrStart 0x%02X "
5161 level, *codepage_attr, peek & 0x7f, Indent (level),
5162 map_token (map->attrStart, *codepage_attr, peek));
5167 DebugLog(("ATTR: level = %u, Return: len = %u (end of function body)\n",
5168 level, off - offset));
5169 return (off - offset);
5173 /* This function performs the WBXML attribute decoding as in
5174 * parse_wbxml_attribute_list_defined() but this time no WBXML mapping
5177 * This function performs attribute list parsing.
5179 * NOTE: Code page switches not yet processed in the code!
5182 parse_wbxml_attribute_list (proto_tree *tree, tvbuff_t *tvb,
5183 guint32 offset, guint32 str_tbl, guint8 level, guint8 *codepage_attr)
5185 guint32 tvb_len = tvb_reported_length (tvb);
5186 guint32 off = offset;
5193 DebugLog(("parse_wbxml_attr (level = %u, offset = %u)\n", level, offset));
5194 /* Parse attributes */
5195 while (off < tvb_len) {
5196 peek = tvb_get_guint8 (tvb, off);
5197 DebugLog(("ATTR: (top of while) level = %3u, peek = 0x%02X, "
5198 "off = %u, tvb_len = %u\n", level, peek, off, tvb_len));
5199 if ((peek & 0x3F) < 5) switch (peek) { /* Global tokens
5201 case 0x00: /* SWITCH_PAGE */
5202 *codepage_attr = tvb_get_guint8 (tvb, off+1);
5203 proto_tree_add_text (tree, tvb, off, 2,
5204 " | Attr | A -->%3d "
5205 "| SWITCH_PAGE (Attr code page) |",
5209 case 0x01: /* END */
5211 * The Attribute END token means either ">" or "/>"
5212 * and as a consequence both must be treated separately.
5213 * This is done in the TAG state parser.
5216 DebugLog(("ATTR: level = %u, Return: len = %u\n",
5217 level, off - offset));
5218 return (off - offset);
5219 case 0x02: /* ENTITY */
5220 ent = tvb_get_guintvar (tvb, off+1, &len);
5221 proto_tree_add_text (tree, tvb, off, 1+len,
5222 " %3d | Attr | A %3d "
5225 level, *codepage_attr, Indent (level), ent);
5228 case 0x03: /* STR_I */
5229 len = tvb_strsize (tvb, off+1);
5230 proto_tree_add_text (tree, tvb, off, 1+len,
5231 " %3d | Attr | A %3d "
5232 "| STR_I (Inline string) "
5234 level, *codepage_attr, Indent (level),
5235 tvb_format_text (tvb, off+1, len-1));
5238 case 0x04: /* LITERAL */
5239 index = tvb_get_guintvar (tvb, off+1, &len);
5240 str_len = tvb_strsize (tvb, str_tbl+index);
5241 proto_tree_add_text (tree, tvb, off, 1+len,
5242 " %3d | Attr | A %3d "
5243 "| LITERAL (Literal Attribute) "
5245 level, *codepage_attr, Indent (level),
5246 tvb_format_text (tvb, str_tbl+index, str_len-1));
5249 case 0x40: /* EXT_I_0 */
5250 case 0x41: /* EXT_I_1 */
5251 case 0x42: /* EXT_I_2 */
5252 /* Extension tokens */
5253 len = tvb_strsize (tvb, off+1);
5254 proto_tree_add_text (tree, tvb, off, 1+len,
5255 " %3d | Attr | A %3d "
5256 "| EXT_I_%1x (Extension Token) "
5257 "| %s(Inline string extension: \'%s\')",
5258 level, *codepage_attr, peek & 0x0f, Indent (level),
5259 tvb_format_text (tvb, off+1, len-1));
5262 /* 0x43 impossible in ATTR state */
5263 /* 0x44 impossible in ATTR state */
5264 case 0x80: /* EXT_T_0 */
5265 case 0x81: /* EXT_T_1 */
5266 case 0x82: /* EXT_T_2 */
5267 /* Extension tokens */
5268 index = tvb_get_guintvar (tvb, off+1, &len);
5269 str_len = tvb_strsize (tvb, str_tbl+index);
5270 proto_tree_add_text (tree, tvb, off, 1+len,
5271 " %3d | Attr | A %3d "
5272 "| EXT_T_%1x (Extension Token) "
5273 "| %s(Extension Token, integer value: %u)",
5274 level, *codepage_attr, peek & 0x0f, Indent (level),
5278 case 0x83: /* STR_T */
5279 index = tvb_get_guintvar (tvb, off+1, &len);
5280 str_len = tvb_strsize (tvb, str_tbl+index);
5281 proto_tree_add_text (tree, tvb, off, 1+len,
5282 " %3d | Attr | A %3d "
5283 "| STR_T (Tableref string) "
5285 level, *codepage_attr, Indent (level),
5286 tvb_format_text (tvb, str_tbl+index, str_len-1));
5289 /* 0x84 impossible in ATTR state */
5290 case 0xC0: /* EXT_0 */
5291 case 0xC1: /* EXT_1 */
5292 case 0xC2: /* EXT_2 */
5293 /* Extension tokens */
5294 proto_tree_add_text (tree, tvb, off, 1,
5295 " %3d | Attr | A %3d "
5296 "| EXT_%1x (Extension Token) "
5297 "| %s(Single-byte extension)",
5298 level, *codepage_attr, peek & 0x0f, Indent (level));
5301 case 0xC3: /* OPAQUE - WBXML 1.1 and newer */
5302 if (tvb_get_guint8 (tvb, 0)) { /* WBXML 1.x (x > 0) */
5303 index = tvb_get_guintvar (tvb, off+1, &len);
5304 proto_tree_add_text (tree, tvb, off, 1 + len + index,
5305 " %3d | Attr | A %3d "
5306 "| OPAQUE (Opaque data) "
5307 "| %s(%d bytes of opaque data)",
5308 level, *codepage_attr, Indent (level), index);
5310 } else { /* WBXML 1.0 - RESERVED_2 token (invalid) */
5311 proto_tree_add_text (tree, tvb, off, 1,
5312 " %3d | Attr | A %3d "
5313 "| RESERVED_2 (Invalid Token!) "
5314 "| WBXML 1.0 parsing stops here.",
5315 level, *codepage_attr);
5316 /* Stop processing as it is impossible to parse now */
5318 DebugLog(("ATTR: level = %u, Return: len = %u\n",
5319 level, off - offset));
5320 return (off - offset);
5323 /* 0xC4 impossible in ATTR state */
5325 proto_tree_add_text (tree, tvb, off, 1,
5326 " %3d | Attr | A %3d "
5327 "| %-10s (Invalid Token!) "
5328 "| WBXML parsing stops here.",
5329 level, *codepage_attr,
5330 match_strval (peek, vals_wbxml1x_global_tokens));
5331 /* Move to end of buffer */
5334 } else { /* Known atribute token */
5335 if (peek & 0x80) { /* attrValue */
5336 proto_tree_add_text (tree, tvb, off, 1,
5337 " %3d | Attr | A %3d "
5338 "| Known attrValue 0x%02X "
5339 "| %sattrValue_0x%02X",
5340 level, *codepage_attr, peek & 0x7f, Indent (level),
5343 } else { /* attrStart */
5344 proto_tree_add_text (tree, tvb, off, 1,
5345 " %3d | Attr | A %3d "
5346 "| Known attrStart 0x%02X "
5347 "| %sattrStart_0x%02X",
5348 level, *codepage_attr, peek & 0x7f, Indent (level),
5354 DebugLog(("ATTR: level = %u, Return: len = %u (end of function body)\n",
5355 level, off - offset));
5356 return (off - offset);
5360 /****************** Register the protocol with Ethereal ******************/
5363 /* This format is required because a script is used to build the C function
5364 * that calls the protocol registration. */
5367 proto_register_wbxml(void)
5368 { /* Setup list of header fields. See Section 1.6.1 for details. */
5369 static hf_register_info hf[] = {
5370 { &hf_wbxml_version,
5374 VALS ( vals_wbxml_versions ), 0x00,
5375 "WBXML Version", HFILL }
5377 { &hf_wbxml_public_id_known,
5378 { "Public Identifier (known)",
5379 "wbxml.public_id.known",
5380 FT_UINT32, BASE_HEX,
5381 VALS ( vals_wbxml_public_ids ), 0x00,
5382 "WBXML Known Public Identifier (integer)", HFILL }
5384 { &hf_wbxml_public_id_literal,
5385 { "Public Identifier (literal)",
5386 "wbxml.public_id.literal",
5387 FT_STRING, BASE_NONE,
5389 "WBXML Literal Public Identifier (text string)", HFILL }
5391 { &hf_wbxml_charset,
5394 FT_UINT32, BASE_HEX,
5395 VALS ( vals_character_sets ), 0x00,
5396 "WBXML Character Set", HFILL }
5400 /* Setup protocol subtree array */
5401 static gint *ett[] = {
5407 /* Register the protocol name and description */
5408 proto_wbxml = proto_register_protocol(
5414 /* Required function calls to register the header fields
5415 * and subtrees used */
5416 proto_register_field_array(proto_wbxml, hf, array_length(hf));
5417 proto_register_subtree_array(ett, array_length(ett));
5419 register_dissector("wbxml", dissect_wbxml, proto_wbxml);
5424 proto_reg_handoff_wbxml(void)
5426 dissector_handle_t wbxml_handle;
5428 /* Heuristic dissectors would be declared by means of:
5429 * heur_dissector_add("wsp", dissect_wbxml_heur, proto_wbxml);
5432 wbxml_handle = create_dissector_handle(dissect_wbxml, proto_wbxml);
5434 /* Register the WSP content types (defined as protocol port)
5435 * for WBXML dissection.
5437 * See http://www.wapforum.org/wina/wsp-content-type.htm
5439 * As the media types for WSP and HTTP are the same, the WSP dissector
5440 * uses the same string dissector table as the HTTP protocol.
5443 /**** Well-known WBXML WSP Content-Type values ****/
5445 dissector_add_string("media_type",
5446 "application/vnd.wap.wmlc", wbxml_handle);
5447 dissector_add_string("media_type",
5448 "application/vnd.wap.wta-eventc", wbxml_handle);
5449 dissector_add_string("media_type",
5450 "application/vnd.wap.wbxml", wbxml_handle);
5451 dissector_add_string("media_type",
5452 "application/vnd.wap.sic", wbxml_handle);
5453 dissector_add_string("media_type",
5454 "application/vnd.wap.slc", wbxml_handle);
5455 dissector_add_string("media_type",
5456 "application/vnd.wap.coc", wbxml_handle);
5457 dissector_add_string("media_type",
5458 "application/vnd.wap.connectivity-wbxml", wbxml_handle);
5459 dissector_add_string("media_type",
5460 "application/vnd.wap.locc+wbxml", wbxml_handle);
5461 dissector_add_string("media_type",
5462 "application/vnd.syncml+wbxml", wbxml_handle);
5463 dissector_add_string("media_type",
5464 "application/vnd.syncml.dm+wbxml", wbxml_handle);
5465 dissector_add_string("media_type",
5466 "application/vnd.oma.drm.rights+wbxml", wbxml_handle);
5467 dissector_add_string("media_type",
5468 "application/vnd.wv.csp.wbxml", wbxml_handle);
5470 /**** Registered WBXML WSP Content-Type values ****/
5472 dissector_add_string("media_type",
5473 "application/vnd.uplanet.cacheop-wbxml", wbxml_handle);
5474 dissector_add_string("media_type",
5475 "application/vnd.uplanet.alert-wbxml", wbxml_handle);
5476 dissector_add_string("media_type",
5477 "application/vnd.uplanet.list-wbxml", wbxml_handle);
5478 dissector_add_string("media_type",
5479 "application/vnd.uplanet.listcmd-wbxml", wbxml_handle);
5480 dissector_add_string("media_type",
5481 "application/vnd.uplanet.channel-wbxml", wbxml_handle);
5482 dissector_add_string("media_type",
5483 "application/vnd.uplanet.bearer-choice-wbxml", wbxml_handle);
5484 dissector_add_string("media_type",
5485 "application/vnd.phonecom.mmc-wbxml", wbxml_handle);
5486 dissector_add_string("media_type",
5487 "application/vnd.nokia.syncset+wbxml", wbxml_handle);
5489 /***** Content types that only have a textual representation *****/
5490 dissector_add_string("media_type",
5491 "application/x-wap-prov.browser-bookmarks", wbxml_handle);
5492 dissector_add_string("media_type",
5493 "application/x-wap-prov.browser-settings", wbxml_handle);
5494 /* Same as application/vnd.nokia.syncset+wbxml */
5495 dissector_add_string("media_type",
5496 "application/x-prov.syncset+wbxml", wbxml_handle);