+static void
+nbns_add_nbns_flags(GtkWidget *nbns_tree, int offset, u_short flags,
+ int is_wack)
+{
+ char buf[128+1];
+ GtkWidget *field_tree, *tf;
+ static const value_string rcode_vals[] = {
+ { RCODE_NOERROR, "No error" },
+ { RCODE_FMTERROR, "Format error" },
+ { RCODE_SERVFAIL, "Server failure" },
+ { RCODE_NAMEERROR, "Name error" },
+ { RCODE_NOTIMPL, "Not implemented" },
+ { RCODE_REFUSED, "Refused" },
+ { RCODE_ACTIVE, "Name is active" },
+ { RCODE_CONFLICT, "Name is in conflict" },
+ { 0, NULL }
+ };
+
+ strcpy(buf, val_to_str(flags & F_OPCODE, opcode_vals,
+ "Unknown (%x)"));
+ if (flags & F_RESPONSE && !is_wack) {
+ strcat(buf, " response");
+ strcat(buf, ", ");
+ strcat(buf, val_to_str(flags & F_RCODE, rcode_vals,
+ "Unknown error (%x)"));
+ }
+ tf = add_item_to_tree(nbns_tree, offset, 2,
+ "Flags: 0x%04x (%s)", flags, buf);
+ field_tree = gtk_tree_new();
+ add_subtree(tf, field_tree, ETT_NBNS_FLAGS);
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, F_RESPONSE,
+ 2*8, "Response", "Query"));
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_enumerated_bitfield(flags, F_OPCODE,
+ 2*8, opcode_vals, "%s"));
+ if (flags & F_RESPONSE) {
+ add_item_to_tree(field_tree, offset, 2,
+ "%s",
+ decode_boolean_bitfield(flags, F_AUTHORITATIVE,
+ 2*8,
+ "Server is an authority for domain",
+ "Server isn't an authority for domain"));
+ }
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, F_TRUNCATED,
+ 2*8,
+ "Message is truncated",
+ "Message is not truncated"));
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, F_RECDESIRED,
+ 2*8,
+ "Do query recursively",
+ "Don't do query recursively"));
+ if (flags & F_RESPONSE) {
+ add_item_to_tree(field_tree, offset, 2,
+ "%s",
+ decode_boolean_bitfield(flags, F_RECAVAIL,
+ 2*8,
+ "Server can do recursive queries",
+ "Server can't do recursive queries"));
+ }
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, F_BROADCAST,
+ 2*8,
+ "Broadcast packet",
+ "Not a broadcast packet"));
+ if (flags & F_RESPONSE && !is_wack) {
+ add_item_to_tree(field_tree, offset, 2,
+ "%s",
+ decode_enumerated_bitfield(flags, F_RCODE,
+ 2*8,
+ rcode_vals, "%s"));
+ }
+}
+
+static void
+nbns_add_nb_flags(GtkWidget *rr_tree, int offset, u_short flags)
+{
+ char buf[128+1];
+ GtkWidget *field_tree, *tf;
+ static const value_string nb_flags_ont_vals[] = {
+ { NB_FLAGS_ONT_B_NODE, "B-node" },
+ { NB_FLAGS_ONT_P_NODE, "P-node" },
+ { NB_FLAGS_ONT_M_NODE, "M-node" },
+ { NB_FLAGS_ONT_H_NODE, "H-node" },
+ { 0, NULL }
+ };
+
+ strcpy(buf, val_to_str(flags & NB_FLAGS_ONT, nb_flags_ont_vals,
+ "Unknown"));
+ strcat(buf, ", ");
+ if (flags & NB_FLAGS_G)
+ strcat(buf, "group");
+ else
+ strcat(buf, "unique");
+ tf = add_item_to_tree(rr_tree, offset, 2, "Flags: 0x%x (%s)", flags,
+ buf);
+ field_tree = gtk_tree_new();
+ add_subtree(tf, field_tree, ETT_NBNS_NB_FLAGS);
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, NB_FLAGS_G,
+ 2*8,
+ "Group name",
+ "Unique name"));
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_enumerated_bitfield(flags, NB_FLAGS_ONT,
+ 2*8, nb_flags_ont_vals, "%s"));
+}
+
+static void
+nbns_add_name_flags(GtkWidget *rr_tree, int offset, u_short flags)
+{
+ char buf[128+1];
+ GtkWidget *field_tree, *tf;
+ static const value_string name_flags_ont_vals[] = {
+ { NAME_FLAGS_ONT_B_NODE, "B-node" },
+ { NAME_FLAGS_ONT_P_NODE, "P-node" },
+ { NAME_FLAGS_ONT_M_NODE, "M-node" },
+ { 0, NULL }
+ };
+
+ strcpy(buf, val_to_str(flags & NAME_FLAGS_ONT, name_flags_ont_vals,
+ "Unknown"));
+ strcat(buf, ", ");
+ if (flags & NAME_FLAGS_G)
+ strcat(buf, "group");
+ else
+ strcat(buf, "unique");
+ if (flags & NAME_FLAGS_DRG)
+ strcat(buf, ", being deregistered");
+ if (flags & NAME_FLAGS_CNF)
+ strcat(buf, ", in conflict");
+ if (flags & NAME_FLAGS_ACT)
+ strcat(buf, ", active");
+ if (flags & NAME_FLAGS_PRM)
+ strcat(buf, ", permanent node name");
+ tf = add_item_to_tree(rr_tree, offset, 2, "Name flags: 0x%x (%s)",
+ flags, buf);
+ field_tree = gtk_tree_new();
+ add_subtree(tf, field_tree, ETT_NBNS_NAME_FLAGS);
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, NAME_FLAGS_G,
+ 2*8,
+ "Group name",
+ "Unique name"));
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_enumerated_bitfield(flags, NAME_FLAGS_ONT,
+ 2*8, name_flags_ont_vals, "%s"));
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, NAME_FLAGS_DRG,
+ 2*8,
+ "Name is being deregistered",
+ "Name is not being deregistered"));
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, NAME_FLAGS_CNF,
+ 2*8,
+ "Name is in conflict",
+ "Name is not in conflict"));
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, NAME_FLAGS_ACT,
+ 2*8,
+ "Name is active",
+ "Name is not active"));
+ add_item_to_tree(field_tree, offset, 2, "%s",
+ decode_boolean_bitfield(flags, NAME_FLAGS_PRM,
+ 2*8,
+ "Permanent node name",
+ "Not permanent node name"));
+}