aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-stun.c
diff options
context:
space:
mode:
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2009-09-14 14:03:32 +0000
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2009-09-14 14:03:32 +0000
commit52d12d264697cf52d14f8c7bade8e466dbfa8055 (patch)
treedccb8dc72ab626eb28c0d99ada3a2bafba11dd73 /epan/dissectors/packet-stun.c
parentabce5f3a5dceb08ab7d247a2fbbc880af112cd4c (diff)
Remove unneeded #includes (stdio.h & etc);
Remove a bunch calls to of check_cols(); Use tfs_set_notset from tfs.c instead of a locally defined tfs struct; Use consistent indentation; Adjust spacing on some lines and reformat a few long lines. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29895 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-stun.c')
-rw-r--r--epan/dissectors/packet-stun.c843
1 files changed, 411 insertions, 432 deletions
diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c
index 6989ca5d3c..d4f7fe187a 100644
--- a/epan/dissectors/packet-stun.c
+++ b/epan/dissectors/packet-stun.c
@@ -37,10 +37,6 @@
# include "config.h"
#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include <glib.h>
#include <epan/packet.h>
@@ -115,14 +111,14 @@ static int stun_att_channelnum = -1;
/* Structure containing transaction specific information */
typedef struct _stun_transaction_t {
- guint32 req_frame;
- guint32 rep_frame;
- nstime_t req_time;
+ guint32 req_frame;
+ guint32 rep_frame;
+ nstime_t req_time;
} stun_transaction_t;
/* Structure containing conversation specific information */
typedef struct _stun_conv_info_t {
- emem_tree_t *transaction_pdus;
+ emem_tree_t *transaction_pdus;
} stun_conv_info_t;
@@ -134,14 +130,14 @@ typedef struct _stun_conv_info_t {
/* Methods */
-#define BINDING 0x0001 /*draft-ietf-behave-rfc3489bis-17 */
-#define ALLOCATE 0x0003 /*draft-ietf-behave-turn-10*/
-#define REFRESH 0x0004 /*draft-ietf-behave-turn-10*/
-#define CHANNELBIND 0x0009 /*draft-ietf-behave-turn-10*/
+#define BINDING 0x0001 /* draft-ietf-behave-rfc3489bis-17 */
+#define ALLOCATE 0x0003 /* draft-ietf-behave-turn-10*/
+#define REFRESH 0x0004 /* draft-ietf-behave-turn-10*/
+#define CHANNELBIND 0x0009 /* draft-ietf-behave-turn-10*/
#define CREATE_PERMISSION 0x0008 /* draft-ietf-behave-turn-10 */
/* Indications */
-#define SEND 0x0006 /*draft-ietf-behave-turn-10*/
-#define DATA_IND 0x0007 /*draft-ietf-behave-turn-10*/
+#define SEND 0x0006 /* draft-ietf-behave-turn-10*/
+#define DATA_IND 0x0007 /* draft-ietf-behave-turn-10*/
/* Attribute Types */
@@ -168,7 +164,7 @@ typedef struct _stun_conv_info_t {
#define RESERVATION_TOKEN 0x0022 /* draft-ietf-behave-turn-10 */
#define PRIORITY 0x0024 /* draft-ietf-mmusic-ice-19 */
#define USE_CANDIDATE 0x0025 /* draft-ietf-mmusic-ice-19 */
-#define PADDING 0x0026 /* draft-ietf-behave-nat-behavior-discovery-03 */
+#define PADDING 0x0026 /* draft-ietf-behave-nat-behavior-discovery-03 */
#define XOR_RESPONSE_TARGET 0x0027 /* draft-ietf-behave-nat-behavior-discovery-03 */
#define XOR_REFLECTED_FROM 0x0028 /* draft-ietf-behave-nat-behavior-discovery-03 */
#define ICMP 0x0030 /* Moved from TURN to a future I-D */
@@ -190,8 +186,8 @@ typedef struct _stun_conv_info_t {
#define TURN_REQUESTED_PROPS_EVEN_PORT 0x01
#define TURN_REQUESTED_PROPS_PAIR_OF_PORTS 0x02
-#define TURN_CHANNEL_NUMBER_MIN 0x4000
-#define TURN_CHANNEL_NUMBER_MAX 0xFFFE
+#define TURN_CHANNEL_NUMBER_MIN 0x4000
+#define TURN_CHANNEL_NUMBER_MAX 0xFFFE
@@ -209,86 +205,86 @@ static gint ett_stun_att_type = -1;
#define UDP_PORT_STUN 3478
#define TCP_PORT_STUN 3478
-#define STUN_HDR_LEN ((guint)20) /* STUN message header length */
-#define ATTR_HDR_LEN 4 /* STUN attribute header length */
-#define CHANNEL_DATA_HDR_LEN 4 /* TURN CHANNEL-DATA Message hdr length */
-#define MIN_HDR_LEN 4
+#define STUN_HDR_LEN ((guint)20) /* STUN message header length */
+#define ATTR_HDR_LEN 4 /* STUN attribute header length */
+#define CHANNEL_DATA_HDR_LEN 4 /* TURN CHANNEL-DATA Message hdr length */
+#define MIN_HDR_LEN 4
static const value_string transportnames[] = {
{ 17, "UDP" },
- { 6, "TCP" },
- { 0, NULL }
+ { 6, "TCP" },
+ { 0, NULL }
};
static const value_string classes[] = {
- {REQUEST, "Request"},
- {INDICATION, "Indication"},
- {RESPONSE, "Success Response"},
+ {REQUEST , "Request"},
+ {INDICATION , "Indication"},
+ {RESPONSE , "Success Response"},
{ERROR_RESPONSE, "Error Response"},
- {0x00, NULL}
+ {0x00 , NULL}
};
static const value_string methods[] = {
- {BINDING, "Binding"},
- {ALLOCATE, "Allocate"},
- {REFRESH, "Refresh"},
- {CHANNELBIND, "Channel-Bind"},
- {SEND, "Send"},
- {DATA_IND, "Data"},
- {CREATE_PERMISSION, "CreatePermission"},
- {0x00, NULL}
+ {BINDING , "Binding"},
+ {ALLOCATE , "Allocate"},
+ {REFRESH , "Refresh"},
+ {CHANNELBIND , "Channel-Bind"},
+ {SEND , "Send"},
+ {DATA_IND , "Data"},
+ {CREATE_PERMISSION, "CreatePermission"},
+ {0x00 , NULL}
};
static const value_string attributes[] = {
- {MAPPED_ADDRESS, "MAPPED-ADDRESS"},
- {CHANGE_REQUEST, "CHANGE_REQUEST"},
- {USERNAME, "USERNAME"},
- {MESSAGE_INTEGRITY, "MESSAGE-INTEGRITY"},
- {ERROR_CODE, "ERROR-CODE"},
- {UNKNOWN_ATTRIBUTES, "UNKNOWN-ATTRIBUTES"},
- {CHANNEL_NUMBER, "CHANNEL-NUMBER"},
- {LIFETIME, "LIFETIME"},
- {BANDWIDTH, "BANDWIDTH"},
- {XOR_PEER_ADDRESS, "XOR-PEER-ADDRESS"},
- {DATA, "DATA"},
- {REALM, "REALM"},
- {NONCE, "NONCE"},
- {XOR_RELAYED_ADDRESS, "XOR-RELAYED-ADDRESS"},
+ {MAPPED_ADDRESS , "MAPPED-ADDRESS"},
+ {CHANGE_REQUEST , "CHANGE_REQUEST"},
+ {USERNAME , "USERNAME"},
+ {MESSAGE_INTEGRITY , "MESSAGE-INTEGRITY"},
+ {ERROR_CODE , "ERROR-CODE"},
+ {UNKNOWN_ATTRIBUTES , "UNKNOWN-ATTRIBUTES"},
+ {CHANNEL_NUMBER , "CHANNEL-NUMBER"},
+ {LIFETIME , "LIFETIME"},
+ {BANDWIDTH , "BANDWIDTH"},
+ {XOR_PEER_ADDRESS , "XOR-PEER-ADDRESS"},
+ {DATA , "DATA"},
+ {REALM , "REALM"},
+ {NONCE , "NONCE"},
+ {XOR_RELAYED_ADDRESS , "XOR-RELAYED-ADDRESS"},
{REQUESTED_ADDRESS_TYPE, "REQUESTED-ADDRESS-TYPE"},
- {EVEN_PORT, "EVEN-PORT"},
- {REQUESTED_TRANSPORT, "REQUESTED-TRANSPORT"},
- {DONT_FRAGMENT, "DONT-FRAGMENT"},
- {XOR_MAPPED_ADDRESS, "XOR-MAPPED-ADDRESS"},
- {RESERVATION_TOKEN, "RESERVATION-TOKEN"},
- {PRIORITY, "PRIORITY"},
- {USE_CANDIDATE, "USE-CANDIDATE"},
- {PADDING, "PADDING"},
- {XOR_RESPONSE_TARGET, "XOR-RESPONSE-TARGET"},
- {XOR_REFLECTED_FROM, "XOR-REFELECTED-FROM"},
- {ICMP, "ICMP"},
- {SOFTWARE, "SOFTWARE"},
- {ALTERNATE_SERVER, "ALTERNATE-SERVER"},
- {CACHE_TIMEOUT, "CACHE-TIMEOUT"},
- {FINGERPRINT, "FINGERPRINT"},
- {ICE_CONTROLLED, "ICE-CONTROLLED"},
- {ICE_CONTROLLING, "ICE-CONTROLLING"},
- {RESPONSE_ORIGIN, "RESPONSE-ORIGIN"},
- {OTHER_ADDRESS, "OTHER-ADDRESS"},
- {0x00, NULL}
+ {EVEN_PORT , "EVEN-PORT"},
+ {REQUESTED_TRANSPORT , "REQUESTED-TRANSPORT"},
+ {DONT_FRAGMENT , "DONT-FRAGMENT"},
+ {XOR_MAPPED_ADDRESS , "XOR-MAPPED-ADDRESS"},
+ {RESERVATION_TOKEN , "RESERVATION-TOKEN"},
+ {PRIORITY , "PRIORITY"},
+ {USE_CANDIDATE , "USE-CANDIDATE"},
+ {PADDING , "PADDING"},
+ {XOR_RESPONSE_TARGET , "XOR-RESPONSE-TARGET"},
+ {XOR_REFLECTED_FROM , "XOR-REFELECTED-FROM"},
+ {ICMP , "ICMP"},
+ {SOFTWARE , "SOFTWARE"},
+ {ALTERNATE_SERVER , "ALTERNATE-SERVER"},
+ {CACHE_TIMEOUT , "CACHE-TIMEOUT"},
+ {FINGERPRINT , "FINGERPRINT"},
+ {ICE_CONTROLLED , "ICE-CONTROLLED"},
+ {ICE_CONTROLLING , "ICE-CONTROLLING"},
+ {RESPONSE_ORIGIN , "RESPONSE-ORIGIN"},
+ {OTHER_ADDRESS , "OTHER-ADDRESS"},
+ {0x00 , NULL}
};
static const value_string assignments[] = {
{0x0000, "IETF Review"},
{0x0001, "Designated Expert"},
- {0x00, NULL}
+ {0x00, NULL}
};
static const value_string comprehensions[] = {
{0x0000, "Required"},
{0x0001, "Optional"},
- {0x00, NULL}
+ {0x00 , NULL}
};
static const value_string attributes_reserve_next[] = {
@@ -309,11 +305,6 @@ static const value_string attributes_family[] = {
{0x00, NULL}
};
-static const true_false_string set_flag = {
- "SET",
- "NOT SET"
-};
-
static const value_string error_code[] = {
{300, "Try Alternate"},/* rfc3489bis-15 */
{400, "Bad Request"},/* rfc3489bis-15 */
@@ -340,7 +331,7 @@ get_stun_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
{
guint16 type = tvb_get_ntohs(tvb, offset);
guint16 length = tvb_get_ntohs(tvb, offset+2);
- guint res = 0;
+ guint res;
if (type & 0xC000)
{
@@ -405,20 +396,20 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* two first bits not NULL => should be a channel-data message */
if (msg_type == 0xFFFF)
return 0;
- /* note that padding is only mandatory over streaming
- protocols */
+ /* note that padding is only mandatory over streaming
+ protocols */
msg_total_len = (guint) ((msg_length + CHANNEL_DATA_HDR_LEN +3) & -4) ;
- /* check if payload enough */
- if (len != msg_total_len) {
- if (pinfo->ipproto != IP_PROTO_UDP) {
- return 0;
- }
- /* recalculate the total length without padding */
- msg_total_len = (guint) msg_length + CHANNEL_DATA_HDR_LEN;
- if (len != msg_total_len)
- return 0;
- }
+ /* check if payload enough */
+ if (len != msg_total_len) {
+ if (pinfo->ipproto != IP_PROTO_UDP) {
+ return 0;
+ }
+ /* recalculate the total length without padding */
+ msg_total_len = (guint) msg_length + CHANNEL_DATA_HDR_LEN;
+ if (len != msg_total_len)
+ return 0;
+ }
}
else
{
@@ -430,9 +421,9 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if ( tvb_get_ntohl(tvb, 4) != 0x2112a442)
return 0;
- /* check if payload enough */
- if (len != msg_total_len)
- return 0;
+ /* check if payload enough */
+ if (len != msg_total_len)
+ return 0;
}
/* The message seems to be a valid STUN message! */
@@ -442,15 +433,14 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* BEGIN of CHANNEL-DATA specific section */
if (msg_type & 0xC000)
{
- guint data_length;
- tvbuff_t *next_tvb;
- guint reported_len, new_len;
+ guint data_length;
+ tvbuff_t *next_tvb;
+ guint reported_len, new_len;
/* two first bits not NULL => should be a channel-data message*/
/* Clear out stuff in the info column */
- if (check_col(pinfo->cinfo,COL_INFO)) {
- col_add_fstr(pinfo->cinfo, COL_INFO, "ChannelData TURN Message");
- }
+ col_add_fstr(pinfo->cinfo, COL_INFO, "ChannelData TURN Message");
+
if (!tree)
return tvb_length(tvb);
ti = proto_tree_add_item(
@@ -460,30 +450,30 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item_append_text(ti, ", TURN ChannelData Message");
stun_tree = proto_item_add_subtree(ti, ett_stun);
proto_tree_add_item(stun_tree, hf_stun_channel, tvb, offset, 2, FALSE); offset += 2;
- data_length = tvb_get_ntohs(tvb, 2);
+ data_length = tvb_get_ntohs(tvb, 2);
proto_tree_add_item(stun_tree, hf_stun_length, tvb, offset, 2, FALSE); offset += 2;
- new_len = tvb_length_remaining(tvb, CHANNEL_DATA_HDR_LEN);
- reported_len = tvb_reported_length_remaining(tvb,
- CHANNEL_DATA_HDR_LEN);
- if (data_length < reported_len) {
- reported_len = data_length;
- }
- next_tvb = tvb_new_subset(tvb, CHANNEL_DATA_HDR_LEN, new_len,
- reported_len);
+ new_len = tvb_length_remaining(tvb, CHANNEL_DATA_HDR_LEN);
+ reported_len = tvb_reported_length_remaining(tvb,
+ CHANNEL_DATA_HDR_LEN);
+ if (data_length < reported_len) {
+ reported_len = data_length;
+ }
+ next_tvb = tvb_new_subset(tvb, CHANNEL_DATA_HDR_LEN, new_len,
+ reported_len);
- if (!dissector_try_heuristic(heur_subdissector_list,
- next_tvb, pinfo, tree)) {
- call_dissector_only(data_handle,next_tvb, pinfo, tree);
- }
+ if (!dissector_try_heuristic(heur_subdissector_list,
+ next_tvb, pinfo, tree)) {
+ call_dissector_only(data_handle,next_tvb, pinfo, tree);
+ }
return tvb_length(tvb);
}
/* END of CHANNEL-DATA specific section */
- /* At this stage, we know this is a standard stun message */
+ /* At this stage, we know this is a standard stun message */
/* Create the transaction key which may be used
to track the conversation */
@@ -493,87 +483,86 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
transaction_id_key[0].length = 3;
transaction_id_key[0].key = transaction_id;
- transaction_id_key[1].length = 0;
- transaction_id_key[1].key = NULL;
+ transaction_id_key[1].length = 0;
+ transaction_id_key[1].key = NULL;
msg_type_class = ((msg_type & 0x0010) >> 4) | ((msg_type & 0x0100) >> 7) ;
msg_type_method = (msg_type & 0x000F) | ((msg_type & 0x00E0) >> 1) | ((msg_type & 0x3E00) >> 2);
/* Do we already have a conversation ? */
conversation =
- find_conversation(pinfo->fd->num,
- &pinfo->src, &pinfo->dst,
- pinfo->ptype,
- pinfo->srcport, pinfo->destport, 0);
+ find_conversation(pinfo->fd->num,
+ &pinfo->src, &pinfo->dst,
+ pinfo->ptype,
+ pinfo->srcport, pinfo->destport, 0);
if (conversation == NULL) {
/* We don't yet have a conversation, so create one. */
- conversation = conversation_new(pinfo->fd->num,
- &pinfo->src, &pinfo->dst,
- pinfo->ptype,
- pinfo->srcport, pinfo->destport, 0);
+ conversation = conversation_new(pinfo->fd->num,
+ &pinfo->src, &pinfo->dst,
+ pinfo->ptype,
+ pinfo->srcport, pinfo->destport, 0);
}
/*
* Do we already have a state structure for this conv
*/
- stun_info = conversation_get_proto_data(conversation, proto_stun);
+ stun_info = conversation_get_proto_data(conversation, proto_stun);
if (!stun_info) {
- /* No. Attach that information to the conversation, and add
- * it to the list of information structures.
- */
- stun_info = se_alloc(sizeof(stun_conv_info_t));
- stun_info->transaction_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "stun_transaction_pdus");
- conversation_add_proto_data(conversation, proto_stun, stun_info);
+ /* No. Attach that information to the conversation, and add
+ * it to the list of information structures.
+ */
+ stun_info = se_alloc(sizeof(stun_conv_info_t));
+ stun_info->transaction_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "stun_transaction_pdus");
+ conversation_add_proto_data(conversation, proto_stun, stun_info);
}
- if (!pinfo->fd->flags.visited){
- if ((stun_trans=
- se_tree_lookup32_array(stun_info->transaction_pdus,
- transaction_id_key)) == NULL) {
- stun_trans=se_alloc(sizeof(stun_transaction_t));
- stun_trans->req_frame=0;
- stun_trans->rep_frame=0;
- stun_trans->req_time=pinfo->fd->abs_ts;
- se_tree_insert32_array(stun_info->transaction_pdus,
- transaction_id_key,
- (void *)stun_trans);
- }
+ if (!pinfo->fd->flags.visited) {
+ if ((stun_trans =
+ se_tree_lookup32_array(stun_info->transaction_pdus,
+ transaction_id_key)) == NULL) {
+ stun_trans=se_alloc(sizeof(stun_transaction_t));
+ stun_trans->req_frame=0;
+ stun_trans->rep_frame=0;
+ stun_trans->req_time=pinfo->fd->abs_ts;
+ se_tree_insert32_array(stun_info->transaction_pdus,
+ transaction_id_key,
+ (void *)stun_trans);
+ }
- if (msg_type_class == REQUEST) {
- /* This is a request */
- if (stun_trans->req_frame == 0) {
- stun_trans->req_frame=pinfo->fd->num;
- }
+ if (msg_type_class == REQUEST) {
+ /* This is a request */
+ if (stun_trans->req_frame == 0) {
+ stun_trans->req_frame=pinfo->fd->num;
+ }
- } else {
- /* This is a catch-all for all non-request messages */
- if (stun_trans->rep_frame == 0) {
- stun_trans->rep_frame=pinfo->fd->num;
- }
+ } else {
+ /* This is a catch-all for all non-request messages */
+ if (stun_trans->rep_frame == 0) {
+ stun_trans->rep_frame=pinfo->fd->num;
+ }
- }
+ }
} else {
- stun_trans=se_tree_lookup32_array(stun_info->transaction_pdus,
- transaction_id_key);
+ stun_trans=se_tree_lookup32_array(stun_info->transaction_pdus,
+ transaction_id_key);
}
if (!stun_trans) {
- /* create a "fake" pana_trans structure */
- stun_trans=ep_alloc(sizeof(stun_transaction_t));
- stun_trans->req_frame=0;
- stun_trans->rep_frame=0;
- stun_trans->req_time=pinfo->fd->abs_ts;
+ /* create a "fake" pana_trans structure */
+ stun_trans=ep_alloc(sizeof(stun_transaction_t));
+ stun_trans->req_frame=0;
+ stun_trans->rep_frame=0;
+ stun_trans->req_time=pinfo->fd->abs_ts;
}
-
+
msg_class_str = match_strval(msg_type_class, classes);
msg_method_str = match_strval(msg_type_method, methods);
if (msg_method_str == NULL)
msg_method_str = "Unknown";
- if (check_col(pinfo->cinfo, COL_INFO))
- col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
- msg_method_str, msg_class_str);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
+ msg_method_str, msg_class_str);
if (!tree)
return tvb_length(tvb);
@@ -584,48 +573,50 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (msg_type_class == REQUEST) {
- if (stun_trans->req_frame != pinfo->fd->num) {
- proto_item *it;
- it=proto_tree_add_uint(stun_tree, hf_stun_duplicate,
- tvb, 0, 0,
- stun_trans->req_frame);
- PROTO_ITEM_SET_GENERATED(it);
- }
- if (stun_trans->rep_frame) {
- proto_item *it;
- it=proto_tree_add_uint(stun_tree, hf_stun_response_in,
- tvb, 0, 0,
- stun_trans->rep_frame);
- PROTO_ITEM_SET_GENERATED(it);
- }
+ if (stun_trans->req_frame != pinfo->fd->num) {
+ proto_item *it;
+ it=proto_tree_add_uint(stun_tree, hf_stun_duplicate,
+ tvb, 0, 0,
+ stun_trans->req_frame);
+ PROTO_ITEM_SET_GENERATED(it);
+ }
+ if (stun_trans->rep_frame) {
+ proto_item *it;
+ it=proto_tree_add_uint(stun_tree, hf_stun_response_in,
+ tvb, 0, 0,
+ stun_trans->rep_frame);
+ PROTO_ITEM_SET_GENERATED(it);
+ }
}
else {
- /* Retransmission control */
- if (stun_trans->rep_frame != pinfo->fd->num) {
- proto_item *it;
- it=proto_tree_add_uint(stun_tree, hf_stun_duplicate,
- tvb, 0, 0,
- stun_trans->rep_frame);
- PROTO_ITEM_SET_GENERATED(it);
- }
- if (msg_type_class == RESPONSE || msg_type_class == ERROR_RESPONSE) {
- /* This is a response */
- if (stun_trans->req_frame) {
- proto_item *it;
- nstime_t ns;
-
- it=proto_tree_add_uint(stun_tree, hf_stun_response_to, tvb, 0, 0, stun_trans->req_frame);
- PROTO_ITEM_SET_GENERATED(it);
-
- nstime_delta(&ns, &pinfo->fd->abs_ts, &stun_trans->req_time);
- it=proto_tree_add_time(stun_tree, hf_stun_time, tvb, 0, 0, &ns);
- PROTO_ITEM_SET_GENERATED(it);
- }
+ /* Retransmission control */
+ if (stun_trans->rep_frame != pinfo->fd->num) {
+ proto_item *it;
+ it=proto_tree_add_uint(stun_tree, hf_stun_duplicate,
+ tvb, 0, 0,
+ stun_trans->rep_frame);
+ PROTO_ITEM_SET_GENERATED(it);
+ }
+ if (msg_type_class == RESPONSE || msg_type_class == ERROR_RESPONSE) {
+ /* This is a response */
+ if (stun_trans->req_frame) {
+ proto_item *it;
+ nstime_t ns;
+
+ it=proto_tree_add_uint(stun_tree, hf_stun_response_to, tvb, 0, 0,
+ stun_trans->req_frame);
+ PROTO_ITEM_SET_GENERATED(it);
+
+ nstime_delta(&ns, &pinfo->fd->abs_ts, &stun_trans->req_time);
+ it=proto_tree_add_time(stun_tree, hf_stun_time, tvb, 0, 0, &ns);
+ PROTO_ITEM_SET_GENERATED(it);
+ }
- }
+ }
}
- ti = proto_tree_add_uint_format(stun_tree, hf_stun_type, tvb, 0, 2, msg_type, "Message Type: 0x%04x (%s %s)", msg_type, msg_method_str, msg_class_str);
+ ti = proto_tree_add_uint_format(stun_tree, hf_stun_type, tvb, 0, 2,
+ msg_type, "Message Type: 0x%04x (%s %s)", msg_type, msg_method_str, msg_class_str);
stun_type_tree = proto_item_add_subtree(ti, ett_stun_type);
proto_tree_add_uint(stun_type_tree, hf_stun_type_class, tvb, 0, 2, msg_type);
ti = proto_tree_add_text(stun_type_tree, tvb, 0, 2, "%s (%d)", msg_class_str, msg_type_class);
@@ -645,40 +636,48 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
magic_cookie_first_word = tvb_get_ntohl(tvb, 4);
if (msg_length > 0) {
- ti = proto_tree_add_item(stun_tree, hf_stun_attributes, tvb, STUN_HDR_LEN, msg_length, FALSE);
- att_all_tree = proto_item_add_subtree(ti, ett_stun_att_all);
+ ti = proto_tree_add_item(stun_tree, hf_stun_attributes, tvb, STUN_HDR_LEN, msg_length, FALSE);
+ att_all_tree = proto_item_add_subtree(ti, ett_stun_att_all);
offset = STUN_HDR_LEN;
while (msg_length > 0) {
att_type = tvb_get_ntohs(tvb, offset); /* Type field in attribute header */
att_length = tvb_get_ntohs(tvb, offset+2); /* Length field in attribute header */
- att_type_str = match_strval(att_type, attributes);
- if (att_type_str == NULL)
- att_type_str = "Unknown";
- ti = proto_tree_add_uint_format(att_all_tree, hf_stun_attr, tvb, offset, ATTR_HDR_LEN+att_length, att_type, "%s", att_type_str);
- att_tree = proto_item_add_subtree(ti, ett_stun_att);
- ti = proto_tree_add_uint(att_tree, stun_att_type, tvb,
- offset, 2, att_type);
- att_type_tree = proto_item_add_subtree(ti, ett_stun_att_type);
- proto_tree_add_uint(att_type_tree, stun_att_type_comprehension, tvb, offset, 2, att_type);
- ti = proto_tree_add_text(att_type_tree, tvb, offset, 2, "%s (%d)", match_strval((att_type & 0x8000) >> 15, comprehensions), (att_type & 0x8000) >> 15);
- PROTO_ITEM_SET_GENERATED(ti);
- proto_tree_add_uint(att_type_tree, stun_att_type_assignment, tvb, offset, 2, att_type);
- ti = proto_tree_add_text(att_type_tree, tvb, offset, 2, "%s (%d)", match_strval((att_type & 0x4000) >> 14, assignments), (att_type & 0x4000) >> 14);
- PROTO_ITEM_SET_GENERATED(ti);
+ att_type_str = match_strval(att_type, attributes);
+ if (att_type_str == NULL)
+ att_type_str = "Unknown";
+ ti = proto_tree_add_uint_format(att_all_tree, hf_stun_attr,
+ tvb, offset, ATTR_HDR_LEN+att_length,
+ att_type, "%s", att_type_str);
+ att_tree = proto_item_add_subtree(ti, ett_stun_att);
+ ti = proto_tree_add_uint(att_tree, stun_att_type, tvb,
+ offset, 2, att_type);
+ att_type_tree = proto_item_add_subtree(ti, ett_stun_att_type);
+ proto_tree_add_uint(att_type_tree, stun_att_type_comprehension, tvb, offset, 2, att_type);
+ ti = proto_tree_add_text(att_type_tree, tvb, offset, 2,
+ "%s (%d)",
+ match_strval((att_type & 0x8000) >> 15, comprehensions),
+ (att_type & 0x8000) >> 15);
+ PROTO_ITEM_SET_GENERATED(ti);
+ proto_tree_add_uint(att_type_tree, stun_att_type_assignment, tvb, offset, 2, att_type);
+ ti = proto_tree_add_text(att_type_tree, tvb, offset, 2,
+ "%s (%d)",
+ match_strval((att_type & 0x4000) >> 14, assignments),
+ (att_type & 0x4000) >> 14);
+ PROTO_ITEM_SET_GENERATED(ti);
offset += 2;
if (ATTR_HDR_LEN+att_length > msg_length) {
proto_tree_add_uint_format(att_tree,
- stun_att_length, tvb, offset, 2,
- att_length,
- "Attribute Length: %u (bogus, goes past the end of the message)",
- att_length);
+ stun_att_length, tvb, offset, 2,
+ att_length,
+ "Attribute Length: %u (bogus, goes past the end of the message)",
+ att_length);
break;
}
proto_tree_add_uint(att_tree, stun_att_length, tvb,
- offset, 2, att_length);
+ offset, 2, att_length);
offset += 2;
switch (att_type) {
case MAPPED_ADDRESS:
@@ -705,15 +704,13 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ip = tvb_get_ipv4(tvb,offset+4);
ipstr = ip_to_str((guint8*)&ip);
proto_item_append_text(att_tree, ": %s:%d", ipstr,tvb_get_ntohs(tvb,offset+2));
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " %s: %s:%d",
- val_to_str(att_type, attributes, "Unknown"),
- ipstr,
- tvb_get_ntohs(tvb,offset+2)
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " %s: %s:%d",
+ val_to_str(att_type, attributes, "Unknown"),
+ ipstr,
+ tvb_get_ntohs(tvb,offset+2)
+ );
}
break;
@@ -727,7 +724,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case CHANGE_REQUEST:
if (att_length < 4)
- break;
+ break;
proto_tree_add_item(att_tree, stun_att_change_ip, tvb, offset, 4, FALSE);
proto_tree_add_item(att_tree, stun_att_change_port, tvb, offset, 4, FALSE);
break;
@@ -735,15 +732,14 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case USERNAME:
proto_tree_add_item(att_tree, stun_att_username, tvb, offset, att_length, FALSE);
proto_item_append_text(att_tree, ": %s", tvb_get_ephemeral_string(tvb, offset, att_length));
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " user: %s",
- tvb_get_ephemeral_string(tvb,offset, att_length)
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " user: %s",
+ tvb_get_ephemeral_string(tvb,offset, att_length)
+ );
if (att_length % 4 != 0)
- proto_tree_add_uint(att_tree, stun_att_padding, tvb, offset+att_length, 4-(att_length % 4), 4-(att_length % 4));
+ proto_tree_add_uint(att_tree, stun_att_padding,
+ tvb, offset+att_length, 4-(att_length % 4), 4-(att_length % 4));
break;
case MESSAGE_INTEGRITY:
@@ -770,27 +766,23 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
human_error_num, /* human readable error code */
val_to_str(human_error_num, error_code, "*Unknown error code*")
);
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " error-code: %d (%s)",
- human_error_num,
- val_to_str(human_error_num, error_code, "*Unknown error code*")
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " error-code: %d (%s)",
+ human_error_num,
+ val_to_str(human_error_num, error_code, "*Unknown error code*")
+ );
}
if (att_length < 5)
break;
proto_tree_add_item(att_tree, stun_att_error_reason, tvb, offset+4, att_length-4, FALSE);
proto_item_append_text(att_tree, ": %s", tvb_get_ephemeral_string(tvb, offset+4, att_length-4));
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " %s",
- tvb_get_ephemeral_string(tvb, offset+4, att_length-4)
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " %s",
+ tvb_get_ephemeral_string(tvb, offset+4, att_length-4)
+ );
if (att_length % 4 != 0)
proto_tree_add_uint(att_tree, stun_att_padding, tvb, offset+att_length, 4-(att_length % 4), 4-(att_length % 4));
@@ -806,13 +798,11 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case REALM:
proto_tree_add_item(att_tree, stun_att_realm, tvb, offset, att_length, FALSE);
proto_item_append_text(att_tree, ": %s", tvb_get_ephemeral_string(tvb, offset, att_length));
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " realm: %s",
- tvb_get_ephemeral_string(tvb,offset, att_length)
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " realm: %s",
+ tvb_get_ephemeral_string(tvb,offset, att_length)
+ );
if (att_length % 4 != 0)
proto_tree_add_uint(att_tree, stun_att_padding, tvb, offset+att_length, 4-(att_length % 4), 4-(att_length % 4));
break;
@@ -820,12 +810,10 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case NONCE:
proto_tree_add_item(att_tree, stun_att_nonce, tvb, offset, att_length, FALSE);
proto_item_append_text(att_tree, ": %s", tvb_get_ephemeral_string(tvb, offset, att_length));
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " with nonce"
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " with nonce"
+ );
if (att_length % 4 != 0)
proto_tree_add_uint(att_tree, stun_att_padding, tvb, offset+att_length, 4-(att_length % 4), 4-(att_length % 4));
break;
@@ -877,15 +865,13 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ipstr = ip_to_str((guint8*)&ip);
port = tvb_get_ntohs(tvb, offset+2) ^ (magic_cookie_first_word >> 16);
proto_item_append_text(att_tree, ": %s:%d", ipstr, port);
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " %s: %s:%d",
- val_to_str(att_type, attributes, "Unknown"),
- ipstr,
- port
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " %s: %s:%d",
+ val_to_str(att_type, attributes, "Unknown"),
+ ipstr,
+ port
+ );
}
break;
@@ -893,15 +879,16 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (att_length < 20)
break;
proto_tree_add_item(att_tree, stun_att_xor_ipv6, tvb, offset+4, 16, FALSE);
- {
- guint32 IPv6[4];
- IPv6[0] = g_htonl(tvb_get_ntohl(tvb, offset+4) ^ magic_cookie_first_word);
- IPv6[1] = g_htonl(tvb_get_ntohl(tvb, offset+8) ^ transaction_id[0]);
- IPv6[2] = g_htonl(tvb_get_ntohl(tvb, offset+12) ^ transaction_id[1]);
- IPv6[3] = g_htonl(tvb_get_ntohl(tvb, offset+16) ^ transaction_id[2]);
- ti = proto_tree_add_ipv6(att_tree, stun_att_ipv6, tvb, offset+4, 16, (const guint8 *)IPv6);
- PROTO_ITEM_SET_GENERATED(ti);
- }
+ {
+ guint32 IPv6[4];
+ IPv6[0] = g_htonl(tvb_get_ntohl(tvb, offset+4) ^ magic_cookie_first_word);
+ IPv6[1] = g_htonl(tvb_get_ntohl(tvb, offset+8) ^ transaction_id[0]);
+ IPv6[2] = g_htonl(tvb_get_ntohl(tvb, offset+12) ^ transaction_id[1]);
+ IPv6[3] = g_htonl(tvb_get_ntohl(tvb, offset+16) ^ transaction_id[2]);
+ ti = proto_tree_add_ipv6(att_tree, stun_att_ipv6, tvb, offset+4, 16,
+ (const guint8 *)IPv6);
+ PROTO_ITEM_SET_GENERATED(ti);
+ }
break;
}
@@ -917,7 +904,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
case EVEN_PORT:
if (att_length < 1)
- break;
+ break;
proto_tree_add_item(att_tree, stun_att_reserve_next, tvb, offset, 1, FALSE);
break;
@@ -971,25 +958,25 @@ case EVEN_PORT:
case DATA:
if (att_length > 0) {
- tvbuff_t *next_tvb;
- guint reported_len, pad=0;
+ tvbuff_t *next_tvb;
+ guint reported_len, pad=0;
proto_tree_add_item(att_tree, stun_att_value, tvb, offset, att_length, FALSE);
if (att_length % 4 != 0) {
- pad = 4-(att_length % 4);
+ pad = 4-(att_length % 4);
proto_tree_add_uint(att_tree, stun_att_padding, tvb, offset+att_length, pad, pad);
}
- reported_len = att_length;
+ reported_len = att_length;
- next_tvb =
- tvb_new_subset(tvb, offset,
- reported_len,
- reported_len);
-
- if (!dissector_try_heuristic(heur_subdissector_list,
- next_tvb, pinfo, att_tree)) {
- call_dissector_only(data_handle,next_tvb, pinfo, att_tree);
- }
+ next_tvb =
+ tvb_new_subset(tvb, offset,
+ reported_len,
+ reported_len);
+
+ if (!dissector_try_heuristic(heur_subdissector_list,
+ next_tvb, pinfo, att_tree)) {
+ call_dissector_only(data_handle,next_tvb, pinfo, att_tree);
+ }
}
break;
@@ -1004,13 +991,11 @@ case EVEN_PORT:
{
guint8 protoCode = tvb_get_guint8(tvb, offset);
proto_item_append_text(att_tree, ": %s", val_to_str(protoCode, transportnames, "Unknown (0x%8x)"));
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " %s",
- val_to_str(protoCode, transportnames, "Unknown (0x%8x)")
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " %s",
+ val_to_str(protoCode, transportnames, "Unknown (0x%8x)")
+ );
}
proto_tree_add_uint(att_tree, stun_att_reserved, tvb, offset+1, 3, 3);
break;
@@ -1022,13 +1007,11 @@ case EVEN_PORT:
{
guint16 chan = tvb_get_ntohs(tvb, offset);
proto_item_append_text(att_tree, ": 0x%x", chan);
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " ChannelNumber=0x%x",
- chan
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " ChannelNumber=0x%x",
+ chan
+ );
}
proto_tree_add_uint(att_tree, stun_att_reserved, tvb, offset+2, 2, 2);
break;
@@ -1038,26 +1021,22 @@ case EVEN_PORT:
break;
proto_tree_add_item(att_tree, stun_att_bandwidth, tvb, offset, 4, FALSE);
proto_item_append_text(att_tree, " %d", tvb_get_ntohl(tvb, offset));
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " bandwidth: %d",
- tvb_get_ntohl(tvb, offset)
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " bandwidth: %d",
+ tvb_get_ntohl(tvb, offset)
+ );
break;
case LIFETIME:
if (att_length < 4)
break;
proto_tree_add_item(att_tree, stun_att_lifetime, tvb, offset, 4, FALSE);
proto_item_append_text(att_tree, " %d", tvb_get_ntohl(tvb, offset));
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(
- pinfo->cinfo, COL_INFO,
- " lifetime: %d",
- tvb_get_ntohl(tvb, offset)
- );
- }
+ col_append_fstr(
+ pinfo->cinfo, COL_INFO,
+ " lifetime: %d",
+ tvb_get_ntohl(tvb, offset)
+ );
break;
default:
@@ -1113,211 +1092,211 @@ proto_register_stun(void)
static hf_register_info hf[] = {
{ &hf_stun_channel,
- { "Channel Number", "stun.channel", FT_UINT16,
- BASE_HEX, NULL, 0x0, NULL, HFILL }
+ { "Channel Number", "stun.channel", FT_UINT16,
+ BASE_HEX, NULL, 0x0, NULL, HFILL }
},
/* ////////////////////////////////////// */
{ &hf_stun_type,
- { "Message Type", "stun.type", FT_UINT16,
- BASE_HEX, NULL, 0, NULL, HFILL }
+ { "Message Type", "stun.type", FT_UINT16,
+ BASE_HEX, NULL, 0, NULL, HFILL }
},
{ &hf_stun_type_class,
- { "Message Class", "stun.type.class", FT_UINT16,
- BASE_HEX, NULL, 0x0110, NULL, HFILL }
+ { "Message Class", "stun.type.class", FT_UINT16,
+ BASE_HEX, NULL, 0x0110, NULL, HFILL }
},
{ &hf_stun_type_method,
- { "Message Method", "stun.type.method", FT_UINT16,
- BASE_HEX, NULL, 0x3EEF, NULL, HFILL }
+ { "Message Method", "stun.type.method", FT_UINT16,
+ BASE_HEX, NULL, 0x3EEF, NULL, HFILL }
},
{ &hf_stun_type_method_assignment,
- { "Message Method Assignment", "stun.type.method-assignment", FT_UINT16,
- BASE_HEX, NULL, 0x2000, NULL, HFILL }
- },
+ { "Message Method Assignment", "stun.type.method-assignment", FT_UINT16,
+ BASE_HEX, NULL, 0x2000, NULL, HFILL }
+ },
{ &hf_stun_length,
- { "Message Length", "stun.length", FT_UINT16,
- BASE_DEC, NULL, 0x0, NULL, HFILL }
+ { "Message Length", "stun.length", FT_UINT16,
+ BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_stun_cookie,
- { "Message Cookie", "stun.cookie", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Message Cookie", "stun.cookie", FT_BYTES,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_stun_id,
- { "Message Transaction ID", "stun.id", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Message Transaction ID", "stun.id", FT_BYTES,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_stun_attributes,
- { "Attributes", "stun.attributes", FT_NONE,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Attributes", "stun.attributes", FT_NONE,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_stun_attr,
- { "Attribute Type", "stun.attribute", FT_UINT16,
- BASE_HEX, NULL, 0, NULL, HFILL }
+ { "Attribute Type", "stun.attribute", FT_UINT16,
+ BASE_HEX, NULL, 0, NULL, HFILL }
},
{ &hf_stun_response_in,
- { "Response In", "stun.response-in", FT_FRAMENUM,
- BASE_NONE, NULL, 0x0, "The response to this STUN query is in this frame", HFILL }
+ { "Response In", "stun.response-in", FT_FRAMENUM,
+ BASE_NONE, NULL, 0x0, "The response to this STUN query is in this frame", HFILL }
},
{ &hf_stun_response_to,
- { "Request In", "stun.response-to", FT_FRAMENUM,
- BASE_NONE, NULL, 0x0, "This is a response to the STUN Request in this frame", HFILL }
+ { "Request In", "stun.response-to", FT_FRAMENUM,
+ BASE_NONE, NULL, 0x0, "This is a response to the STUN Request in this frame", HFILL }
},
{ &hf_stun_time,
- { "Time", "stun.time", FT_RELATIVE_TIME,
- BASE_NONE, NULL, 0x0, "The time between the Request and the Response", HFILL }
+ { "Time", "stun.time", FT_RELATIVE_TIME,
+ BASE_NONE, NULL, 0x0, "The time between the Request and the Response", HFILL }
},
{ &hf_stun_duplicate,
- { "Duplicated original message in", "stun.reqduplicate", FT_FRAMENUM,
- BASE_NONE, NULL, 0x0, "This is a duplicate of STUN message in this frame", HFILL }
+ { "Duplicated original message in", "stun.reqduplicate", FT_FRAMENUM,
+ BASE_NONE, NULL, 0x0, "This is a duplicate of STUN message in this frame", HFILL }
},
/* ////////////////////////////////////// */
{ &stun_att_type,
- { "Attribute Type", "stun.att.type", FT_UINT16,
- BASE_HEX, VALS(attributes), 0x0, NULL, HFILL }
+ { "Attribute Type", "stun.att.type", FT_UINT16,
+ BASE_HEX, VALS(attributes), 0x0, NULL, HFILL }
},
{ &stun_att_type_comprehension,
- { "Attribute Type Comprehension", "stun.att.type.comprehension", FT_UINT16,
- BASE_HEX, NULL, 0x8000, NULL, HFILL }
+ { "Attribute Type Comprehension", "stun.att.type.comprehension", FT_UINT16,
+ BASE_HEX, NULL, 0x8000, NULL, HFILL }
},
{ &stun_att_type_assignment,
- { "Attribute Type Assignment", "stun.att.type.assignment", FT_UINT16,
- BASE_HEX, NULL, 0x4000, NULL, HFILL }
+ { "Attribute Type Assignment", "stun.att.type.assignment", FT_UINT16,
+ BASE_HEX, NULL, 0x4000, NULL, HFILL }
},
{ &stun_att_length,
- { "Attribute Length", "stun.att.length", FT_UINT16,
- BASE_DEC, NULL, 0x0, NULL, HFILL }
+ { "Attribute Length", "stun.att.length", FT_UINT16,
+ BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_family,
- { "Protocol Family", "stun.att.family", FT_UINT8,
- BASE_HEX, VALS(attributes_family), 0x0, NULL, HFILL }
+ { "Protocol Family", "stun.att.family", FT_UINT8,
+ BASE_HEX, VALS(attributes_family), 0x0, NULL, HFILL }
},
{ &stun_att_ipv4,
- { "IP", "stun.att.ipv4", FT_IPv4,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "IP", "stun.att.ipv4", FT_IPv4,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_ipv6,
- { "IP", "stun.att.ipv6", FT_IPv6,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "IP", "stun.att.ipv6", FT_IPv6,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_port,
- { "Port", "stun.att.port", FT_UINT16,
- BASE_DEC, NULL, 0x0, NULL, HFILL }
+ { "Port", "stun.att.port", FT_UINT16,
+ BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_username,
- { "Username", "stun.att.username", FT_STRING,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Username", "stun.att.username", FT_STRING,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_padding,
- { "Padding", "stun.att.padding", FT_UINT16,
- BASE_DEC, NULL, 0x0, NULL, HFILL }
+ { "Padding", "stun.att.padding", FT_UINT16,
+ BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_hmac,
- { "HMAC-SHA1", "stun.att.hmac", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "HMAC-SHA1", "stun.att.hmac", FT_BYTES,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_crc32,
- { "CRC-32", "stun.att.crc32", FT_UINT32,
- BASE_HEX, NULL, 0x0, NULL, HFILL }
+ { "CRC-32", "stun.att.crc32", FT_UINT32,
+ BASE_HEX, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_error_class,
- { "Error Class","stun.att.error.class", FT_UINT8,
- BASE_DEC, NULL, 0x07, NULL, HFILL}
+ { "Error Class","stun.att.error.class", FT_UINT8,
+ BASE_DEC, NULL, 0x07, NULL, HFILL}
},
{ &stun_att_error_number,
- { "Error Code","stun.att.error", FT_UINT8,
- BASE_DEC, NULL, 0x0, NULL, HFILL}
+ { "Error Code","stun.att.error", FT_UINT8,
+ BASE_DEC, NULL, 0x0, NULL, HFILL}
},
{ &stun_att_error_reason,
- { "Error Reason Phrase","stun.att.error.reason", FT_STRING,
- BASE_NONE, NULL, 0x0, NULL, HFILL}
+ { "Error Reason Phrase","stun.att.error.reason", FT_STRING,
+ BASE_NONE, NULL, 0x0, NULL, HFILL}
},
{ &stun_att_realm,
- { "Realm", "stun.att.realm", FT_STRING,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Realm", "stun.att.realm", FT_STRING,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_nonce,
- { "Nonce", "stun.att.nonce", FT_STRING,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Nonce", "stun.att.nonce", FT_STRING,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_unknown,
- { "Unknown Attribute","stun.att.unknown", FT_UINT16,
- BASE_HEX, NULL, 0x0, NULL, HFILL}
+ { "Unknown Attribute","stun.att.unknown", FT_UINT16,
+ BASE_HEX, NULL, 0x0, NULL, HFILL}
},
{ &stun_att_xor_ipv4,
- { "IP (XOR-d)", "stun.att.ipv4-xord", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "IP (XOR-d)", "stun.att.ipv4-xord", FT_BYTES,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_xor_ipv6,
- { "IP (XOR-d)", "stun.att.ipv6-xord", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "IP (XOR-d)", "stun.att.ipv6-xord", FT_BYTES,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_xor_port,
- { "Port (XOR-d)", "stun.att.port-xord", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Port (XOR-d)", "stun.att.port-xord", FT_BYTES,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_icmp_type,
- { "ICMP type", "stun.att.icmp.type", FT_UINT8,
- BASE_DEC, NULL, 0x0, NULL, HFILL}
+ { "ICMP type", "stun.att.icmp.type", FT_UINT8,
+ BASE_DEC, NULL, 0x0, NULL, HFILL}
},
{ &stun_att_icmp_code,
- { "ICMP code", "stun.att.icmp.code", FT_UINT8,
- BASE_DEC, NULL, 0x0, NULL, HFILL}
+ { "ICMP code", "stun.att.icmp.code", FT_UINT8,
+ BASE_DEC, NULL, 0x0, NULL, HFILL}
},
{ &stun_att_software,
- { "Software","stun.att.software", FT_STRING,
- BASE_NONE, NULL, 0x0, NULL, HFILL}
+ { "Software","stun.att.software", FT_STRING,
+ BASE_NONE, NULL, 0x0, NULL, HFILL}
},
{ &stun_att_priority,
- { "Priority", "stun.att.priority", FT_UINT32,
- BASE_DEC, NULL, 0x0, NULL, HFILL}
+ { "Priority", "stun.att.priority", FT_UINT32,
+ BASE_DEC, NULL, 0x0, NULL, HFILL}
},
{ &stun_att_tie_breaker,
- { "Tie breaker", "stun.att.tie-breaker", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Tie breaker", "stun.att.tie-breaker", FT_BYTES,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_lifetime,
- { "Lifetime", "stun.att.lifetime", FT_UINT32,
- BASE_DEC, NULL, 0x0, NULL, HFILL}
+ { "Lifetime", "stun.att.lifetime", FT_UINT32,
+ BASE_DEC, NULL, 0x0, NULL, HFILL}
},
{ &stun_att_change_ip,
- { "Change IP","stun.att.change-ip", FT_BOOLEAN,
- 16, TFS(&set_flag), 0x0004, NULL, HFILL}
+ { "Change IP","stun.att.change-ip", FT_BOOLEAN,
+ 16, TFS(&tfs_set_notset), 0x0004, NULL, HFILL}
},
{ &stun_att_change_port,
- { "Change Port","stun.att.change-port", FT_BOOLEAN,
- 16, TFS(&set_flag), 0x0002, NULL, HFILL}
+ { "Change Port","stun.att.change-port", FT_BOOLEAN,
+ 16, TFS(&tfs_set_notset), 0x0002, NULL, HFILL}
},
{ &stun_att_reserve_next,
- { "Reserve next","stun.att.even-port.reserve-next", FT_UINT8,
- BASE_DEC, VALS(attributes_reserve_next), 0x80, NULL, HFILL}
+ { "Reserve next","stun.att.even-port.reserve-next", FT_UINT8,
+ BASE_DEC, VALS(attributes_reserve_next), 0x80, NULL, HFILL}
},
{ &stun_att_cache_timeout,
- { "Cache timeout", "stun.att.cache-timeout", FT_UINT32,
- BASE_DEC, NULL, 0x0, NULL, HFILL}
+ { "Cache timeout", "stun.att.cache-timeout", FT_UINT32,
+ BASE_DEC, NULL, 0x0, NULL, HFILL}
},
{ &stun_att_token,
- { "Token", "stun.att.token", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Token", "stun.att.token", FT_BYTES,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_value,
- { "Value", "stun.value", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL }
+ { "Value", "stun.value", FT_BYTES,
+ BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_reserved,
- { "Reserved", "stun.att.reserved", FT_UINT16,
- BASE_DEC, NULL, 0x0, NULL, HFILL }
+ { "Reserved", "stun.att.reserved", FT_UINT16,
+ BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_transp,
- { "Transport", "stun.att.transp", FT_UINT8,
- BASE_HEX, VALS(transportnames), 0x0, NULL, HFILL }
+ { "Transport", "stun.att.transp", FT_UINT8,
+ BASE_HEX, VALS(transportnames), 0x0, NULL, HFILL }
},
{ &stun_att_channelnum,
- { "Channel-Number", "stun.att.channelnum", FT_UINT16,
- BASE_HEX, NULL, 0x0, NULL, HFILL }
+ { "Channel-Number", "stun.att.channelnum", FT_UINT16,
+ BASE_HEX, NULL, 0x0, NULL, HFILL }
},
{ &stun_att_bandwidth,
- { "Bandwidth", "stun.port.bandwidth", FT_UINT32,
- BASE_DEC, NULL, 0x0, NULL, HFILL }
+ { "Bandwidth", "stun.port.bandwidth", FT_UINT32,
+ BASE_DEC, NULL, 0x0, NULL, HFILL }
},
};
@@ -1337,7 +1316,7 @@ proto_register_stun(void)
proto_register_field_array(proto_stun, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
- /* heuristic subdissectors (used for the DATA field) */
+ /* heuristic subdissectors (used for the DATA field) */
register_heur_dissector_list("stun", &heur_subdissector_list);
}
@@ -1357,6 +1336,6 @@ proto_reg_handoff_stun(void)
heur_dissector_add("tcp", dissect_stun_heur, proto_stun);
heur_dissector_add("stun", dissect_stun_heur, proto_stun);
- data_handle = find_dissector("data");
+ data_handle = find_dissector("data");
}