3 * Routines to dissect WTP component of WAP traffic.
5 * $Id: packet-wtp.c,v 1.42 2002/12/19 11:22:38 sahlberg Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * WAP dissector based on original work by Ben Fowler
12 * Updated by Neil Hunter <neil.hunter@energis-squared.com>
13 * WTLS support by Alexandre P. Ferreira (Splice IP)
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 #ifdef NEED_SNPRINTF_H
38 # include "snprintf.h"
43 #include <epan/packet.h>
44 #include "reassemble.h"
45 #include "packet-wap.h"
46 #include "packet-wtp.h"
47 #include "packet-wsp.h"
49 static const true_false_string continue_truth = {
54 static const true_false_string RID_truth = {
59 static const true_false_string TIDNew_truth = {
64 static const true_false_string tid_response_truth = {
69 static const true_false_string UP_truth = {
70 "User Acknowledgement required" ,
71 "User Acknowledgement optional"
74 static const true_false_string TVETOK_truth = {
79 static const value_string vals_pdu_type[] = {
85 { 5, "Segmented Invoke" },
86 { 6, "Segmented Result" },
87 { 7, "Negative Ack" },
91 static const value_string vals_transaction_trailer[] = {
92 { 0, "Not last packet" },
93 { 1, "Last packet of message" },
94 { 2, "Last packet of group" },
95 { 3, "Re-assembly not supported" },
99 static const value_string vals_version[] = {
107 static const value_string vals_abort_type[] = {
113 static const value_string vals_abort_reason_provider[] = {
115 { 0x01, "Protocol Error" },
116 { 0x02, "Invalid TID" },
117 { 0x03, "Not Implemented Class 2" },
118 { 0x04, "Not Implemented SAR" },
119 { 0x05, "Not Implemented User Acknowledgement" },
120 { 0x06, "WTP Version Zero" },
121 { 0x07, "Capacity Temporarily Exceeded" },
122 { 0x08, "No Response" },
123 { 0x09, "Message Too Large" },
127 static const value_string vals_transaction_classes[] = {
128 { 0x00, "Unreliable Invoke without Result" },
129 { 0x01, "Reliable Invoke without Result" },
130 { 0x02, "Reliable Invoke with Reliable Result" },
134 static const value_string vals_tpi_type[] = {
138 { 0x03, "Packet sequence number" },
139 { 0x04, "SDU boundary" },
140 { 0x05, "Frame boundary" },
144 static const value_string vals_tpi_opt[] = {
145 { 0x01, "Maximum receive unit" },
146 { 0x02, "Total message size" },
147 { 0x03, "Delay transmission timer" },
148 { 0x04, "Maximum group" },
149 { 0x05, "Current TID" },
150 { 0x06, "No cached TID" },
154 /* File scoped variables for the protocol and registered fields */
155 static int proto_wtp = HF_EMPTY;
157 /* These fields used by fixed part of header */
158 static int hf_wtp_header_sub_pdu_size = HF_EMPTY;
159 static int hf_wtp_header_flag_continue = HF_EMPTY;
160 static int hf_wtp_header_pdu_type = HF_EMPTY;
161 static int hf_wtp_header_flag_Trailer = HF_EMPTY;
162 static int hf_wtp_header_flag_RID = HF_EMPTY;
163 static int hf_wtp_header_flag_TID = HF_EMPTY;
164 static int hf_wtp_header_flag_TID_response = HF_EMPTY;
166 /* These fields used by Invoke packets */
167 static int hf_wtp_header_Inv_version = HF_EMPTY;
168 static int hf_wtp_header_Inv_flag_TIDNew = HF_EMPTY;
169 static int hf_wtp_header_Inv_flag_UP = HF_EMPTY;
170 static int hf_wtp_header_Inv_Reserved = HF_EMPTY;
171 static int hf_wtp_header_Inv_TransactionClass = HF_EMPTY;
174 static int hf_wtp_header_variable_part = HF_EMPTY;
175 static int hf_wtp_data = HF_EMPTY;
177 static int hf_wtp_tpi_type = HF_EMPTY;
178 static int hf_wtp_tpi_psn = HF_EMPTY;
179 static int hf_wtp_tpi_opt = HF_EMPTY;
180 static int hf_wtp_tpi_optval = HF_EMPTY;
181 static int hf_wtp_tpi_info = HF_EMPTY;
183 static int hf_wtp_header_Ack_flag_TVETOK = HF_EMPTY;
184 static int hf_wtp_header_Abort_type = HF_EMPTY;
185 static int hf_wtp_header_Abort_reason_provider = HF_EMPTY;
186 static int hf_wtp_header_Abort_reason_user = HF_EMPTY;
187 static int hf_wtp_header_sequence_number = HF_EMPTY;
188 static int hf_wtp_header_missing_packets = HF_EMPTY;
190 /* These fields used when reassembling WTP fragments */
191 static int hf_wtp_fragments = HF_EMPTY;
192 static int hf_wtp_fragment = HF_EMPTY;
193 static int hf_wtp_fragment_overlap = HF_EMPTY;
194 static int hf_wtp_fragment_overlap_conflict = HF_EMPTY;
195 static int hf_wtp_fragment_multiple_tails = HF_EMPTY;
196 static int hf_wtp_fragment_too_long_fragment = HF_EMPTY;
197 static int hf_wtp_fragment_error = HF_EMPTY;
199 /* Initialize the subtree pointers */
200 static gint ett_wtp = ETT_EMPTY;
201 static gint ett_header = ETT_EMPTY;
202 static gint ett_tpilist = ETT_EMPTY;
203 static gint ett_wsp_fragments = ETT_EMPTY;
204 static gint ett_wtp_fragment = ETT_EMPTY;
206 static const fragment_items wtp_frag_items = {
211 &hf_wtp_fragment_overlap,
212 &hf_wtp_fragment_overlap_conflict,
213 &hf_wtp_fragment_multiple_tails,
214 &hf_wtp_fragment_too_long_fragment,
215 &hf_wtp_fragment_error,
219 /* Handle for WSP dissector */
220 static dissector_handle_t wsp_handle;
225 static GHashTable *wtp_fragment_table = NULL;
228 wtp_defragment_init(void)
230 fragment_table_init(&wtp_fragment_table);
234 * Extract some bitfields
236 #define pdu_type(octet) (((octet) >> 3) & 0x0F) /* Note pdu type must not be 0x00 */
237 #define transaction_class(octet) ((octet) & 0x03) /* ......XX */
238 #define transmission_trailer(octet) (((octet) >> 1) & 0x01) /* ......X. */
240 static char retransmission_indicator(unsigned char octet)
242 switch (pdu_type(octet)) {
246 case SEGMENTED_INVOKE:
247 case SEGMENTED_RESULT:
249 return octet & 0x01; /* .......X */
259 wtp_handle_tpi(proto_tree *tree, tvbuff_t *tvb)
265 proto_item *subTree = NULL;
267 tByte = tvb_get_guint8(tvb, offset++);
268 tType = (tByte & 0x78) >> 3;
269 if (tByte & 0x04) /* Long TPI */
270 tLen = tvb_get_guint8(tvb, offset++);
273 subTree = proto_tree_add_uint(tree, hf_wtp_tpi_type,
274 tvb, 0, tvb_length(tvb), tType);
275 proto_item_add_subtree(subTree, ett_tpilist);
277 case 0x00: /* Error*/
280 case 0x01: /* Info */
281 /* Beware, untested case here */
282 proto_tree_add_item(subTree, hf_wtp_tpi_info,
283 tvb, offset, tLen, bo_little_endian);
285 case 0x02: /* Option */
286 proto_tree_add_item(subTree, hf_wtp_tpi_opt,
287 tvb, offset++, 1, bo_little_endian);
288 proto_tree_add_item(subTree, hf_wtp_tpi_optval,
289 tvb, offset, tLen - 1, bo_little_endian);
292 proto_tree_add_item(subTree, hf_wtp_tpi_psn,
293 tvb, offset, 1, bo_little_endian);
295 case 0x04: /* SDU boundary */
298 case 0x05: /* Frame boundary */
306 /* Code to actually dissect the packets */
308 dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
311 int offCur = 0; /* current offset from start of WTP data */
315 /* continuation flag */
316 unsigned char fCon; /* Continue flag */
317 unsigned char fRID; /* Re-transmission indicator*/
318 unsigned char fTTR = '\0'; /* Transmission trailer */
319 guint cbHeader = 0; /* Fixed header length */
320 guint vHeader = 0; /* Variable header length*/
323 /* Set up structures we'll need to add the protocol subtree and manage it */
325 proto_tree *wtp_tree = NULL;
328 char clsTransaction = ' ';
330 int numMissing = 0; /* Number of missing packets in a negative ack */
332 tvbuff_t *wsp_tvb = NULL;
333 fragment_data *fd_head = NULL;
334 guint8 psn = 0; /* Packet sequence number*/
335 guint16 TID = 0; /* Transaction-Id */
337 b0 = tvb_get_guint8 (tvb, offCur + 0);
338 /* Discover Concatenated PDUs */
340 guint c_fieldlen = 0; /* Length of length-field */
341 guint c_pdulen = 0; /* Length of conc. PDU */
344 ti = proto_tree_add_item(tree, proto_wtp,
345 tvb, offCur, 1, bo_little_endian);
346 wtp_tree = proto_item_add_subtree(ti, ett_wtp);
350 while (offCur < (int) tvb_reported_length(tvb)) {
351 b0 = tvb_get_guint8(tvb, offCur + 0);
354 c_pdulen = ((b0 & 0x7f) << 8) | tvb_get_guint8(tvb, offCur + 1);
360 proto_tree_add_item(wtp_tree, hf_wtp_header_sub_pdu_size,
361 tvb, offCur, c_fieldlen, bo_big_endian);
363 if (i > 1 && check_col(pinfo->cinfo, COL_INFO)) {
364 col_append_str(pinfo->cinfo, COL_INFO, ", ");
366 wsp_tvb = tvb_new_subset(tvb, offCur + c_fieldlen, -1, c_pdulen);
367 dissect_wtp_common(wsp_tvb, pinfo, wtp_tree);
368 offCur += c_fieldlen + c_pdulen;
374 fRID = retransmission_indicator(b0);
377 /* Develop the string to put in the Info column */
378 cchInfo = snprintf(szInfo, sizeof( szInfo ), "WTP %s",
379 val_to_str(pdut, vals_pdu_type, "Unknown PDU type 0x%x"));
383 fTTR = transmission_trailer(b0);
384 TID = tvb_get_ntohs(tvb, offCur + 1);
386 clsTransaction = transaction_class(tvb_get_guint8(tvb, offCur + 3));
387 snprintf(szInfo + cchInfo, sizeof(szInfo) - cchInfo,
388 " Class %d", clsTransaction);
392 case SEGMENTED_INVOKE:
393 case SEGMENTED_RESULT:
394 fTTR = transmission_trailer(b0);
395 TID = tvb_get_ntohs(tvb, offCur + 1);
396 psn = tvb_get_guint8(tvb, offCur + 3);
405 fTTR = transmission_trailer(b0);
406 TID = tvb_get_ntohs(tvb, offCur + 1);
416 /* Variable number of missing packets */
417 numMissing = tvb_get_guint8(tvb, offCur + 3);
418 cbHeader = numMissing + 4;
425 strcat( szInfo, " R" );
427 if (fCon) { /* Scan variable part (TPI's), */
428 /* determine length of it */
433 tByte = tvb_get_guint8(tvb, offCur + cbHeader + vHeader);
435 if (tByte & 0x04) /* Long format */
436 vHeader = vHeader + tvb_get_guint8(tvb,
437 offCur + cbHeader + vHeader + 1) + 2;
439 vHeader = vHeader + (tByte & 0x03) + 1;
444 fprintf( stderr, "dissect_wtp: cbHeader = %d\n", cbHeader );
447 /* Only update "Info" column when no data in this PDU will
448 * be handed off to a subsequent dissector.
450 if (check_col(pinfo->cinfo, COL_INFO) &&
451 ((tvb_length_remaining(tvb, offCur + cbHeader + vHeader) <= 0) ||
452 (pdut == ACK) || (pdut==NEGATIVE_ACK) || (pdut==ABORT)) ) {
454 fprintf(stderr, "dissect_wtp: (6) About to set info_col header to %s\n", szInfo);
456 col_append_str(pinfo->cinfo, COL_INFO, szInfo);
458 /* In the interest of speed, if "tree" is NULL, don't do any work not
459 necessary to generate protocol tree items. */
462 fprintf(stderr, "dissect_wtp: cbHeader = %d\n", cbHeader);
464 ti = proto_tree_add_item(tree, proto_wtp, tvb, offCur, cbHeader + vHeader, bo_little_endian);
466 fprintf(stderr, "dissect_wtp: (7) Returned from proto_tree_add_item\n");
468 wtp_tree = proto_item_add_subtree(ti, ett_wtp);
470 /* Code to process the packet goes here */
472 fprintf(stderr, "dissect_wtp: cbHeader = %d\n", cbHeader);
473 fprintf(stderr, "dissect_wtp: offCur = %d\n", offCur);
475 /* Add common items: only CON and PDU Type */
478 hf_wtp_header_flag_continue, /* id */
480 offCur, /* start of highlight */
481 1, /* length of highlight*/
484 proto_tree_add_item(wtp_tree, hf_wtp_header_pdu_type, tvb, offCur, 1, bo_little_endian);
488 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian);
489 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
490 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
491 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
493 proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_version , tvb, offCur + 3, 1, bo_little_endian);
494 proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_flag_TIDNew, tvb, offCur + 3, 1, bo_little_endian);
495 proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_flag_UP, tvb, offCur + 3, 1, bo_little_endian);
496 proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_Reserved, tvb, offCur + 3, 1, bo_little_endian);
497 proto_tree_add_item(wtp_tree, hf_wtp_header_Inv_TransactionClass, tvb, offCur + 3, 1, bo_little_endian);
501 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian);
502 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
503 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
504 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
508 proto_tree_add_item(wtp_tree, hf_wtp_header_Ack_flag_TVETOK, tvb, offCur, 1, bo_big_endian);
510 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
511 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
512 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
516 abortType = tvb_get_guint8 (tvb, offCur) & 0x07;
517 proto_tree_add_item(wtp_tree, hf_wtp_header_Abort_type , tvb, offCur , 1, bo_little_endian);
518 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
519 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
521 if (abortType == PROVIDER)
523 proto_tree_add_item( wtp_tree, hf_wtp_header_Abort_reason_provider , tvb, offCur + 3 , 1, bo_little_endian);
525 else if (abortType == USER)
527 proto_tree_add_item(wtp_tree, hf_wtp_header_Abort_reason_user , tvb, offCur + 3 , 1, bo_little_endian);
531 case SEGMENTED_INVOKE:
532 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian);
533 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
534 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
535 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
537 proto_tree_add_item(wtp_tree, hf_wtp_header_sequence_number , tvb, offCur + 3, 1, bo_little_endian);
540 case SEGMENTED_RESULT:
541 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian);
542 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
543 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
544 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
546 proto_tree_add_item(wtp_tree, hf_wtp_header_sequence_number , tvb, offCur + 3, 1, bo_little_endian);
550 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian);
551 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian);
552 proto_tree_add_item(wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian);
554 proto_tree_add_item(wtp_tree, hf_wtp_header_missing_packets , tvb, offCur + 3, 1, bo_little_endian);
555 /* Iterate through missing packets */
556 for (i = 0; i < numMissing; i++)
558 proto_tree_add_item(wtp_tree, hf_wtp_header_sequence_number, tvb, offCur + i, 1, bo_little_endian);
565 if (fCon) { /* Now, analyze variable part */
568 unsigned char tpiLen;
571 vHeader = 0; /* Start scan all over */
574 tByte = tvb_get_guint8(tvb, offCur + cbHeader + vHeader);
576 if (tByte & 0x04) /* Long TPI */
577 tpiLen = 2 + tvb_get_guint8(tvb,
578 offCur + cbHeader + vHeader + 1);
580 tpiLen = 1 + (tByte & 0x03);
581 tmp_tvb = tvb_new_subset(tvb, offCur + cbHeader + vHeader,
583 wtp_handle_tpi(wtp_tree, tmp_tvb);
587 /* There is no variable part */
588 } /* End of variable part of header */
591 fprintf(stderr, "dissect_wtp: (4) tree was %p\n", tree);
595 * Any remaining data ought to be WSP data (if not WTP ACK, NACK
596 * or ABORT pdu), so hand off (defragmented) to the WSP dissector
598 if ((tvb_length_remaining(tvb, offCur + cbHeader + vHeader) > 0) &&
599 ! ((pdut==ACK) || (pdut==NEGATIVE_ACK) || (pdut==ABORT)))
601 int dataOffset = offCur + cbHeader + vHeader;
602 guint32 dataLen = tvb_length_remaining(tvb, offCur + cbHeader + vHeader);
603 gboolean save_fragmented;
605 if ((pdut == SEGMENTED_INVOKE) || (pdut == SEGMENTED_RESULT) ||
606 (((pdut == INVOKE) || (pdut == RESULT)) && (!fTTR)))
607 { /* 1st part of segment */
608 save_fragmented = pinfo->fragmented;
609 pinfo->fragmented = TRUE;
610 fd_head = fragment_add_seq(tvb, dataOffset, pinfo, TID,
611 wtp_fragment_table, psn, dataLen, !fTTR);
612 if (fd_head != NULL) /* Reassembled */
614 wsp_tvb = tvb_new_real_data(fd_head->data,
617 tvb_set_child_real_data_tvbuff(tvb, wsp_tvb);
618 add_new_data_source(pinfo, wsp_tvb,
620 pinfo->fragmented = FALSE;
622 /* show all fragments */
623 show_fragment_seq_tree(fd_head, &wtp_frag_items,
624 wtp_tree, pinfo, wsp_tvb);
626 call_dissector(wsp_handle, wsp_tvb, pinfo, tree);
630 if (check_col(pinfo->cinfo, COL_INFO)) /* Won't call WSP so display */
631 col_append_str(pinfo->cinfo, COL_INFO, szInfo);
633 pinfo->fragmented = save_fragmented;
635 else /* Normal packet, call next dissector */
637 wsp_tvb = tvb_new_subset(tvb, dataOffset, -1, dataLen);
638 call_dissector(wsp_handle, wsp_tvb, pinfo, tree);
644 * Called directly from UDP.
645 * Put "WTP+WSP" into the "Protocol" column.
648 dissect_wtp_fromudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
650 if (check_col(pinfo->cinfo, COL_PROTOCOL))
651 col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTP+WSP" );
652 if (check_col(pinfo->cinfo, COL_INFO))
653 col_clear(pinfo->cinfo, COL_INFO);
655 dissect_wtp_common(tvb, pinfo, tree);
659 * Called from a higher-level WAP dissector, presumably WTLS.
660 * Put "WTLS+WSP+WTP" to the "Protocol" column.
662 * XXX - is this supposed to be called from WTLS? If so, we're not
665 * XXX - can this be called from any other dissector?
668 dissect_wtp_fromwap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
670 if (check_col(pinfo->cinfo, COL_PROTOCOL))
671 col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTLS+WTP+WSP" );
672 if (check_col(pinfo->cinfo, COL_INFO))
673 col_clear(pinfo->cinfo, COL_INFO);
675 dissect_wtp_common(tvb, pinfo, tree);
678 /* Register the protocol with Ethereal */
680 proto_register_wtp(void)
683 /* Setup list of header fields */
684 static hf_register_info hf[] = {
685 { &hf_wtp_header_sub_pdu_size,
688 FT_BYTES, BASE_HEX, NULL, 0x0,
689 "Size of Sub-PDU", HFILL
692 { &hf_wtp_header_flag_continue,
695 FT_BOOLEAN, 8, TFS( &continue_truth ), 0x80,
696 "Continue Flag", HFILL
699 { &hf_wtp_header_pdu_type,
702 FT_UINT8, BASE_HEX, VALS( vals_pdu_type ), 0x78,
706 { &hf_wtp_header_flag_Trailer,
709 FT_UINT8, BASE_HEX, VALS( vals_transaction_trailer ), 0x06,
710 "Trailer Flags", HFILL
713 { &hf_wtp_header_flag_RID,
714 { "Re-transmission Indicator",
716 FT_BOOLEAN, 8, TFS( &RID_truth ), 0x01,
717 "Re-transmission Indicator", HFILL
720 { &hf_wtp_header_flag_TID_response,
723 FT_BOOLEAN, 16, TFS( &tid_response_truth ), 0x8000,
724 "TID Response", HFILL
727 { &hf_wtp_header_flag_TID,
730 FT_UINT16, BASE_HEX, NULL, 0x7FFF,
731 "Transaction ID", HFILL
734 { &hf_wtp_header_Inv_version,
736 "wtp.header.version",
737 FT_UINT8, BASE_HEX, VALS( vals_version ), 0xC0,
741 { &hf_wtp_header_Inv_flag_TIDNew,
744 FT_BOOLEAN, 8, TFS( &TIDNew_truth ), 0x20,
748 { &hf_wtp_header_Inv_flag_UP,
751 FT_BOOLEAN, 8, TFS( &UP_truth ), 0x10,
755 { &hf_wtp_header_Inv_Reserved,
758 FT_UINT8, BASE_HEX, NULL, 0x0C,
762 { &hf_wtp_header_Inv_TransactionClass,
763 { "Transaction Class",
764 "wtp.inv.transaction_class",
765 FT_UINT8, BASE_HEX, VALS( vals_transaction_classes ), 0x03,
766 "Transaction Class", HFILL
769 { &hf_wtp_header_Ack_flag_TVETOK,
772 FT_BOOLEAN, 8, TFS( &TVETOK_truth ), 0x04,
773 "Tve/Tok flag", HFILL
776 { &hf_wtp_header_Abort_type,
779 FT_UINT8, BASE_HEX, VALS ( vals_abort_type ), 0x07,
783 { &hf_wtp_header_Abort_reason_provider,
785 "wtp.abort.reason.provider",
786 FT_UINT8, BASE_HEX, VALS ( vals_abort_reason_provider ), 0x00,
787 "Abort Reason", HFILL
790 /* Assume WSP is the user and use its reason codes */
791 { &hf_wtp_header_Abort_reason_user,
793 "wtp.abort.reason.user",
794 FT_UINT8, BASE_HEX, VALS ( vals_wsp_reason_codes ), 0x00,
795 "Abort Reason", HFILL
798 { &hf_wtp_header_sequence_number,
799 { "Packet Sequence Number",
800 "wtp.header.sequence",
801 FT_UINT8, BASE_DEC, NULL, 0x00,
802 "Packet Sequence Number", HFILL
805 { &hf_wtp_header_missing_packets,
807 "wtp.header.missing_packets",
808 FT_UINT8, BASE_DEC, NULL, 0x00,
809 "Missing Packets", HFILL
812 { &hf_wtp_header_variable_part,
813 { "Header: Variable part",
814 "wtp.header_variable_part",
815 FT_BYTES, BASE_HEX, NULL, 0x0,
816 "Variable part of the header", HFILL
822 FT_BYTES, BASE_HEX, NULL, 0x0,
829 FT_UINT8, BASE_HEX, VALS(vals_tpi_type), 0x00,
830 "Identification of the Transport Information Item", HFILL
834 { "Packet sequence number",
836 FT_UINT8, BASE_DEC, NULL, 0x00,
837 "Sequence number of this packet", HFILL
843 FT_UINT8, BASE_HEX, VALS(vals_tpi_opt), 0x00,
844 "The given option for this TPI", HFILL
847 { &hf_wtp_tpi_optval,
850 FT_NONE, BASE_NONE, NULL, 0x00,
851 "The value that is supplied with this option", HFILL
857 FT_NONE, BASE_NONE, NULL, 0x00,
858 "The information being send by this TPI", HFILL
862 /* Fragment fields */
863 { &hf_wtp_fragment_overlap,
864 { "Fragment overlap",
865 "wtp.fragment.overlap",
866 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
867 "Fragment overlaps with other fragments", HFILL
870 { &hf_wtp_fragment_overlap_conflict,
871 { "Conflicting data in fragment overlap",
872 "wtp.fragment.overlap.conflict",
873 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
874 "Overlapping fragments contained conflicting data", HFILL
877 { &hf_wtp_fragment_multiple_tails,
878 { "Multiple tail fragments found",
879 "wtp.fragment.multipletails",
880 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
881 "Several tails were found when defragmenting the packet", HFILL
884 { &hf_wtp_fragment_too_long_fragment,
885 { "Fragment too long",
886 "wtp.fragment.toolongfragment",
887 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
888 "Fragment contained data past end of packet", HFILL
891 { &hf_wtp_fragment_error,
892 { "Defragmentation error",
893 "wtp.fragment.error",
894 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
895 "Defragmentation error due to illegal fragments", HFILL
901 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
902 "WTP Fragment", HFILL
908 FT_NONE, BASE_NONE, NULL, 0x0,
909 "WTP Fragments", HFILL
914 /* Setup protocol subtree array */
915 static gint *ett[] = {
923 /* Register the protocol name and description */
924 proto_wtp = proto_register_protocol(
925 "Wireless Transaction Protocol", /* protocol name for use by ethereal */
926 "WTP", /* short version of name */
927 "wap-wsp-wtp" /* Abbreviated protocol name, should Match IANA
928 < URL:http://www.isi.edu/in-notes/iana/assignments/port-numbers/ >
932 /* Required calls to register the header fields and subtrees used */
933 proto_register_field_array(proto_wtp, hf, array_length(hf));
934 proto_register_subtree_array(ett, array_length(ett));
936 register_dissector("wtp", dissect_wtp_fromwap, proto_wtp);
937 register_dissector("wtp-udp", dissect_wtp_fromudp, proto_wtp);
938 register_init_routine(wtp_defragment_init);
942 proto_reg_handoff_wtp(void)
944 dissector_handle_t wtp_fromudp_handle;
947 * Get a handle for the connection-oriented WSP dissector - if WTP
948 * PDUs have data, it is WSP.
950 wsp_handle = find_dissector("wsp-co");
952 wtp_fromudp_handle = find_dissector("wtp-udp");
953 dissector_add("udp.port", UDP_PORT_WTP_WSP, wtp_fromudp_handle);