Eliminate proto_tree_add_text from packet-nbns.c
Some other cleanup while in the neighborhood. Not sure the all the proto_tree_add_expert calls are needed after each field (having implicit bounds error thrown should be sufficient), but left them in there. Change-Id: I3ca75ec9f51ccbed6b6ca792789daa8e7cebf34a Reviewed-on: https://code.wireshark.org/review/4574 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
1c51075376
commit
39b281461d
|
@ -998,7 +998,7 @@ static const value_string gw_type_vals[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const value_string dns_classes[] = {
|
||||
const value_string dns_classes[] = {
|
||||
{C_IN, "IN"},
|
||||
{C_CS, "CS"},
|
||||
{C_CH, "CH"},
|
||||
|
@ -1007,11 +1007,6 @@ static const value_string dns_classes[] = {
|
|||
{C_ANY, "ANY"},
|
||||
{0,NULL}
|
||||
};
|
||||
const char *
|
||||
dns_class_name(int dns_class)
|
||||
{
|
||||
return val_to_str(dns_class, dns_classes, "Unknown (%u)");
|
||||
}
|
||||
|
||||
/* This function returns the number of bytes consumed and the expanded string
|
||||
* in *name.
|
||||
|
@ -1323,7 +1318,7 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset,
|
|||
}
|
||||
if (dns_tree != NULL) {
|
||||
q_tree = proto_tree_add_subtree_format(dns_tree, tvb, offset, len, ett_dns_qd, &tq, "%s: type %s, class %s",
|
||||
name_out, type_name, dns_class_name(dns_class));
|
||||
name_out, type_name, val_to_str_const(dns_class, dns_classes, "Unknown"));
|
||||
if (is_mdns) {
|
||||
proto_item_append_text(tq, ", \"%s\" question", qu ? "QU" : "QM");
|
||||
}
|
||||
|
@ -1640,7 +1635,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
|
|||
flush = 0;
|
||||
}
|
||||
type_name = val_to_str_ext(dns_type, &dns_types_vals_ext, "Unknown (%d)");
|
||||
class_name = dns_class_name(dns_class);
|
||||
class_name = val_to_str_const(dns_class, dns_classes, "Unknown");
|
||||
|
||||
data_offset += 4;
|
||||
cur_offset += 4;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#ifndef __PACKET_DNS_H__
|
||||
#define __PACKET_DNS_H__
|
||||
|
||||
const char *dns_class_name(int dns_class);
|
||||
extern const value_string dns_classes[];
|
||||
|
||||
int expand_dns_name(tvbuff_t *, int, int, int, const guchar **);
|
||||
/* Just like expand_dns_name, but pretty-prints empty names. */
|
||||
|
|
|
@ -68,6 +68,35 @@ static int hf_nbns_name_flags_prm = -1;
|
|||
static int hf_nbns_nb_flags = -1;
|
||||
static int hf_nbns_nb_flags_group = -1;
|
||||
static int hf_nbns_nb_flags_ont = -1;
|
||||
static int hf_nbns_name = -1;
|
||||
static int hf_nbns_type = -1;
|
||||
static int hf_nbns_class = -1;
|
||||
|
||||
/* Generated from convert_proto_tree_add_text.pl */
|
||||
static int hf_nbns_num_alignment_errors = -1;
|
||||
static int hf_nbns_data = -1;
|
||||
static int hf_nbns_unit_id = -1;
|
||||
static int hf_nbns_num_command_blocks = -1;
|
||||
static int hf_nbns_num_retransmits = -1;
|
||||
static int hf_nbns_period_of_statistics = -1;
|
||||
static int hf_nbns_addr = -1;
|
||||
static int hf_nbns_test_result = -1;
|
||||
static int hf_nbns_num_pending_sessions = -1;
|
||||
static int hf_nbns_num_no_resource_conditions = -1;
|
||||
static int hf_nbns_session_data_packet_size = -1;
|
||||
static int hf_nbns_version_number = -1;
|
||||
static int hf_nbns_max_num_pending_sessions = -1;
|
||||
static int hf_nbns_num_collisions = -1;
|
||||
static int hf_nbns_num_good_sends = -1;
|
||||
static int hf_nbns_num_send_aborts = -1;
|
||||
static int hf_nbns_number_of_names = -1;
|
||||
static int hf_nbns_num_crcs = -1;
|
||||
static int hf_nbns_num_good_receives = -1;
|
||||
static int hf_nbns_max_total_sessions_possible = -1;
|
||||
static int hf_nbns_jumpers = -1;
|
||||
static int hf_nbns_netbios_name = -1;
|
||||
static int hf_nbns_ttl = -1;
|
||||
static int hf_nbns_data_length = -1;
|
||||
|
||||
static gint ett_nbns = -1;
|
||||
static gint ett_nbns_qd = -1;
|
||||
|
@ -91,6 +120,8 @@ static int hf_nbdgm_src_port = -1;
|
|||
static int hf_nbdgm_datagram_length = -1;
|
||||
static int hf_nbdgm_packet_offset = -1;
|
||||
static int hf_nbdgm_error_code = -1;
|
||||
static int hf_nbdgm_source_name = -1;
|
||||
static int hf_nbdgm_destination_name = -1;
|
||||
|
||||
static gint ett_nbdgm = -1;
|
||||
|
||||
|
@ -103,6 +134,9 @@ static int hf_nbss_cifs_length = -1;
|
|||
static int hf_nbss_error_code = -1;
|
||||
static int hf_nbss_retarget_ip_address = -1;
|
||||
static int hf_nbss_retarget_port = -1;
|
||||
static int hf_nbss_continuation_data = -1;
|
||||
static int hf_nbss_called_name = -1;
|
||||
static int hf_nbss_calling_name = -1;
|
||||
|
||||
static gint ett_nbss = -1;
|
||||
static gint ett_nbss_flags = -1;
|
||||
|
@ -277,41 +311,30 @@ static const value_string nb_flags_ont_vals[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const char *
|
||||
nbns_type_name (int type)
|
||||
{
|
||||
switch (type) {
|
||||
case T_NB:
|
||||
return "NB";
|
||||
case T_NBSTAT:
|
||||
return "NBSTAT";
|
||||
}
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
static const value_string nb_type_name_vals[] = {
|
||||
{ T_NB, "NB" },
|
||||
{ T_NBSTAT, "NBSTAT" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define NBNAME_BUF_LEN 128
|
||||
|
||||
static proto_tree *
|
||||
add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset,
|
||||
static void
|
||||
add_rr_to_tree(proto_tree *rr_tree, tvbuff_t *tvb, int offset,
|
||||
const char *name, int namelen,
|
||||
const char *type_name, const char *class_description,
|
||||
int type, int class_val,
|
||||
guint ttl, gushort data_len)
|
||||
{
|
||||
proto_tree *rr_tree;
|
||||
|
||||
rr_tree = proto_item_add_subtree(trr, rr_type);
|
||||
proto_tree_add_text(rr_tree, tvb, offset+1, namelen-1, "Name: %s", name);
|
||||
proto_tree_add_string(rr_tree, hf_nbns_name, tvb, offset+1, namelen-1, name);
|
||||
offset += namelen;
|
||||
proto_tree_add_text(rr_tree, tvb, offset, 2, "Type: %s", type_name);
|
||||
proto_tree_add_uint(rr_tree, hf_nbns_type, tvb, offset, 2, type);
|
||||
offset += 2;
|
||||
proto_tree_add_text(rr_tree, tvb, offset, 2, "Class: %s", class_description);
|
||||
proto_tree_add_uint(rr_tree, hf_nbns_class, tvb, offset, 2, class_val);
|
||||
offset += 2;
|
||||
proto_tree_add_text(rr_tree, tvb, offset, 4, "Time to live: %s",
|
||||
proto_tree_add_uint_format_value(rr_tree, hf_nbns_ttl, tvb, offset, 4, ttl, "%s",
|
||||
time_secs_to_str(wmem_packet_scope(), ttl));
|
||||
offset += 4;
|
||||
proto_tree_add_text(rr_tree, tvb, offset, 2, "Data length: %u", data_len);
|
||||
return rr_tree;
|
||||
proto_tree_add_uint(rr_tree, hf_nbns_data_length, tvb, offset, 2, data_len);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -436,14 +459,13 @@ get_nbns_name_type_class(tvbuff_t *tvb, int offset, int nbns_data_offset,
|
|||
|
||||
static void
|
||||
add_name_and_type(proto_tree *tree, tvbuff_t *tvb, int offset, int len,
|
||||
const char *tag, const char *name, int name_type)
|
||||
int hf_tag, const char *name, int name_type)
|
||||
{
|
||||
if (name_type != -1) {
|
||||
proto_tree_add_text(tree, tvb, offset, len, "%s: %s (%s)",
|
||||
tag, name, netbios_name_type_descr(name_type));
|
||||
proto_tree_add_string_format_value(tree, hf_tag, tvb, offset, len, name, "%s (%s)",
|
||||
name, netbios_name_type_descr(name_type));
|
||||
} else {
|
||||
proto_tree_add_text(tree, tvb, offset, len, "%s: %s",
|
||||
tag, name);
|
||||
proto_tree_add_string(tree, hf_tag, tvb, offset, len, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +494,7 @@ dissect_nbns_query(tvbuff_t *tvb, int offset, int nbns_data_offset,
|
|||
&name_len, &name_type, &type, &dns_class);
|
||||
data_offset += len;
|
||||
|
||||
type_name = nbns_type_name(type);
|
||||
type_name = val_to_str_const(type, nb_type_name_vals, "Unknown");
|
||||
|
||||
if (cinfo != NULL)
|
||||
col_append_fstr(cinfo, COL_INFO, " %s %s", type_name, name);
|
||||
|
@ -480,17 +502,16 @@ dissect_nbns_query(tvbuff_t *tvb, int offset, int nbns_data_offset,
|
|||
if (nbns_tree != NULL) {
|
||||
q_tree = proto_tree_add_subtree_format(nbns_tree, tvb, offset, len,
|
||||
ett_nbns_qd, NULL, "%s: type %s, class %s", name, type_name,
|
||||
dns_class_name(dns_class));
|
||||
val_to_str_const(dns_class, dns_classes, "Unknown"));
|
||||
|
||||
add_name_and_type(q_tree, tvb, offset, name_len, "Name", name,
|
||||
add_name_and_type(q_tree, tvb, offset, name_len, hf_nbns_name, name,
|
||||
name_type);
|
||||
offset += name_len;
|
||||
|
||||
proto_tree_add_text(q_tree, tvb, offset, 2, "Type: %s", type_name);
|
||||
proto_tree_add_uint(q_tree, hf_nbns_type, tvb, offset, 2, type);
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_text(q_tree, tvb, offset, 2, "Class: %s",
|
||||
dns_class_name(dns_class));
|
||||
proto_tree_add_uint(q_tree, hf_nbns_class, tvb, offset, 2, dns_class);
|
||||
/*offset += 2;*/
|
||||
}
|
||||
|
||||
|
@ -498,21 +519,48 @@ dissect_nbns_query(tvbuff_t *tvb, int offset, int nbns_data_offset,
|
|||
}
|
||||
|
||||
static void
|
||||
nbns_add_nbns_flags(column_info *cinfo, proto_tree *nbns_tree, tvbuff_t *tvb, int offset,
|
||||
gushort flags, int is_wack)
|
||||
nbns_add_nbns_flags(column_info *cinfo, proto_tree *nbns_tree, tvbuff_t *tvb, int offset, int is_wack)
|
||||
{
|
||||
char *buf;
|
||||
guint16 opcode;
|
||||
proto_tree *field_tree;
|
||||
guint16 opcode, flag;
|
||||
proto_item *tf;
|
||||
static const int * req_flags[] = {
|
||||
&hf_nbns_flags_response,
|
||||
&hf_nbns_flags_opcode,
|
||||
&hf_nbns_flags_truncated,
|
||||
&hf_nbns_flags_recdesired,
|
||||
&hf_nbns_flags_broadcast,
|
||||
NULL
|
||||
};
|
||||
|
||||
#define MAX_BUF_SIZE (128+1)
|
||||
static const int * resp_flags[] = {
|
||||
&hf_nbns_flags_response,
|
||||
&hf_nbns_flags_opcode,
|
||||
&hf_nbns_flags_authoritative,
|
||||
&hf_nbns_flags_truncated,
|
||||
&hf_nbns_flags_recdesired,
|
||||
&hf_nbns_flags_recavail,
|
||||
&hf_nbns_flags_broadcast,
|
||||
&hf_nbns_flags_rcode,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const int * resp_wack_flags[] = {
|
||||
&hf_nbns_flags_response,
|
||||
&hf_nbns_flags_opcode,
|
||||
&hf_nbns_flags_authoritative,
|
||||
&hf_nbns_flags_truncated,
|
||||
&hf_nbns_flags_recdesired,
|
||||
&hf_nbns_flags_recavail,
|
||||
&hf_nbns_flags_broadcast,
|
||||
NULL
|
||||
};
|
||||
|
||||
flag = tvb_get_ntohs(tvb, offset);
|
||||
if (cinfo) {
|
||||
if (flags & F_RESPONSE && !is_wack) {
|
||||
if ((flags & F_RCODE))
|
||||
if (flag & F_RESPONSE && !is_wack) {
|
||||
if ((flag & F_RCODE))
|
||||
col_append_fstr(cinfo, COL_INFO, ", %s",
|
||||
val_to_str_const(flags & F_RCODE, rcode_vals,
|
||||
val_to_str_const(flag & F_RCODE, rcode_vals,
|
||||
"Unknown error"));
|
||||
}
|
||||
}
|
||||
|
@ -520,93 +568,73 @@ nbns_add_nbns_flags(column_info *cinfo, proto_tree *nbns_tree, tvbuff_t *tvb, in
|
|||
if (!nbns_tree)
|
||||
return;
|
||||
|
||||
buf = (char *)wmem_alloc(wmem_packet_scope(), MAX_BUF_SIZE);
|
||||
opcode = (guint16) ((flags & F_OPCODE) >> OPCODE_SHIFT);
|
||||
g_snprintf(buf, MAX_BUF_SIZE, "%s", val_to_str_const(opcode, opcode_vals, "Unknown operation"));
|
||||
if (flags & F_RESPONSE && !is_wack) {
|
||||
g_strlcat(buf, " response", MAX_BUF_SIZE);
|
||||
g_strlcat(buf, ", ", MAX_BUF_SIZE);
|
||||
g_strlcat(buf, val_to_str_const(flags & F_RCODE, rcode_vals, "Unknown error"), MAX_BUF_SIZE);
|
||||
buf[MAX_BUF_SIZE-1] = '\0';
|
||||
opcode = (guint16) ((flag & F_OPCODE) >> OPCODE_SHIFT);
|
||||
if (flag & F_RESPONSE) {
|
||||
if (!is_wack) {
|
||||
tf = proto_tree_add_bitmask(nbns_tree, tvb, offset, hf_nbns_flags, ett_nbns_flags, resp_flags, ENC_BIG_ENDIAN);
|
||||
} else {
|
||||
tf = proto_tree_add_bitmask(nbns_tree, tvb, offset, hf_nbns_flags, ett_nbns_flags, resp_wack_flags, ENC_BIG_ENDIAN);
|
||||
}
|
||||
} else {
|
||||
tf = proto_tree_add_bitmask(nbns_tree, tvb, offset, hf_nbns_flags, ett_nbns_flags, req_flags, ENC_BIG_ENDIAN);
|
||||
}
|
||||
tf = proto_tree_add_uint_format_value(nbns_tree, hf_nbns_flags,
|
||||
tvb, offset, 2, flags, "0x%04x (%s)", flags, buf);
|
||||
field_tree = proto_item_add_subtree(tf, ett_nbns_flags);
|
||||
proto_tree_add_item(field_tree, hf_nbns_flags_response,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(field_tree, hf_nbns_flags_opcode,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
if (flags & F_RESPONSE) {
|
||||
proto_tree_add_item(field_tree, hf_nbns_flags_authoritative,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
}
|
||||
proto_tree_add_item(field_tree, hf_nbns_flags_truncated,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(field_tree, hf_nbns_flags_recdesired,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
if (flags & F_RESPONSE) {
|
||||
proto_tree_add_item(field_tree, hf_nbns_flags_recavail,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
}
|
||||
proto_tree_add_item(field_tree, hf_nbns_flags_broadcast,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
if (flags & F_RESPONSE && !is_wack) {
|
||||
proto_tree_add_item(field_tree, hf_nbns_flags_rcode,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
|
||||
proto_item_append_text(tf, " (%s)", val_to_str_const(opcode, opcode_vals, "Unknown operation"));
|
||||
if (flag & F_RESPONSE && !is_wack) {
|
||||
proto_item_append_text(tf, " response, %s", val_to_str_const(flag & F_RCODE, rcode_vals, "Unknown error"));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nbns_add_nb_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
proto_tree *field_tree;
|
||||
proto_item *tf;
|
||||
gushort flags;
|
||||
gushort flag;
|
||||
static const int * flags[] = {
|
||||
&hf_nbns_nb_flags_group,
|
||||
&hf_nbns_nb_flags_ont,
|
||||
NULL
|
||||
};
|
||||
|
||||
if (!rr_tree)
|
||||
return;
|
||||
|
||||
flags = tvb_get_ntohs(tvb, offset);
|
||||
tf = proto_tree_add_item(rr_tree, hf_nbns_nb_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
field_tree = proto_item_add_subtree(tf, ett_nbns_nb_flags);
|
||||
proto_tree_add_item(field_tree, hf_nbns_nb_flags_group, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(field_tree, hf_nbns_nb_flags_ont, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
tf = proto_tree_add_bitmask(rr_tree, tvb, offset, hf_nbns_nb_flags, ett_nbns_nb_flags, flags, ENC_BIG_ENDIAN);
|
||||
|
||||
flag = tvb_get_ntohs(tvb, offset);
|
||||
proto_item_append_text(tf, "(%s, %s",
|
||||
val_to_str_const(flags & NB_FLAGS_ONT, nb_flags_ont_vals, "Unknown"),
|
||||
(flags & NB_FLAGS_G) ? "group" : "unique");
|
||||
val_to_str_const(flag & NB_FLAGS_ONT, nb_flags_ont_vals, "Unknown"),
|
||||
(flag & NB_FLAGS_G) ? "group" : "unique");
|
||||
}
|
||||
|
||||
static void
|
||||
nbns_add_name_flags(proto_tree *rr_tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
proto_item *field_tree;
|
||||
proto_item *tf;
|
||||
gushort flags;
|
||||
gushort flag;
|
||||
static const int * flags[] = {
|
||||
&hf_nbns_name_flags_group,
|
||||
&hf_nbns_name_flags_ont,
|
||||
&hf_nbns_name_flags_drg,
|
||||
&hf_nbns_name_flags_cnf,
|
||||
&hf_nbns_name_flags_act,
|
||||
&hf_nbns_name_flags_prm,
|
||||
NULL
|
||||
};
|
||||
|
||||
if (!rr_tree)
|
||||
return;
|
||||
|
||||
flags = tvb_get_ntohs(tvb, offset);
|
||||
tf = proto_tree_add_item(rr_tree, hf_nbns_name_flags, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
field_tree = proto_item_add_subtree(tf, ett_nbns_name_flags);
|
||||
proto_tree_add_item(field_tree, hf_nbns_name_flags_group, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(field_tree, hf_nbns_name_flags_ont, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(field_tree, hf_nbns_name_flags_drg, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(field_tree, hf_nbns_name_flags_cnf, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(field_tree, hf_nbns_name_flags_act, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(field_tree, hf_nbns_name_flags_prm, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
flag = tvb_get_ntohs(tvb, offset);
|
||||
tf = proto_tree_add_bitmask(rr_tree, tvb, offset, hf_nbns_name_flags, ett_nbns_name_flags, flags, ENC_BIG_ENDIAN);
|
||||
|
||||
proto_item_append_text(tf, "(%s, %s",
|
||||
val_to_str_const(flags & NAME_FLAGS_ONT, name_flags_ont_vals, "Unknown"),
|
||||
(flags & NAME_FLAGS_G) ? "group" : "unique");
|
||||
if (flags & NAME_FLAGS_DRG)
|
||||
val_to_str_const(flag & NAME_FLAGS_ONT, name_flags_ont_vals, "Unknown"),
|
||||
(flag & NAME_FLAGS_G) ? "group" : "unique");
|
||||
if (flag & NAME_FLAGS_DRG)
|
||||
proto_item_append_text(tf, ", being deregistered");
|
||||
if (flags & NAME_FLAGS_CNF)
|
||||
if (flag & NAME_FLAGS_CNF)
|
||||
proto_item_append_text(tf, ", in conflict");
|
||||
if (flags & NAME_FLAGS_ACT)
|
||||
if (flag & NAME_FLAGS_ACT)
|
||||
proto_item_append_text(tf, ", active");
|
||||
if (flags & NAME_FLAGS_PRM)
|
||||
if (flag & NAME_FLAGS_PRM)
|
||||
proto_item_append_text(tf, ", permanent node name");
|
||||
proto_item_append_text(tf, ")");
|
||||
}
|
||||
|
@ -626,9 +654,7 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
int cur_offset;
|
||||
guint ttl;
|
||||
gushort data_len;
|
||||
gushort flags;
|
||||
proto_tree *rr_tree = NULL;
|
||||
proto_item *trr;
|
||||
char *name_str;
|
||||
guint num_names;
|
||||
char *nbname;
|
||||
|
@ -644,8 +670,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
&name_len, &name_type, &type, &dns_class);
|
||||
cur_offset += len;
|
||||
|
||||
type_name = nbns_type_name(type);
|
||||
class_name = dns_class_name(dns_class);
|
||||
type_name = val_to_str_const(type, nb_type_name_vals, "Unknown");
|
||||
class_name = val_to_str_const(dns_class, dns_classes, "Unknown");
|
||||
|
||||
ttl = tvb_get_ntohl(tvb, cur_offset);
|
||||
cur_offset += 4;
|
||||
|
@ -665,15 +691,15 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
}
|
||||
|
||||
if (nbns_tree) {
|
||||
trr = proto_tree_add_text(nbns_tree, tvb, offset,
|
||||
rr_tree = proto_tree_add_subtree_format(nbns_tree, tvb, offset,
|
||||
(cur_offset - offset) + data_len,
|
||||
"%s: type %s, class %s",
|
||||
ett_nbns_rr, NULL, "%s: type %s, class %s",
|
||||
name, type_name, class_name);
|
||||
g_strlcat(name, " (", MAX_NAME_LEN);
|
||||
g_strlcat(name, netbios_name_type_descr(name_type), MAX_NAME_LEN);
|
||||
g_strlcat(name, ")", MAX_NAME_LEN);
|
||||
rr_tree = add_rr_to_tree(trr, ett_nbns_rr, tvb, offset, name,
|
||||
name_len, type_name, dns_class_name(dns_class), ttl, data_len);
|
||||
add_rr_to_tree(rr_tree, tvb, offset, name,
|
||||
name_len, type, dns_class, ttl, data_len);
|
||||
}
|
||||
while (data_len > 0) {
|
||||
if (opcode == OPCODE_WACK) {
|
||||
|
@ -684,9 +710,7 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
flags = tvb_get_ntohs(tvb, cur_offset);
|
||||
nbns_add_nbns_flags(cinfo, rr_tree, tvb, cur_offset,
|
||||
flags, 1);
|
||||
nbns_add_nbns_flags(cinfo, rr_tree, tvb, cur_offset, 1);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
} else {
|
||||
|
@ -702,9 +726,7 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 4,
|
||||
"Addr: %s",
|
||||
tvb_ip_to_str(tvb, cur_offset));
|
||||
proto_tree_add_item(rr_tree, hf_nbns_addr, tvb, cur_offset, 4, ENC_BIG_ENDIAN);
|
||||
cur_offset += 4;
|
||||
data_len -= 4;
|
||||
}
|
||||
|
@ -716,12 +738,12 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
col_append_fstr(cinfo, COL_INFO, " %s", type_name);
|
||||
|
||||
if (nbns_tree) {
|
||||
trr = proto_tree_add_text(nbns_tree, tvb, offset,
|
||||
rr_tree = proto_tree_add_subtree_format(nbns_tree, tvb, offset,
|
||||
(cur_offset - offset) + data_len,
|
||||
"%s: type %s, class %s",
|
||||
ett_nbns_rr, NULL, "%s: type %s, class %s",
|
||||
name, type_name, class_name);
|
||||
rr_tree = add_rr_to_tree(trr, ett_nbns_rr, tvb, offset, name,
|
||||
name_len, type_name, dns_class_name(dns_class), ttl, data_len);
|
||||
add_rr_to_tree(rr_tree, tvb, offset, name,
|
||||
name_len, type, dns_class, ttl, data_len);
|
||||
}
|
||||
|
||||
if (data_len < 1) {
|
||||
|
@ -730,8 +752,7 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
}
|
||||
|
||||
num_names = tvb_get_guint8(tvb, cur_offset);
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
|
||||
"Number of names: %u", num_names);
|
||||
proto_tree_add_item(rr_tree, hf_nbns_number_of_names, tvb, cur_offset, 1, ENC_NA);
|
||||
cur_offset += 1;
|
||||
|
||||
while (num_names != 0) {
|
||||
|
@ -744,8 +765,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
NETBIOS_NAME_LEN);
|
||||
name_type = process_netbios_name(nbname,
|
||||
name_str, name_len);
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset,
|
||||
NETBIOS_NAME_LEN, "Name: %s<%02x> (%s)",
|
||||
proto_tree_add_string_format_value(rr_tree, hf_nbns_netbios_name, tvb, cur_offset,
|
||||
NETBIOS_NAME_LEN, name_str, "%s<%02x> (%s)",
|
||||
name_str, name_type,
|
||||
netbios_name_type_descr(name_type));
|
||||
}
|
||||
|
@ -770,11 +791,7 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
break;
|
||||
}
|
||||
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 6,
|
||||
"Unit ID: %s",
|
||||
tvb_ether_to_str(tvb, cur_offset));
|
||||
}
|
||||
proto_tree_add_item(rr_tree, hf_nbns_unit_id, tvb, cur_offset, 6, ENC_NA);
|
||||
cur_offset += 6;
|
||||
data_len -= 6;
|
||||
|
||||
|
@ -783,10 +800,7 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
break;
|
||||
}
|
||||
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
|
||||
"Jumpers: 0x%x", tvb_get_guint8(tvb, cur_offset));
|
||||
}
|
||||
proto_tree_add_item(rr_tree, hf_nbns_jumpers, tvb, cur_offset, 1, ENC_NA);
|
||||
cur_offset += 1;
|
||||
data_len -= 1;
|
||||
|
||||
|
@ -794,10 +808,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 1,
|
||||
"Test result: 0x%x", tvb_get_guint8(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_test_result, tvb, cur_offset, 1, ENC_NA);
|
||||
cur_offset += 1;
|
||||
data_len -= 1;
|
||||
|
||||
|
@ -805,10 +817,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Version number: 0x%x", tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_version_number, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -816,11 +826,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Period of statistics: 0x%x",
|
||||
tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_period_of_statistics, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -828,10 +835,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Number of CRCs: %u", tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_crcs, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -839,11 +844,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Number of alignment errors: %u",
|
||||
tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_alignment_errors, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -851,10 +853,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Number of collisions: %u", tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_collisions, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -862,10 +862,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Number of send aborts: %u", tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_send_aborts, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -873,10 +871,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 4,
|
||||
"Number of good sends: %u", tvb_get_ntohl(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_good_sends, tvb, cur_offset, 4, ENC_BIG_ENDIAN);
|
||||
cur_offset += 4;
|
||||
data_len -= 4;
|
||||
|
||||
|
@ -884,11 +880,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 4,
|
||||
"Number of good receives: %u",
|
||||
tvb_get_ntohl(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_good_receives, tvb, cur_offset, 4, ENC_BIG_ENDIAN);
|
||||
cur_offset += 4;
|
||||
data_len -= 4;
|
||||
|
||||
|
@ -896,10 +889,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Number of retransmits: %u", tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_retransmits, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -907,11 +898,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Number of no resource conditions: %u",
|
||||
tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_no_resource_conditions, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -919,11 +907,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Number of command blocks: %u",
|
||||
tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_command_blocks, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -931,11 +916,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Number of pending sessions: %u",
|
||||
tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_num_pending_sessions, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -943,11 +925,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Max number of pending sessions: %u",
|
||||
tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_max_num_pending_sessions, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -955,11 +934,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Max total sessions possible: %u",
|
||||
tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_max_total_sessions_possible, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
data_len -= 2;
|
||||
|
||||
|
@ -967,11 +943,8 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
proto_tree_add_expert(rr_tree, pinfo, &ei_nbns_incomplete_entry, tvb, cur_offset, data_len);
|
||||
break;
|
||||
}
|
||||
if (rr_tree) {
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
|
||||
"Session data packet size: %u",
|
||||
tvb_get_ntohs(tvb, cur_offset));
|
||||
}
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_nbns_session_data_packet_size, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
|
||||
cur_offset += 2;
|
||||
/*data_len -= 2;*/
|
||||
out:
|
||||
|
@ -982,13 +955,13 @@ dissect_nbns_answer(tvbuff_t *tvb, packet_info *pinfo, int offset, int nbns_data
|
|||
col_append_fstr(cinfo, COL_INFO, " %s", type_name);
|
||||
|
||||
if (nbns_tree) {
|
||||
trr = proto_tree_add_text(nbns_tree, tvb, offset,
|
||||
rr_tree = proto_tree_add_subtree_format(nbns_tree, tvb, offset,
|
||||
(cur_offset - offset) + data_len,
|
||||
"%s: type %s, class %s",
|
||||
ett_nbns_rr, NULL, "%s: type %s, class %s",
|
||||
name, type_name, class_name);
|
||||
rr_tree = add_rr_to_tree(trr, ett_nbns_rr, tvb, offset, name,
|
||||
name_len, type_name, dns_class_name(dns_class), ttl, data_len);
|
||||
proto_tree_add_text(rr_tree, tvb, cur_offset, data_len, "Data");
|
||||
add_rr_to_tree(rr_tree, tvb, offset, name,
|
||||
name_len, type, dns_class, ttl, data_len);
|
||||
proto_tree_add_item(rr_tree, hf_nbns_data, tvb, cur_offset, data_len, ENC_NA);
|
||||
}
|
||||
cur_offset += data_len;
|
||||
break;
|
||||
|
@ -1074,8 +1047,7 @@ dissect_nbns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
offset + NBNS_ID, 2, id);
|
||||
}
|
||||
|
||||
nbns_add_nbns_flags(pinfo->cinfo, nbns_tree, tvb, offset + NBNS_FLAGS,
|
||||
flags, 0);
|
||||
nbns_add_nbns_flags(pinfo->cinfo, nbns_tree, tvb, offset + NBNS_FLAGS, 0);
|
||||
|
||||
quest = tvb_get_ntohs(tvb, offset + NBNS_QUEST);
|
||||
if (tree) {
|
||||
|
@ -1289,7 +1261,7 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
if (tree) {
|
||||
add_name_and_type(nbdgm_tree, tvb, offset, len,
|
||||
"Source name", name, name_type);
|
||||
hf_nbdgm_source_name, name, name_type);
|
||||
}
|
||||
offset += len;
|
||||
|
||||
|
@ -1298,7 +1270,7 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
if (tree) {
|
||||
add_name_and_type(nbdgm_tree, tvb, offset, len,
|
||||
"Destination name", name, name_type);
|
||||
hf_nbdgm_destination_name, name, name_type);
|
||||
}
|
||||
offset += len;
|
||||
|
||||
|
@ -1336,7 +1308,7 @@ dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
if (tree) {
|
||||
add_name_and_type(nbdgm_tree, tvb, offset, len,
|
||||
"Destination name", name, name_type);
|
||||
hf_nbdgm_destination_name, name, name_type);
|
||||
}
|
||||
offset += len;
|
||||
if (ti != NULL)
|
||||
|
@ -1400,8 +1372,6 @@ dissect_nbss_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
int offset = 0;
|
||||
proto_tree *nbss_tree = NULL;
|
||||
proto_item *ti = NULL;
|
||||
proto_tree *field_tree;
|
||||
proto_item *tf;
|
||||
guint8 msg_type;
|
||||
guint8 flags;
|
||||
guint32 length;
|
||||
|
@ -1412,6 +1382,10 @@ dissect_nbss_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
tvbuff_t *next_tvb;
|
||||
const char *saved_proto;
|
||||
void *pd_save;
|
||||
static const int * nbss_flags[] = {
|
||||
&hf_nbss_flags_e,
|
||||
NULL
|
||||
};
|
||||
|
||||
name = (char *)wmem_alloc(wmem_packet_scope(), MAX_NAME_LEN);
|
||||
|
||||
|
@ -1429,11 +1403,7 @@ dissect_nbss_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
offset += 3;
|
||||
} else {
|
||||
flags = tvb_get_guint8(tvb, offset);
|
||||
if (tree) {
|
||||
tf = proto_tree_add_uint(nbss_tree, hf_nbss_flags, tvb, offset, 1, flags);
|
||||
field_tree = proto_item_add_subtree(tf, ett_nbss_flags);
|
||||
proto_tree_add_item(field_tree, hf_nbss_flags_e, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
}
|
||||
proto_tree_add_bitmask(nbss_tree, tvb, offset, hf_nbss_flags, ett_nbss_flags, nbss_flags, ENC_BIG_ENDIAN);
|
||||
|
||||
length = tvb_get_ntohs(tvb, offset + 1);
|
||||
if (flags & NBSS_FLAGS_E)
|
||||
|
@ -1449,7 +1419,7 @@ dissect_nbss_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
len = get_nbns_name(tvb, offset, offset, name, MAX_NAME_LEN, &name_type);
|
||||
if (tree)
|
||||
add_name_and_type(nbss_tree, tvb, offset, len,
|
||||
"Called name", name, name_type);
|
||||
hf_nbss_called_name, name, name_type);
|
||||
offset += len;
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", to %s ", name);
|
||||
|
@ -1458,7 +1428,7 @@ dissect_nbss_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
|
||||
if (tree)
|
||||
add_name_and_type(nbss_tree, tvb, offset, len,
|
||||
"Calling name", name, name_type);
|
||||
hf_nbss_calling_name, name, name_type);
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "from %s", name);
|
||||
|
||||
|
@ -1542,7 +1512,7 @@ dissect_continuation_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
if (tree) {
|
||||
ti = proto_tree_add_item(tree, proto_nbss, tvb, 0, -1, ENC_NA);
|
||||
nbss_tree = proto_item_add_subtree(ti, ett_nbss);
|
||||
proto_tree_add_text(nbss_tree, tvb, 0, -1, "Continuation data");
|
||||
proto_tree_add_item(nbss_tree, hf_nbss_continuation_data, tvb, 0, -1, ENC_NA);
|
||||
}
|
||||
|
||||
return tvb_length(tvb);
|
||||
|
@ -1940,6 +1910,44 @@ proto_register_nbt(void)
|
|||
{ "ONT", "nbns.nb_flags.ont",
|
||||
FT_UINT16, BASE_DEC, VALS(nb_flags_ont_vals), NB_FLAGS_ONT,
|
||||
NULL, HFILL }},
|
||||
{ &hf_nbns_type,
|
||||
{ "Type", "nbns.type",
|
||||
FT_UINT16, BASE_DEC, VALS(nb_type_name_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_nbns_class,
|
||||
{ "Class", "nbns.class",
|
||||
FT_UINT16, BASE_DEC, VALS(dns_classes), 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_nbns_name,
|
||||
{ "Name", "nbns.name",
|
||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
/* Generated from convert_proto_tree_add_text.pl */
|
||||
{ &hf_nbns_addr, { "Addr", "nbns.addr", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_number_of_names, { "Number of names", "nbns.number_of_names", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_unit_id, { "Unit ID", "nbns.unit_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_jumpers, { "Jumpers", "nbns.jumpers", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_test_result, { "Test result", "nbns.test_result", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_version_number, { "Version number", "nbns.version_number", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_period_of_statistics, { "Period of statistics", "nbns.period_of_statistics", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_crcs, { "Number of CRCs", "nbns.num_crcs", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_alignment_errors, { "Number of alignment errors", "nbns.num_alignment_errors", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_collisions, { "Number of collisions", "nbns.num_collisions", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_send_aborts, { "Number of send aborts", "nbns.num_send_aborts", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_good_sends, { "Number of good sends", "nbns.num_good_sends", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_good_receives, { "Number of good receives", "nbns.num_good_receives", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_retransmits, { "Number of retransmits", "nbns.numretransmits", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_no_resource_conditions, { "Number of no resource conditions", "nbns.num_no_resource_conditions", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_command_blocks, { "Number of command blocks", "nbns.numcommand_blocks", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_num_pending_sessions, { "Number of pending sessions", "nbns.numpending_sessions", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_max_num_pending_sessions, { "Max number of pending sessions", "nbns.max_num_pending_sessions", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_max_total_sessions_possible, { "Max total sessions possible", "nbns.max_total_sessions_possible", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_session_data_packet_size, { "Session data packet size", "nbns.session_data_packet_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_data, { "Data", "nbns.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_netbios_name, { "Name", "nbns.netbios_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_ttl, { "Time to live", "nbns.ttl", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_nbns_data_length, { "Data length", "nbns.data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
};
|
||||
|
||||
static hf_register_info hf_nbdgm[] = {
|
||||
|
@ -1983,6 +1991,14 @@ proto_register_nbt(void)
|
|||
{ "Error code", "nbdgm.error_code",
|
||||
FT_UINT8, BASE_HEX, VALS(nbds_error_codes), 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_nbdgm_source_name,
|
||||
{ "Source name", "nbdgm.source_name",
|
||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_nbdgm_destination_name,
|
||||
{ "Destination name", "nbdgm.destination_name",
|
||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
};
|
||||
|
||||
static hf_register_info hf_nbss[] = {
|
||||
|
@ -2018,6 +2034,18 @@ proto_register_nbt(void)
|
|||
{ "Retarget port", "nbss.retarget_port",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_nbss_continuation_data,
|
||||
{ "Continuation data", "nbss.continuation_data",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_nbss_called_name,
|
||||
{ "Called name", "nbss.called_name",
|
||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_nbss_calling_name,
|
||||
{ "Calling name", "nbss.calling_name",
|
||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_nbns,
|
||||
|
|
Loading…
Reference in New Issue