summaryrefslogtreecommitdiffstats
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
commit4563d978feaed37aab78e62461026a79dbc50249 (patch)
treec78891e8b6500718016c762b473c91cd9b20adb3
parent7c690e020ffae9a56c678ae46ae87283a1aa92fe (diff)
downloadsamba-4563d978feaed37aab78e62461026a79dbc50249.tar.gz
samba-4563d978feaed37aab78e62461026a79dbc50249.tar.xz
samba-4563d978feaed37aab78e62461026a79dbc50249.zip
Added better debug for what kind of netbios packet we got.
jra@cygnus.com
-rw-r--r--source/libsmb/nmblib.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/source/libsmb/nmblib.c b/source/libsmb/nmblib.c
index c70311f9978..a0f93331d95 100644
--- a/source/libsmb/nmblib.c
+++ b/source/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),