* Refer to the AUTHORS file or the AUTHORS section in the man page
* for contacting the author(s) of this file.
*
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* WAP Binary XML decoding functionality provided by Olivier Biot.
- *
+ *
* 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:
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef DEBUG_wbxml
#define DebugLog(x) \
- printf("%s:%u: ", __FILE__, __LINE__); \
- printf x; \
- fflush(stdout)
+ g_print("%s:%u: ", __FILE__, __LINE__); \
+ g_print x
#else
#define DebugLog(x) ;
#endif
* 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,
guint32 data_len = tvb_get_guintvar(tvb, offset, length);
char *str = NULL;
- if ( (strcmp(token, "Code") == 0)
+ if ( token && ( (strcmp(token, "Code") == 0)
|| (strcmp(token, "ContentSize") == 0)
|| (strcmp(token, "MessageCount") == 0)
|| (strcmp(token, "Validity") == 0)
|| (strcmp(token, "ServerPollMin") == 0)
|| (strcmp(token, "TCPAddress") == 0)
|| (strcmp(token, "TCPPort") == 0)
- || (strcmp(token, "UDPPort") == 0) )
+ || (strcmp(token, "UDPPort") == 0) ) )
{
str = wv_integer_from_opaque(tvb, offset + *length, data_len);
}
- else if (strcmp(token, "DateTime") == 0)
+ else if ( token && ( strcmp(token, "DateTime") == 0) )
{
str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
}
guint32 data_len = tvb_get_guintvar(tvb, offset, length);
char *str = NULL;
- if ( (strcmp(token, "Code") == 0)
+ if ( token && ( (strcmp(token, "Code") == 0)
|| (strcmp(token, "ContentSize") == 0)
|| (strcmp(token, "MessageCount") == 0)
|| (strcmp(token, "Validity") == 0)
|| (strcmp(token, "ParserSize") == 0)
|| (strcmp(token, "ServerPollMin") == 0)
|| (strcmp(token, "TCPPort") == 0)
- || (strcmp(token, "UDPPort") == 0) )
+ || (strcmp(token, "UDPPort") == 0) ) )
{
str = wv_integer_from_opaque(tvb, offset + *length, data_len);
}
else
- if ( (strcmp(token, "DateTime") == 0)
- || (strcmp(token, "DeliveryTime") == 0) )
+ if ( token && ( (strcmp(token, "DateTime") == 0)
+ || (strcmp(token, "DeliveryTime") == 0) ) )
{
str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
}
guint32 data_len = tvb_get_guintvar(tvb, offset, length);
char *str = NULL;
- if ( (strcmp(token, "Code") == 0)
+ if ( token && ( (strcmp(token, "Code") == 0)
|| (strcmp(token, "ContentSize") == 0)
|| (strcmp(token, "MessageCount") == 0)
|| (strcmp(token, "Validity") == 0)
|| (strcmp(token, "TCPPort") == 0)
|| (strcmp(token, "UDPPort") == 0)
|| (strcmp(token, "HistoryPeriod") == 0)
- || (strcmp(token, "MaxWatcherList") == 0) )
+ || (strcmp(token, "MaxWatcherList") == 0) ) )
{
str = wv_integer_from_opaque(tvb, offset + *length, data_len);
}
else
- if ( (strcmp(token, "DateTime") == 0)
- || (strcmp(token, "DeliveryTime") == 0) )
+ if ( token && ( (strcmp(token, "DateTime") == 0)
+ || (strcmp(token, "DeliveryTime") == 0) ) )
{
str = wv_datetime_from_opaque(tvb, offset + *length, data_len);
}
guint32 data_len = tvb_get_guintvar(tvb, offset, length);
char *str = NULL;
- if ( (strcmp(token, "created") == 0)
- || (strcmp(token, "si-expires") == 0) )
+ if ( token && ( (strcmp(token, "created") == 0)
+ || (strcmp(token, "si-expires") == 0) ) )
{
str = date_time_from_opaque(tvb, offset + *length, data_len);
}
guint32 data_len = tvb_get_guintvar(tvb, offset, length);
char *str = NULL;
- if ( (strcmp(token, "timestamp") == 0) )
+ if ( token && (strcmp(token, "timestamp") == 0) )
{
str = date_time_from_opaque(tvb, offset + *length, data_len);
}
const wbxml_decoding *map;
} wbxml_integer_list;
-/* For the decoding lists on the literal content type */
+/* For the decoding lists on the literal content type */
typedef struct _wbxml_literal_list {
const char *content_type;
discriminator_func_ptr discriminator; /* TODO */
{ 0x110e, "-//PHONE.COM//DTD MMC 2.0//EN" },
/* 0x110F -- 0x11FF: unassigned */
{ 0x1200, "-//3GPP2.COM//DTD IOTA 1.0//EN" },
-
+
{ 0x00, NULL }
};
{ 0x01, "1.1" }, /* WAP-135-WBXML */
{ 0x02, "1.2" }, /* WAP-154-WBXML */
{ 0x03, "1.3" }, /* WAP-192-WBXML */
-
+
{ 0x00, NULL }
};
/* WML 1.0
- *
+ *
* Wireless Markup Language
***************************************/
static char *
/* WML 1.1
- *
+ *
* Wireless Markup Language
***************************************/
/* WML 1.2
- *
+ *
* Wireless Markup Language
***************************************/
/* WML 1.3
- *
+ *
* Wireless Markup Language
***************************************/
/* SI 1.0
- *
+ *
* Service Indication
***************************************/
/* SL 1.0
- *
+ *
* Service Loading
***************************************/
/* CO 1.0
- *
+ *
* Cache Operation
***************************************/
/* EMN 1.0
- *
+ *
* Email Notification
***************************************/
/* SyncML 1.0
- *
+ *
* SyncML Representation Protocol
***************************************/
/* SyncML 1.1
- *
+ *
* SyncML Representation Protocol
***************************************/
/* CHANNEL 1.0
- *
+ *
* WTA Channel
***************************************/
/* application/x-wap-prov.browser-settings
* application/x-wap-prov.browser-bookmarks
- *
+ *
* Nokia OTA Provisioning document format
***************************************/
/* UAProf [WAP-248]
- *
+ *
* User-Agent Profile (used in profile-diff WSP header)
***************************************/
/* WV-CSP 1.0
- *
+ *
* Wireless Village Client Server Protocol
***************************************/
/* WV-CSP 1.1
- *
+ *
* Wireless Village Client Server Protocol
***************************************/
* NOTE - WV-CSP uses the EXT_T_0 token in a peculiar way: the mb_u_int32
* does *not* reference an offset in the string table, but it refers to
* the index in the following value_string.
- *
+ *
* Please note that:
* - Values 'T' and 'F' are Boolean values representing "True" and "False"
* (or "Yes" and "No" in some circumstances) respectively.
/* WV-CSP 1.2
- *
+ *
* Wireless Village Client Server Protocol
***************************************/
#ifdef Remove_this_comment_when_WV_CSP_will_be_an_approved_spec
},
{ NULL, NULL, NULL }
};
-
+
/* Returns a pointer to the WBXML token map for the given WBXML public
* identifier value (see WINA for a table with defined identifiers). */
DebugLog(("dissect_wbxml: Dissecting packet %u\n", pinfo->fd->num));
/* WBXML format
- *
+ *
* Version 1.0: version publicid strtbl BODY
* Version 1.x: version publicid charset strtbl BODY
*
/********************
* WBXML tag tokens *
********************
- *
+ *
* Bit Mask : Example
* -------------------
* 00.. .... : <tag />
* atrtribute1="value1"
* atrtribute2="value2"
* />
- *
+ *
* 11.. .... : <tag
* atrtribute1="value1"
* atrtribute2="value2"
const char *tag_new_literal; /* Will contain the LITERAL tag identity */
guint8 parsing_tag_content = FALSE; /* Are we parsing content from a
tag with content: <x>Content</x>
-
+
The initial state is FALSE.
This state will trigger recursion. */
tag_save_literal = NULL; /* Prevents compiler warning */
"| END (Literal Tag) "
"| %s</%s>",
*level, *codepage_stag, Indent (*level),
- tag_save_literal);
+ tag_save_literal ? tag_save_literal : "");
}
(*level)--;
off++;
if (map->ext_t[peek & 0x03])
s = (map->ext_t[peek & 0x03])(tvb, index, str_tbl);
else
- s = g_strdup_printf("EXT_T_%1x (%s)", peek & 0x03,
+ s = g_strdup_printf("EXT_T_%1x (%s)", peek & 0x03,
map_token (map->global, 0, peek));
proto_tree_add_text (tree, tvb, off, 1+len,
" %3d | Tag | T %3d "
* For efficiency reasons, we store the literal tag representation
* for known tags too, so we can easily close the tag without the
* need of a new lookup and avoiding storage of token codepage.
- *
+ *
* There are 4 possibilities:
*
* 1. Known tag followed by a known tag
off, str_tbl, *level, codepage_attr, map);
/* Check that there is still room in packet */
off += len;
- if (off >= tvb_len) {
+ if (off > tvb_len) {
DebugLog(("STAG: level = %u, ThrowException: len = %u (short frame)\n", *level, off - offset));
/*
* TODO - Do we need to free g_malloc()ed memory?
char *tag_new_buf=NULL; /* Will contain "tag_0x%02X" */
guint8 parsing_tag_content = FALSE; /* Are we parsing content from a
tag with content: <x>Content</x>
-
+
The initial state is FALSE.
This state will trigger recursion. */
tag_save_literal = NULL; /* Prevents compiler warning */
"| END (Literal Tag) "
"| %s</%s>",
*level, *codepage_stag, Indent (*level),
- tag_save_literal);
+ tag_save_literal ? tag_save_literal : "");
}
(*level)--;
off++;
* For efficiency reasons, we store the literal tag representation
* for known tags too, so we can easily close the tag without the
* need of a new lookup and avoiding storage of token codepage.
- *
+ *
* There are 4 possibilities:
*
* 1. Known tag followed by a known tag
* 0... .... : attr= (attribute name)
* href='http://' (attribute name with start of attribute value)
* 1... .... : 'www.' (attribute value, or part of it)
- *
+ *
*/
* recreated. Indentation is generated in order to ease reading.
*
* This function performs attribute list parsing.
- *
+ *
* The wbxml_decoding entry *map contains the actual token mapping.
*
* NOTE: See above for known token mappings.
if (map->ext_t[peek & 0x03])
s = (map->ext_t[peek & 0x03])(tvb, index, str_tbl);
else
- s = g_strdup_printf("EXT_T_%1x (%s)", peek & 0x03,
+ s = g_strdup_printf("EXT_T_%1x (%s)", peek & 0x03,
map_token (map->global, 0, peek));
proto_tree_add_text (tree, tvb, off, 1+len,
* is performed.
*
* This function performs attribute list parsing.
- *
+ *
* NOTE: Code page switches not yet processed in the code!
*/
static guint32
}
-/****************** Register the protocol with Ethereal ******************/
+/****************** Register the protocol with Wireshark ******************/
/* This format is required because a script is used to build the C function
/* Register the WSP content types (defined as protocol port)
* for WBXML dissection.
- *
+ *
* See http://www.wapforum.org/wina/wsp-content-type.htm
- *
+ *
* As the media types for WSP and HTTP are the same, the WSP dissector
* uses the same string dissector table as the HTTP protocol.
*/
/**** Well-known WBXML WSP Content-Type values ****/
-
+
dissector_add_string("media_type",
"application/vnd.wap.wmlc", wbxml_handle);
dissector_add_string("media_type",