3 * Routines to dissect WTP component of WAP traffic.
5 * $Id: packet-wtp.c,v 1.32 2002/04/17 08:30:17 guy 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 HAVE_SYS_TYPES_H
38 # include <sys/types.h>
41 #ifdef HAVE_NETINET_IN_H
42 # include <netinet/in.h>
45 #ifdef NEED_SNPRINTF_H
51 # include "snprintf.h"
56 #include <epan/packet.h>
57 #include "reassemble.h"
58 #include "packet-wap.h"
59 #include "packet-wtp.h"
60 #include "packet-wsp.h"
62 static const true_false_string continue_truth = {
67 static const true_false_string RID_truth = {
72 static const true_false_string TIDNew_truth = {
77 static const true_false_string tid_response_truth = {
82 static const true_false_string UP_truth = {
83 "User Acknowledgement required" ,
84 "User Acknowledgement optional"
87 static const true_false_string TVETOK_truth = {
92 static const value_string vals_pdu_type[] = {
98 { 5, "Segmented Invoke" },
99 { 6, "Segmented Result" },
100 { 7, "Negative Ack" },
104 static const value_string vals_transaction_trailer[] = {
105 { 0, "Not last packet" },
106 { 1, "Last packet of message" },
107 { 2, "Last packet of group" },
108 { 3, "Re-assembly not supported" },
112 static const value_string vals_version[] = {
120 static const value_string vals_abort_type[] = {
126 static const value_string vals_abort_reason_provider[] = {
128 { 0x01, "Protocol Error" },
129 { 0x02, "Invalid TID" },
130 { 0x03, "Not Implemented Class 2" },
131 { 0x04, "Not Implemented SAR" },
132 { 0x05, "Not Implemented User Acknowledgement" },
133 { 0x06, "WTP Version Zero" },
134 { 0x07, "Capacity Temporarily Exceeded" },
135 { 0x08, "No Response" },
136 { 0x09, "Message Too Large" },
140 static const value_string vals_transaction_classes[] = {
141 { 0x00, "Unreliable Invoke without Result" },
142 { 0x01, "Reliable Invoke without Result" },
143 { 0x02, "Reliable Invoke with Reliable Result" },
147 /* File scoped variables for the protocol and registered fields */
148 static int proto_wtp = HF_EMPTY;
150 /* These fields used by fixed part of header */
151 static int hf_wtp_header_sub_pdu_size = HF_EMPTY;
152 static int hf_wtp_header_flag_continue = HF_EMPTY;
153 static int hf_wtp_header_pdu_type = HF_EMPTY;
154 static int hf_wtp_header_flag_Trailer = HF_EMPTY;
155 static int hf_wtp_header_flag_RID = HF_EMPTY;
156 static int hf_wtp_header_flag_TID = HF_EMPTY;
157 static int hf_wtp_header_flag_TID_response = HF_EMPTY;
159 /* These fields used by Invoke packets */
160 static int hf_wtp_header_Inv_version = HF_EMPTY;
161 static int hf_wtp_header_Inv_flag_TIDNew = HF_EMPTY;
162 static int hf_wtp_header_Inv_flag_UP = HF_EMPTY;
163 static int hf_wtp_header_Inv_Reserved = HF_EMPTY;
164 static int hf_wtp_header_Inv_TransactionClass = HF_EMPTY;
167 static int hf_wtp_header_variable_part = HF_EMPTY;
168 static int hf_wtp_data = HF_EMPTY;
170 static int hf_wtp_header_Ack_flag_TVETOK = HF_EMPTY;
171 static int hf_wtp_header_Abort_type = HF_EMPTY;
172 static int hf_wtp_header_Abort_reason_provider = HF_EMPTY;
173 static int hf_wtp_header_Abort_reason_user = HF_EMPTY;
174 static int hf_wtp_header_sequence_number = HF_EMPTY;
175 static int hf_wtp_header_missing_packets = HF_EMPTY;
177 /* These fields used when reassembling WTP fragments */
178 static int hf_wtp_fragments = HF_EMPTY;
179 static int hf_wtp_fragment = HF_EMPTY;
180 static int hf_wtp_fragment_overlap = HF_EMPTY;
181 static int hf_wtp_fragment_overlap_conflict = HF_EMPTY;
182 static int hf_wtp_fragment_multiple_tails = HF_EMPTY;
183 static int hf_wtp_fragment_too_long_fragment = HF_EMPTY;
184 static int hf_wtp_fragment_error = HF_EMPTY;
186 /* Initialize the subtree pointers */
187 static gint ett_wtp = ETT_EMPTY;
188 static gint ett_header = ETT_EMPTY;
189 static gint ett_wsp_fragments = ETT_EMPTY;
190 static gint ett_wtp_fragment = ETT_EMPTY;
192 /* Handle for WSP dissector */
193 static dissector_handle_t wsp_handle;
198 static GHashTable *wtp_fragment_table = NULL;
201 wtp_defragment_init(void)
203 fragment_table_init(&wtp_fragment_table);
207 * Extract some bitfields
209 #define pdu_type(octet) (((octet) >> 3) & 0x0F) /* Note pdu type must not be 0x00 */
210 #define transaction_class(octet) ((octet) & 0x03) /* ......XX */
211 #define transmission_trailer(octet) (((octet) >> 1) & 0x01) /* ......X. */
213 static char retransmission_indicator(unsigned char octet)
215 switch ( pdu_type(octet) ) {
219 case SEGMENTED_INVOKE:
220 case SEGMENTED_RESULT:
222 return octet & 0x01; /* .......X */
228 static void show_fragments(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
229 fragment_data *fd_head)
236 fi = proto_tree_add_item(tree, hf_wtp_fragments, tvb, 0, -1, FALSE);
237 ft = proto_item_add_subtree(fi, ett_wsp_fragments);
239 for (fd=fd_head->next; fd; fd=fd->next){
240 if (fd->flags & (FD_OVERLAP|FD_OVERLAPCONFLICT
241 |FD_MULTIPLETAILS|FD_TOOLONGFRAGMENT) ) {
242 /* this fragment has some flags set, create a subtree
243 for it and display the flags. */
244 proto_tree *fet=NULL;
245 proto_item *fei=NULL;
248 if (fd->flags & (FD_OVERLAPCONFLICT
249 |FD_MULTIPLETAILS|FD_TOOLONGFRAGMENT) ) {
250 hf = hf_wtp_fragment_error;
252 hf = hf_wtp_fragment;
254 fei = proto_tree_add_none_format(ft, hf,
255 tvb, offset, fd->len,
256 "Frame:%u payload:%u-%u",
257 fd->frame, offset, offset+fd->len-1);
258 fet = proto_item_add_subtree(fei, ett_wtp_fragment);
259 if (fd->flags&FD_OVERLAP) {
260 proto_tree_add_boolean(fet,
261 hf_wtp_fragment_overlap, tvb, 0, 0,
264 if (fd->flags&FD_OVERLAPCONFLICT) {
265 proto_tree_add_boolean(fet,
266 hf_wtp_fragment_overlap_conflict, tvb, 0, 0,
269 if (fd->flags&FD_MULTIPLETAILS) {
270 proto_tree_add_boolean(fet,
271 hf_wtp_fragment_multiple_tails, tvb, 0, 0,
274 if (fd->flags&FD_TOOLONGFRAGMENT) {
275 proto_tree_add_boolean(fet,
276 hf_wtp_fragment_too_long_fragment, tvb, 0, 0,
280 /* nothing of interest for this fragment */
281 proto_tree_add_none_format(ft, hf_wtp_fragment,
282 tvb, offset, fd->len,
283 "Frame:%u payload:%u-%u",
284 fd->frame, offset, offset+fd->len-1);
288 if (fd_head->flags & (FD_OVERLAPCONFLICT
289 |FD_MULTIPLETAILS|FD_TOOLONGFRAGMENT) ) {
290 if (check_col(pinfo->cinfo, COL_INFO))
291 col_set_str(pinfo->cinfo, COL_INFO, "[Illegal fragments]");
295 /* Code to actually dissect the packets */
297 dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
300 int offCur = 0; /* current offset from start of WTP data */
302 /* bytes at offset 0 - 3 */
304 unsigned char b0 = pd[offset + 0];
305 unsigned char b3 = pd[offset + 3];
309 /* continuation flag */
310 unsigned char fCon; /* Continue flag */
311 unsigned char fRID; /* Re-transmission indicator */
312 unsigned char fTTR = '\0'; /* Transmission trailer */
317 /* Set up structures we will need to add the protocol subtree and manage it */
319 proto_tree *wtp_tree = NULL;
322 char clsTransaction = ' ';
324 int numMissing = 0; /* Number of missing packets in a negative ack */
326 tvbuff_t *wsp_tvb = NULL;
327 fragment_data *fd_head = NULL;
328 guint8 psn = 0; /* Packet sequence number */
329 guint16 TID = 0; /* Transaction-Id */
331 b0 = tvb_get_guint8 (tvb, offCur + 0);
332 /* Discover Concatenated PDUs */
335 ti = proto_tree_add_item(tree, proto_wtp, tvb, offCur, 1, bo_little_endian);
336 wtp_tree = proto_item_add_subtree(ti, ett_wtp);
340 while (offCur < (int) tvb_reported_length (tvb)) {
341 b0 = tvb_get_guint8 (tvb, offCur + 0);
344 cbHeader = ((b0 & 0x7f) << 8) |
345 tvb_get_guint8 (tvb, offCur + 1);
351 proto_tree_add_item(wtp_tree, hf_wtp_header_sub_pdu_size, tvb, offCur, vHeader, bo_big_endian);
353 if (i > 1 && check_col(pinfo->cinfo, COL_INFO)) {
354 col_append_str (pinfo->cinfo, COL_INFO, ", ");
356 wsp_tvb = tvb_new_subset(tvb, offCur + vHeader, -1, cbHeader);
357 dissect_wtp_common (wsp_tvb, pinfo, wtp_tree);
358 offCur += vHeader + cbHeader;
364 fRID = retransmission_indicator( b0 );
365 pdut = pdu_type( b0 );
367 /* Develop the string to put in the Info column */
368 cchInfo = snprintf( szInfo, sizeof( szInfo ), "WTP %s",
369 val_to_str(pdut, vals_pdu_type, "Unknown PDU type 0x%x"));
373 fTTR = transmission_trailer( b0 );
374 TID = tvb_get_ntohs(tvb, offCur + 1);
376 clsTransaction = transaction_class( tvb_get_guint8 (tvb, offCur + 3) );
377 snprintf( szInfo + cchInfo, sizeof( szInfo ) - cchInfo, " Class %d", clsTransaction );
381 case SEGMENTED_INVOKE:
382 case SEGMENTED_RESULT:
383 fTTR = transmission_trailer( b0 );
384 TID = tvb_get_ntohs(tvb, offCur + 1);
385 psn = tvb_get_guint8(tvb, offCur + 3);
394 fTTR = transmission_trailer( b0 );
395 TID = tvb_get_ntohs(tvb, offCur + 1);
405 /* Variable number of missing packets */
406 numMissing = tvb_get_guint8 (tvb, offCur + 3);
407 cbHeader = numMissing + 4;
415 strcat( szInfo, " R" );
417 if( fCon ) { /* Scan variable part (TPI's) */
422 tByte = tvb_get_guint8(tvb, offCur + cbHeader + vHeader);
425 vHeader = vHeader + tvb_get_guint8(tvb,
426 offCur + cbHeader + vHeader + 1) + 2;
428 vHeader = vHeader + (tByte & 0x03) + 1;
433 fprintf( stderr, "dissect_wtp: cbHeader = %d\n", cbHeader );
436 /* This field shows up as the "Info" column in the display; you should make
437 it, if possible, summarize what's in the packet, so that a user looking
438 at the list of packets can tell what type of packet it is. */
439 if (check_col(pinfo->cinfo, COL_INFO) &&
440 (tvb_length_remaining(tvb, offCur + cbHeader + vHeader) <= 0)) {
442 fprintf( stderr, "dissect_wtp: (6) About to set info_col header to %s\n", szInfo );
444 col_append_str(pinfo->cinfo, COL_INFO, szInfo );
446 /* In the interest of speed, if "tree" is NULL, don't do any work not
447 necessary to generate protocol tree items. */
450 fprintf( stderr, "dissect_wtp: cbHeader = %d\n", cbHeader );
452 ti = proto_tree_add_item(tree, proto_wtp, tvb, offCur, cbHeader + vHeader, bo_little_endian);
454 fprintf( stderr, "dissect_wtp: (7) Returned from proto_tree_add_item\n" );
456 wtp_tree = proto_item_add_subtree(ti, ett_wtp);
458 /* Code to process the packet goes here */
461 fprintf( stderr, "dissect_wtp: cbHeader = %d\n", cbHeader );
462 fprintf( stderr, "dissect_wtp: offCur = %d\n", offCur );
464 /* Add common items: only CON and PDU Type */
467 hf_wtp_header_flag_continue, /* id */
469 offCur, /* start of high light */
470 1, /* length of high light */
473 proto_tree_add_item( wtp_tree, hf_wtp_header_pdu_type, tvb, offCur, 1, bo_little_endian );
477 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian );
478 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian );
479 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian );
480 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian );
482 proto_tree_add_item( wtp_tree, hf_wtp_header_Inv_version , tvb, offCur + 3, 1, bo_little_endian );
483 proto_tree_add_item( wtp_tree, hf_wtp_header_Inv_flag_TIDNew, tvb, offCur + 3, 1, bo_little_endian );
484 proto_tree_add_item( wtp_tree, hf_wtp_header_Inv_flag_UP, tvb, offCur + 3, 1, bo_little_endian );
485 proto_tree_add_item( wtp_tree, hf_wtp_header_Inv_Reserved, tvb, offCur + 3, 1, bo_little_endian );
486 proto_tree_add_item( wtp_tree, hf_wtp_header_Inv_TransactionClass, tvb, offCur + 3, 1, bo_little_endian );
490 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian );
491 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian );
492 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian );
493 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian );
497 proto_tree_add_item( wtp_tree, hf_wtp_header_Ack_flag_TVETOK, tvb, offCur, 1, bo_big_endian );
499 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian );
500 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian );
501 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian );
505 abortType = tvb_get_guint8 (tvb, offCur) & 0x07;
506 proto_tree_add_item( wtp_tree, hf_wtp_header_Abort_type , tvb, offCur , 1, bo_little_endian );
507 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian );
508 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian );
510 if (abortType == PROVIDER)
512 proto_tree_add_item( wtp_tree, hf_wtp_header_Abort_reason_provider , tvb, offCur + 3 , 1, bo_little_endian );
514 else if (abortType == USER)
516 proto_tree_add_item( wtp_tree, hf_wtp_header_Abort_reason_user , tvb, offCur + 3 , 1, bo_little_endian );
520 case SEGMENTED_INVOKE:
521 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian );
522 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian );
523 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian );
524 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian );
526 proto_tree_add_item( wtp_tree, hf_wtp_header_sequence_number , tvb, offCur + 3, 1, bo_little_endian );
529 case SEGMENTED_RESULT:
530 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_Trailer, tvb, offCur, 1, bo_little_endian );
531 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian );
532 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian );
533 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian );
535 proto_tree_add_item( wtp_tree, hf_wtp_header_sequence_number , tvb, offCur + 3, 1, bo_little_endian );
539 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_RID, tvb, offCur, 1, bo_little_endian );
540 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID_response, tvb, offCur + 1, 2, bo_big_endian );
541 proto_tree_add_item( wtp_tree, hf_wtp_header_flag_TID, tvb, offCur + 1, 2, bo_big_endian );
543 proto_tree_add_item( wtp_tree, hf_wtp_header_missing_packets , tvb, offCur + 3, 1, bo_little_endian );
544 /* Iterate through missing packets */
545 for (i=0; i<numMissing; i++)
547 proto_tree_add_item( wtp_tree, hf_wtp_header_sequence_number , tvb, offCur + i, 1, bo_little_endian );
556 /* There is a variable part if the Con flag is set */
557 proto_tree_add_bytes_format(
559 hf_wtp_header_variable_part, /* id */
561 offCur + cbHeader, /* start */
562 vHeader, /* length */
563 "What should go here!", /* value */
564 "Header (Variable part) %02X %02X %02X %02X", /* format */
568 /* There is no variable part */
569 } /* End of variable part of header */
573 fprintf( stderr, "dissect_wtp: (4) tree was %p\n", tree );
577 * Any remaining data ought to be WSP data,
578 * so hand off (defragmented) to the WSP dissector
580 if (tvb_length_remaining(tvb, offCur + cbHeader + vHeader) > 0)
582 int dataOffset = offCur + cbHeader + vHeader;
583 guint32 dataLen = tvb_length_remaining(tvb, offCur + cbHeader + vHeader);
584 gboolean save_fragmented;
586 if ((pdut == SEGMENTED_INVOKE) || (pdut == SEGMENTED_RESULT) ||
587 (((pdut == INVOKE) || (pdut == RESULT)) && (!fTTR))) /* 1st part of segment */
589 save_fragmented = pinfo->fragmented;
590 pinfo->fragmented = TRUE;
591 fd_head = fragment_add_seq(tvb, dataOffset, pinfo, TID,
592 wtp_fragment_table, psn, dataLen, !fTTR);
593 if (fd_head != NULL) /* Reassembled */
595 wsp_tvb = tvb_new_real_data(fd_head->data,
598 tvb_set_child_real_data_tvbuff(tvb, wsp_tvb);
599 add_new_data_source(pinfo->fd, wsp_tvb,
601 pinfo->fragmented = FALSE;
603 /* show all fragments */
604 show_fragments(wsp_tvb, pinfo, wtp_tree, fd_head);
606 call_dissector(wsp_handle, wsp_tvb, pinfo, tree);
610 if (check_col(pinfo->cinfo, COL_INFO)) /* Won't call WSP so display */
611 col_append_str(pinfo->cinfo, COL_INFO, szInfo );
613 pinfo->fragmented = save_fragmented;
615 else /* Normal packet, call next dissector */
617 wsp_tvb = tvb_new_subset(tvb, dataOffset, -1, dataLen);
618 call_dissector(wsp_handle, wsp_tvb, pinfo, tree);
624 * Called directly from UDP.
625 * Put "WTP+WSP" into the "Protocol" column.
628 dissect_wtp_fromudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
630 if (check_col(pinfo->cinfo, COL_PROTOCOL))
631 col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTP+WSP" );
632 if (check_col(pinfo->cinfo, COL_INFO)) {
633 col_clear(pinfo->cinfo, COL_INFO);
636 dissect_wtp_common(tvb, pinfo, tree);
640 * Called from a higher-level WAP dissector, presumably WTLS.
641 * Put "WTLS+WSP+WTP" to the "Protocol" column.
643 * XXX - is this supposed to be called from WTLS? If so, we're not
646 * XXX - can this be called from any other dissector?
649 dissect_wtp_fromwap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
651 if (check_col(pinfo->cinfo, COL_PROTOCOL))
652 col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTLS+WTP+WSP" );
653 if (check_col(pinfo->cinfo, COL_INFO)) {
654 col_clear(pinfo->cinfo, COL_INFO);
657 dissect_wtp_common(tvb, pinfo, tree);
660 /* Register the protocol with Ethereal */
662 proto_register_wtp(void)
665 /* Setup list of header fields */
666 static hf_register_info hf[] = {
667 { &hf_wtp_header_sub_pdu_size,
670 FT_BYTES, BASE_HEX, NULL, 0x0,
671 "Size of Sub-PDU", HFILL
674 { &hf_wtp_header_flag_continue,
677 FT_BOOLEAN, 8, TFS( &continue_truth ), 0x80,
678 "Continue Flag", HFILL
681 { &hf_wtp_header_pdu_type,
684 FT_UINT8, BASE_HEX, VALS( vals_pdu_type ), 0x78,
688 { &hf_wtp_header_flag_Trailer,
691 FT_UINT8, BASE_HEX, VALS( vals_transaction_trailer ), 0x06,
692 "Trailer Flags", HFILL
695 { &hf_wtp_header_flag_RID,
696 { "Re-transmission Indicator",
698 FT_BOOLEAN, 8, TFS( &RID_truth ), 0x01,
699 "Re-transmission Indicator", HFILL
702 { &hf_wtp_header_flag_TID_response,
705 FT_BOOLEAN, 16, TFS( &tid_response_truth ), 0x8000,
706 "TID Response", HFILL
709 { &hf_wtp_header_flag_TID,
712 FT_UINT16, BASE_HEX, NULL, 0x7FFF,
713 "Transaction ID", HFILL
716 { &hf_wtp_header_Inv_version,
718 "wtp.header.version",
719 FT_UINT8, BASE_HEX, VALS( vals_version ), 0xC0,
723 { &hf_wtp_header_Inv_flag_TIDNew,
726 FT_BOOLEAN, 8, TFS( &TIDNew_truth ), 0x20,
730 { &hf_wtp_header_Inv_flag_UP,
733 FT_BOOLEAN, 8, TFS( &UP_truth ), 0x10,
737 { &hf_wtp_header_Inv_Reserved,
740 FT_UINT8, BASE_HEX, NULL, 0x0C,
744 { &hf_wtp_header_Inv_TransactionClass,
745 { "Transaction Class",
746 "wtp.inv.transaction_class",
747 FT_UINT8, BASE_HEX, VALS( vals_transaction_classes ), 0x03,
748 "Transaction Class", HFILL
751 { &hf_wtp_header_Ack_flag_TVETOK,
754 FT_BOOLEAN, 8, TFS( &TVETOK_truth ), 0x04,
755 "Tve/Tok flag", HFILL
758 { &hf_wtp_header_Abort_type,
761 FT_UINT8, BASE_HEX, VALS ( vals_abort_type ), 0x07,
765 { &hf_wtp_header_Abort_reason_provider,
767 "wtp.abort.reason.provider",
768 FT_UINT8, BASE_HEX, VALS ( vals_abort_reason_provider ), 0x00,
769 "Abort Reason", HFILL
772 /* Assume WSP is the user and use its reason codes */
773 { &hf_wtp_header_Abort_reason_user,
775 "wtp.abort.reason.user",
776 FT_UINT8, BASE_HEX, VALS ( vals_wsp_reason_codes ), 0x00,
777 "Abort Reason", HFILL
780 { &hf_wtp_header_sequence_number,
781 { "Packet Sequence Number",
782 "wtp.header.sequence",
783 FT_UINT8, BASE_HEX, NULL, 0x00,
784 "Packet Sequence Number", HFILL
787 { &hf_wtp_header_missing_packets,
789 "wtp.header.missing_packets",
790 FT_UINT8, BASE_HEX, NULL, 0x00,
791 "Missing Packets", HFILL
794 { &hf_wtp_header_variable_part,
795 { "Header: Variable part",
796 "wtp.header_variable_part",
797 FT_BYTES, BASE_HEX, NULL, 0x0,
798 "Variable part of the header", HFILL
804 FT_BYTES, BASE_HEX, NULL, 0x0,
809 /* Fragment fields */
810 { &hf_wtp_fragment_overlap,
811 { "Fragment overlap",
812 "wtp.fragment.overlap",
813 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
814 "Fragment overlaps with other fragments", HFILL
817 { &hf_wtp_fragment_overlap_conflict,
818 { "Conflicting data in fragment overlap",
819 "wtp.fragment.overlap.conflict",
820 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
821 "Overlapping fragments contained conflicting data", HFILL
824 { &hf_wtp_fragment_multiple_tails,
825 { "Multiple tail fragments found",
826 "wtp.fragment.multipletails",
827 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
828 "Several tails were found when defragmenting the packet", HFILL
831 { &hf_wtp_fragment_too_long_fragment,
832 { "Fragment too long",
833 "wtp.fragment.toolongfragment",
834 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
835 "Fragment contained data past end of packet", HFILL
838 { &hf_wtp_fragment_error,
839 { "Defragmentation error",
840 "wtp.fragment.error",
841 FT_NONE, BASE_NONE, NULL, 0x0,
842 "Defragmentation error due to illegal fragments", HFILL
848 FT_NONE, BASE_NONE, NULL, 0x0,
849 "WTP Fragment", HFILL
855 FT_NONE, BASE_NONE, NULL, 0x0,
856 "WTP Fragments", HFILL
861 /* Setup protocol subtree array */
862 static gint *ett[] = {
869 /* Register the protocol name and description */
870 proto_wtp = proto_register_protocol(
871 "Wireless Transaction Protocol", /* protocol name for use by ethereal */
872 "WTP", /* short version of name */
873 "wap-wsp-wtp" /* Abbreviated protocol name, should Match IANA
874 < URL:http://www.isi.edu/in-notes/iana/assignments/port-numbers/ >
878 /* Required function calls to register the header fields and subtrees used */
879 proto_register_field_array(proto_wtp, hf, array_length(hf));
880 proto_register_subtree_array(ett, array_length(ett));
882 register_dissector("wtp", dissect_wtp_fromwap, proto_wtp);
883 register_dissector("wtp-udp", dissect_wtp_fromudp, proto_wtp);
884 register_init_routine(wtp_defragment_init);
888 proto_reg_handoff_wtp(void)
890 dissector_handle_t wtp_fromudp_handle;
893 * Get a handle for the connection-oriented WSP dissector - if WTP
894 * PDUs have data, it is WSP.
896 wsp_handle = find_dissector("wsp-co");
898 wtp_fromudp_handle = find_dissector("wtp-udp");
899 dissector_add("udp.port", UDP_PORT_WTP_WSP, wtp_fromudp_handle);