1 /* packet-classicstun.c
2 * Routines for Simple Traversal of UDP Through NAT dissection
3 * Copyright 2003, Shiang-Ming Huang <smhuang@pcs.csie.nctu.edu.tw>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 * Please refer to RFC 3489 for protocol detail.
24 * (supports extra message attributes described in draft-ietf-behave-rfc3489bis-00)
31 #include <epan/packet.h>
32 #include <epan/conversation.h>
33 #include <epan/wmem/wmem.h>
35 void proto_register_classicstun(void);
36 void proto_reg_handoff_classicstun(void);
38 /* Initialize the protocol and registered fields */
39 static int proto_classicstun = -1;
41 static int hf_classicstun_type = -1; /* CLASSIC-STUN message header */
42 static int hf_classicstun_length = -1;
43 static int hf_classicstun_id = -1;
44 static int hf_classicstun_att = -1;
45 static int hf_classicstun_response_in = -1;
46 static int hf_classicstun_response_to = -1;
47 static int hf_classicstun_time = -1;
50 static int classicstun_att_type = -1; /* CLASSIC-STUN attribute fields */
51 static int classicstun_att_length = -1;
52 static int classicstun_att_value = -1;
53 static int classicstun_att_family = -1;
54 static int classicstun_att_ipv4 = -1;
55 static int classicstun_att_ipv6 = -1;
56 static int classicstun_att_port = -1;
57 static int classicstun_att_change_ip = -1;
58 static int classicstun_att_change_port = -1;
59 static int classicstun_att_unknown = -1;
60 static int classicstun_att_error_class = -1;
61 static int classicstun_att_error_number = -1;
62 static int classicstun_att_error_reason = -1;
63 static int classicstun_att_server_string = -1;
64 static int classicstun_att_xor_ipv4 = -1;
65 static int classicstun_att_xor_ipv6 = -1;
66 static int classicstun_att_xor_port = -1;
67 static int classicstun_att_lifetime = -1;
68 static int classicstun_att_magic_cookie = -1;
69 static int classicstun_att_bandwidth = -1;
70 static int classicstun_att_data = -1;
71 static int classicstun_att_connection_request_binding = -1;
73 /* Structure containing transaction specific information */
74 typedef struct _classicstun_transaction_t {
78 } classicstun_transaction_t;
80 /* Structure containing conversation specific information */
81 typedef struct _classicstun_conv_info_t {
83 } classicstun_conv_info_t;
87 #define BINDING_REQUEST 0x0001
88 #define BINDING_RESPONSE 0x0101
89 #define BINDING_ERROR_RESPONSE 0x0111
90 #define SHARED_SECRET_REQUEST 0x0002
91 #define SHARED_SECRET_RESPONSE 0x0102
92 #define SHARED_SECRET_ERROR_RESPONSE 0x1112
93 #define ALLOCATE_REQUEST 0x0003
94 #define ALLOCATE_RESPONSE 0x0103
95 #define ALLOCATE_ERROR_RESPONSE 0x0113
96 #define SEND_REQUEST 0x0004
97 #define SEND_RESPONSE 0x0104
98 #define SEND_ERROR_RESPONSE 0x0114
99 #define DATA_INDICATION 0x0115
100 #define SET_ACTIVE_DESTINATION_REQUEST 0x0006
101 #define SET_ACTIVE_DESTINATION_RESPONSE 0x0106
102 #define SET_ACTIVE_DESTINATION_ERROR_RESPONSE 0x0116
105 /* Message classes */
106 #define CLASS_MASK 0xC110
107 #define REQUEST 0x0000
108 #define INDICATION 0x0001
109 #define RESPONSE 0x0010
110 #define ERROR_RESPONSE 0x0011
112 /* Attribute Types */
113 #define MAPPED_ADDRESS 0x0001
114 #define RESPONSE_ADDRESS 0x0002
115 #define CHANGE_REQUEST 0x0003
116 #define SOURCE_ADDRESS 0x0004
117 #define CHANGED_ADDRESS 0x0005
118 #define USERNAME 0x0006
119 #define PASSWORD 0x0007
120 #define MESSAGE_INTEGRITY 0x0008
121 #define ERROR_CODE 0x0009
122 #define UNKNOWN_ATTRIBUTES 0x000a
123 #define REFLECTED_FROM 0x000b
124 #define LIFETIME 0x000d
125 #define ALTERNATE_SERVER 0x000e
126 #define MAGIC_COOKIE 0x000f
127 #define BANDWIDTH 0x0010
128 #define DESTINATION_ADDRESS 0x0011
129 #define REMOTE_ADDRESS 0x0012
133 #define REQUESTED_ADDRESS_TYPE 0x0016
134 #define XOR_MAPPED_ADDRESS 0x8020
135 #define XOR_ONLY 0x0021
136 #define SERVER 0x8022
137 #define CONNECTION_REQUEST_BINDING 0xc001
138 #define BINDING_CHANGE 0xc002
142 /* Initialize the subtree pointers */
143 static gint ett_classicstun = -1;
144 static gint ett_classicstun_att_type = -1;
145 static gint ett_classicstun_att = -1;
148 #define UDP_PORT_STUN 3478
149 #define TCP_PORT_STUN 3478
152 #define CLASSICSTUN_HDR_LEN ((guint)20) /* CLASSIC-STUN message header length */
153 #define ATTR_HDR_LEN 4 /* CLASSIC-STUN attribute header length */
156 static const value_string messages[] = {
157 {BINDING_REQUEST , "Binding Request"},
158 {BINDING_RESPONSE , "Binding Response"},
159 {BINDING_ERROR_RESPONSE , "Binding Error Response"},
160 {SHARED_SECRET_REQUEST , "Shared Secret Request"},
161 {SHARED_SECRET_RESPONSE , "Shared Secret Response"},
162 {SHARED_SECRET_ERROR_RESPONSE , "Shared Secret Error Response"},
163 {ALLOCATE_REQUEST , "Allocate Request"},
164 {ALLOCATE_RESPONSE , "Allocate Response"},
165 {ALLOCATE_ERROR_RESPONSE , "Allocate Error Response"},
166 {SEND_REQUEST , "Send Request"},
167 {SEND_RESPONSE , "Send Response"},
168 {SEND_ERROR_RESPONSE , "Send Error Response"},
169 {DATA_INDICATION , "Data Indication"},
170 {SET_ACTIVE_DESTINATION_REQUEST , "Set Active Destination Request"},
171 {SET_ACTIVE_DESTINATION_RESPONSE , "Set Active Destination Response"},
172 {SET_ACTIVE_DESTINATION_ERROR_RESPONSE , "Set Active Destination Error Response"},
176 static const value_string attributes[] = {
177 {MAPPED_ADDRESS , "MAPPED-ADDRESS"},
178 {RESPONSE_ADDRESS , "RESPONSE-ADDRESS"},
179 {CHANGE_REQUEST , "CHANGE-REQUEST"},
180 {SOURCE_ADDRESS , "SOURCE-ADDRESS"},
181 {CHANGED_ADDRESS , "CHANGED-ADDRESS"},
182 {USERNAME , "USERNAME"},
183 {PASSWORD , "PASSWORD"},
184 {MESSAGE_INTEGRITY , "MESSAGE-INTEGRITY"},
185 {ERROR_CODE , "ERROR-CODE"},
186 {REFLECTED_FROM , "REFLECTED-FROM"},
187 {LIFETIME , "LIFETIME"},
188 {ALTERNATE_SERVER , "ALTERNATE_SERVER"},
189 {MAGIC_COOKIE , "MAGIC_COOKIE"},
190 {BANDWIDTH , "BANDWIDTH"},
191 {DESTINATION_ADDRESS , "DESTINATION_ADDRESS"},
192 {REMOTE_ADDRESS , "REMOTE_ADDRESS"},
196 {REQUESTED_ADDRESS_TYPE , "REQUESTED_ADDRESS_TYPE"},
197 {XOR_MAPPED_ADDRESS , "XOR_MAPPED_ADDRESS"},
198 {XOR_ONLY , "XOR_ONLY"},
200 {CONNECTION_REQUEST_BINDING , "CONNECTION-REQUEST-BINDING"},
201 {BINDING_CHANGE , "BINDING-CHANGE"},
205 static const value_string attributes_family[] = {
212 dissect_classicstun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
217 proto_tree *classicstun_tree;
218 proto_tree *att_type_tree;
219 proto_tree *att_tree;
222 const char *msg_type_str;
228 conversation_t *conversation;
229 classicstun_conv_info_t *classicstun_info;
230 classicstun_transaction_t *classicstun_trans;
231 wmem_tree_key_t transaction_id_key[2];
232 guint32 transaction_id[4];
236 * First check if the frame is really meant for us.
238 len = tvb_length(tvb);
239 /* First, make sure we have enough data to do the check. */
240 if (len < CLASSICSTUN_HDR_LEN)
243 msg_type = tvb_get_ntohs(tvb, 0);
245 if (msg_type & 0xC000 || tvb_get_ntohl(tvb, 4) == 0x2112a442 /* New STUN */
246 || tvb_get_ntohl(tvb, 4) == 0x7f5a9bc7) /* XMCP */
249 /* check if message type is correct */
250 msg_type_str = try_val_to_str(msg_type, messages);
251 if (msg_type_str == NULL)
254 msg_length = tvb_get_ntohs(tvb, 2);
256 /* check if payload enough */
257 if (len != CLASSICSTUN_HDR_LEN+msg_length)
260 /* The message seems to be a valid CLASSIC-STUN message! */
262 /* Create the transaction key which may be used
263 to track the conversation */
264 transaction_id[0] = tvb_get_ntohl(tvb, 4);
265 transaction_id[1] = tvb_get_ntohl(tvb, 8);
266 transaction_id[2] = tvb_get_ntohl(tvb, 12);
267 transaction_id[3] = tvb_get_ntohl(tvb, 16);
269 transaction_id_key[0].length = 4;
270 transaction_id_key[0].key = transaction_id;
271 transaction_id_key[1].length = 0;
272 transaction_id_key[1].key = NULL;
275 * Do we have a conversation for this connection?
277 conversation = find_or_create_conversation(pinfo);
280 * Do we already have a state structure for this conv
282 classicstun_info = (classicstun_conv_info_t *)conversation_get_proto_data(conversation, proto_classicstun);
283 if (!classicstun_info) {
284 /* No. Attach that information to the conversation, and add
285 * it to the list of information structures.
287 classicstun_info = wmem_new(wmem_file_scope(), classicstun_conv_info_t);
288 classicstun_info->pdus=wmem_tree_new(wmem_file_scope());
289 conversation_add_proto_data(conversation, proto_classicstun, classicstun_info);
292 if(!pinfo->fd->flags.visited){
293 if (((msg_type & CLASS_MASK) >> 4) == REQUEST) {
294 /* This is a request */
295 classicstun_trans=wmem_new(wmem_file_scope(), classicstun_transaction_t);
296 classicstun_trans->req_frame=pinfo->fd->num;
297 classicstun_trans->rep_frame=0;
298 classicstun_trans->req_time=pinfo->fd->abs_ts;
299 wmem_tree_insert32_array(classicstun_info->pdus, transaction_id_key,
300 (void *)classicstun_trans);
302 classicstun_trans=(classicstun_transaction_t *)wmem_tree_lookup32_array(classicstun_info->pdus,
304 if(classicstun_trans){
305 classicstun_trans->rep_frame=pinfo->fd->num;
309 classicstun_trans=(classicstun_transaction_t *)wmem_tree_lookup32_array(classicstun_info->pdus, transaction_id_key);
311 if(!classicstun_trans){
312 /* create a "fake" pana_trans structure */
313 classicstun_trans=wmem_new(wmem_packet_scope(), classicstun_transaction_t);
314 classicstun_trans->req_frame=0;
315 classicstun_trans->rep_frame=0;
316 classicstun_trans->req_time=pinfo->fd->abs_ts;
321 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CLASSIC-STUN");
323 col_add_fstr(pinfo->cinfo, COL_INFO, "Message: %s",
327 guint transaction_id_first_word;
329 ti = proto_tree_add_item(tree, proto_classicstun, tvb, 0, -1, ENC_NA);
331 classicstun_tree = proto_item_add_subtree(ti, ett_classicstun);
333 if (((msg_type & CLASS_MASK) >> 4) == REQUEST) {
334 if (classicstun_trans->rep_frame) {
336 it=proto_tree_add_uint(classicstun_tree, hf_classicstun_response_in,
338 classicstun_trans->rep_frame);
339 PROTO_ITEM_SET_GENERATED(it);
342 else if ((((msg_type & CLASS_MASK) >> 4) == RESPONSE) ||
343 (((msg_type & CLASS_MASK) >> 4) == ERROR_RESPONSE)) {
344 /* This is a response */
345 if(classicstun_trans->req_frame){
349 it=proto_tree_add_uint(classicstun_tree, hf_classicstun_response_to, tvb, 0, 0, classicstun_trans->req_frame);
350 PROTO_ITEM_SET_GENERATED(it);
352 nstime_delta(&ns, &pinfo->fd->abs_ts, &classicstun_trans->req_time);
353 it=proto_tree_add_time(classicstun_tree, hf_classicstun_time, tvb, 0, 0, &ns);
354 PROTO_ITEM_SET_GENERATED(it);
359 proto_tree_add_uint(classicstun_tree, hf_classicstun_type, tvb, 0, 2, msg_type);
360 proto_tree_add_uint(classicstun_tree, hf_classicstun_length, tvb, 2, 2, msg_length);
361 proto_tree_add_item(classicstun_tree, hf_classicstun_id, tvb, 4, 16, ENC_NA);
363 /* Remember this (in host order) so we can show clear xor'd addresses */
364 transaction_id_first_word = tvb_get_ntohl(tvb, 4);
366 if (msg_length > 0) {
367 ta = proto_tree_add_item(classicstun_tree, hf_classicstun_att, tvb, CLASSICSTUN_HDR_LEN, msg_length, ENC_NA);
368 att_type_tree = proto_item_add_subtree(ta, ett_classicstun_att_type);
370 offset = CLASSICSTUN_HDR_LEN;
372 while( msg_length > 0) {
373 att_type = tvb_get_ntohs(tvb, offset); /* Type field in attribute header */
374 att_length = tvb_get_ntohs(tvb, offset+2); /* Length field in attribute header */
376 ta = proto_tree_add_text(att_type_tree, tvb, offset,
377 ATTR_HDR_LEN+att_length,
379 val_to_str(att_type, attributes, "Unknown (0x%04x)"));
380 att_tree = proto_item_add_subtree(ta, ett_classicstun_att);
382 proto_tree_add_uint(att_tree, classicstun_att_type, tvb,
383 offset, 2, att_type);
385 if (ATTR_HDR_LEN+att_length > msg_length) {
386 proto_tree_add_uint_format_value(att_tree,
387 classicstun_att_length, tvb, offset, 2,
389 "%u (bogus, goes past the end of the message)",
393 proto_tree_add_uint(att_tree, classicstun_att_length, tvb,
394 offset, 2, att_length);
398 case RESPONSE_ADDRESS:
400 case CHANGED_ADDRESS:
402 case ALTERNATE_SERVER:
403 case DESTINATION_ADDRESS:
407 proto_tree_add_item(att_tree, classicstun_att_family, tvb, offset+1, 1, ENC_BIG_ENDIAN);
410 proto_tree_add_item(att_tree, classicstun_att_port, tvb, offset+2, 2, ENC_BIG_ENDIAN);
411 switch( tvb_get_guint8(tvb, offset+1) ){
415 proto_tree_add_item(att_tree, classicstun_att_ipv4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
421 proto_tree_add_item(att_tree, classicstun_att_ipv6, tvb, offset+4, 16, ENC_NA);
429 proto_tree_add_item(att_tree, classicstun_att_change_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
430 proto_tree_add_item(att_tree, classicstun_att_change_port, tvb, offset, 4, ENC_BIG_ENDIAN);
435 case MESSAGE_INTEGRITY:
440 proto_tree_add_item(att_tree, classicstun_att_value, tvb, offset, att_length, ENC_NA);
446 proto_tree_add_item(att_tree, classicstun_att_error_class, tvb, offset+2, 1, ENC_BIG_ENDIAN);
449 proto_tree_add_item(att_tree, classicstun_att_error_number, tvb, offset+3, 1, ENC_BIG_ENDIAN);
452 proto_tree_add_item(att_tree, classicstun_att_error_reason, tvb, offset+4, (att_length-4), ENC_ASCII|ENC_NA);
458 proto_tree_add_item(att_tree, classicstun_att_lifetime, tvb, offset, 4, ENC_BIG_ENDIAN);
464 proto_tree_add_item(att_tree, classicstun_att_magic_cookie, tvb, offset, 4, ENC_BIG_ENDIAN);
470 proto_tree_add_item(att_tree, classicstun_att_bandwidth, tvb, offset, 4, ENC_BIG_ENDIAN);
474 proto_tree_add_item(att_tree, classicstun_att_data, tvb, offset, att_length, ENC_NA);
477 case UNKNOWN_ATTRIBUTES:
478 for (i = 0; i < att_length; i += 4) {
479 proto_tree_add_item(att_tree, classicstun_att_unknown, tvb, offset+i, 2, ENC_BIG_ENDIAN);
480 proto_tree_add_item(att_tree, classicstun_att_unknown, tvb, offset+i+2, 2, ENC_BIG_ENDIAN);
485 proto_tree_add_item(att_tree, classicstun_att_server_string, tvb, offset, att_length, ENC_ASCII|ENC_NA);
488 case XOR_MAPPED_ADDRESS:
491 proto_tree_add_item(att_tree, classicstun_att_family, tvb, offset+1, 1, ENC_BIG_ENDIAN);
494 proto_tree_add_item(att_tree, classicstun_att_xor_port, tvb, offset+2, 2, ENC_BIG_ENDIAN);
496 /* Show the port 'in the clear'
497 XOR (host order) transid with (host order) xor-port.
498 Add host-order port into tree. */
499 ti = proto_tree_add_uint(att_tree, classicstun_att_port, tvb, offset+2, 2,
500 tvb_get_ntohs(tvb, offset+2) ^
501 (transaction_id_first_word >> 16));
502 PROTO_ITEM_SET_GENERATED(ti);
506 switch( tvb_get_guint8(tvb, offset+1) ){
510 proto_tree_add_item(att_tree, classicstun_att_xor_ipv4, tvb, offset+4, 4, ENC_BIG_ENDIAN);
512 /* Show the address 'in the clear'.
513 XOR (host order) transid with (host order) xor-address.
514 Add in network order tree. */
515 ti = proto_tree_add_ipv4(att_tree, classicstun_att_ipv4, tvb, offset+4, 4,
516 tvb_get_ipv4(tvb, offset+4) ^ g_htonl(transaction_id_first_word));
517 PROTO_ITEM_SET_GENERATED(ti);
523 proto_tree_add_item(att_tree, classicstun_att_xor_ipv6, tvb, offset+4, 16, ENC_NA);
528 case REQUESTED_ADDRESS_TYPE:
531 proto_tree_add_item(att_tree, classicstun_att_family, tvb, offset+1, 1, ENC_BIG_ENDIAN);
534 case CONNECTION_REQUEST_BINDING:
535 proto_tree_add_item(att_tree, classicstun_att_connection_request_binding, tvb, offset, att_length, ENC_ASCII|ENC_NA);
541 offset += att_length;
542 msg_length -= ATTR_HDR_LEN+att_length;
546 return tvb_length(tvb);
551 dissect_classicstun_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
553 if (dissect_classicstun(tvb, pinfo, tree, NULL) == 0)
563 proto_register_classicstun(void)
565 static hf_register_info hf[] = {
566 { &hf_classicstun_type,
567 { "Message Type", "classicstun.type", FT_UINT16,
568 BASE_HEX, VALS(messages), 0x0, NULL, HFILL }
570 { &hf_classicstun_length,
571 { "Message Length", "classicstun.length", FT_UINT16,
572 BASE_HEX, NULL, 0x0, NULL, HFILL }
574 { &hf_classicstun_id,
575 { "Message Transaction ID", "classicstun.id", FT_BYTES,
576 BASE_NONE, NULL, 0x0, NULL, HFILL }
578 { &hf_classicstun_att,
579 { "Attributes", "classicstun.att", FT_NONE,
580 BASE_NONE, NULL, 0x0, NULL, HFILL }
582 { &hf_classicstun_response_in,
583 { "Response In", "classicstun.response_in",
584 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
585 "The response to this CLASSICSTUN query is in this frame", HFILL }},
586 { &hf_classicstun_response_to,
587 { "Request In", "classicstun.response_to",
588 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
589 "This is a response to the CLASSICSTUN Request in this frame", HFILL }},
590 { &hf_classicstun_time,
591 { "Time", "classicstun.time",
592 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
593 "The time between the Request and the Response", HFILL }},
595 /* ////////////////////////////////////// */
596 { &classicstun_att_type,
597 { "Attribute Type", "classicstun.att.type", FT_UINT16,
598 BASE_HEX, VALS(attributes), 0x0, NULL, HFILL }
600 { &classicstun_att_length,
601 { "Attribute Length", "classicstun.att.length", FT_UINT16,
602 BASE_DEC, NULL, 0x0, NULL, HFILL }
604 { &classicstun_att_value,
605 { "Value", "classicstun.att.value", FT_BYTES,
606 BASE_NONE, NULL, 0x0, NULL, HFILL }
608 { &classicstun_att_family,
609 { "Protocol Family", "classicstun.att.family", FT_UINT16,
610 BASE_HEX, VALS(attributes_family), 0x0, NULL, HFILL }
612 { &classicstun_att_ipv4,
613 { "IP", "classicstun.att.ipv4", FT_IPv4,
614 BASE_NONE, NULL, 0x0, NULL, HFILL }
616 { &classicstun_att_ipv6,
617 { "IP", "classicstun.att.ipv6", FT_IPv6,
618 BASE_NONE, NULL, 0x0, NULL, HFILL }
620 { &classicstun_att_port,
621 { "Port", "classicstun.att.port", FT_UINT16,
622 BASE_DEC, NULL, 0x0, NULL, HFILL }
624 { &classicstun_att_change_ip,
625 { "Change IP","classicstun.att.change.ip", FT_BOOLEAN,
626 16, TFS(&tfs_set_notset), 0x0004, NULL, HFILL}
628 { &classicstun_att_change_port,
629 { "Change Port","classicstun.att.change.port", FT_BOOLEAN,
630 16, TFS(&tfs_set_notset), 0x0002, NULL, HFILL}
632 { &classicstun_att_unknown,
633 { "Unknown Attribute","classicstun.att.unknown", FT_UINT16,
634 BASE_HEX, NULL, 0x0, NULL, HFILL}
636 { &classicstun_att_error_class,
637 { "Error Class","classicstun.att.error.class", FT_UINT8,
638 BASE_DEC, NULL, 0x07, NULL, HFILL}
640 { &classicstun_att_error_number,
641 { "Error Code","classicstun.att.error", FT_UINT8,
642 BASE_DEC, NULL, 0x0, NULL, HFILL}
644 { &classicstun_att_error_reason,
645 { "Error Reason Phase","classicstun.att.error.reason", FT_STRING,
646 BASE_NONE, NULL, 0x0, NULL, HFILL}
648 { &classicstun_att_xor_ipv4,
649 { "IP (XOR-d)", "classicstun.att.ipv4-xord", FT_IPv4,
650 BASE_NONE, NULL, 0x0, NULL, HFILL }
652 { &classicstun_att_xor_ipv6,
653 { "IP (XOR-d)", "classicstun.att.ipv6-xord", FT_IPv6,
654 BASE_NONE, NULL, 0x0, NULL, HFILL }
656 { &classicstun_att_xor_port,
657 { "Port (XOR-d)", "classicstun.att.port-xord", FT_UINT16,
658 BASE_DEC, NULL, 0x0, NULL, HFILL }
660 { &classicstun_att_server_string,
661 { "Server version","classicstun.att.server", FT_STRING,
662 BASE_NONE, NULL, 0x0, NULL, HFILL}
664 { &classicstun_att_lifetime,
665 { "Lifetime", "classicstun.att.lifetime", FT_UINT32,
666 BASE_DEC, NULL, 0x0, NULL, HFILL }
668 { &classicstun_att_magic_cookie,
669 { "Magic Cookie", "classicstun.att.magic.cookie", FT_UINT32,
670 BASE_HEX, NULL, 0x0, NULL, HFILL }
672 { &classicstun_att_bandwidth,
673 { "Bandwidth", "classicstun.att.bandwidth", FT_UINT32,
674 BASE_DEC, NULL, 0x0, NULL, HFILL }
676 { &classicstun_att_data,
677 { "Data", "classicstun.att.data", FT_BYTES,
678 BASE_NONE, NULL, 0x0, NULL, HFILL }
680 { &classicstun_att_connection_request_binding,
681 { "Connection Request Binding", "classicstun.att.connection_request_binding", FT_STRING,
682 BASE_NONE, NULL, 0x0, NULL, HFILL }
686 /* Setup protocol subtree array */
687 static gint *ett[] = {
689 &ett_classicstun_att_type,
690 &ett_classicstun_att,
693 /* Register the protocol name and description */
694 proto_classicstun = proto_register_protocol("Simple Traversal of UDP Through NAT",
695 "CLASSICSTUN", "classicstun");
697 /* Required function calls to register the header fields and subtrees used */
698 proto_register_field_array(proto_classicstun, hf, array_length(hf));
699 proto_register_subtree_array(ett, array_length(ett));
701 new_register_dissector("classicstun", dissect_classicstun, proto_classicstun);
702 new_register_dissector("classicstun-heur", dissect_classicstun_heur, proto_classicstun);
707 proto_reg_handoff_classicstun(void)
709 #if 0 /* The stun dissector registers on these ports */
710 dissector_handle_t classicstun_handle;
712 classicstun_handle = find_dissector("classicstun");
714 dissector_add_uint("tcp.port", TCP_PORT_STUN, classicstun_handle);
715 dissector_add_uint("udp.port", UDP_PORT_STUN, classicstun_handle);
717 heur_dissector_add("udp", dissect_classicstun_heur, proto_classicstun);
718 heur_dissector_add("tcp", dissect_classicstun_heur, proto_classicstun);