summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-03-07 17:28:41 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-03-07 17:28:41 +0000
commitab0bdc6682815fe9878afdda6cc8119798fa2770 (patch)
tree7dcae80079a6885dcbd5d05a7d446a82d7d1154e /source3
parent3e2f9c3dee3895b44a367ec1b1b2d9b1b3b00e7c (diff)
downloadsamba-ab0bdc6682815fe9878afdda6cc8119798fa2770.tar.gz
samba-ab0bdc6682815fe9878afdda6cc8119798fa2770.tar.bz2
samba-ab0bdc6682815fe9878afdda6cc8119798fa2770.zip
Added better debug for what kind of netbios packet we got.
jra@cygnus.com (This used to be commit 4563d978feaed37aab78e62461026a79dbc50249)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/nmblib.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index c70311f997..a0f93331d9 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -30,6 +30,34 @@ extern pstring scope;
extern pstring myname;
extern struct in_addr ipzero;
+static struct opcode_names {
+ const char *nmb_opcode_name;
+ int opcode;
+} nmb_header_opcode_names[] = {
+ { "Query", 0 },
+ {"Registration", 5 },
+ {"Release", 6 },
+ {"WACK", 7 },
+ {"refresh", 8 },
+ {0, -1 }
+};
+
+/****************************************************************************
+ * Lookup a nmb opcode name.
+ ****************************************************************************/
+
+const char *lookup_opcode_name( int opcode )
+{
+ struct opcode_names *op_namep;
+ int i;
+
+ for(i = 0; nmb_header_opcode_names[i].nmb_opcode_name != 0; i++) {
+ op_namep = &nmb_header_opcode_names[i];
+ if(opcode == op_namep->opcode)
+ return op_namep->nmb_opcode_name;
+ }
+ return "<unknown opcode>";
+}
/****************************************************************************
print out a res_rec structure
@@ -79,9 +107,11 @@ void debug_nmb_packet(struct packet_struct *p)
{
struct nmb_packet *nmb = &p->packet.nmb;
- DEBUG(4,("nmb packet from %s header: id=%d opcode=%d response=%s\n",
+ DEBUG(4,("nmb packet from %s header: id=%d opcode=%s(%d) response=%s\n",
inet_ntoa(p->ip),
- nmb->header.name_trn_id,nmb->header.opcode,BOOLSTR(nmb->header.response)));
+ nmb->header.name_trn_id,
+ lookup_opcode_name(nmb->header.opcode),
+ nmb->header.opcode,BOOLSTR(nmb->header.response)));
DEBUG(4,(" header: flags: bcast=%s rec_avail=%s rec_des=%s trunc=%s auth=%s\n",
BOOLSTR(nmb->header.nm_flags.bcast),
BOOLSTR(nmb->header.nm_flags.recursion_available),