* Gilbert Ramirez <gram@verdict.uthscsa.edu>
* Much stuff added by Guy Harris <guy@netapp.com>
*
- * $Id: packet-nbns.c,v 1.2 1998/10/14 19:34:59 guy Exp $
+ * $Id: packet-nbns.c,v 1.7 1998/11/17 04:28:58 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
#endif
#include <gtk/gtk.h>
-#include <pcap.h>
#include <stdio.h>
#include <memory.h>
/* This one is; canonicalize its name. */
pnbname = canonicalize_netbios_name(nbname);
} else {
- sprintf(nbname, "Illegal NetBIOS name (%d bytes long)",
- pnbname - nbname);
+ sprintf(nbname, "Illegal NetBIOS name (%ld bytes long)",
+ (long)(pnbname - nbname));
goto bad;
}
if (cname == '.') {
char *type_name;
const u_char *dptr;
const u_char *data_start;
+ GtkWidget *q_tree, *tq;
data_start = dptr = pd + offset;
&name_len, &type, &class);
dptr += len;
- add_item_to_tree(nbns_tree, offset, name_len, "Name: %s", name);
+ type_name = nbns_type_name(type);
+ class_name = dns_class_name(class);
+
+ tq = add_item_to_tree(nbns_tree, offset, len, "%s: type %s, class %s",
+ name, type_name, class_name);
+ q_tree = gtk_tree_new();
+ add_subtree(tq, q_tree, ETT_NBNS_QD);
+
+ add_item_to_tree(q_tree, offset, name_len, "Name: %s", name);
offset += name_len;
- type_name = nbns_type_name(type);
- add_item_to_tree(nbns_tree, offset, 2, "Type: %s", type_name);
+ add_item_to_tree(q_tree, offset, 2, "Type: %s", type_name);
offset += 2;
- class_name = dns_class_name(class);
- add_item_to_tree(nbns_tree, offset, 2, "Class: %s", class_name);
+ add_item_to_tree(q_tree, offset, 2, "Class: %s", class_name);
offset += 2;
return dptr - data_start;
break;
}
add_item_to_tree(rr_tree, offset, 4,
- "Addr: %d.%d.%d.%d",
- *dptr, *(dptr+1), *(dptr+2), *(dptr+3));
+ "Addr: %s",
+ ip_to_str((guint8 *)dptr));
dptr += 4;
offset += 4;
data_len -= 4;
break;
}
add_item_to_tree(rr_tree, offset, 6,
- "Unit ID: %02x:%02x:%02x:%02x:%02x:%02x",
- *dptr, *(dptr + 1), *(dptr + 2),
- *(dptr + 3), *(dptr + 4), *(dptr + 5));
+ "Unit ID: %s",
+ ether_to_str((guint8 *)dptr));
dptr += 6;
offset += 6;
data_len -= 6;
header.nscount = pntohs(&pd[offset+8]);
header.arcount = pntohs(&pd[offset+10]);
- if (fd->win_info[COL_NUM]) {
- strcpy(fd->win_info[COL_PROTOCOL], "NBNS (UDP)");
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, "NBNS (UDP)");
+ if (check_col(fd, COL_INFO)) {
if (header.opcode <= 15) {
- sprintf(fd->win_info[COL_INFO], "%s %s",
+ col_add_fstr(fd, COL_INFO, "%s %s",
opcode[header.opcode], header.r ? "reply" : "request");
} else {
- sprintf(fd->win_info[COL_INFO], "Unknown operation (%d) %s",
+ col_add_fstr(fd, COL_INFO, "Unknown operation (%d) %s",
header.opcode, header.r ? "reply" : "request");
}
}