2001-02-13 00:17:55 +00:00
|
|
|
/* packet-wtp.c
|
2000-11-04 03:30:41 +00:00
|
|
|
*
|
|
|
|
* Routines to dissect WTP component of WAP traffic.
|
|
|
|
*
|
2002-08-09 09:12:51 +00:00
|
|
|
* $Id: packet-wtp.c,v 1.38 2002/08/09 09:12:51 guy Exp $
|
2000-11-04 03:30:41 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2001-12-03 02:10:31 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
|
|
|
* Copyright 1998 Gerald Combs
|
2000-11-04 03:30:41 +00:00
|
|
|
*
|
2001-02-13 00:17:55 +00:00
|
|
|
* WAP dissector based on original work by Ben Fowler
|
|
|
|
* Updated by Neil Hunter <neil.hunter@energis-squared.com>
|
|
|
|
* WTLS support by Alexandre P. Ferreira (Splice IP)
|
|
|
|
*
|
2000-11-04 03:30:41 +00:00
|
|
|
* 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 HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#ifdef NEED_SNPRINTF_H
|
|
|
|
# include "snprintf.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2002-01-04 20:20:08 +00:00
|
|
|
#include "reassemble.h"
|
2000-11-04 03:30:41 +00:00
|
|
|
#include "packet-wap.h"
|
|
|
|
#include "packet-wtp.h"
|
|
|
|
#include "packet-wsp.h"
|
|
|
|
|
|
|
|
static const true_false_string continue_truth = {
|
2002-08-09 09:12:51 +00:00
|
|
|
"TPI Present" ,
|
|
|
|
"No TPI"
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string RID_truth = {
|
2002-08-09 09:12:51 +00:00
|
|
|
"Re-Transmission",
|
|
|
|
"First transmission"
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string TIDNew_truth = {
|
2002-08-09 09:12:51 +00:00
|
|
|
"TID is new" ,
|
|
|
|
"TID is valid"
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string tid_response_truth = {
|
2002-08-09 09:12:51 +00:00
|
|
|
"Response" ,
|
|
|
|
"Original"
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string UP_truth = {
|
2002-08-09 09:12:51 +00:00
|
|
|
"User Acknowledgement required" ,
|
|
|
|
"User Acknowledgement optional"
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string TVETOK_truth = {
|
2002-08-09 09:12:51 +00:00
|
|
|
"True",
|
|
|
|
"False"
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vals_pdu_type[] = {
|
2002-08-09 09:12:51 +00:00
|
|
|
{ 0, "Not Allowed" },
|
|
|
|
{ 1, "Invoke" },
|
|
|
|
{ 2, "Result" },
|
|
|
|
{ 3, "Ack" },
|
|
|
|
{ 4, "Abort" },
|
|
|
|
{ 5, "Segmented Invoke" },
|
|
|
|
{ 6, "Segmented Result" },
|
|
|
|
{ 7, "Negative Ack" },
|
|
|
|
{ 0, NULL }
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
2001-09-10 21:54:08 +00:00
|
|
|
static const value_string vals_transaction_trailer[] = {
|
2002-08-09 09:12:51 +00:00
|
|
|
{ 0, "Not last packet" },
|
|
|
|
{ 1, "Last packet of message" },
|
|
|
|
{ 2, "Last packet of group" },
|
|
|
|
{ 3, "Re-assembly not supported" },
|
|
|
|
{ 0, NULL }
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vals_version[] = {
|
2002-08-09 09:12:51 +00:00
|
|
|
{ 0, "Current" },
|
|
|
|
{ 1, "Undefined" },
|
|
|
|
{ 2, "Undefined" },
|
|
|
|
{ 3, "Undefined" },
|
|
|
|
{ 0, NULL }
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vals_abort_type[] = {
|
2002-08-09 09:12:51 +00:00
|
|
|
{ 0, "Provider" },
|
|
|
|
{ 1, "User (WSP)" },
|
|
|
|
{ 0, NULL }
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vals_abort_reason_provider[] = {
|
2002-08-09 09:12:51 +00:00
|
|
|
{ 0x00, "Unknown" },
|
|
|
|
{ 0x01, "Protocol Error" },
|
|
|
|
{ 0x02, "Invalid TID" },
|
|
|
|
{ 0x03, "Not Implemented Class 2" },
|
|
|
|
{ 0x04, "Not Implemented SAR" },
|
|
|
|
{ 0x05, "Not Implemented User Acknowledgement" },
|
|
|
|
{ 0x06, "WTP Version Zero" },
|
|
|
|
{ 0x07, "Capacity Temporarily Exceeded" },
|
|
|
|
{ 0x08, "No Response" },
|
|
|
|
{ 0x09, "Message Too Large" },
|
|
|
|
{ 0x00, NULL }
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
2001-09-10 21:54:08 +00:00
|
|
|
static const value_string vals_transaction_classes[] = {
|
2002-08-09 09:12:51 +00:00
|
|
|
{ 0x00, "Unreliable Invoke without Result" },
|
|
|
|
{ 0x01, "Reliable Invoke without Result" },
|
|
|
|
{ 0x02, "Reliable Invoke with Reliable Result" },
|
|
|
|
{ 0x00, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vals_tpi_type[] = {
|
|
|
|
{ 0x00, "Error" },
|
|
|
|
{ 0x01, "Info" },
|
|
|
|
{ 0x02, "Option" },
|
|
|
|
{ 0x03, "Packet sequence number" },
|
|
|
|
{ 0x04, "SDU boundary" },
|
|
|
|
{ 0x05, "Frame boundary" },
|
|
|
|
{ 0x00, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vals_tpi_opt[] = {
|
|
|
|
{ 0x01, "Maximum receive unit" },
|
|
|
|
{ 0x02, "Total message size" },
|
|
|
|
{ 0x03, "Delay transmission timer" },
|
|
|
|
{ 0x04, "Maximum group" },
|
|
|
|
{ 0x05, "Current TID" },
|
|
|
|
{ 0x06, "No cached TID" },
|
|
|
|
{ 0x00, NULL }
|
2001-09-10 21:54:08 +00:00
|
|
|
};
|
|
|
|
|
2000-11-04 03:30:41 +00:00
|
|
|
/* File scoped variables for the protocol and registered fields */
|
2002-08-09 09:12:51 +00:00
|
|
|
static int proto_wtp = HF_EMPTY;
|
2000-11-04 03:30:41 +00:00
|
|
|
|
|
|
|
/* These fields used by fixed part of header */
|
2002-08-09 09:12:51 +00:00
|
|
|
static int hf_wtp_header_sub_pdu_size = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_flag_continue = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_pdu_type = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_flag_Trailer = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_flag_RID = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_flag_TID = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_flag_TID_response = HF_EMPTY;
|
2000-11-04 03:30:41 +00:00
|
|
|
|
|
|
|
/* These fields used by Invoke packets */
|
2002-08-09 09:12:51 +00:00
|
|
|
static int hf_wtp_header_Inv_version = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_Inv_flag_TIDNew = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_Inv_flag_UP = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_Inv_Reserved = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_Inv_TransactionClass = HF_EMPTY;
|
|
|
|
|
2000-11-04 03:30:41 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
static int hf_wtp_header_variable_part = HF_EMPTY;
|
|
|
|
static int hf_wtp_data = HF_EMPTY;
|
2000-11-04 03:30:41 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
static int hf_wtp_tpi_type = HF_EMPTY;
|
|
|
|
static int hf_wtp_tpi_psn = HF_EMPTY;
|
|
|
|
static int hf_wtp_tpi_opt = HF_EMPTY;
|
|
|
|
static int hf_wtp_tpi_optval = HF_EMPTY;
|
|
|
|
static int hf_wtp_tpi_info = HF_EMPTY;
|
2000-11-04 03:30:41 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
static int hf_wtp_header_Ack_flag_TVETOK = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_Abort_type = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_Abort_reason_provider = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_Abort_reason_user = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_sequence_number = HF_EMPTY;
|
|
|
|
static int hf_wtp_header_missing_packets = HF_EMPTY;
|
2000-11-04 03:30:41 +00:00
|
|
|
|
2002-03-27 07:44:33 +00:00
|
|
|
/* These fields used when reassembling WTP fragments */
|
2002-08-09 09:12:51 +00:00
|
|
|
static int hf_wtp_fragments = HF_EMPTY;
|
|
|
|
static int hf_wtp_fragment = HF_EMPTY;
|
|
|
|
static int hf_wtp_fragment_overlap = HF_EMPTY;
|
|
|
|
static int hf_wtp_fragment_overlap_conflict = HF_EMPTY;
|
|
|
|
static int hf_wtp_fragment_multiple_tails = HF_EMPTY;
|
|
|
|
static int hf_wtp_fragment_too_long_fragment = HF_EMPTY;
|
|
|
|
static int hf_wtp_fragment_error = HF_EMPTY;
|
2002-03-27 07:44:33 +00:00
|
|
|
|
2000-11-04 03:30:41 +00:00
|
|
|
/* Initialize the subtree pointers */
|
2002-08-09 09:12:51 +00:00
|
|
|
static gint ett_wtp = ETT_EMPTY;
|
|
|
|
static gint ett_header = ETT_EMPTY;
|
|
|
|
static gint ett_tpilist = ETT_EMPTY;
|
|
|
|
static gint ett_wsp_fragments = ETT_EMPTY;
|
|
|
|
static gint ett_wtp_fragment = ETT_EMPTY;
|
2000-11-04 03:30:41 +00:00
|
|
|
|
2002-06-07 10:11:41 +00:00
|
|
|
fragment_items wtp_frag_items = {
|
2002-08-09 09:12:51 +00:00
|
|
|
&ett_wtp_fragment,
|
|
|
|
&ett_wsp_fragments,
|
|
|
|
&hf_wtp_fragments,
|
|
|
|
&hf_wtp_fragment,
|
|
|
|
&hf_wtp_fragment_overlap,
|
|
|
|
&hf_wtp_fragment_overlap_conflict,
|
|
|
|
&hf_wtp_fragment_multiple_tails,
|
|
|
|
&hf_wtp_fragment_too_long_fragment,
|
|
|
|
&hf_wtp_fragment_error,
|
|
|
|
"fragments"
|
2002-06-07 10:11:41 +00:00
|
|
|
};
|
|
|
|
|
2001-02-13 00:17:55 +00:00
|
|
|
/* Handle for WSP dissector */
|
2001-01-03 08:42:48 +00:00
|
|
|
static dissector_handle_t wsp_handle;
|
|
|
|
|
2002-01-04 20:20:08 +00:00
|
|
|
/*
|
|
|
|
* reassembly of WSP
|
|
|
|
*/
|
|
|
|
static GHashTable *wtp_fragment_table = NULL;
|
|
|
|
|
|
|
|
static void
|
|
|
|
wtp_defragment_init(void)
|
|
|
|
{
|
2002-08-09 09:12:51 +00:00
|
|
|
fragment_table_init(&wtp_fragment_table);
|
2002-01-04 20:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Extract some bitfields
|
|
|
|
*/
|
|
|
|
#define pdu_type(octet) (((octet) >> 3) & 0x0F) /* Note pdu type must not be 0x00 */
|
|
|
|
#define transaction_class(octet) ((octet) & 0x03) /* ......XX */
|
|
|
|
#define transmission_trailer(octet) (((octet) >> 1) & 0x01) /* ......X. */
|
|
|
|
|
|
|
|
static char retransmission_indicator(unsigned char octet)
|
|
|
|
{
|
2002-08-09 09:12:51 +00:00
|
|
|
switch (pdu_type(octet)) {
|
|
|
|
case INVOKE:
|
|
|
|
case RESULT:
|
|
|
|
case ACK:
|
|
|
|
case SEGMENTED_INVOKE:
|
|
|
|
case SEGMENTED_RESULT:
|
|
|
|
case NEGATIVE_ACK:
|
|
|
|
return octet & 0x01; /* .......X */
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* dissect a TPI
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
wtp_handle_tpi(proto_tree *tree, tvbuff_t *tvb)
|
|
|
|
{
|
|
|
|
int offset = 0;
|
|
|
|
unsigned char tByte;
|
|
|
|
unsigned char tType;
|
|
|
|
unsigned char tLen;
|
|
|
|
proto_item *subTree = NULL;
|
|
|
|
|
|
|
|
tByte = tvb_get_guint8(tvb, offset++);
|
|
|
|
tType = (tByte & 0x78) >> 3;
|
|
|
|
if (tByte & 0x04) /* Long TPI */
|
|
|
|
tLen = tvb_get_guint8(tvb, offset++);
|
|
|
|
else
|
|
|
|
tLen = tByte & 0x03;
|
|
|
|
subTree = proto_tree_add_uint(tree, hf_wtp_tpi_type,
|
|
|
|
tvb, 0, tvb_length(tvb), tType);
|
|
|
|
proto_item_add_subtree(subTree, ett_tpilist);
|
|
|
|
switch (tType) {
|
|
|
|
case 0x00: /* Error*/
|
|
|
|
/* \todo */
|
|
|
|
break;
|
|
|
|
case 0x01: /* Info */
|
|
|
|
/* Beware, untested case here */
|
|
|
|
proto_tree_add_item(subTree, hf_wtp_tpi_info,
|
|
|
|
tvb, offset, tLen, bo_little_endian);
|
|
|
|
break;
|
|
|
|
case 0x02: /* Option */
|
|
|
|
proto_tree_add_item(subTree, hf_wtp_tpi_opt,
|
|
|
|
tvb, offset++, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(subTree, hf_wtp_tpi_optval,
|
|
|
|
tvb, offset, tLen - 1, bo_little_endian);
|
|
|
|
break;
|
|
|
|
case 0x03: /* PSN */
|
|
|
|
proto_tree_add_item(subTree, hf_wtp_tpi_psn,
|
|
|
|
tvb, offset, 1, bo_little_endian);
|
|
|
|
break;
|
|
|
|
case 0x04: /* SDU boundary */
|
|
|
|
/* \todo */
|
|
|
|
break;
|
|
|
|
case 0x05: /* Frame boundary */
|
|
|
|
/* \todo */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2002-01-04 20:20:08 +00:00
|
|
|
}
|
2000-11-04 03:30:41 +00:00
|
|
|
|
|
|
|
/* Code to actually dissect the packets */
|
2000-11-05 09:30:11 +00:00
|
|
|
static void
|
Don't base the protocol column setting in the WSP and WTP dissectors on
the port - instead, base it on whether the dissector was called directly
from UDP or called from another WAP dissector.
That way, if you explicitly say "decode this as WTP" because there was a
redirection (or if, in the future, the WSP dissector handles
redirections for you, although that won't handle the case of a capture
where the redirection wasn't captured), the column doesn't say "UDP", it
says the right thing.
Don't register the WTLS dissector by name - nobody calls it through a
handle.
Register the WTP dissector by name, as the WTLS dissector tries to get a
handle for it - although it doesn't actually call it, or the WSP
dissector, through a handle.
svn path=/trunk/; revision=3647
2001-07-03 09:53:22 +00:00
|
|
|
dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
2000-11-04 03:30:41 +00:00
|
|
|
{
|
2002-08-09 09:12:51 +00:00
|
|
|
char szInfo[50];
|
|
|
|
int offCur = 0; /* current offset from start of WTP data */
|
|
|
|
|
|
|
|
unsigned char b0;
|
|
|
|
|
|
|
|
/* continuation flag */
|
|
|
|
unsigned char fCon; /* Continue flag */
|
|
|
|
unsigned char fRID; /* Re-transmission indicator*/
|
|
|
|
unsigned char fTTR = '\0'; /* Transmission trailer */
|
|
|
|
guint cbHeader = 0; /* Fixed header length */
|
|
|
|
guint vHeader = 0; /* Variable header length*/
|
|
|
|
int abortType = 0;
|
|
|
|
|
|
|
|
/* Set up structures we'll need to add the protocol subtree and manage it */
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *wtp_tree = NULL;
|
|
|
|
|
|
|
|
char pdut;
|
|
|
|
char clsTransaction = ' ';
|
|
|
|
int cchInfo;
|
|
|
|
int numMissing = 0; /* Number of missing packets in a negative ack */
|
|
|
|
int i;
|
|
|
|
tvbuff_t *wsp_tvb = NULL;
|
|
|
|
fragment_data *fd_head = NULL;
|
|
|
|
guint8 psn = 0; /* Packet sequence number*/
|
|
|
|
guint16 TID = 0; /* Transaction-Id */
|
|
|
|
|
|
|
|
b0 = tvb_get_guint8 (tvb, offCur + 0);
|
|
|
|
/* Discover Concatenated PDUs */
|
|
|
|
if (b0 == 0) {
|
|
|
|
guint c_fieldlen = 0; /* Length of length-field */
|
|
|
|
guint c_pdulen = 0; /* Length of conc. PDU */
|
Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="
statements.
Move the setting of the Protocol column in various dissectors before
anything is fetched from the packet, and also clear the Info column at
that point in those and some other dissectors, so that if an exception
is thrown, the columns don't reflect the previous protocol.
Don't use
col_add_fstr(..., "%s", string);
Use
col_add_str(..., string);
as it does the same thing, but doesn't drag all the heavy *printf
machinery in.
Fix the DDTP dissector to set the Info column regardless of whether
we're building a protocol tree or not, and to set it to "Encrypted
payload" if the payload is encrypted. Also fix a typo in a field name.
Register the FTP data dissector as being associated with the FTP data
protocol, not the FTP protocol (the removed "CHECK_DISPLAY_AS_DATA()"
call checked "proto_ftp_data", and the removed "pinfo->current_proto ="
line set it to "FTP-DATA", so it should be associated with
"proto_ftp_data").
Make the H1 dissector check whether the frame has at least 2 bytes in it
before checking the first two bytes; heuristic dissectors must not throw
exceptions until they've accepted the packet as one of theirs.
Use "tvb_format_text()" rather than "tvb_get_ptr()" and "format_text()"
in some dissectors where the result of "tvb_get_ptr()" is used only in
the "format_text()" call.
In the Quake dissector, don't check whether there are at least 4 bytes
in the packet - if we return, the packet won't be dissected at all (it's
not as if some other dissector will get to handle it), and, if we don't
return, we'll throw an exception if there aren't at least 4 bytes in the
packet, so the packet will be marked as short or malformed, as
appropriate.
In the RIPng dissector, associate the table of strings for the command
field with the command field, so that the dissector doesn't have to
format the string for the protocol tree entry itself, and so that the
filter construction dialog box can let you select "Request" or
"Response" from a list rather than requiring you to know the values for
"Request" and "Response".
Make "dissect_rpc()" static, as it's called only through a heuristic
dissector list.
Use "col_set_str()" to set the COL_PROTOCOL column for RPC protocols;
the string used is from a table provided by the dissector, and is a
string constant.
Don't format the Info column for WSP into a buffer and then format that
buffer into the column with "%s" - "col_add_fstr()" can do the
formatting for you, without having to allocate your own buffer (or run
through the *printf machinery twice).
Don't fetch fields from the WTP packet until you're ready to use them,
so that you don't throw an exception before you even set the Protocol
column or clear the Info column.
Use "pinfo->destport", not "pi.destport", in the Zebra dissector when
checking whether the packet is a request or reply, and do the check by
comparing with "pinfo->match_port" rather than TCP_PORT_ZEBRA (so that
if the dissector is ever registered on another port, it still correctly
determines whether the packet is a request or reply - the Network
Monitor HTTP dissector has port 80 wired into its brain, which is a bit
irritating if you're trying to get it to dissect HTTP proxy traffic on
port 3128 or proxy administration UI traffic on port 3132).
svn path=/trunk/; revision=2931
2001-01-22 08:03:46 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_item(tree, proto_wtp,
|
|
|
|
tvb, offCur, 1, bo_little_endian);
|
|
|
|
wtp_tree = proto_item_add_subtree(ti, ett_wtp);
|
|
|
|
}
|
|
|
|
offCur = 1;
|
|
|
|
i = 1;
|
|
|
|
while (offCur < (int) tvb_reported_length(tvb)) {
|
|
|
|
b0 = tvb_get_guint8(tvb, offCur + 0);
|
|
|
|
if (b0 & 0x80) {
|
|
|
|
c_fieldlen = 2;
|
|
|
|
c_pdulen = ((b0 & 0x7f) << 8) | tvb_get_guint8(tvb, offCur + 1);
|
|
|
|
} else {
|
|
|
|
c_fieldlen = 1;
|
|
|
|
c_pdulen = b0;
|
|
|
|
}
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_sub_pdu_size,
|
|
|
|
tvb, offCur, c_fieldlen, bo_big_endian);
|
|
|
|
}
|
|
|
|
if (i > 1 && check_col(pinfo->cinfo, COL_INFO)) {
|
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, ", ");
|
|
|
|
}
|
|
|
|
wsp_tvb = tvb_new_subset(tvb, offCur + c_fieldlen, -1, c_pdulen);
|
|
|
|
dissect_wtp_common(wsp_tvb, pinfo, wtp_tree);
|
|
|
|
offCur += c_fieldlen + c_pdulen;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fCon = b0 & 0x80;
|
|
|
|
fRID = retransmission_indicator(b0);
|
|
|
|
pdut = pdu_type(b0);
|
|
|
|
|
|
|
|
/* Develop the string to put in the Info column */
|
|
|
|
cchInfo = snprintf(szInfo, sizeof( szInfo ), "WTP %s",
|
2002-01-04 20:20:08 +00:00
|
|
|
val_to_str(pdut, vals_pdu_type, "Unknown PDU type 0x%x"));
|
2000-11-04 03:30:41 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
switch (pdut) {
|
|
|
|
case INVOKE:
|
|
|
|
fTTR = transmission_trailer(b0);
|
|
|
|
TID = tvb_get_ntohs(tvb, offCur + 1);
|
|
|
|
psn = 0;
|
|
|
|
clsTransaction = transaction_class(tvb_get_guint8(tvb, offCur + 3));
|
|
|
|
snprintf(szInfo + cchInfo, sizeof(szInfo) - cchInfo,
|
|
|
|
" Class %d", clsTransaction);
|
|
|
|
cbHeader = 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SEGMENTED_INVOKE:
|
|
|
|
case SEGMENTED_RESULT:
|
|
|
|
fTTR = transmission_trailer(b0);
|
|
|
|
TID = tvb_get_ntohs(tvb, offCur + 1);
|
|
|
|
psn = tvb_get_guint8(tvb, offCur + 3);
|
|
|
|
cbHeader = 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ABORT:
|
|
|
|
cbHeader = 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RESULT:
|
|
|
|
fTTR = transmission_trailer(b0);
|
|
|
|
TID = tvb_get_ntohs(tvb, offCur + 1);
|
|
|
|
psn = 0;
|
|
|
|
cbHeader = 3;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACK:
|
|
|
|
cbHeader = 3;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NEGATIVE_ACK:
|
|
|
|
/* Variable number of missing packets */
|
|
|
|
numMissing = tvb_get_guint8(tvb, offCur + 3);
|
|
|
|
cbHeader = numMissing + 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
if (fRID) {
|
|
|
|
strcat( szInfo, " R" );
|
|
|
|
};
|
|
|
|
if (fCon) { /* Scan variable part (TPI's), */
|
|
|
|
/* determine length of it */
|
|
|
|
unsigned char tCon;
|
|
|
|
unsigned char tByte;
|
|
|
|
|
|
|
|
do {
|
|
|
|
tByte = tvb_get_guint8(tvb, offCur + cbHeader + vHeader);
|
|
|
|
tCon = tByte & 0x80;
|
|
|
|
if (tByte & 0x04) /* Long format */
|
|
|
|
vHeader = vHeader + tvb_get_guint8(tvb,
|
2001-09-11 14:36:33 +00:00
|
|
|
offCur + cbHeader + vHeader + 1) + 2;
|
2002-08-09 09:12:51 +00:00
|
|
|
else
|
|
|
|
vHeader = vHeader + (tByte & 0x03) + 1;
|
|
|
|
} while (tCon);
|
|
|
|
}
|
2000-11-04 03:30:41 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2002-08-09 09:12:51 +00:00
|
|
|
fprintf( stderr, "dissect_wtp: cbHeader = %d\n", cbHeader );
|
2000-11-04 03:30:41 +00:00
|
|
|
#endif
|
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
/* Only update "Info" column when no data in this PDU will
|
|
|
|
* be handed off to a subsequent dissector.
|
|
|
|
*/
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO) &&
|
|
|
|
((tvb_length_remaining(tvb, offCur + cbHeader + vHeader) <= 0) ||
|
|
|
|
(pdut == ACK) || (pdut==NEGATIVE_ACK) || (pdut==ABORT)) ) {
|
2000-11-04 03:30:41 +00:00
|
|
|
#ifdef DEBUG
|
2002-08-09 09:12:51 +00:00
|
|
|
fprintf(stderr, "dissect_wtp: (6) About to set info_col header to %s\n", szInfo);
|
2000-11-04 03:30:41 +00:00
|
|
|
#endif
|
2002-08-09 09:12:51 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, szInfo);
|
|
|
|
};
|
|
|
|
/* In the interest of speed, if "tree" is NULL, don't do any work not
|
|
|
|
necessary to generate protocol tree items. */
|
|
|
|
if (tree) {
|
2000-11-04 03:30:41 +00:00
|
|
|
#ifdef DEBUG
|
2002-08-09 09:12:51 +00:00
|
|
|
fprintf(stderr, "dissect_wtp: cbHeader = %d\n", cbHeader);
|
2000-11-04 03:30:41 +00:00
|
|
|
#endif
|
2002-08-09 09:12:51 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_wtp, tvb, offCur, cbHeader + vHeader, bo_little_endian);
|
2000-11-04 03:30:41 +00:00
|
|
|
#ifdef DEBUG
|
2002-08-09 09:12:51 +00:00
|
|
|
fprintf(stderr, "dissect_wtp: (7) Returned from proto_tree_add_item\n");
|
2000-11-04 03:30:41 +00:00
|
|
|
#endif
|
2002-08-09 09:12:51 +00:00
|
|
|
wtp_tree = proto_item_add_subtree(ti, ett_wtp);
|
2000-11-04 03:30:41 +00:00
|
|
|
|
|
|
|
/* Code to process the packet goes here */
|
|
|
|
#ifdef DEBUG
|
2002-08-09 09:12:51 +00:00
|
|
|
fprintf(stderr, "dissect_wtp: cbHeader = %d\n", cbHeader);
|
|
|
|
fprintf(stderr, "dissect_wtp: offCur = %d\n", offCur);
|
2002-04-05 09:29:15 +00:00
|
|
|
#endif
|
2002-08-09 09:12:51 +00:00
|
|
|
/* Add common items: only CON and PDU Type */
|
|
|
|
proto_tree_add_item(
|
|
|
|
wtp_tree, /* tree */
|
|
|
|
hf_wtp_header_flag_continue, /* id */
|
|
|
|
tvb,
|
|
|
|
offCur, /* start of highlight */
|
|
|
|
1, /* length of highlight*/
|
|
|
|
b0 /* value */
|
|
|
|
);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_pdu_type, tvb, offCur, 1, bo_little_endian);
|
|
|
|
|
|
|
|
switch(pdut) {
|
|
|
|
case INVOKE:
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_version , tvb, offCur + 3, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_flag_TIDNew, tvb, offCur + 3, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_flag_UP, tvb, offCur + 3, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_Reserved, tvb, offCur + 3, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_TransactionClass, tvb, offCur + 3, 1, bo_little_endian);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RESULT:
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACK:
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_Ack_flag_TVETOK, tvb, offCur, 1, bo_big_endian);
|
|
|
|
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ABORT:
|
|
|
|
abortType = tvb_get_guint8 (tvb, offCur) & 0x07;
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_Abort_type , tvb, offCur , 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
|
|
|
|
if (abortType == PROVIDER)
|
|
|
|
{
|
|
|
|
proto_tree_add_item( wtp_tree, hf_wtp_header_Abort_reason_provider , tvb, offCur + 3 , 1, bo_little_endian);
|
|
|
|
}
|
|
|
|
else if (abortType == USER)
|
|
|
|
{
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_Abort_reason_user , tvb, offCur + 3 , 1, bo_little_endian);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SEGMENTED_INVOKE:
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_sequence_number , tvb, offCur + 3, 1, bo_little_endian);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SEGMENTED_RESULT:
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_sequence_number , tvb, offCur + 3, 1, bo_little_endian);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NEGATIVE_ACK:
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
|
|
|
|
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_missing_packets , tvb, offCur + 3, 1, bo_little_endian);
|
|
|
|
/* Iterate through missing packets */
|
|
|
|
for (i = 0; i < numMissing; i++)
|
|
|
|
{
|
|
|
|
proto_tree_add_item(wtp_tree, hf_wtp_header_sequence_number, tvb, offCur + i, 1, bo_little_endian);
|
2000-11-04 03:30:41 +00:00
|
|
|
}
|
2002-08-09 09:12:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
if (fCon) { /* Now, analyze variable part */
|
|
|
|
unsigned char tCon;
|
|
|
|
unsigned char tByte;
|
|
|
|
unsigned char tpiLen;
|
|
|
|
tvbuff_t *tmp_tvb;
|
|
|
|
|
|
|
|
vHeader = 0; /* Start scan all over */
|
|
|
|
|
|
|
|
do {
|
|
|
|
tByte = tvb_get_guint8(tvb, offCur + cbHeader + vHeader);
|
|
|
|
tCon = tByte & 0x80;
|
|
|
|
if (tByte & 0x04) /* Long TPI */
|
|
|
|
tpiLen = 2 + tvb_get_guint8(tvb,
|
|
|
|
offCur + cbHeader + vHeader + 1);
|
|
|
|
else
|
|
|
|
tpiLen = 1 + (tByte & 0x03);
|
|
|
|
tmp_tvb = tvb_new_subset(tvb, offCur + cbHeader + vHeader,
|
|
|
|
tpiLen, tpiLen);
|
|
|
|
wtp_handle_tpi(wtp_tree, tmp_tvb);
|
|
|
|
vHeader += tpiLen;
|
|
|
|
} while (tCon);
|
2000-11-04 03:30:41 +00:00
|
|
|
} else {
|
2002-08-09 09:12:51 +00:00
|
|
|
/* There is no variable part */
|
|
|
|
} /* End of variable part of header */
|
|
|
|
} else {
|
2000-11-04 03:30:41 +00:00
|
|
|
#ifdef DEBUG
|
2002-08-09 09:12:51 +00:00
|
|
|
fprintf(stderr, "dissect_wtp: (4) tree was %p\n", tree);
|
2000-11-04 03:30:41 +00:00
|
|
|
#endif
|
2002-08-09 09:12:51 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Any remaining data ought to be WSP data (if not WTP ACK, NACK
|
|
|
|
* or ABORT pdu), so hand off (defragmented) to the WSP dissector
|
|
|
|
*/
|
|
|
|
if ((tvb_length_remaining(tvb, offCur + cbHeader + vHeader) > 0) &&
|
|
|
|
! ((pdut==ACK) || (pdut==NEGATIVE_ACK) || (pdut==ABORT)))
|
|
|
|
{
|
|
|
|
int dataOffset = offCur + cbHeader + vHeader;
|
|
|
|
guint32 dataLen = tvb_length_remaining(tvb, offCur + cbHeader + vHeader);
|
|
|
|
gboolean save_fragmented;
|
|
|
|
|
|
|
|
if ((pdut == SEGMENTED_INVOKE) || (pdut == SEGMENTED_RESULT) ||
|
|
|
|
(((pdut == INVOKE) || (pdut == RESULT)) && (!fTTR)))
|
|
|
|
{ /* 1st part of segment */
|
|
|
|
save_fragmented = pinfo->fragmented;
|
|
|
|
pinfo->fragmented = TRUE;
|
|
|
|
fd_head = fragment_add_seq(tvb, dataOffset, pinfo, TID,
|
|
|
|
wtp_fragment_table, psn, dataLen, !fTTR);
|
|
|
|
if (fd_head != NULL) /* Reassembled */
|
|
|
|
{
|
|
|
|
wsp_tvb = tvb_new_real_data(fd_head->data,
|
|
|
|
fd_head->len,
|
|
|
|
fd_head->len);
|
|
|
|
tvb_set_child_real_data_tvbuff(tvb, wsp_tvb);
|
|
|
|
add_new_data_source(pinfo, wsp_tvb,
|
|
|
|
"Reassembled WTP");
|
|
|
|
pinfo->fragmented = FALSE;
|
|
|
|
|
|
|
|
/* show all fragments */
|
|
|
|
show_fragment_seq_tree(fd_head, &wtp_frag_items,
|
|
|
|
wtp_tree, pinfo, wsp_tvb);
|
|
|
|
|
|
|
|
call_dissector(wsp_handle, wsp_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) /* Won't call WSP so display */
|
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, szInfo);
|
|
|
|
}
|
|
|
|
pinfo->fragmented = save_fragmented;
|
2000-11-04 03:30:41 +00:00
|
|
|
}
|
2002-08-09 09:12:51 +00:00
|
|
|
else /* Normal packet, call next dissector */
|
2000-11-04 03:30:41 +00:00
|
|
|
{
|
2002-08-09 09:12:51 +00:00
|
|
|
wsp_tvb = tvb_new_subset(tvb, dataOffset, -1, dataLen);
|
|
|
|
call_dissector(wsp_handle, wsp_tvb, pinfo, tree);
|
2000-11-04 03:30:41 +00:00
|
|
|
}
|
2002-08-09 09:12:51 +00:00
|
|
|
}
|
2000-11-04 03:30:41 +00:00
|
|
|
}
|
|
|
|
|
Don't base the protocol column setting in the WSP and WTP dissectors on
the port - instead, base it on whether the dissector was called directly
from UDP or called from another WAP dissector.
That way, if you explicitly say "decode this as WTP" because there was a
redirection (or if, in the future, the WSP dissector handles
redirections for you, although that won't handle the case of a capture
where the redirection wasn't captured), the column doesn't say "UDP", it
says the right thing.
Don't register the WTLS dissector by name - nobody calls it through a
handle.
Register the WTP dissector by name, as the WTLS dissector tries to get a
handle for it - although it doesn't actually call it, or the WSP
dissector, through a handle.
svn path=/trunk/; revision=3647
2001-07-03 09:53:22 +00:00
|
|
|
/*
|
|
|
|
* Called directly from UDP.
|
|
|
|
* Put "WTP+WSP" into the "Protocol" column.
|
|
|
|
*/
|
2001-12-03 02:10:31 +00:00
|
|
|
static void
|
Don't base the protocol column setting in the WSP and WTP dissectors on
the port - instead, base it on whether the dissector was called directly
from UDP or called from another WAP dissector.
That way, if you explicitly say "decode this as WTP" because there was a
redirection (or if, in the future, the WSP dissector handles
redirections for you, although that won't handle the case of a capture
where the redirection wasn't captured), the column doesn't say "UDP", it
says the right thing.
Don't register the WTLS dissector by name - nobody calls it through a
handle.
Register the WTP dissector by name, as the WTLS dissector tries to get a
handle for it - although it doesn't actually call it, or the WSP
dissector, through a handle.
svn path=/trunk/; revision=3647
2001-07-03 09:53:22 +00:00
|
|
|
dissect_wtp_fromudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2002-08-09 09:12:51 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTP+WSP" );
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
Don't base the protocol column setting in the WSP and WTP dissectors on
the port - instead, base it on whether the dissector was called directly
from UDP or called from another WAP dissector.
That way, if you explicitly say "decode this as WTP" because there was a
redirection (or if, in the future, the WSP dissector handles
redirections for you, although that won't handle the case of a capture
where the redirection wasn't captured), the column doesn't say "UDP", it
says the right thing.
Don't register the WTLS dissector by name - nobody calls it through a
handle.
Register the WTP dissector by name, as the WTLS dissector tries to get a
handle for it - although it doesn't actually call it, or the WSP
dissector, through a handle.
svn path=/trunk/; revision=3647
2001-07-03 09:53:22 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
dissect_wtp_common(tvb, pinfo, tree);
|
Don't base the protocol column setting in the WSP and WTP dissectors on
the port - instead, base it on whether the dissector was called directly
from UDP or called from another WAP dissector.
That way, if you explicitly say "decode this as WTP" because there was a
redirection (or if, in the future, the WSP dissector handles
redirections for you, although that won't handle the case of a capture
where the redirection wasn't captured), the column doesn't say "UDP", it
says the right thing.
Don't register the WTLS dissector by name - nobody calls it through a
handle.
Register the WTP dissector by name, as the WTLS dissector tries to get a
handle for it - although it doesn't actually call it, or the WSP
dissector, through a handle.
svn path=/trunk/; revision=3647
2001-07-03 09:53:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called from a higher-level WAP dissector, presumably WTLS.
|
|
|
|
* Put "WTLS+WSP+WTP" to the "Protocol" column.
|
|
|
|
*
|
|
|
|
* XXX - is this supposed to be called from WTLS? If so, we're not
|
|
|
|
* calling it....
|
|
|
|
*
|
|
|
|
* XXX - can this be called from any other dissector?
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
dissect_wtp_fromwap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2002-08-09 09:12:51 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTLS+WTP+WSP" );
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
Don't base the protocol column setting in the WSP and WTP dissectors on
the port - instead, base it on whether the dissector was called directly
from UDP or called from another WAP dissector.
That way, if you explicitly say "decode this as WTP" because there was a
redirection (or if, in the future, the WSP dissector handles
redirections for you, although that won't handle the case of a capture
where the redirection wasn't captured), the column doesn't say "UDP", it
says the right thing.
Don't register the WTLS dissector by name - nobody calls it through a
handle.
Register the WTP dissector by name, as the WTLS dissector tries to get a
handle for it - although it doesn't actually call it, or the WSP
dissector, through a handle.
svn path=/trunk/; revision=3647
2001-07-03 09:53:22 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
dissect_wtp_common(tvb, pinfo, tree);
|
Don't base the protocol column setting in the WSP and WTP dissectors on
the port - instead, base it on whether the dissector was called directly
from UDP or called from another WAP dissector.
That way, if you explicitly say "decode this as WTP" because there was a
redirection (or if, in the future, the WSP dissector handles
redirections for you, although that won't handle the case of a capture
where the redirection wasn't captured), the column doesn't say "UDP", it
says the right thing.
Don't register the WTLS dissector by name - nobody calls it through a
handle.
Register the WTP dissector by name, as the WTLS dissector tries to get a
handle for it - although it doesn't actually call it, or the WSP
dissector, through a handle.
svn path=/trunk/; revision=3647
2001-07-03 09:53:22 +00:00
|
|
|
}
|
|
|
|
|
2000-11-04 03:30:41 +00:00
|
|
|
/* Register the protocol with Ethereal */
|
|
|
|
void
|
|
|
|
proto_register_wtp(void)
|
|
|
|
{
|
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
/* Setup list of header fields */
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_wtp_header_sub_pdu_size,
|
|
|
|
{ "Sub PDU size",
|
|
|
|
"wtp.sub_pdu_size",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0x0,
|
|
|
|
"Size of Sub-PDU", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_flag_continue,
|
|
|
|
{ "Continue Flag",
|
|
|
|
"wtp.continue_flag",
|
|
|
|
FT_BOOLEAN, 8, TFS( &continue_truth ), 0x80,
|
|
|
|
"Continue Flag", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_pdu_type,
|
|
|
|
{ "PDU Type",
|
|
|
|
"wtp.pdu_type",
|
|
|
|
FT_UINT8, BASE_HEX, VALS( vals_pdu_type ), 0x78,
|
|
|
|
"PDU Type", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_flag_Trailer,
|
|
|
|
{ "Trailer Flags",
|
|
|
|
"wtp.trailer_flags",
|
|
|
|
FT_UINT8, BASE_HEX, VALS( vals_transaction_trailer ), 0x06,
|
|
|
|
"Trailer Flags", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_flag_RID,
|
|
|
|
{ "Re-transmission Indicator",
|
|
|
|
"wtp.RID",
|
|
|
|
FT_BOOLEAN, 8, TFS( &RID_truth ), 0x01,
|
|
|
|
"Re-transmission Indicator", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_flag_TID_response,
|
|
|
|
{ "TID Response",
|
|
|
|
"wtp.TID.response",
|
|
|
|
FT_BOOLEAN, 16, TFS( &tid_response_truth ), 0x8000,
|
|
|
|
"TID Response", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_flag_TID,
|
|
|
|
{ "Transaction ID",
|
|
|
|
"wtp.TID",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x7FFF,
|
|
|
|
"Transaction ID", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_Inv_version,
|
|
|
|
{ "Version",
|
|
|
|
"wtp.header.version",
|
|
|
|
FT_UINT8, BASE_HEX, VALS( vals_version ), 0xC0,
|
|
|
|
"Version", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_Inv_flag_TIDNew,
|
|
|
|
{ "TIDNew",
|
|
|
|
"wtp.header.TIDNew",
|
|
|
|
FT_BOOLEAN, 8, TFS( &TIDNew_truth ), 0x20,
|
|
|
|
"TIDNew", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_Inv_flag_UP,
|
|
|
|
{ "U/P flag",
|
|
|
|
"wtp.header.UP",
|
|
|
|
FT_BOOLEAN, 8, TFS( &UP_truth ), 0x10,
|
|
|
|
"U/P Flag", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_Inv_Reserved,
|
|
|
|
{ "Reserved",
|
|
|
|
"wtp.inv.reserved",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0C,
|
|
|
|
"Reserved", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_Inv_TransactionClass,
|
|
|
|
{ "Transaction Class",
|
|
|
|
"wtp.inv.transaction_class",
|
|
|
|
FT_UINT8, BASE_HEX, VALS( vals_transaction_classes ), 0x03,
|
|
|
|
"Transaction Class", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_Ack_flag_TVETOK,
|
|
|
|
{ "Tve/Tok flag",
|
|
|
|
"wtp.ack.tvetok",
|
|
|
|
FT_BOOLEAN, 8, TFS( &TVETOK_truth ), 0x04,
|
|
|
|
"Tve/Tok flag", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_Abort_type,
|
|
|
|
{ "Abort Type",
|
|
|
|
"wtp.abort.type",
|
|
|
|
FT_UINT8, BASE_HEX, VALS ( vals_abort_type ), 0x07,
|
|
|
|
"Abort Type", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_Abort_reason_provider,
|
|
|
|
{ "Abort Reason",
|
|
|
|
"wtp.abort.reason.provider",
|
|
|
|
FT_UINT8, BASE_HEX, VALS ( vals_abort_reason_provider ), 0x00,
|
|
|
|
"Abort Reason", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/* Assume WSP is the user and use its reason codes */
|
|
|
|
{ &hf_wtp_header_Abort_reason_user,
|
|
|
|
{ "Abort Reason",
|
|
|
|
"wtp.abort.reason.user",
|
|
|
|
FT_UINT8, BASE_HEX, VALS ( vals_wsp_reason_codes ), 0x00,
|
|
|
|
"Abort Reason", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_sequence_number,
|
|
|
|
{ "Packet Sequence Number",
|
|
|
|
"wtp.header.sequence",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x00,
|
|
|
|
"Packet Sequence Number", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_missing_packets,
|
|
|
|
{ "Missing Packets",
|
|
|
|
"wtp.header.missing_packets",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x00,
|
|
|
|
"Missing Packets", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_header_variable_part,
|
|
|
|
{ "Header: Variable part",
|
|
|
|
"wtp.header_variable_part",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0x0,
|
|
|
|
"Variable part of the header", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_data,
|
|
|
|
{ "Data",
|
|
|
|
"wtp.header_data",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0x0,
|
|
|
|
"Data", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_tpi_type,
|
|
|
|
{ "TPI",
|
|
|
|
"wtp.tpi",
|
|
|
|
FT_UINT8, BASE_HEX, VALS(vals_tpi_type), 0x00,
|
|
|
|
"Identification of the Transport Information Item", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_tpi_psn,
|
|
|
|
{ "Packet sequence number",
|
|
|
|
"wtp.tpi.psn",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x00,
|
|
|
|
"Sequence number of this packet", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_tpi_opt,
|
|
|
|
{ "Option",
|
|
|
|
"wtp.tpi.opt",
|
|
|
|
FT_UINT8, BASE_HEX, VALS(vals_tpi_opt), 0x00,
|
|
|
|
"The given option for this TPI", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_tpi_optval,
|
|
|
|
{ "Option Value",
|
|
|
|
"wtp.tpi.opt.val",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0x00,
|
|
|
|
"The value that is supplied with this option", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_tpi_info,
|
|
|
|
{ "Information",
|
|
|
|
"wtp.tpi.info",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0x00,
|
|
|
|
"The information being send by this TPI", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/* Fragment fields */
|
|
|
|
{ &hf_wtp_fragment_overlap,
|
|
|
|
{ "Fragment overlap",
|
|
|
|
"wtp.fragment.overlap",
|
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"Fragment overlaps with other fragments", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_fragment_overlap_conflict,
|
|
|
|
{ "Conflicting data in fragment overlap",
|
|
|
|
"wtp.fragment.overlap.conflict",
|
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"Overlapping fragments contained conflicting data", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_fragment_multiple_tails,
|
|
|
|
{ "Multiple tail fragments found",
|
|
|
|
"wtp.fragment.multipletails",
|
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"Several tails were found when defragmenting the packet", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_fragment_too_long_fragment,
|
|
|
|
{ "Fragment too long",
|
|
|
|
"wtp.fragment.toolongfragment",
|
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"Fragment contained data past end of packet", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_fragment_error,
|
|
|
|
{ "Defragmentation error",
|
|
|
|
"wtp.fragment.error",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"Defragmentation error due to illegal fragments", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_fragment,
|
|
|
|
{ "WTP Fragment",
|
|
|
|
"wtp.fragment",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"WTP Fragment", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_wtp_fragments,
|
|
|
|
{ "WTP Fragments",
|
|
|
|
"wtp.fragments",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"WTP Fragments", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
2000-11-04 03:30:41 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_wtp,
|
|
|
|
&ett_header,
|
|
|
|
&ett_tpilist,
|
|
|
|
&ett_wsp_fragments,
|
|
|
|
&ett_wtp_fragment,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
|
|
|
proto_wtp = proto_register_protocol(
|
|
|
|
"Wireless Transaction Protocol", /* protocol name for use by ethereal */
|
|
|
|
"WTP", /* short version of name */
|
|
|
|
"wap-wsp-wtp" /* Abbreviated protocol name, should Match IANA
|
|
|
|
< URL:http://www.isi.edu/in-notes/iana/assignments/port-numbers/ >
|
|
|
|
*/
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Required calls to register the header fields and subtrees used */
|
|
|
|
proto_register_field_array(proto_wtp, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
register_dissector("wtp", dissect_wtp_fromwap, proto_wtp);
|
|
|
|
register_dissector("wtp-udp", dissect_wtp_fromudp, proto_wtp);
|
|
|
|
register_init_routine(wtp_defragment_init);
|
2000-11-04 03:30:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_wtp(void)
|
|
|
|
{
|
2002-08-09 09:12:51 +00:00
|
|
|
dissector_handle_t wtp_fromudp_handle;
|
2001-12-03 04:00:26 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
/*
|
|
|
|
* Get a handle for the connection-oriented WSP dissector - if WTP
|
|
|
|
* PDUs have data, it is WSP.
|
|
|
|
*/
|
|
|
|
wsp_handle = find_dissector("wsp-co");
|
2001-01-03 08:42:48 +00:00
|
|
|
|
2002-08-09 09:12:51 +00:00
|
|
|
wtp_fromudp_handle = find_dissector("wtp-udp");
|
|
|
|
dissector_add("udp.port", UDP_PORT_WTP_WSP, wtp_fromudp_handle);
|
2000-11-04 03:30:41 +00:00
|
|
|
}
|