/epan/dissectors/packet-wbxml.c
C | 8705 lines | 6865 code | 677 blank | 1163 comment | 394 complexity | 7de3a2300939154d1ec9467566c53d61 MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause
Large files files are truncated, but you can click here to view the full file
- /* packet-wbxml.c
- *
- * Routines for WAP Binary XML dissection
- * Copyright 2003, 2004, Olivier Biot.
- *
- * Routines for WV-CSP 1.3 dissection
- * Copyright 2007, Andrei Rubaniuk.
- *
- * $Id$
- *
- * Refer to the AUTHORS file or the AUTHORS section in the man page
- * for contacting the author(s) of this file.
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * WAP Binary XML decoding functionality provided by Olivier Biot.
- * WV-CSP 1.2 updated to Release version and WV-CSP 1.3 protocol
- * decoding functionality provided by Andrei Rubaniuk.
- *
- * The WAP specifications used to be found at the WAP Forum:
- * <http://www.wapforum.org/what/Technical.htm>
- * But now the correct link is at the Open Mobile Alliance:
- * <http://www.openmobilealliance.org/tech/affiliates/wap/wapindex.html>
- * Media types defined by OMA affiliates will have their standards at:
- * <http://www.openmobilealliance.org/tech/affiliates/index.html>
- * <http://www.openmobilealliance.org/release_program/index.html>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
- /* Edit this file with 4-space tabulation */
- #include "config.h"
- #include <string.h>
- #include <glib.h>
- #include <epan/packet.h>
- #include <epan/prefs.h>
- #include <epan/emem.h>
- /* We need the function tvb_get_guintvar() */
- #include "packet-wap.h"
- /* General-purpose debug logger.
- * Requires double parentheses because of variable arguments of printf().
- *
- * Enable debug logging for WBXML by defining AM_FLAGS
- * so that it contains "-DDEBUG_wbxml"
- */
- #ifdef DEBUG_wbxml
- #define DebugLog(x) \
- g_print("%s:%u: ", __FILE__, __LINE__); \
- g_print x
- #else
- #define DebugLog(x) ;
- #endif
- /* The code in this source file dissects the WAP Binary XML content,
- * and if possible renders it. WBXML mappings are defined in the
- * "wbxml_decoding" structure.
- *
- * NOTES:
- *
- * - Some WBXML content is *not* backwards compatible across minor versions.
- * This painful remark is true for:
- * o WMLC 1.0 with respect to later WMLC 1.x
- * o All WV-CSP versions (never backwards compatible)
- * The only way of correctly rendering the WBXML is to let the end-user
- * choose from the possible renderings. This only applies to the case when
- * the WBXML DocType is not included in the WBXML header (unknown/missing).
- *
- * - Some WBXML content uses EXT_T_* in a non-tableref manner. This is the
- * case with WV-CSP 1.1 and up, where the index points to a value_string
- * containing WV-CSP specific token values. This is allowed as it is not
- * explicitly forbidden in the WBXML specifications. Hence the global token
- * map for content must also contain a function pointer if no tableref
- * string is used.
- *
- * - Code page switches apply until a new code page switch. In the WBXML/1.x
- * ABNF notation, it can be proven that the switch_page can only precede
- * the following tokens:
- * o stag : TAG | LITERAL | LITERAL_A | LITERAL_C | LITERAL_AC
- * o attr : ATTRSTART | ATTRVALUE
- * o extension : EXT_I | EXT_T | EXT
- * Code page switches are displayed in a separate column.
- *
- * - The WBXML spec states that code pages are static to both the tag and the
- * attribute state parser. A SWITCH_PAGE within a state switches the code
- * page of the active state only. Note that code page 255 is reserved for
- * application-specific (read: testing) purposes.
- *
- * - In order to render the XML content, recursion is inevitable at some
- * point (when a tag with content occurs in the content of a tag with
- * content). The code will however not recurse if this is not strictly
- * required (e.g., tag without content in the content of a tag with
- * content).
- *
- * - I found it useful to display the XML nesting level as a first "column",
- * followed by the abbreviated WBXML token interpretation. When a mapping
- * is defined for the parsed WBXML content, then the XML rendering is
- * displayed with appropriate indentation (maximum nesting level = 255,
- * after which the nesting and level will safely roll-over to 0).
- *
- * - The WAP Forum defines the order of precedence for finding out the
- * WBXML content type (same rules for charset) as follows:
- * 1. Look in the Content-Type WSP header
- * 2. Look in the WBXML header
- * Currently there is no means of using content type parameters:
- * o Type=<some_type>
- * o Charset=<charset_of_the_content>
- * So it is possible some WBXML content types are incorrectly parsed.
- * This would only be the case when the content type declaration in the
- * WSP Content-Type header would be different (or would have parameters
- * which are relevant to the WBXML decoding) from the content type
- * identifier specified in the WBXML header. This has to do with the
- * decoding of terminated text strings in the different character codings.
- * TODO: investigate this and provide correct decoding at all times.
- */
- typedef struct _value_valuestring {
- guint32 value;
- const value_string *valstrptr;
- } value_valuestring;
- /* Tries to match val against each element in the value_value_string array vvs.
- * Returns the associated value_string ptr on a match, or NULL on failure. */
- static const value_string *
- val_to_valstr(guint32 val, const value_valuestring *vvs)
- {
- gint i = 0;
- while (vvs[i].valstrptr) {
- if (vvs[i].value == val)
- return(vvs[i].valstrptr);
- i++;
- }
- return(NULL);
- }
- /* Note on Token mapping
- * ---------------------
- *
- * The WBXML dissector will try mapping the token decoding to their textual
- * representation if the media type has a defined token representation. The
- * following logic applies:
- *
- * a. Inspect the WBXML PublicID
- * This means that I need a list { PublicID, decoding }
- *
- * b. Inspect the literal media type
- * This requires a list { "media/type", discriminator, { decodings } }
- *
- * b.1. Use a discriminator to choose an appropriate token mapping;
- * The disciminator needs a small number of bytes from the data tvbuff_t.
- *
- * else
- * b.2. Provide a list to the end-user with all possible token mappings.
- *
- * c. If none match then only show the tokens without mapping.
- *
- */
- /* ext_t_func_ptr is a pointer to a function handling the EXT_T_i tokens:
- *
- * char * ext_t_function(tvbuff_t *tvb, guint32 value, guint32 strtbl);
- */
- typedef char * (* ext_t_func_ptr)(tvbuff_t *, guint32, guint32);
- /* Note on parsing of OPAQUE data
- * ------------------------------
- *
- * The WBXML encapsulation allows the insertion of opaque binary data in the
- * WBXML body. Although this opaque data has no meaning in WBXML, the media
- * type itself may define compact encoding of given input by encoding it in
- * such a OPAQUE blob of bytes.
- *
- * The WBXML dissector now supports dissection of OPAQUE data by means of a
- * mapping function that will operate based on the token (well-known or literal)
- * and the active code page.
- *
- * For well-known tokens the simplest approach is to use a switch for the code
- * pages and another switch for the relevant tokens within a code page.
- *
- * For literal tokens (tags and attribute names), the only approach is a string
- * comparison with the literal representation of the given tag or attribute
- * name.
- *
- * opaque_token_func_ptr is a pointer to a function handling OPAQUE values
- * for binary tokens representing tags or attribute starts.
- * opaque_literal_func_ptr is a pointer to a function handling OPAQUE values
- * for literal tokens representing tags or attribute starts.
- *
- * The length field of the OPAQUE entry starts at offset (not offset + 1).
- *
- * The length of the processed OPAQUE value is returned by reference.
- *
- * char * opaque_token_function(tvbuff_t *tvb, guint32 offset,
- * guint8 token, guint8 codepage, guint32 *length);
- * char * opaque_literal_function(tvbuff_t *tvb, guint32 offset,
- * const char *token, guint8 codepage, guint32 *length);
- */
- typedef char * (* opaque_token_func_ptr)(tvbuff_t *, guint32, guint8, guint8, guint32 *);
- typedef char * (* opaque_literal_func_ptr)(tvbuff_t *, guint32, const char *, guint8, guint32 *);
- static char *
- default_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
- guint8 token _U_, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = ep_strdup_printf("(%d bytes of opaque data)", data_len);
- *length += data_len;
- return str;
- }
- static char *
- default_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
- const char *token _U_, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = ep_strdup_printf("(%d bytes of opaque data)", data_len);
- *length += data_len;
- return str;
- }
- static char *
- default_opaque_binary_attr(tvbuff_t *tvb, guint32 offset,
- guint8 token _U_, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = ep_strdup_printf("(%d bytes of opaque data)", data_len);
- *length += data_len;
- return str;
- }
- static char *
- default_opaque_literal_attr(tvbuff_t *tvb, guint32 offset,
- const char *token _U_, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = ep_strdup_printf("(%d bytes of opaque data)", data_len);
- *length += data_len;
- return str;
- }
- /* Render a hex %dateTime encoded timestamp as a string.
- * 0x20011231123456 becomes "2001-12-31T12:34:56Z" */
- static char *
- date_time_from_opaque(tvbuff_t *tvb, guint32 offset, guint32 data_len)
- {
- char *str;
- switch (data_len) {
- case 4: /* YYYY-MM-DD[T00:00:00Z] */
- str = ep_strdup_printf("%%DateTime: "
- "%02x%02x-%02x-%02xT00:00:00Z",
- tvb_get_guint8(tvb, offset),
- tvb_get_guint8(tvb, offset + 1),
- tvb_get_guint8(tvb, offset + 2),
- tvb_get_guint8(tvb, offset + 3));
- break;
- case 5: /* YYYY-MM-DDThh[:00:00Z] */
- str = ep_strdup_printf("%%DateTime: "
- "%02x%02x-%02x-%02xT%02x:00:00Z",
- tvb_get_guint8(tvb, offset),
- tvb_get_guint8(tvb, offset + 1),
- tvb_get_guint8(tvb, offset + 2),
- tvb_get_guint8(tvb, offset + 3),
- tvb_get_guint8(tvb, offset + 4));
- break;
- case 6: /* YYYY-MM-DDThh:mm[:00Z] */
- str = ep_strdup_printf("%%DateTime: "
- "%02x%02x-%02x-%02xT%02x:%02x:00Z",
- tvb_get_guint8(tvb, offset),
- tvb_get_guint8(tvb, offset + 1),
- tvb_get_guint8(tvb, offset + 2),
- tvb_get_guint8(tvb, offset + 3),
- tvb_get_guint8(tvb, offset + 4),
- tvb_get_guint8(tvb, offset + 5));
- break;
- case 7: /* YYYY-MM-DDThh:mm[:00Z] */
- str = ep_strdup_printf("%%DateTime: "
- "%02x%02x-%02x-%02xT%02x:%02x:%02xZ",
- tvb_get_guint8(tvb, offset),
- tvb_get_guint8(tvb, offset + 1),
- tvb_get_guint8(tvb, offset + 2),
- tvb_get_guint8(tvb, offset + 3),
- tvb_get_guint8(tvb, offset + 4),
- tvb_get_guint8(tvb, offset + 5),
- tvb_get_guint8(tvb, offset + 6));
- break;
- default:
- str = ep_strdup_printf("<Error: invalid binary %%DateTime "
- "(%d bytes of opaque data)>", data_len);
- break;
- }
- return str;
- }
- /* Is ALWAYS 6 bytes long:
- * 00YY YYYY YYYY YYMM MMDD DDDh hhhh mmmm mmss ssss ZZZZ ZZZZ */
- static char *
- wv_datetime_from_opaque(tvbuff_t *tvb, guint32 offset, guint32 data_len)
- {
- char *str;
- guint16 year;
- guint8 month, day, hour, minute, second, time_zone;
- guint8 peek;
- if (data_len == 6) { /* Valid */
- /* Octet 1: 00YY YYYY */
- year = tvb_get_guint8(tvb, offset) & 0x3F; /* ..11 1111 */
- year <<=6;
- /* Octet 2: YYYY YYMM */
- peek = tvb_get_guint8(tvb, offset + 1);
- year += (peek >> 2); /* 1111 11.. */
- month = (peek & 0x03) << 2; /* .... ..11 */
- /* Octet 3: MMDD DDDh */
- peek = tvb_get_guint8(tvb, offset + 2);
- month += (peek >> 6); /* 11.. .... */
- day = (peek & 0x3E) >> 1; /* ..11 111. */
- hour = (peek & 0x01) << 4; /* .... ...1 */
- /* Octet 4: hhhh mmmm */
- peek = tvb_get_guint8(tvb, offset + 3);
- hour += (peek >> 4);
- minute = (peek & 0x0F) << 2; /* .... 1111 */
- /* Octet 5: mmss ssss */
- peek = tvb_get_guint8(tvb, offset + 4);
- minute += (peek >> 6); /* 11.. .... */
- second = peek & 0x3F; /* ..11 1111 */
- /* octet 6: ZZZZZZZZ */
- time_zone = tvb_get_guint8(tvb, offset + 5);
- /* Now construct the string */
- str = ep_strdup_printf("WV-CSP DateTime: "
- "%04d-%02d-%02dT%02d:%02d:%02d%c",
- year, month, day, hour, minute, second, time_zone);
- } else { /* Invalid length for a WV-CSP DateTime tag value */
- str = ep_strdup_printf("<Error: invalid binary WV-CSP DateTime value "
- "(%d bytes of opaque data)>", data_len);
- }
- return str;
- }
- /* WV-CSP integer values for tag content is encoded in a fashion similar
- * to a Long-Integer in WSP */
- static char *
- wv_integer_from_opaque(tvbuff_t *tvb, guint32 offset, guint32 data_len)
- {
- char *str;
- switch (data_len) {
- case 1:
- str = ep_strdup_printf("WV-CSP Integer: %d",
- tvb_get_guint8(tvb, offset));
- break;
- case 2:
- str = ep_strdup_printf("WV-CSP Integer: %d",
- tvb_get_ntohs(tvb, offset));
- break;
- case 3:
- str = ep_strdup_printf("WV-CSP Integer: %d",
- tvb_get_ntoh24(tvb, offset));
- break;
- case 4:
- str = ep_strdup_printf("WV-CSP Integer: %d",
- tvb_get_ntohl(tvb, offset));
- break;
- default:
- str = ep_strdup_printf("<Error: invalid binary WV-CSP Integer value "
- "(%d bytes of opaque data)>", data_len);
- break;
- }
- return str;
- }
- static char *
- wv_csp10_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
- guint8 token, guint8 codepage, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- switch (codepage) {
- case 0: /* Common code page */
- switch (token) {
- case 0x0B: /* <Code> */
- case 0x0F: /* <ContentSize> */
- case 0x1A: /* <MessageCount> */
- case 0x3C: /* <Validity> */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- case 0x11: /* <DateTime> */
- str = wv_datetime_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 1: /* Access code page */
- switch (token) {
- case 0x1C: /* <KeepAliveTime> */
- case 0x32: /* <TimeToLive> */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 3: /* Client capability code page */
- switch (token) {
- case 0x06: /* <AcceptedContentLength> */
- case 0x0C: /* <MultiTrans> */
- case 0x0D: /* <ParserSize> */
- case 0x0E: /* <ServerPollMin> */
- case 0x11: /* <TCPAddress> */
- case 0x12: /* <TCPPort> */
- case 0x13: /* <UDPPort> */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- wv_csp10_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
- const char *token, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- if ( token && ( (strcmp(token, "Code") == 0)
- || (strcmp(token, "ContentSize") == 0)
- || (strcmp(token, "MessageCount") == 0)
- || (strcmp(token, "Validity") == 0)
- || (strcmp(token, "KeepAliveTime") == 0)
- || (strcmp(token, "TimeToLive") == 0)
- || (strcmp(token, "AcceptedContentLength") == 0)
- || (strcmp(token, "MultiTrans") == 0)
- || (strcmp(token, "ParserSize") == 0)
- || (strcmp(token, "ServerPollMin") == 0)
- || (strcmp(token, "TCPAddress") == 0)
- || (strcmp(token, "TCPPort") == 0)
- || (strcmp(token, "UDPPort") == 0) ) )
- {
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- }
- else if ( token && ( strcmp(token, "DateTime") == 0) )
- {
- str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- wv_csp11_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
- guint8 token, guint8 codepage, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- switch (codepage) {
- case 0: /* Common code page */
- switch (token) {
- case 0x0B: /* <Code> */
- case 0x0F: /* <ContentSize> */
- case 0x1A: /* <MessageCount> */
- case 0x3C: /* <Validity> */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- case 0x11: /* <DateTime> */
- str = wv_datetime_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 1: /* Access code page */
- switch (token) {
- case 0x1C: /* <KeepAliveTime> */
- case 0x32: /* <TimeToLive> */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 3: /* Client capability code page */
- switch (token) {
- case 0x06: /* <AcceptedContentLength> */
- case 0x0C: /* <MultiTrans> */
- case 0x0D: /* <ParserSize> */
- case 0x0E: /* <ServerPollMin> */
- case 0x12: /* <TCPPort> */
- case 0x13: /* <UDPPort> */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 6: /* Messaging code page */
- switch (token) {
- case 0x1A: /* <DeliveryTime> - not in 1.0 */
- str = wv_datetime_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- wv_csp11_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
- const char *token, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- if ( token && ( (strcmp(token, "Code") == 0)
- || (strcmp(token, "ContentSize") == 0)
- || (strcmp(token, "MessageCount") == 0)
- || (strcmp(token, "Validity") == 0)
- || (strcmp(token, "KeepAliveTime") == 0)
- || (strcmp(token, "TimeToLive") == 0)
- || (strcmp(token, "AcceptedContentLength") == 0)
- || (strcmp(token, "MultiTrans") == 0)
- || (strcmp(token, "ParserSize") == 0)
- || (strcmp(token, "ServerPollMin") == 0)
- || (strcmp(token, "TCPPort") == 0)
- || (strcmp(token, "UDPPort") == 0) ) )
- {
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- }
- else
- if ( token && ( (strcmp(token, "DateTime") == 0)
- || (strcmp(token, "DeliveryTime") == 0) ) )
- {
- str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- wv_csp12_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
- guint8 token, guint8 codepage, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- switch (codepage) {
- case 0: /* Common code page */
- switch (token) {
- case 0x0B: /* <Code> */
- case 0x0F: /* <ContentSize> */
- case 0x1A: /* <MessageCount> */
- case 0x3C: /* <Validity> */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- case 0x11: /* <DateTime> */
- str = wv_datetime_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 1: /* Access code page */
- switch (token) {
- case 0x1C: /* <KeepAliveTime> */
- case 0x32: /* <TimeToLive> */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 3: /* Client capability code page */
- switch (token) {
- case 0x06: /* <AcceptedContentLength> */
- case 0x0C: /* <MultiTrans> */
- case 0x0D: /* <ParserSize> */
- case 0x0E: /* <ServerPollMin> */
- case 0x12: /* <TCPPort> */
- case 0x13: /* <UDPPort> */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 6: /* Messaging code page */
- switch (token) {
- case 0x1A: /* <DeliveryTime> - not in 1.0 */
- str = wv_datetime_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 9: /* Common code page (continued) */
- switch (token) {
- case 0x08: /* <HistoryPeriod> - 1.2 only */
- case 0x0A: /* <MaxWatcherList> - 1.2 only */
- str = wv_integer_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- wv_csp12_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
- const char *token, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- if ( token && ( (strcmp(token, "Code") == 0)
- || (strcmp(token, "ContentSize") == 0)
- || (strcmp(token, "MessageCount") == 0)
- || (strcmp(token, "Validity") == 0)
- || (strcmp(token, "KeepAliveTime") == 0)
- || (strcmp(token, "TimeToLive") == 0)
- || (strcmp(token, "AcceptedContentLength") == 0)
- || (strcmp(token, "MultiTrans") == 0)
- || (strcmp(token, "ParserSize") == 0)
- || (strcmp(token, "ServerPollMin") == 0)
- || (strcmp(token, "TCPPort") == 0)
- || (strcmp(token, "UDPPort") == 0)
- || (strcmp(token, "HistoryPeriod") == 0)
- || (strcmp(token, "MaxWatcherList") == 0) ) )
- {
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- }
- else
- if ( token && ( (strcmp(token, "DateTime") == 0)
- || (strcmp(token, "DeliveryTime") == 0) ) )
- {
- str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- wv_csp13_opaque_binary_tag(tvbuff_t *tvb, guint32 offset,
- guint8 token, guint8 codepage, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- switch (codepage)
- {
- case 0: /* Common code page */
- switch (token)
- {
- case 0x0B: /* <Code> */
- case 0x0F: /* <ContentSize> */
- case 0x1A: /* <MessageCount> */
- case 0x3C: /* <Validity> */
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- break;
- case 0x11: /* <DateTime> */
- str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 1: /* Access code page */
- switch (token)
- {
- case 0x1C: /* <KeepAliveTime> */
- case 0x25: /* <SearchFindings> */
- case 0x26: /* <SearchID> */
- case 0x27: /* <SearchIndex> */
- case 0x28: /* <SearchLimit> */
- case 0x32: /* <TimeToLive> */
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 3: /* Client capability code page */
- switch (token)
- {
- case 0x06: /* <AcceptedContentLength> */
- case 0x0C: /* <MultiTrans> */
- case 0x0D: /* <ParserSize> */
- case 0x0E: /* <ServerPollMin> */
- case 0x12: /* <TCPPort> */
- case 0x13: /* <UDPPort> */
- /* New in WV-CSP 1.3*/
- case 0x16: /* <AcceptedPullLength> */
- case 0x17: /* <AcceptedPushLength> */
- case 0x18: /* <AcceptedRichContentLength> */
- case 0x19: /* <AcceptedTextContentLength> */
- case 0x1B: /* <PlainTextCharset> MIBenum number - character set, i.e. UTF-8, windows-1251, etc. */
- case 0x1C: /* <SessionPriority> */
- case 0x1F: /* <UserSessionLimit> */
- case 0x21: /* <MultiTransPerMessage> */
- case 0x24: /* <ContentPolicyLimit> */
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 5: /* Presence attribute code page */
- switch (token)
- {
- /* New in WV-CSP 1.3*/
- /* case 0x3B: */ /* <ClientContentLimit> */
- case 0x3C: /* <ClientIMPriority> */
- case 0x3D: /* <MaxPullLength> */
- case 0x3E: /* <MaxPushLength> */
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 6: /* Messaging code page */
- switch (token)
- {
- case 0x1A: /* <DeliveryTime> - not in 1.0 */
- /* New in WV-CSP 1.3*/
- case 0x1C: /* <AnswerOptionID> */
- str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 9: /* Common code page (continued) */
- switch (token)
- {
- case 0x08: /* <HistoryPeriod> - 1.2 only */
- case 0x0A: /* <MaxWatcherList> - 1.2 only */
- /* New in WV-CSP 1.3*/
- case 0x25: /* <SegmentCount> */
- case 0x28: /* <SegmentReference> */
- case 0x30: /* <TryAgainTimeout> */
- case 0x3A: /* <GroupContentLimit> */
- case 0x3B: /* <MessageTotalCount> */
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- case 10:
- switch (token)
- {
- /* New in WV-CSP 1.3*/
- case 0x0C: /* <PairID> */
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- if (str == NULL)
- { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- wv_csp13_opaque_literal_tag(tvbuff_t *tvb, guint32 offset,
- const char *token, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- if ( token && ( (strcmp(token, "Code") == 0)
- || (strcmp(token, "ContentSize") == 0)
- || (strcmp(token, "MessageCount") == 0)
- || (strcmp(token, "Validity") == 0)
- || (strcmp(token, "KeepAliveTime") == 0)
- || (strcmp(token, "TimeToLive") == 0)
- || (strcmp(token, "AcceptedContentLength") == 0)
- || (strcmp(token, "MultiTrans") == 0)
- || (strcmp(token, "ParserSize") == 0)
- || (strcmp(token, "ServerPollMin") == 0)
- || (strcmp(token, "TCPPort") == 0)
- || (strcmp(token, "UDPPort") == 0)
- || (strcmp(token, "HistoryPeriod") == 0)
- || (strcmp(token, "MaxWatcherList") == 0)
- /* New in WV-CSP 1.3*/
- || (strcmp(token, "SearchFindings") == 0)
- || (strcmp(token, "SearchID") == 0)
- || (strcmp(token, "SearchIndex") == 0)
- || (strcmp(token, "SearchLimit") == 0)
- || (strcmp(token, "AcceptedPullLength") == 0)
- || (strcmp(token, "AcceptedPushLength") == 0)
- || (strcmp(token, "AcceptedRichContentLength") == 0)
- || (strcmp(token, "AcceptedTextContentLength") == 0)
- || (strcmp(token, "SessionPriority") == 0)
- || (strcmp(token, "UserSessionLimit") == 0)
- || (strcmp(token, "MultiTransPerMessage") == 0)
- || (strcmp(token, "ContentPolicyLimit") == 0)
- || (strcmp(token, "AnswerOptionID") == 0)
- || (strcmp(token, "SegmentCount") == 0)
- || (strcmp(token, "SegmentReference") == 0)
- || (strcmp(token, "TryAgainTimeout") == 0)
- || (strcmp(token, "GroupContentLimit") == 0)
- || (strcmp(token, "MessageTotalCount") == 0)
- || (strcmp(token, "PairID") == 0) ) )
- {
- str = wv_integer_from_opaque(tvb, offset + *length, data_len);
- }
- else
- if ( token && ( (strcmp(token, "DateTime") == 0)
- || (strcmp(token, "DeliveryTime") == 0) ) )
- {
- str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- sic10_opaque_literal_attr(tvbuff_t *tvb, guint32 offset,
- const char *token, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- if ( token && ( (strcmp(token, "created") == 0)
- || (strcmp(token, "si-expires") == 0) ) )
- {
- str = date_time_from_opaque(tvb, offset + *length, data_len);
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- sic10_opaque_binary_attr(tvbuff_t *tvb, guint32 offset,
- guint8 token, guint8 codepage, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- switch (codepage) {
- case 0: /* Only valid codepage for SI */
- switch (token) {
- case 0x0A: /* created= */
- case 0x10: /* si-expires= */
- str = date_time_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- emnc10_opaque_literal_attr(tvbuff_t *tvb, guint32 offset,
- const char *token, guint8 codepage _U_, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- if ( token && (strcmp(token, "timestamp") == 0) )
- {
- str = date_time_from_opaque(tvb, offset + *length, data_len);
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- static char *
- emnc10_opaque_binary_attr(tvbuff_t *tvb, guint32 offset,
- guint8 token, guint8 codepage, guint32 *length)
- {
- guint32 data_len = tvb_get_guintvar(tvb, offset, length);
- char *str = NULL;
- switch (codepage) {
- case 0: /* Only valid codepage for EMN */
- switch (token) {
- case 0x05: /* timestamp= */
- str = date_time_from_opaque(tvb,
- offset + *length, data_len);
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- if (str == NULL) { /* Error, or not parsed */
- str = ep_strdup_printf("(%d bytes of unparsed opaque data)", data_len);
- }
- *length += data_len;
- return str;
- }
- typedef struct _wbxml_decoding {
- const char *name;
- const char *abbrev;
- ext_t_func_ptr ext_t[3];
- opaque_token_func_ptr opaque_binary_tag;
- opaque_literal_func_ptr opaque_literal_tag;
- opaque_token_func_ptr opaque_binary_attr;
- opaque_literal_func_ptr opaque_literal_attr;
- const value_valuestring *global;
- const value_valuestring *tags;
- const value_valuestring *attrStart;
- const value_valuestring *attrValue;
- } wbxml_decoding;
- /* Define a pointer to a discriminator function taking a tvb and the start
- * offset of the WBXML tokens in the body as arguments.
- */
- typedef const wbxml_decoding * (* discriminator_func_ptr)(tvbuff_t *, guint32);
- /* For the decoding lists based on the known WBXML public ID */
- typedef struct _wbxml_integer_list {
- guint32 public_id;
- const wbxml_decoding *map;
- } wbxml_integer_list;
- /* For the decoding lists on the literal content type */
- typedef struct _wbxml_literal_list {
- const char *content_type;
- discriminator_func_ptr discriminator; /* TODO */
- const wbxml_decoding *map;
- } wbxml_literal_list;
- /************************** Variable declarations **************************/
- /* Initialize the protocol and registered fields */
- static int proto_wbxml = -1;
- static int hf_wbxml_version = -1;
- static int hf_wbxml_public_id_known = -1;
- static int hf_wbxml_public_id_literal = -1;
- static int hf_wbxml_charset = -1;
- /* Initialize the subtree pointers */
- static gint ett_wbxml = -1;
- static gint ett_wbxml_str_tbl = -1;
- static gint ett_wbxml_content = -1;
- /* WBXML Preferences */
- static gboolean skip_wbxml_token_mapping = FALSE;
- static gboolean disable_wbxml_token_parsing = FALSE;
- /**************** WBXML related declarations and definitions ****************/
- /* WBXML public ID mappings. For an up-to-date list, see
- * http://www.openmobilealliance.org/tech/omna/ */
- static const value_string vals_wbxml_public_ids[] = {
- /* 0x00 = literal public identifier */
- { 0x01, "Unknown or missing Public Identifier" },
- { 0x02, "-//WAPFORUM//DTD WML 1.0//EN (WML 1.0)" },
- { 0x03, "-//WAPFORUM//DTD WTA 1.0//EN (WTA Event 1.0) - Deprecated" },
- { 0x04, "-//WAPFORUM//DTD WML 1.1//EN (WML 1.1)" },
- { 0x05, "-//WAPFORUM//DTD SI 1.0//EN (Service Indication 1.0)" },
- { 0x06, "-//WAPFORUM//DTD SL 1.0//EN (Service Loading 1.0)" },
- { 0x07, "-//WAPFORUM//DTD CO 1.0//EN (Cache Operation 1.0)" },
- { 0x08, "-//WAPFORUM//DTD CHANNEL 1.1//EN (Channel 1.1)" },
- { 0x09, "-//WAPFORUM//DTD WML 1.2//EN (WML 1.2)" },
- { 0x0a, "-//WAPFORUM//DTD WML 1.3//EN (WML 1.3)" },
- { 0x0b, "-//WAPFORUM//DTD PROV 1.0//EN (Provisioning 1.0)" },
- { 0x0c, "-//WAPFORUM//DTD WTA-WML 1.2//EN (WTA-WML 1.2)" },
- { 0x0d, "-//WAPFORUM//DTD EMN 1.0//EN (Email Notification 1.0)" },
- { 0x0e, "-//WAPFORUM//DTD DRMREL 1.0//EN (DRMREL 1.0)" },
- { 0x0f, "-//WIRELESSVILLAGE//DTD CSP 1.0//EN"
- " (Wireless Village Client-Server Protocol DTD v1.0)" },
- { 0x10, "-//WIRELESSVILLAGE//DTD CSP 1.1//EN"
- " (Wireless Village Client-Server Protocol DTD v1.1)" },
- { 0x11, "-//OMA//DTD WV-CSP 1.2//EN (OMA IMPS - CSP protocol DTD v1.2)" },
- { 0x12, "-//OMA//DTD IMPS-CSP 1.3//EN (OMA IMPS - CSP protocol DTD v1.3)" },
- { 0x13, "-//OMA//DRM 2.1//EN (OMA DRM 2.1)" },
- /* 0x14 -- 0x7F: reserved */
- /* Registered values - www.syncml.org */
- { 0x0fd1, "-//SYNCML//DTD SyncML 1.0//EN (SyncML 1.0)" },
- { 0x0fd3, "-//SYNCML//DTD SyncML 1.1//EN (SyncML 1.1)" },
- /* Registered values - www.wapforum.org/wina/ */
- { 0x1100, "-//PHONE.COM//DTD ALERT 1.0//EN" },
- { 0x1101, "-//PHONE.COM//DTD CACHE-OPERATION 1.0//EN" },
- { 0x1102, "-//PHONE.COM//DTD SIGNAL 1.0//EN" },
- { 0x1103, "-//PHONE.COM//DTD LIST 1.0//EN" },
- { 0x1104, "-//PHONE.COM//DTD LISTCMD 1.0//EN" },
- { 0x1105, "-//PHONE.COM//DTD CHANNEL 1.0//EN" },
- { 0x1106, "-//PHONE.COM//DTD MMC 1.0//EN" },
- { 0x1107, "-//PHONE.COM//DTD BEARER-CHOICE 1.0//EN" },
- { 0x1108, "-//PHONE.COM//DTD WML 1.1//EN (WML+ 1.1)" },
- { 0x1109, "-//PHONE.COM//DTD CHANNEL 1.1//EN" },
- { 0x110a, "-//PHONE.COM//DTD LIST 1.1//EN" },
- { 0x110b, "-//PHONE.COM//DTD LISTCMD 1.1//EN" },
- { 0x110c, "-//PHONE.COM//DTD MMC 1.1//EN" },
- { 0x110d, "-//PHONE.COM//DTD WML 1.3//EN (WML+ 1.3)" },
- { 0x110e, "-//PHONE.COM//DTD MMC 2.0//EN" },
- /* 0x110F -- 0x11FF: unassigned */
- { 0x1200, "-//3GPP2.COM//DTD IOTA 1.0//EN" },
- { 0x1201, "-//SYNCML//DTD SyncML 1.2//EN" },
- { 0x1202, "-//SYNCML//DTD MetaInf 1.2//EN" },
- { 0x1203, "-//SYNCML//DTD DevInf 1.2//EN" },
- { 0x1204, "-//NOKIA//DTD LANDMARKS 1.0//EN" },
- { 0x00, NULL }
- };
- static value_string_ext vals_wbxml_public_ids_ext = VALUE_STRING_EXT_INIT(vals_wbxml_public_ids);
- static const value_string vals_wbxml_versions[] = {
- { 0x00, "1.0" }, /* WAP-104-WBXML */
- { 0x01, "1.1" }, /* WAP-135-WBXML */
- { 0x02, "1.2" }, /* WAP-154-WBXML */
- { 0x03, "1.3" }, /* WAP-192-WBXML */
- { 0x00, NULL }
- };
- static value_string_ext vals_wbxml_versions_ext = VALUE_STRING_EXT_INIT(vals_wbxml_versions);
- /* WBXML 1.0 global tokens: WAP-104-WBXML
- * Same token mapping as in vals_wbxml1x_global_tokens, but:
- * { 0xC3, "RESERVED_2" }
- */
- /* WBXML 1.x (x>0) global tokens: WAP-135-WBXML, WAP-154-WBXML, WAP-192-WBXML
- */
- static const value_string vals_wbxml1x_global_tokens[] = {
- { 0x00, "SWITCH_PAGE" },
- { 0x01, "END" },
- { 0x02, "ENTITY" },
- { 0x03, "STR_I" },
- { 0x04, "LITERAL" },
- { 0x40, "EXT_I_0" },
- { 0x41, "EXT_I_1" },
- { 0x42, "EXT_I_2" },
- { 0x43, "PI" },
- { 0x44, "LITERAL_C" },
- { 0x80, "EXT_T_0" },
- { 0x81, "EXT_T_1" },
- { 0x82, "EXT_T_2" },
- { 0x83, "STR_T" },
- { 0x84, "LITERAL_A" },
- { 0xC0, "EXT_0" },
- { 0xC1, "EXT_1" },
- { 0xC2, "EXT_2" },
- { 0xC3, "OPAQUE" },
- { 0xC4, "LITERAL_AC" },
- { 0x00, NULL }
- };
- static value_string_ext vals_wbxml1x_global_tokens_ext = VALUE_STRING_EXT_INIT(vals_wbxml1x_global_tokens);
- /********************** WBXML token mapping definition **********************/
- /*
- * NOTE: Please make sure the Attribute Start values all contain an equal sign
- * even in cases where they do not contain the start of an Attribute
- * Value.
- */
- /* WML 1.0
- *
- * Wireless Markup Language
- ***************************************/
- static char *
- ext_t_0_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
- {
- char *str = ep_strdup_printf("Variable substitution - escaped: '%s'",
- tvb_get_const_stringz(tvb, str_tbl + value, NULL));
- return str;
- }
- static char *
- ext_t_1_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
- {
- char *str = ep_strdup_printf("Variable substitution - unescaped: '%s'",
- tvb_get_const_stringz(tvb, str_tbl + value, NULL));
- return str;
- }
- static char *
- ext_t_2_wml_10(tvbuff_t *tvb, guint32 value, guint32 str_tbl)
- {
- char *str = ep_strdup_printf("Variable substitution - no transformation: '%s'",
- tvb_get_const_stringz(tvb, str_tbl + value, NULL));
- return str;
- }
- /***** Global extension tokens *****/
- static const value_string wbxml_wmlc10_global_cp0[] = {
- { 0x40, "Variable substitution - escaped" },
- { 0x41, "Variable substitution - unescaped" },
- { 0x42, "Variable substitution - no transformation" },
- { 0x80, "Variable substitution - escaped" },
- { 0x81, "Variable substitution - unescaped" },
- { 0x82, "Variable substitution - no transformation" },
- { 0xC0, "Reserved" },
- { 0xC1, "Reserved" },
- { 0xC2, "Reserved" },
- { 0x00, NULL }
- };
- /***** Tag tokens *****/
- static const value_string wbxml_wmlc10_tags_cp0[] = {
- /* 0x00 -- 0x04 GLOBAL */
- /* 0x05 -- 0x21 */
- { 0x22, "A" },
- { 0x23, "ACCESS" },
- { 0x24, "B" },
- { 0x25, "BIG" },
- { 0x26, "BR" },
- { 0x27, "CARD" },
- { 0x28, "DO" },
- { 0x29, "EM" },
- { 0x2A, "FIELDSET" },
- { 0x2B, "GO" },
- { 0x2C, "HEAD" },
- { 0x2D, "I" },
- { 0x2E, "IMG" },
- { 0x2F, "INPUT" },
- { 0x30, "META" },
- { 0x31, "NOOP" },
- { 0x32, "PREV" },
- { 0x33, "ONEVENT" },
- { 0x34, "OPTGROUP" },
- { 0x35, "OPTION" },
- { 0x36, "REFRESH" },
- { 0x37, "SELECT" },
- { 0x38, "SMALL" },
- { 0x39, "STRONG" },
- { 0x3A, "TAB" },
- { 0x3B, "TEMPLATE" },
- { 0x3C, "TIMER" },
- { 0x3D, "U" },
- { 0x3E, "VAR" },
- { 0x3F, "WML" },
- { 0x00, NULL }
- };
- /***** Attribute Start tokens *****/
- static const value_string wbxml_wmlc10_attrStart_cp0[] = {
- /* 0x00 -- 0x04 GLOBAL */
- { 0x05, "ACCEPT-CHARSET=" },
- { 0x06, "ALIGN='BOTTOM'" },
- { 0x07, "ALIGN='CENTER'" },
- { 0x08, "ALIGN='LEFT'" },
- { 0x09, "ALIGN='MIDDLE'" },
- { 0x0A, "ALIGN='RIGHT'" },
- { 0x0B, "ALIGN='TOP'" },
- { 0x0C, "ALT=" },
- { 0x0D, "CONTENT=" },
- { 0x0E, "DEFAULT=" },
- { 0x0F, "DOMAIN=" },
- { 0x10, "EMPTYOK='FALSE'" },
- { 0x11, "EMPTYOK='TRUE'" },
- { 0x12, "FORMAT=" },
- { 0x13, "HEIGHT=" },
- { 0x14, "HSPACE=" },
- { 0x15, "IDEFAULT=" },
- { 0x16, "IKEY=" },
- { 0x17, "KEY=" },
- { 0x18, "LABEL=" },
- { 0x19, "LOCALSRC=" },
- { 0x1A, "MAXLENGTH=" },
- { 0x1B, "METHOD='GET'" },
- { 0x1C, "METHOD='POST'" },
- { 0x1D, "MODE='NOWRAP'" },
- { 0x1E, "MODE='WRAP'" },
- { 0x1F, "MULTIPLE='FALSE'" },
- { 0x20, "MULTIPLE='TRUE'" },
- { 0x21, "NAME=" },
- { 0x22, "NEWCONTEXT='FALSE'" },
- { 0x23, "NEWCONTEXT='TRUE'" },
- { 0x24, "ONCLICK=" },
- { 0x25, "ONENTERBACKWARD=" },
- { 0x26, "ONENTERFORWARD=" },
- { 0x27, "ONTIMER=" },
- { 0x28, "OPTIONAL='FALSE'" },
- { 0x29, "OPTIONAL='TRUE'" },
- { 0x2A, "PATH=" },
- { 0x2B, "POSTDATA=" },
- { 0x2C, "PUBLIC='FALSE'" },
- { 0x2D, "PUBLIC='TRUE'" },
- { 0x2E, "SCHEME=" },
- { 0x2F, "SENDREFERER='FALSE'" },
- { 0x30, "SENDREFERER='TRUE'" },
- { 0x31, "SIZE=" },
- { 0x32, "SRC=" },
- { 0x33, "STYLE='LIST'" },
- { 0x34, "STYLE='SET'" },
- { 0x35, "TABINDEX=" },
- { 0x36, "TITLE=" },
- { 0x37, "TYPE=" },
- { 0x38, "TYPE='ACCEPT'" },
- { 0x39, "TYPE='DELETE'" },
- { 0x3A, "TYPE='HELP'" },
- { 0x3B, "TYPE='PASSWORD'" },
- { 0x3C, "TYPE='ONCLICK'" },
- { 0x3D, "TYPE='ONENTERBACKWARD'" },
- { 0x3E, "TYPE='ONENTERFORWARD'" },
- { 0x3F, "TYPE='ONTIMER'" },
- /* 0x40 -- 0x44 GLOBAL */
- { 0x45, "TYPE='OPTIONS'" },
- { 0x46, "TYPE='PREV'" },
- { 0x47, "TYPE='RESET'" },
- { 0x48, "TYPE='TEXT'" },
- { 0x49, "TYPE='vnd.'" },
- { 0x4A, "URL=" },
- { 0x4B, "URL='http://'" },
- { 0x4C, "URL='https://'" },
- { 0x4D, "USER-AGENT=" },
- { 0x4E, "VALUE=" },
- { 0x4F, "VSPACE=" },
- { 0x50, "WIDTH=" },
- { 0x51, "xml:lang=" },
- { 0x00, NULL }
- };
- /***** Attribute Value tokens *****/
- static const value_string wbxml_wmlc10_attrValue_cp0[] = {
- /* 0x80 -- 0x84 GLOBAL */
- { 0x85, "'.com/'" },
- { 0x86, "'.edu/'" },
- { 0x87, "'.net/'" },
- { 0x88, "'.org/'" },
- { 0x89, "'ACCEPT'" },
- { 0x8A, "'BOTTOM'" },
- { 0x8B, "'CLEAR'" },
- { 0x8C, "'DELETE'" },
- { 0x8D, "'HELP'" },
- { 0x8E, "'http://'" },
- { 0x8F, "'http://www.'" },
- { 0x90, "'https://'" },
- { 0x91, "'https://www.'" },
- { 0x92, "'LIST'" },
- { 0x93, "'MIDDLE'" },
- { 0x94, "'NOWRAP'" },
- { 0x95, "'ONCLICK'" },
- { 0x96, "'ONENTERBACKWARD'" },
- { 0x97, "'ONENTERFORWARD'" },
- { 0x98, "'ONTIMER'" },
- { 0x99, "'OPTIONS'" },
- { 0x9A, "'PASSWORD'" },
- { 0x9B, "'RESET'" },
- { 0x9C, "'SET'" },
- { 0x9D, "'TEXT'" },
- { 0x9E, "'TOP'" },
- { 0x9F, "'UNKNOWN'" },
- { 0xA0, "'WRAP'" },
- { 0xA1, "'www.'" },
- { 0x00, NULL }
- };
- /***** Token code page aggregation *****/
- static const value_valuestring wbxml_wmlc10_global[] = {
- { 0, wbxml_wmlc10_global_cp0 },
- { 0, NULL }
- };
- static const value_valuestring wbxml_wmlc10_tags[] = {
- { 0, wbxml_wmlc10_tags_cp0 },
- { 0, NULL }
- };
- static const value_valuestring wbxml_wmlc10_attrStart[] = {
- { 0, wbxml_wmlc10_attrStart_cp0 },
- { 0, NULL }
- };
- static const value_valuestring wbxml_wmlc10_attrValue[] = {
- { 0, wbxml_wmlc10_attrValue_cp0 },
- { 0, NULL }
- };
- static const wbxml_decoding decode_wmlc_10 = {
- "Wireless Markup Language 1.0",
- "WML 1.0",
- { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
- default_opaque_binary_tag,
- default_opaque_literal_tag,
- default_opaque_binary_attr,
- default_opaque_literal_attr,
- wbxml_wmlc10_global,
- wbxml_wmlc10_tags,
- wbxml_wmlc10_attrStart,
- wbxml_wmlc10_attrValue
- };
- /* WML 1.1
- *
- * Wireless Markup Language
- ***************************************/
- /***** Global extension tokens *****/
- /* Same as in WML 1.0 */
- /***** Tag tokens *****/
- static const value_string wbxml_wmlc11_tags_cp0[] = {
- /* 0x00 -- 0x04 GLOBAL */
- /* 0x05 -- 0x1B */
- { 0x1C, "a" },
- { 0x1D, "td" },
- { 0x1E, "tr" },
- { 0x1F, "table" },
- { 0x20, "p" },
- { 0x21, "postfield" },
- { 0x22, "anchor" },
- { 0x23, "access" },
- { 0x24, "b" },
- { 0x25, "big" },
- { 0x26, "br" },
- { 0x27, "card" },
- { 0x28, "do" },
- { 0x29, "em" },
- { 0x2A, "fieldset" },
- { 0x2B, "go" },
- { 0x2C, "head" },
- { 0x2D, "i" },
- { 0x2E, "img" },
- { 0x2F, "input" },
- { 0x30, "meta" },
- { 0x31, "noop" },
- { 0x32, "prev" },
- { 0x33, "onevent" },
- { 0x34, "optgroup" },
- { 0x35, "option" },
- { 0x36, "refresh" },
- { 0x37, "select" },
- { 0x38, "small" },
- { 0x39, "strong" },
- /* 0x3A */
- { 0x3B, "template" },
- { 0x3C, "timer" },
- { 0x3D, "u" },
- { 0x3E, "setvar" },
- { 0x3F, "wml" },
- { 0x00, NULL }
- };
- /***** Attribute Start tokens *****/
- static const value_string wbxml_wmlc11_attrStart_cp0[] = {
- /* 0x00 -- 0x04 GLOBAL */
- { 0x05, "accept-charset=" },
- { 0x06, "align='bottom'" },
- { 0x07, "align='center'" },
- { 0x08, "align='left'" },
- { 0x09, "align='middle'" },
- { 0x0A, "align='right'" },
- { 0x0B, "align='top'" },
- { 0x0C, "alt=" },
- { 0x0D, "content=" },
- /* 0x0E */
- { 0x0F, "domain=" },
- { 0x10, "emptyok='false'" },
- { 0x11, "emptyok='true'" },
- { 0x12, "format=" },
- { 0x13, "height=" },
- { 0x14, "hspace=" },
- { 0x15, "ivalue=" },
- { 0x16, "iname=" },
- /* 0x17 */
- { 0x18, "label=" },
- { 0x19, "localsrc=" },
- { 0x1A, "maxlength=" },
- { 0x1B, "method='get'" },
- { 0x1C, "method='post'" },
- { 0x1D, "mode='nowrap'" },
- { 0x1E, "mode='wrap'" },
- { 0x1F, "multiple='false'" },
- { 0x20, "multiple='true'" },
- { 0x21, "name=" },
- { 0x22, "newcontext='false'" },
- { 0x23, "newcontext='true'" },
- { 0x24, "onpick=" },
- { 0x25, "onenterbackward=" },
- { 0x26, "onenterforward=" },
- { 0x27, "ontimer=" },
- { 0x28, "optional='false'" },
- { 0x29, "optional='true'" },
- { 0x2A, "path=" },
- /* 0x2B -- 0x2D */
- { 0x2E, "scheme=" },
- { 0x2F, "sendreferer='false'" },
- { 0x30, "sendreferer='true'" },
- { 0x31, "size=" },
- { 0x32, "src=" },
- { 0x33, "ordered='false'" },
- { 0x34, "ordered='true'" },
- { 0x35, "tabindex=" },
- { 0x36, "title=" },
- { 0x37, "type=" },
- { 0x38, "type='accept'" },
- { 0x39, "type='delete'" },
- { 0x3A, "type='help'" },
- { 0x3B, "type='password'" },
- { 0x3C, "type='onpick'" },
- { 0x3D, "type='onenterbackward'" },
- { 0x3E, "type='onenterforward'" },
- { 0x3F, "type='ontimer'" },
- /* 0x40 -- 0x44 GLOBAL */
- { 0x45, "type='options'" },
- { 0x46, "type='prev'" },
- { 0x47, "type='reset'" },
- { 0x48, "type='text'" },
- { 0x49, "type='vnd.'" },
- { 0x4A, "href=" },
- { 0x4B, "href='http://'" },
- { 0x4C, "href='https://'" },
- { 0x4D, "value=" },
- { 0x4E, "vspace=" },
- { 0x4F, "width=" },
- { 0x50, "xml:lang=" },
- /* 0x51 */
- { 0x52, "align=" },
- { 0x53, "columns=" },
- { 0x54, "class=" },
- { 0x55, "id=" },
- { 0x56, "forua='false'" },
- { 0x57, "forua='true'" },
- { 0x58, "src='http://'" },
- { 0x59, "src='https://'" },
- { 0x5A, "http-equiv=" },
- { 0x5B, "http-equiv='Content-Type'" },
- { 0x5C, "content='application/vnd.wap.wmlc;charset='" },
- { 0x5D, "http-equiv='Expires'" },
- { 0x00, NULL }
- };
- /***** Attribute Value tokens *****/
- static const value_string wbxml_wmlc11_attrValue_cp0[] = {
- /* 0x80 -- 0x84 GLOBAL */
- { 0x85, "'.com/'" },
- { 0x86, "'.edu/'" },
- { 0x87, "'.net/'" },
- { 0x88, "'.org/'" },
- { 0x89, "'accept'" },
- { 0x8A, "'bottom'" },
- { 0x8B, "'clear'" },
- { 0x8C, "'delete'" },
- { 0x8D, "'help'" },
- { 0x8E, "'http://'" },
- { 0x8F, "'http://www.'" },
- { 0x90, "'https://'" },
- { 0x91, "'https://www.'" },
- /* 0x92 */
- { 0x93, "'middle'" },
- { 0x94, "'nowrap'" },
- { 0x95, "'onpick'" },
- { 0x96, "'onenterbackward'" },
- { 0x97, "'onenterforward'" },
- { 0x98, "'ontimer'" },
- { 0x99, "'options'" },
- { 0x9A, "'password'" },
- { 0x9B, "'reset'" },
- /* 0x9C */
- { 0x9D, "'text'" },
- { 0x9E, "'top'" },
- { 0x9F, "'unknown'" },
- { 0xA0, "'wrap'" },
- { 0xA1, "'www.'" },
- { 0x00, NULL }
- };
- /***** Token code page aggregation *****/
- static const value_valuestring wbxml_wmlc11_global[] = {
- { 0, wbxml_wmlc10_global_cp0 }, /* Same as WML 1.0 */
- { 0, NULL }
- };
- static const value_valuestring wbxml_wmlc11_tags[] = {
- { 0, wbxml_wmlc11_tags_cp0 },
- { 0, NULL }
- };
- static const value_valuestring wbxml_wmlc11_attrStart[] = {
- { 0, wbxml_wmlc11_attrStart_cp0 },
- { 0, NULL }
- };
- static const value_valuestring wbxml_wmlc11_attrValue[] = {
- { 0, wbxml_wmlc11_attrValue_cp0 },
- { 0, NULL }
- };
- static const wbxml_decoding decode_wmlc_11 = {
- "Wireless Markup Language 1.1",
- "WML 1.1",
- { ext_t_0_wml_10, ext_t_1_wml_10, ext_t_2_wml_10 },
- default_opaque_binary_tag,
- default_opaque_literal_tag,
- default_opaque_binary_attr,
- default_opaque_literal_attr,
- wbxml_wmlc11_global,
- wbxml_wmlc11_tags,
- wbxml_wmlc11_attrStart,
- wbxml_wmlc11_attrValue
- };
- /* WML 1.2
- *
- * Wireless Markup Language
- ***************************************/
- /***** Global extension tokens *****/
- /* Same as in WML 1.0 */
- /***** Tag tokens *****/
- static const value_string wbxml_wmlc12_tags_cp0[] = {
- /* 0x00 -- 0x04 GLOBAL */
- /* 0x05 -- 0x1A */
- { 0x1B, "pre" },
- { 0x1C, "a" },
- { 0x1D, "td" },
- { 0x1E, "tr" },
- { 0x1F, "table" },
- { 0x20, "p" },
- { 0x21, "postfield" },
- { 0x22, "anchor" },
- { 0x23, "access" },
- { 0x24, "b" },
- { 0x25, "big" },
- { 0x26, "br" },
- { 0x27, "card" },
- { 0x28, "do" },
- { 0x29, "em" },
- { 0x2A, "fieldset" },
- { 0x2B, "go" },
- { 0x2C, "head" },
- { 0x2D, "i" },
- { 0x2E, "img" },
- { 0x2F, "input" },
- { 0x30, "meta" },
- { 0x31, "noop" },
- { 0x32, "prev" },
- { 0x33, "onevent" },
- { 0x34, "optgroup" },
- { 0x35, "option" },
- { 0x36, "refresh" },
- { 0x37, "select" },
- { 0x38, "small" },
- { 0x39, "strong" },
- /* 0x3A */
- { 0x3B, "template" },
- { 0x3C, "timer" },
- { 0x3D, "u" },
- { 0x3E, "setvar" },
- { 0x3F, "wml" },
- { 0x00, NULL }
- };
- /***** Attribute Start tokens *****/
- static const value_string wbxml_wmlc12_attrStart_cp0[] = {
- /* 0x00 -- 0x04 GLOBAL */
- { 0x05, "accept-charset=" },
- { 0x06, "align='bottom'" },
- { 0x07, "align='center'" },
- { 0x08, "align='left'" },
- { 0x09, "align='middle'" },
- { 0x0A, "align='right'" },
- { 0x0B, "align='top'" },
- { 0x0C, "alt=" },
- { 0x0D, "content=" },
- /* 0x0E */
- { 0x0F, "domain=" },
- { 0x10, "emptyok='false'" },
- { 0x11, "emptyok='true'" },
- { 0x12, "format=" },
- { 0x13, "height=" },
- { 0x14, "hspace=" },
- { 0x15, "ivalue=" },
- { 0x16, "iname=" },
- /* 0x17 */
- { 0x18, "label=" },
- { 0x19, "localsrc=" },
- { 0x1A, "maxlength=" },
- { 0x1B, "method='get'" },
- { 0x1C, "method='post'" },
- { 0x1D, "mode='nowrap'" },
- { 0x1E, "mode='wrap'" },
- { 0x1F, "multiple='false'" },
- { 0x20, "multiple='true'" },
- { 0x21, "name=" },
- { 0x22, "newcontext='false'" },
- { 0x23, "newcontext='true'" },
- { 0x24, "onpick=" },
- { 0x25, "onenterbackward=" },
- { 0x26, "onenterforward=" },
- { 0x27, "ontimer=" },
- { 0x28, "optional='false'" },
- { 0x29, "optional='true'" },
- { 0x2A, "path=" },
- /* 0x2B -- 0x2D */
- { 0x2E, "scheme=" },
- { 0x2F, "sendreferer='false'" },
- { 0x30, "sendreferer='true'" },
- { 0x31, "size=" },
- { 0x32, "src=" },
- { 0x33, "ordered='false'" },
- { 0x34, "ordered='true'" },
- { 0x35, "tabindex=" },
- { 0x36, "title=" },
- { 0x37, "type=" },
- { 0x38, "type='accept'" },
- { 0x39, "type='delet…
Large files files are truncated, but you can click here to view the full file