From d35862ac07fed2f0a12032102c664665e50257f1 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 11 Jul 1999 07:24:57 +0000 Subject: The previous checkins were based on versions of the file prior to Gilbert's new protocol-tree code (and to a bunch of other changes); put all the missing changes back in. svn path=/trunk/; revision=354 --- packet-smb.c | 578 +++++++++++++++++++++++++++++------------------------------ packet.h | 116 ++++++++---- 2 files changed, 366 insertions(+), 328 deletions(-) diff --git a/packet-smb.c b/packet-smb.c index c30540cb86..10a4346d75 100644 --- a/packet-smb.c +++ b/packet-smb.c @@ -2,7 +2,7 @@ * Routines for smb packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-smb.c,v 1.16 1999/07/10 14:01:52 sharpe Exp $ + * $Id: packet-smb.c,v 1.17 1999/07/11 07:24:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -316,7 +316,7 @@ dissect_unknown_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, END_OF_FRAME, "Data (%u bytes)", + proto_tree_add_text(tree, offset, END_OF_FRAME, "Data (%u bytes)", END_OF_FRAME); } @@ -421,7 +421,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -433,7 +433,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -445,7 +445,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 1, "BufferFormat1: %u", BufferFormat1); + proto_tree_add_text(tree, offset, 1, "BufferFormat1: %u", BufferFormat1); } @@ -457,7 +457,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, strlen(SharePath) + 1, "Share Path: %s", SharePath); + proto_tree_add_text(tree, offset, strlen(SharePath) + 1, "Share Path: %s", SharePath); } @@ -469,7 +469,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 1, "BufferFormat2: %u", BufferFormat2); + proto_tree_add_text(tree, offset, 1, "BufferFormat2: %u", BufferFormat2); } @@ -481,7 +481,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, strlen(Password) + 1, "Password: %s", Password); + proto_tree_add_text(tree, offset, strlen(Password) + 1, "Password: %s", Password); } @@ -493,7 +493,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 1, "BufferFormat3: %u", BufferFormat3); + proto_tree_add_text(tree, offset, 1, "BufferFormat3: %u", BufferFormat3); } @@ -505,7 +505,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, strlen(Service) + 1, "Service: %s", Service); + proto_tree_add_text(tree, offset, strlen(Service) + 1, "Service: %s", Service); } @@ -521,7 +521,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -533,7 +533,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Max Buffer Size: %u", MaxBufferSize); + proto_tree_add_text(tree, offset, 2, "Max Buffer Size: %u", MaxBufferSize); } @@ -545,7 +545,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "TID: %u", TID); + proto_tree_add_text(tree, offset, 2, "TID: %u", TID); } @@ -557,7 +557,7 @@ dissect_treecon_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -612,7 +612,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -625,7 +625,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree /* if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXCommand: %u", AndXCommand); + proto_tree_add_text(tree, offset, 1, "AndXCommand: %u", AndXCommand); } */ @@ -637,7 +637,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXReserved: %u", AndXReserved); + proto_tree_add_text(tree, offset, 1, "AndXReserved: %u", AndXReserved); } @@ -649,7 +649,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "AndXOffset: %u", AndXOffset); + proto_tree_add_text(tree, offset, 2, "AndXOffset: %u", AndXOffset); } @@ -661,7 +661,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "MaxBufferSize: %u", MaxBufferSize); + proto_tree_add_text(tree, offset, 2, "MaxBufferSize: %u", MaxBufferSize); } @@ -673,7 +673,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "MaxMpxCount: %u", MaxMpxCount); + proto_tree_add_text(tree, offset, 2, "MaxMpxCount: %u", MaxMpxCount); } @@ -685,7 +685,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "VcNumber: %u", VcNumber); + proto_tree_add_text(tree, offset, 2, "VcNumber: %u", VcNumber); } @@ -697,7 +697,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 4, "SessionKey: %u", SessionKey); + proto_tree_add_text(tree, offset, 4, "SessionKey: %u", SessionKey); } @@ -709,7 +709,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "PasswordLen: %u", PasswordLen); + proto_tree_add_text(tree, offset, 2, "PasswordLen: %u", PasswordLen); } @@ -721,7 +721,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 4, "Reserved: %u", Reserved); + proto_tree_add_text(tree, offset, 4, "Reserved: %u", Reserved); } @@ -733,7 +733,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -745,7 +745,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(AccountName) + 1, "AccountName: %s", AccountName); + proto_tree_add_text(tree, offset, strlen(AccountName) + 1, "AccountName: %s", AccountName); } @@ -757,7 +757,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(PrimaryDomain) + 1, "PrimaryDomain: %s", PrimaryDomain); + proto_tree_add_text(tree, offset, strlen(PrimaryDomain) + 1, "PrimaryDomain: %s", PrimaryDomain); } @@ -769,7 +769,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(NativeOS) + 1, "NativeOS: %s", NativeOS); + proto_tree_add_text(tree, offset, strlen(NativeOS) + 1, "NativeOS: %s", NativeOS); } @@ -785,7 +785,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -798,7 +798,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree /* if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXCommand: %u", AndXCommand); + proto_tree_add_text(tree, offset, 1, "AndXCommand: %u", AndXCommand); } */ @@ -810,7 +810,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXReserved: %u", AndXReserved); + proto_tree_add_text(tree, offset, 1, "AndXReserved: %u", AndXReserved); } @@ -822,7 +822,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "AndXOffset: %u", AndXOffset); + proto_tree_add_text(tree, offset, 2, "AndXOffset: %u", AndXOffset); } @@ -834,7 +834,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "MaxBufferSize: %u", MaxBufferSize); + proto_tree_add_text(tree, offset, 2, "MaxBufferSize: %u", MaxBufferSize); } @@ -846,7 +846,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "MaxMpxCount: %u", MaxMpxCount); + proto_tree_add_text(tree, offset, 2, "MaxMpxCount: %u", MaxMpxCount); } @@ -858,7 +858,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "VcNumber: %u", VcNumber); + proto_tree_add_text(tree, offset, 2, "VcNumber: %u", VcNumber); } @@ -870,7 +870,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 4, "SessionKey: %u", SessionKey); + proto_tree_add_text(tree, offset, 4, "SessionKey: %u", SessionKey); } @@ -882,7 +882,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "ANSI Account Password Length: %u", ANSIAccountPasswordLength); + proto_tree_add_text(tree, offset, 2, "ANSI Account Password Length: %u", ANSIAccountPasswordLength); } @@ -894,7 +894,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "UNICODE Account Password Length: %u", UNICODEAccountPasswordLength); + proto_tree_add_text(tree, offset, 2, "UNICODE Account Password Length: %u", UNICODEAccountPasswordLength); } @@ -906,7 +906,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 4, "Reserved: %u", Reserved); + proto_tree_add_text(tree, offset, 4, "Reserved: %u", Reserved); } @@ -918,36 +918,35 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - ti = proto_tree_add_item(tree, offset, 4, "Capabilities: 0x%04x", Capabilities); - Capabilities_tree = proto_tree_new(); - proto_item_add_subtree(ti, Capabilities_tree, ETT_SMB_CAPABILITIES); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + ti = proto_tree_add_text(tree, offset, 4, "Capabilities: 0x%04x", Capabilities); + Capabilities_tree = proto_item_add_subtree(ti, ETT_SMB_CAPABILITIES); + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0001, 32, " Raw Mode supported", " Raw Mode not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", - decode_boolean_bitfield(Capabilities, 0x0002, 32, " Raw Mode supported", " MPX Mode not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0002, 32, " MPX Mode supported", " MPX Mode not supported")); + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0004, 32," Unicode supported", " Unicode not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0008, 32, " Large Files supported", " Large Files not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0010, 32, " NT LM 0.12 SMBs supported", " NT LM 0.12 SMBs not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0020, 32, " RPC Remote APIs supported", " RPC Remote APIs not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0040, 32, " NT Status Codes supported", " NT Status Codes not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0080, 32, " Level 2 OpLocks supported", " Level 2 OpLocks not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0100, 32, " Lock&Read supported", " Lock&Read not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x0200, 32, " NT Find supported", " NT Find not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x1000, 32, " DFS supported", " DFS not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x4000, 32, " Large READX supported", " Large READX not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x8000, 32, " Large WRITEX supported", " Large WRITEX not supported")); - proto_tree_add_item(Capabilities_tree, offset, 4, "%s", + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", decode_boolean_bitfield(Capabilities, 0x80000000, 32, " Extended Security Exchanges supported", " Extended Security Exchanges not supported")); } @@ -960,7 +959,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count: %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count: %u", ByteCount); } @@ -972,7 +971,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(ANSIPassword) + 1, "ANSI Password: %s", ANSIPassword); + proto_tree_add_text(tree, offset, strlen(ANSIPassword) + 1, "ANSI Password: %s", ANSIPassword); } @@ -986,7 +985,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(UNICODEPassword) + 1, "UNICODE Password: %s", UNICODEPassword); + proto_tree_add_text(tree, offset, strlen(UNICODEPassword) + 1, "UNICODE Password: %s", UNICODEPassword); } @@ -1000,7 +999,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(AccountName) + 1, "Account Name: %s", AccountName); + proto_tree_add_text(tree, offset, strlen(AccountName) + 1, "Account Name: %s", AccountName); } @@ -1012,7 +1011,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(PrimaryDomain) + 1, "Primary Domain: %s", PrimaryDomain); + proto_tree_add_text(tree, offset, strlen(PrimaryDomain) + 1, "Primary Domain: %s", PrimaryDomain); } @@ -1024,7 +1023,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(NativeOS) + 1, "Native OS: %s", NativeOS); + proto_tree_add_text(tree, offset, strlen(NativeOS) + 1, "Native OS: %s", NativeOS); } @@ -1036,7 +1035,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(NativeLanManType) + 1, "Native LanMan Type: %s", NativeLanManType); + proto_tree_add_text(tree, offset, strlen(NativeLanManType) + 1, "Native LanMan Type: %s", NativeLanManType); } @@ -1051,7 +1050,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, AndXCmdOffset, 1, "Command: %s", decode_smb_name(AndXCommand)); + proto_tree_add_text(tree, AndXCmdOffset, 1, "Command: %s", decode_smb_name(AndXCommand)); } @@ -1069,7 +1068,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -1081,7 +1080,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXCommand: %u", AndXCommand); + proto_tree_add_text(tree, offset, 1, "AndXCommand: %u", AndXCommand); } @@ -1093,7 +1092,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXReserved: %u", AndXReserved); + proto_tree_add_text(tree, offset, 1, "AndXReserved: %u", AndXReserved); } @@ -1105,7 +1104,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "AndXOffset: %u", AndXOffset); + proto_tree_add_text(tree, offset, 2, "AndXOffset: %u", AndXOffset); } @@ -1117,7 +1116,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "Action: %u", Action); + proto_tree_add_text(tree, offset, 2, "Action: %u", Action); } @@ -1129,7 +1128,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -1141,7 +1140,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(NativeOS) + 1, "NativeOS: %s", NativeOS); + proto_tree_add_text(tree, offset, strlen(NativeOS) + 1, "NativeOS: %s", NativeOS); } @@ -1153,7 +1152,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(NativeLanMan) + 1, "NativeLanMan: %s", NativeLanMan); + proto_tree_add_text(tree, offset, strlen(NativeLanMan) + 1, "NativeLanMan: %s", NativeLanMan); } @@ -1165,7 +1164,7 @@ dissect_ssetup_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree if (tree) { - proto_tree_add_item(tree, offset, strlen(PrimaryDomain) + 1, "PrimaryDomain: %s", PrimaryDomain); + proto_tree_add_text(tree, offset, strlen(PrimaryDomain) + 1, "PrimaryDomain: %s", PrimaryDomain); } @@ -1207,7 +1206,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 2, "Desired Access (Mode): %u", DesiredAccess); + proto_tree_add_text(tree, offset, 2, "Desired Access (Mode): %u", DesiredAccess); } @@ -1219,7 +1218,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 2, "Search Attributes: %u", SearchAttributes); + proto_tree_add_text(tree, offset, 2, "Search Attributes: %u", SearchAttributes); } @@ -1231,7 +1230,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -1243,7 +1242,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 1, "Buffer Format: %u", BufferFormat); + proto_tree_add_text(tree, offset, 1, "Buffer Format: %u", BufferFormat); } @@ -1255,7 +1254,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, strlen(FileName) + 1, "File Name: %s", FileName); + proto_tree_add_text(tree, offset, strlen(FileName) + 1, "File Name: %s", FileName); } @@ -1271,7 +1270,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -1283,7 +1282,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 2, "FID (File Handle): %u", FID); + proto_tree_add_text(tree, offset, 2, "FID (File Handle): %u", FID); } @@ -1295,7 +1294,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 2, "File Attributes: %u", FileAttributes); + proto_tree_add_text(tree, offset, 2, "File Attributes: %u", FileAttributes); } @@ -1307,7 +1306,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 2, "Last Write Date: %s", dissect_dos_date(LastWriteDate)); + proto_tree_add_text(tree, offset, 2, "Last Write Date: %s", dissect_dos_date(LastWriteDate)); } @@ -1319,7 +1318,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 2, "Last Write Time: %s", dissect_dos_time(LastWriteTime)); + proto_tree_add_text(tree, offset, 2, "Last Write Time: %s", dissect_dos_time(LastWriteTime)); } @@ -1331,7 +1330,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 4, "Data Size: %u", DataSize); + proto_tree_add_text(tree, offset, 4, "Data Size: %u", DataSize); } @@ -1343,7 +1342,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 2, "Access Granted: %u", AccessGranted); + proto_tree_add_text(tree, offset, 2, "Access Granted: %u", AccessGranted); } @@ -1355,7 +1354,7 @@ dissect_open_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -1422,7 +1421,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -1434,7 +1433,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXCommand: %u", AndXCommand); + proto_tree_add_text(tree, offset, 1, "AndXCommand: %u", AndXCommand); } @@ -1446,7 +1445,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXReserved: %u", AndXReserved); + proto_tree_add_text(tree, offset, 1, "AndXReserved: %u", AndXReserved); } @@ -1458,7 +1457,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "AndXOffset: %u", AndXOffset); + proto_tree_add_text(tree, offset, 2, "AndXOffset: %u", AndXOffset); } @@ -1470,14 +1469,13 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - ti = proto_tree_add_item(tree, offset, 2, "Flags: 0x%02x", Flags); - Flags_tree = proto_tree_new(); - proto_item_add_subtree(ti, Flags_tree, ETT_SMB_FLAGS); - proto_tree_add_item(Flags_tree, offset, 2, "%s", + ti = proto_tree_add_text(tree, offset, 2, "Flags: 0x%02x", Flags); + Flags_tree = proto_item_add_subtree(ti, ETT_SMB_FLAGS); + proto_tree_add_text(Flags_tree, offset, 2, "%s", decode_boolean_bitfield(Flags, 0x01, 16, " Dont Return Additional Info", " Return Additional Info")); - proto_tree_add_item(Flags_tree, offset, 2, "%s", + proto_tree_add_text(Flags_tree, offset, 2, "%s", decode_boolean_bitfield(Flags, 0x02, 16, " Exclusive OpLock not Requested", " Exclusive OpLock Requested")); - proto_tree_add_item(Flags_tree, offset, 2, "%s", + proto_tree_add_text(Flags_tree, offset, 2, "%s", decode_boolean_bitfield(Flags, 0x04, 16, " Batch OpLock not Requested", " Batch OpLock Requested")); } @@ -1490,7 +1488,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Desired Access: %u", DesiredAccess); + proto_tree_add_text(tree, offset, 2, "Desired Access: %u", DesiredAccess); } @@ -1502,7 +1500,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Search Attributes: %u", SearchAttributes); + proto_tree_add_text(tree, offset, 2, "Search Attributes: %u", SearchAttributes); } @@ -1514,7 +1512,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "File Attributes: %u", FileAttributes); + proto_tree_add_text(tree, offset, 2, "File Attributes: %u", FileAttributes); } @@ -1526,7 +1524,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Creation Time: %s", dissect_dos_date(CreationTime)); + proto_tree_add_text(tree, offset, 2, "Creation Time: %s", dissect_dos_date(CreationTime)); } @@ -1538,7 +1536,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Creation Date: %s", dissect_dos_time(CreationDate)); + proto_tree_add_text(tree, offset, 2, "Creation Date: %s", dissect_dos_time(CreationDate)); } @@ -1550,12 +1548,11 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - ti = proto_tree_add_item(tree, offset, 2, "Open Function: 0x%02x", OpenFunction); - OpenFunction_tree = proto_tree_new(); - proto_item_add_subtree(ti, OpenFunction_tree, ETT_SMB_OPENFUNCTION); - proto_tree_add_item(OpenFunction_tree, offset, 2, "%s", + ti = proto_tree_add_text(tree, offset, 2, "Open Function: 0x%02x", OpenFunction); + OpenFunction_tree = proto_item_add_subtree(ti, ETT_SMB_OPENFUNCTION); + proto_tree_add_text(OpenFunction_tree, offset, 2, "%s", decode_enumerated_bitfield(OpenFunction, 0x10, 16, OpenFunction_0x10, "%s")); - proto_tree_add_item(OpenFunction_tree, offset, 2, "%s", + proto_tree_add_text(OpenFunction_tree, offset, 2, "%s", decode_enumerated_bitfield(OpenFunction, 0x03, 16, OpenFunction_0x03, "%s")); } @@ -1568,7 +1565,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 4, "Allocated Size: %u", AllocatedSize); + proto_tree_add_text(tree, offset, 4, "Allocated Size: %u", AllocatedSize); } @@ -1580,7 +1577,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 4, "Reserved1: %u", Reserved1); + proto_tree_add_text(tree, offset, 4, "Reserved1: %u", Reserved1); } @@ -1592,7 +1589,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 4, "Reserved2: %u", Reserved2); + proto_tree_add_text(tree, offset, 4, "Reserved2: %u", Reserved2); } @@ -1604,7 +1601,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count: %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count: %u", ByteCount); } @@ -1616,7 +1613,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Buffer Format: %u", BufferFormat); + proto_tree_add_text(tree, offset, 1, "Buffer Format: %u", BufferFormat); } @@ -1628,7 +1625,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, strlen(FileName) + 1, "File Name: %s", FileName); + proto_tree_add_text(tree, offset, strlen(FileName) + 1, "File Name: %s", FileName); } @@ -1651,7 +1648,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -1663,7 +1660,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXCommand: %u", AndXCommand); + proto_tree_add_text(tree, offset, 1, "AndXCommand: %u", AndXCommand); } @@ -1675,7 +1672,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "AndXReserved: %u", AndXReserved); + proto_tree_add_text(tree, offset, 1, "AndXReserved: %u", AndXReserved); } @@ -1687,7 +1684,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "AndXOffset: %u", AndXOffset); + proto_tree_add_text(tree, offset, 2, "AndXOffset: %u", AndXOffset); } @@ -1699,7 +1696,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "FID: %u", FID); + proto_tree_add_text(tree, offset, 2, "FID: %u", FID); } @@ -1711,7 +1708,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Attributed: %u", Attributed); + proto_tree_add_text(tree, offset, 2, "Attributed: %u", Attributed); } @@ -1723,7 +1720,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Last Write Time: %s", dissect_dos_time(LastWriteTime)); + proto_tree_add_text(tree, offset, 2, "Last Write Time: %s", dissect_dos_time(LastWriteTime)); } @@ -1735,7 +1732,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Last Write Date: %s", dissect_dos_date(LastWriteDate)); + proto_tree_add_text(tree, offset, 2, "Last Write Date: %s", dissect_dos_date(LastWriteDate)); } @@ -1747,7 +1744,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 4, "Data Size: %u", DataSize); + proto_tree_add_text(tree, offset, 4, "Data Size: %u", DataSize); } @@ -1759,7 +1756,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Granted Access: %u", GrantedAccess); + proto_tree_add_text(tree, offset, 2, "Granted Access: %u", GrantedAccess); } @@ -1771,7 +1768,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "File Type: %u", FileType); + proto_tree_add_text(tree, offset, 2, "File Type: %u", FileType); } @@ -1783,7 +1780,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Device State: %u", DeviceState); + proto_tree_add_text(tree, offset, 2, "Device State: %u", DeviceState); } @@ -1795,7 +1792,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Action: %u", Action); + proto_tree_add_text(tree, offset, 2, "Action: %u", Action); } @@ -1807,7 +1804,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 4, "Server FID: %u", ServerFID); + proto_tree_add_text(tree, offset, 4, "Server FID: %u", ServerFID); } @@ -1819,7 +1816,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Reserved: %u", Reserved); + proto_tree_add_text(tree, offset, 2, "Reserved: %u", Reserved); } @@ -1831,7 +1828,7 @@ dissect_open_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count: %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count: %u", ByteCount); } @@ -1869,9 +1866,9 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Invalid TCON_ANDX format. WCT should be 2, 3, or 4 ..., not %u", wct); + proto_tree_add_text(tree, offset, 1, "Invalid TCON_ANDX format. WCT should be 2, 3, or 4 ..., not %u", wct); - proto_tree_add_item(tree, offset, END_OF_FRAME, "Data"); + proto_tree_add_text(tree, offset, END_OF_FRAME, "Data"); return; @@ -1881,7 +1878,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", wct); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", wct); } @@ -1891,11 +1888,11 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Next Command: %s", + proto_tree_add_text(tree, offset, 1, "Next Command: %s", (andxcmd == 0xFF) ? "No further commands": decode_smb_name(andxcmd)); - proto_tree_add_item(tree, offset + 1, 1, "Reserved (MBZ): %u", pd[offset+1]); + proto_tree_add_text(tree, offset + 1, 1, "Reserved (MBZ): %u", pd[offset+1]); } @@ -1905,7 +1902,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Offset to next command: %u", andxoffs); + proto_tree_add_text(tree, offset, 2, "Offset to next command: %u", andxoffs); } @@ -1919,10 +1916,9 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - ti = proto_tree_add_item(tree, offset, 2, "Additional Flags: 0x%02x", flags); - flags_tree = proto_tree_new(); - proto_item_add_subtree(ti, flags_tree, ETT_SMB_AFLAGS); - proto_tree_add_item(flags_tree, offset, 2, "%s", + ti = proto_tree_add_text(tree, offset, 2, "Additional Flags: 0x%02x", flags); + flags_tree = proto_item_add_subtree(ti, ETT_SMB_AFLAGS); + proto_tree_add_text(flags_tree, offset, 2, "%s", decode_boolean_bitfield(flags, 0x01, 16, "Disconnect TID", "Don't disconnect TID")); @@ -1935,7 +1931,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Password Length: %u", passwdlen); + proto_tree_add_text(tree, offset, 2, "Password Length: %u", passwdlen); } @@ -1945,7 +1941,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", bcc); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", bcc); } @@ -1955,7 +1951,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, strlen(str) + 1, "Password: %s", str); + proto_tree_add_text(tree, offset, strlen(str) + 1, "Password: %s", str); } @@ -1965,7 +1961,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, strlen(str) + 1, "Path: %s", str); + proto_tree_add_text(tree, offset, strlen(str) + 1, "Path: %s", str); } @@ -1975,7 +1971,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, strlen(str) + 1, "Service: %s", str); + proto_tree_add_text(tree, offset, strlen(str) + 1, "Service: %s", str); } @@ -1989,7 +1985,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", bcc); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", bcc); } @@ -1999,7 +1995,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, strlen(str) + 1, "Service Type: %s", + proto_tree_add_text(tree, offset, strlen(str) + 1, "Service Type: %s", str); } @@ -2014,7 +2010,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { /* Should break out the bits */ - proto_tree_add_item(tree, offset, 2, "Optional Support: 0x%04x", + proto_tree_add_text(tree, offset, 2, "Optional Support: 0x%04x", optionsup); } @@ -2025,7 +2021,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", bcc); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", bcc); } @@ -2035,7 +2031,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, strlen(str) + 1, "Service: %s", str); + proto_tree_add_text(tree, offset, strlen(str) + 1, "Service: %s", str); } @@ -2045,7 +2041,7 @@ dissect_tcon_andx_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, strlen(str) + 1, "Native File System: %s", str); + proto_tree_add_text(tree, offset, strlen(str) + 1, "Native File System: %s", str); } @@ -2069,8 +2065,8 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr { guint8 wct, enckeylen; guint16 bcc, mode, rawmode, dialect; - guint32 caps; - proto_tree *dialects = NULL, *mode_tree, *caps_tree, *rawmode_tree; + guint32 Capabilities; + proto_tree *dialects = NULL, *mode_tree, *Capabilities_tree, *rawmode_tree; proto_item *ti; const char *str; char *ustr; @@ -2082,9 +2078,9 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr !((wct == 13) && (dirn == 0)) && !((wct == 17) && (dirn == 0))) { if (tree) { - proto_tree_add_item(tree, offset, 1, "Invalid Negotiate Protocol format. WCT should be zero or 1 or 13 or 17 ..., not %u", wct); + proto_tree_add_text(tree, offset, 1, "Invalid Negotiate Protocol format. WCT should be zero or 1 or 13 or 17 ..., not %u", wct); - proto_tree_add_item(tree, offset, END_OF_FRAME, "Data"); + proto_tree_add_text(tree, offset, END_OF_FRAME, "Data"); return; } @@ -2092,7 +2088,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %d", wct); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %d", wct); } @@ -2108,7 +2104,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", bcc); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", bcc); } @@ -2116,9 +2112,8 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - ti = proto_tree_add_item(tree, offset, END_OF_FRAME, "Dialects"); - dialects = proto_tree_new(); - proto_item_add_subtree(ti, dialects, ETT_SMB_DIALECTS); + ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "Dialects"); + dialects = proto_item_add_subtree(ti, ETT_SMB_DIALECTS); } @@ -2127,7 +2122,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(dialects, offset, 1, "Dialect Marker: %d", pd[offset]); + proto_tree_add_text(dialects, offset, 1, "Dialect Marker: %d", pd[offset]); } @@ -2137,7 +2132,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(dialects, offset, strlen(str)+1, "Dialect: %s", str); + proto_tree_add_text(dialects, offset, strlen(str)+1, "Dialect: %s", str); } @@ -2154,12 +2149,12 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (dialect == 0xFFFF) { /* Server didn't like them dialects */ - proto_tree_add_item(tree, offset, 2, "Supplied dialects not recognized"); + proto_tree_add_text(tree, offset, 2, "Supplied dialects not recognized"); } else { - proto_tree_add_item(tree, offset, 2, "Dialect Index: %u, PC NETWORK PROTGRAM 1.0", dialect); + proto_tree_add_text(tree, offset, 2, "Dialect Index: %u, PC NETWORK PROTGRAM 1.0", dialect); } @@ -2171,7 +2166,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", bcc); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", bcc); } @@ -2181,7 +2176,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Dialect Index: %u, Greater than CORE PROTOCOL and up to LANMAN2.1", GSHORT(pd, offset)); + proto_tree_add_text(tree, offset, 2, "Dialect Index: %u, Greater than CORE PROTOCOL and up to LANMAN2.1", GSHORT(pd, offset)); } @@ -2193,14 +2188,13 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - ti = proto_tree_add_item(tree, offset, 2, "Security Mode: 0x%04x", mode); - mode_tree = proto_tree_new(); - proto_item_add_subtree(ti, mode_tree, ETT_SMB_MODE); - proto_tree_add_item(mode_tree, offset, 2, "%s", + ti = proto_tree_add_text(tree, offset, 2, "Security Mode: 0x%04x", mode); + mode_tree = proto_item_add_subtree(ti, ETT_SMB_MODE); + proto_tree_add_text(mode_tree, offset, 2, "%s", decode_boolean_bitfield(mode, 0x0001, 16, "Security = User", "Security = Share")); - proto_tree_add_item(mode_tree, offset, 2, "%s", + proto_tree_add_text(mode_tree, offset, 2, "%s", decode_boolean_bitfield(mode, 0x0002, 16, "Passwords = Encrypted", "Passwords = Plaintext")); @@ -2211,7 +2205,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Max buffer size: %u", GSHORT(pd, offset)); + proto_tree_add_text(tree, offset, 2, "Max buffer size: %u", GSHORT(pd, offset)); } @@ -2219,7 +2213,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Max multiplex count: %u", GSHORT(pd, offset)); + proto_tree_add_text(tree, offset, 2, "Max multiplex count: %u", GSHORT(pd, offset)); } @@ -2227,7 +2221,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Max vcs: %u", GSHORT(pd, offset)); + proto_tree_add_text(tree, offset, 2, "Max vcs: %u", GSHORT(pd, offset)); } @@ -2237,14 +2231,13 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - ti = proto_tree_add_item(tree, offset, 2, "Raw Mode: 0x%04x", rawmode); - rawmode_tree = proto_tree_new(); - proto_item_add_subtree(ti, rawmode_tree, ETT_SMB_RAWMODE); - proto_tree_add_item(rawmode_tree, offset, 2, "%s", + ti = proto_tree_add_text(tree, offset, 2, "Raw Mode: 0x%04x", rawmode); + rawmode_tree = proto_item_add_subtree(ti, ETT_SMB_RAWMODE); + proto_tree_add_text(rawmode_tree, offset, 2, "%s", decode_boolean_bitfield(rawmode, 0x01, 16, "Read Raw supported", "Read Raw not supported")); - proto_tree_add_item(rawmode_tree, offset, 2, "%s", + proto_tree_add_text(rawmode_tree, offset, 2, "%s", decode_boolean_bitfield(rawmode, 0x02, 16, "Write Raw supported", "Write Raw not supported")); @@ -2255,7 +2248,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 4, "Session key: %08x", GWORD(pd, offset)); + proto_tree_add_text(tree, offset, 4, "Session key: %08x", GWORD(pd, offset)); } @@ -2265,9 +2258,9 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Server Time: %s", + proto_tree_add_text(tree, offset, 2, "Server Time: %s", dissect_dos_time(GSHORT(pd, offset))); - proto_tree_add_item(tree, offset + 2, 2, "Server Date: %s", + proto_tree_add_text(tree, offset + 2, 2, "Server Date: %s", dissect_dos_date(GSHORT(pd, offset + 2))); } @@ -2278,7 +2271,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Server time zone: %i min from UTC", + proto_tree_add_text(tree, offset, 2, "Server time zone: %i min from UTC", (signed)GSSHORT(pd, offset)); } @@ -2291,7 +2284,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Challenge Length: %u", enckeylen); + proto_tree_add_text(tree, offset, 2, "Challenge Length: %u", enckeylen); } @@ -2299,7 +2292,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Reserved: %u (MBZ)", GSHORT(pd, offset)); + proto_tree_add_text(tree, offset, 2, "Reserved: %u (MBZ)", GSHORT(pd, offset)); } @@ -2309,7 +2302,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", bcc); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", bcc); } @@ -2321,7 +2314,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, enckeylen, "Challenge: %s", + proto_tree_add_text(tree, offset, enckeylen, "Challenge: %s", bytes_to_str(str, enckeylen)); } @@ -2335,7 +2328,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, strlen(str)+1, "Primary Domain: %s", str); + proto_tree_add_text(tree, offset, strlen(str)+1, "Primary Domain: %s", str); } @@ -2345,7 +2338,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Dialect Index: %u, Greater than LANMAN2.1", GSHORT(pd, offset)); + proto_tree_add_text(tree, offset, 2, "Dialect Index: %u, Greater than LANMAN2.1", GSHORT(pd, offset)); } @@ -2355,22 +2348,21 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - ti = proto_tree_add_item(tree, offset, 1, "Security Mode: 0x%02x", mode); - mode_tree = proto_tree_new(); - proto_item_add_subtree(ti, mode_tree, ETT_SMB_MODE); - proto_tree_add_item(mode_tree, offset, 1, "%s", + ti = proto_tree_add_text(tree, offset, 1, "Security Mode: 0x%02x", mode); + mode_tree = proto_item_add_subtree(ti, ETT_SMB_MODE); + proto_tree_add_text(mode_tree, offset, 1, "%s", decode_boolean_bitfield(mode, 0x01, 8, "Security = User", "Security = Share")); - proto_tree_add_item(mode_tree, offset, 1, "%s", + proto_tree_add_text(mode_tree, offset, 1, "%s", decode_boolean_bitfield(mode, 0x02, 8, "Passwords = Encrypted", "Passwords = Plaintext")); - proto_tree_add_item(mode_tree, offset, 1, "%s", + proto_tree_add_text(mode_tree, offset, 1, "%s", decode_boolean_bitfield(mode, 0x04, 8, "Security signatures enabled", "Security signatures not enabled")); - proto_tree_add_item(mode_tree, offset, 1, "%s", + proto_tree_add_text(mode_tree, offset, 1, "%s", decode_boolean_bitfield(mode, 0x08, 8, "Security signatures required", "Security signatures not required")); @@ -2381,7 +2373,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Max multiplex count: %u", GSHORT(pd, offset)); + proto_tree_add_text(tree, offset, 2, "Max multiplex count: %u", GSHORT(pd, offset)); } @@ -2389,7 +2381,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Max vcs: %u", GSHORT(pd, offset)); + proto_tree_add_text(tree, offset, 2, "Max vcs: %u", GSHORT(pd, offset)); } @@ -2397,7 +2389,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Max buffer size: %u", GWORD(pd, offset)); + proto_tree_add_text(tree, offset, 2, "Max buffer size: %u", GWORD(pd, offset)); } @@ -2405,7 +2397,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 4, "Max raw size: %u", GWORD(pd, offset)); + proto_tree_add_text(tree, offset, 4, "Max raw size: %u", GWORD(pd, offset)); } @@ -2413,73 +2405,72 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 4, "Session key: %08x", GWORD(pd, offset)); + proto_tree_add_text(tree, offset, 4, "Session key: %08x", GWORD(pd, offset)); } offset += 4; - caps = GWORD(pd, offset); + Capabilities = GWORD(pd, offset); if (tree) { - ti = proto_tree_add_item(tree, offset, 4, "Capabilities: 0x%04x", caps); - caps_tree = proto_tree_new(); - proto_item_add_subtree(ti, caps_tree, ETT_SMB_CAPS); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0001, 32, + ti = proto_tree_add_text(tree, offset, 4, "Capabilities: 0x%04x", Capabilities); + Capabilities_tree = proto_item_add_subtree(ti, ETT_SMB_CAPABILITIES); + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0001, 32, "Raw Mode supported", "Raw Mode not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0002, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0002, 32, "MPX Mode supported", "MPX Mode not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0004, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0004, 32, "Unicode supported", "Unicode not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0008, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0008, 32, "Large files supported", "Large files not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0010, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0010, 32, "NT LM 0.12 SMBs supported", "NT LM 0.12 SMBs not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0020, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0020, 32, "RPC remote APIs supported", "RPC remote APIs not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0040, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0040, 32, "NT status codes supported", "NT status codes not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0080, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0080, 32, "Level 2 OpLocks supported", "Level 2 OpLocks not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0100, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0100, 32, "Lock&Read supported", "Lock&Read not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x0200, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x0200, 32, "NT Find supported", "NT Find not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x1000, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x1000, 32, "DFS supported", "DFS not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x4000, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x4000, 32, "Large READX supported", "Large READX not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x8000, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x8000, 32, "Large WRITEX supported", "Large WRITEX not supported")); - proto_tree_add_item(caps_tree, offset, 4, "%s", - decode_boolean_bitfield(caps, 0x80000000, 32, + proto_tree_add_text(Capabilities_tree, offset, 4, "%s", + decode_boolean_bitfield(Capabilities, 0x80000000, 32, "Extended security exchanges supported", "Extended security exchanges not supported")); } @@ -2490,8 +2481,8 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 4, "System Time Low: 0x%08x", GWORD(pd, offset)); - proto_tree_add_item(tree, offset + 4, 4, "System Time High: 0x%08x", GWORD(pd, offset + 4)); + proto_tree_add_text(tree, offset, 4, "System Time Low: 0x%08x", GWORD(pd, offset)); + proto_tree_add_text(tree, offset + 4, 4, "System Time High: 0x%08x", GWORD(pd, offset + 4)); } @@ -2501,7 +2492,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Server time zone: %i min from UTC", + proto_tree_add_text(tree, offset, 2, "Server time zone: %i min from UTC", (signed)GSSHORT(pd, offset)); } @@ -2514,7 +2505,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 1, "Encryption key len: %u", enckeylen); + proto_tree_add_text(tree, offset, 1, "Encryption key len: %u", enckeylen); } @@ -2524,7 +2515,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte count (BCC): %u", bcc); + proto_tree_add_text(tree, offset, 2, "Byte count (BCC): %u", bcc); } @@ -2538,7 +2529,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - proto_tree_add_item(tree, offset, enckeylen, "Challenge encryption key: %s", + proto_tree_add_text(tree, offset, enckeylen, "Challenge encryption key: %s", bytes_to_str(str, enckeylen)); } @@ -2555,11 +2546,11 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr if (tree) { - if (caps & 0x0004) { + if (Capabilities & 0x0004) { ustr = unicode_to_str(str, &ustr_len); - proto_tree_add_item(tree, offset, ustr_len+2, "OEM domain name: %s", ustr); + proto_tree_add_text(tree, offset, ustr_len+2, "OEM domain name: %s", ustr); } else { - proto_tree_add_item(tree, offset, strlen(str)+1, "OEM domain name: %s", str); + proto_tree_add_text(tree, offset, strlen(str)+1, "OEM domain name: %s", str); } } @@ -2569,7 +2560,7 @@ dissect_negprot_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tr default: /* Baddd */ if (tree) - proto_tree_add_item(tree, offset, 1, "Bad format, should never get here"); + proto_tree_add_text(tree, offset, 1, "Bad format, should never get here"); return; } @@ -2593,7 +2584,7 @@ dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -2605,7 +2596,7 @@ dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -2617,7 +2608,7 @@ dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Buffer Format: %u", BufferFormat); + proto_tree_add_text(tree, offset, 1, "Buffer Format: %u", BufferFormat); } @@ -2629,7 +2620,7 @@ dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, strlen(DirectoryName) + 1, "Directory Name: %s", DirectoryName); + proto_tree_add_text(tree, offset, strlen(DirectoryName) + 1, "Directory Name: %s", DirectoryName); } @@ -2645,7 +2636,7 @@ dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -2657,7 +2648,7 @@ dissect_deletedir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -2684,7 +2675,7 @@ dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -2696,7 +2687,7 @@ dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -2708,7 +2699,7 @@ dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Buffer Format: %u", BufferFormat); + proto_tree_add_text(tree, offset, 1, "Buffer Format: %u", BufferFormat); } @@ -2720,7 +2711,7 @@ dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, strlen(DirectoryName) + 1, "Directory Name: %s", DirectoryName); + proto_tree_add_text(tree, offset, strlen(DirectoryName) + 1, "Directory Name: %s", DirectoryName); } @@ -2736,7 +2727,7 @@ dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -2748,7 +2739,7 @@ dissect_createdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree * if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -2775,7 +2766,7 @@ dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *t if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -2787,7 +2778,7 @@ dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *t if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -2799,7 +2790,7 @@ dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *t if (tree) { - proto_tree_add_item(tree, offset, 1, "Buffer Format: %u", BufferFormat); + proto_tree_add_text(tree, offset, 1, "Buffer Format: %u", BufferFormat); } @@ -2811,7 +2802,7 @@ dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *t if (tree) { - proto_tree_add_item(tree, offset, strlen(DirectoryName) + 1, "Directory Name: %s", DirectoryName); + proto_tree_add_text(tree, offset, strlen(DirectoryName) + 1, "Directory Name: %s", DirectoryName); } @@ -2827,7 +2818,7 @@ dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *t if (tree) { - proto_tree_add_item(tree, offset, 1, "Word Count (WCT): %u", WordCount); + proto_tree_add_text(tree, offset, 1, "Word Count (WCT): %u", WordCount); } @@ -2839,7 +2830,7 @@ dissect_checkdir_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *t if (tree) { - proto_tree_add_item(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); + proto_tree_add_text(tree, offset, 2, "Byte Count (BCC): %u", ByteCount); } @@ -3284,17 +3275,16 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - ti = proto_tree_add_item(tree, offset, END_OF_FRAME, + ti = proto_tree_add_text(tree, offset, END_OF_FRAME, "Server Message Block Protocol"); - smb_tree = proto_tree_new(); - proto_item_add_subtree(ti, smb_tree, ETT_SMB); + smb_tree = proto_item_add_subtree(ti, ETT_SMB); /* 0xFFSMB is actually a 1 byte msg type and 3 byte server * component ... SMB is only one used */ - proto_tree_add_item(smb_tree, offset, 1, "Message Type: 0xFF"); - proto_tree_add_item(smb_tree, offset+1, 3, "Server Component: SMB"); + proto_tree_add_text(smb_tree, offset, 1, "Message Type: 0xFF"); + proto_tree_add_text(smb_tree, offset+1, 3, "Server Component: SMB"); } @@ -3302,7 +3292,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - proto_tree_add_item(smb_tree, offset, 1, "Command: %s", decode_smb_name(cmd)); + proto_tree_add_text(smb_tree, offset, 1, "Command: %s", decode_smb_name(cmd)); } @@ -3314,7 +3304,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - proto_tree_add_item(smb_tree, offset, 1, "Error Class: %s", + proto_tree_add_text(smb_tree, offset, 1, "Error Class: %s", val_to_str((guint8)pd[offset], errcls_types, "Unknown Error Class (%x)")); } @@ -3326,7 +3316,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - proto_tree_add_item(smb_tree, offset, 1, "Reserved: %i", errcode1); + proto_tree_add_text(smb_tree, offset, 1, "Reserved: %i", errcode1); } @@ -3336,7 +3326,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - proto_tree_add_item(smb_tree, offset, 2, "Error Code: %s", + proto_tree_add_text(smb_tree, offset, 2, "Error Code: %s", decode_smb_error(errcls, errcode)); } @@ -3349,36 +3339,35 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - tf = proto_tree_add_item(smb_tree, offset, 1, "Flags: 0x%02x", flags); + tf = proto_tree_add_text(smb_tree, offset, 1, "Flags: 0x%02x", flags); - flags_tree = proto_tree_new(); - proto_item_add_subtree(tf, flags_tree, ETT_SMB_FLAGS); - proto_tree_add_item(flags_tree, offset, 1, "%s", + flags_tree = proto_item_add_subtree(tf, ETT_SMB_FLAGS); + proto_tree_add_text(flags_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x01, 8, "Lock&Read, Write&Unlock supported", "Lock&Read, Write&Unlock not supported")); - proto_tree_add_item(flags_tree, offset, 1, "%s", + proto_tree_add_text(flags_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x02, 8, "Receive buffer posted", "Receive buffer not posted")); - proto_tree_add_item(flags_tree, offset, 1, "%s", + proto_tree_add_text(flags_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x08, 8, "Path names caseless", "Path names case sensitive")); - proto_tree_add_item(flags_tree, offset, 1, "%s", + proto_tree_add_text(flags_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x10, 8, "Pathnames canonicalized", "Pathnames not canonicalized")); - proto_tree_add_item(flags_tree, offset, 1, "%s", + proto_tree_add_text(flags_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x20, 8, "OpLocks requested/granted", "OpLocks not requested/granted")); - proto_tree_add_item(flags_tree, offset, 1, "%s", + proto_tree_add_text(flags_tree, offset, 1, "%s", decode_boolean_bitfield(flags, 0x40, 8, "Notify all", "Notify open only")); - proto_tree_add_item(flags_tree, offset, 1, "%s", + proto_tree_add_text(flags_tree, offset, 1, "%s", decode_boolean_bitfield(flags, SMB_FLAGS_DIRN, 8, "Response to client/redirector", "Request to server")); @@ -3390,39 +3379,38 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - tf = proto_tree_add_item(smb_tree, offset, 1, "Flags2: 0x%04x", flags2); + tf = proto_tree_add_text(smb_tree, offset, 1, "Flags2: 0x%04x", flags2); - flags2_tree = proto_tree_new(); - proto_item_add_subtree(tf, flags2_tree, ETT_SMB_FLAGS2); - proto_tree_add_item(flags2_tree, offset, 1, "%s", + flags2_tree = proto_item_add_subtree(tf, ETT_SMB_FLAGS2); + proto_tree_add_text(flags2_tree, offset, 1, "%s", decode_boolean_bitfield(flags2, 0x0001, 16, "Long file names supported", "Long file names not supported")); - proto_tree_add_item(flags2_tree, offset, 1, "%s", + proto_tree_add_text(flags2_tree, offset, 1, "%s", decode_boolean_bitfield(flags2, 0x0002, 16, "Extended attributes supported", "Extended attributes not supported")); - proto_tree_add_item(flags2_tree, offset, 1, "%s", + proto_tree_add_text(flags2_tree, offset, 1, "%s", decode_boolean_bitfield(flags2, 0x0004, 16, "Security signatures supported", "Security signatures not supported")); - proto_tree_add_item(flags2_tree, offset, 1, "%s", + proto_tree_add_text(flags2_tree, offset, 1, "%s", decode_boolean_bitfield(flags2, 0x0800, 16, "Extended security negotiation supported", "Extended security negotiation not supported")); - proto_tree_add_item(flags2_tree, offset, 1, "%s", + proto_tree_add_text(flags2_tree, offset, 1, "%s", decode_boolean_bitfield(flags2, 0x1000, 16, "Resolve pathnames with DFS", "Don't resolve pathnames with DFS")); - proto_tree_add_item(flags2_tree, offset, 1, "%s", + proto_tree_add_text(flags2_tree, offset, 1, "%s", decode_boolean_bitfield(flags2, 0x2000, 16, "Permit reads if execute-only", "Don't permit reads if execute-only")); - proto_tree_add_item(flags2_tree, offset, 1, "%s", + proto_tree_add_text(flags2_tree, offset, 1, "%s", decode_boolean_bitfield(flags2, 0x4000, 16, "Error codes are NT error codes", "Error codes are DOS error codes")); - proto_tree_add_item(flags2_tree, offset, 1, "%s", + proto_tree_add_text(flags2_tree, offset, 1, "%s", decode_boolean_bitfield(flags2, 0x8000, 16, "Strings are Unicode", "Strings are ASCII")); @@ -3433,7 +3421,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - proto_tree_add_item(smb_tree, offset, 12, "Reserved: 6 WORDS"); + proto_tree_add_text(smb_tree, offset, 12, "Reserved: 6 WORDS"); } @@ -3445,7 +3433,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - proto_tree_add_item(smb_tree, offset, 2, "Network Path/Tree ID (TID): %i (%04x)", tid, tid); + proto_tree_add_text(smb_tree, offset, 2, "Network Path/Tree ID (TID): %i (%04x)", tid, tid); } @@ -3457,7 +3445,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - proto_tree_add_item(smb_tree, offset, 2, "Process ID (PID): %i (%04x)", pid, pid); + proto_tree_add_text(smb_tree, offset, 2, "Process ID (PID): %i (%04x)", pid, pid); } @@ -3469,7 +3457,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - proto_tree_add_item(smb_tree, offset, 2, "User ID (UID): %i (%04x)", uid, uid); + proto_tree_add_text(smb_tree, offset, 2, "User ID (UID): %i (%04x)", uid, uid); } @@ -3481,7 +3469,7 @@ dissect_smb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int if (tree) { - proto_tree_add_item(smb_tree, offset, 2, "Multiplex ID (MID): %i (%04x)", mid, mid); + proto_tree_add_text(smb_tree, offset, 2, "Multiplex ID (MID): %i (%04x)", mid, mid); } diff --git a/packet.h b/packet.h index c3a5e16146..7cd1e16d97 100644 --- a/packet.h +++ b/packet.h @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.68 1999/07/10 14:01:53 sharpe Exp $ + * $Id: packet.h,v 1.69 1999/07/11 07:24:57 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -27,6 +27,10 @@ #ifndef __PACKET_H__ #define __PACKET_H__ +#ifndef __PROTO_H__ +#include "proto.h" +#endif + /* Pointer versions of ntohs and ntohl. Given a pointer to a member of a * byte array, returns the value of the two or four bytes at the pointer. * The pletoh[sl] versions return the little-endian representation. @@ -65,17 +69,24 @@ #endif #endif +/* Useful when you have an array whose size you can tell at compile-time */ +#define array_length(x) (sizeof x / sizeof x[0]) + /* Useful when highlighting regions inside a dissect_*() function. With this * macro, you can highlight from an arbitrary offset to the end of the * frame. See dissect_data() for an example. */ #define END_OF_FRAME (fd->cap_len - offset) +/* To pass one of two strings, singular or plural */ +#define plurality(d,s,p) ((d) == 1 ? (s) : (p)) typedef struct _column_info { gint num_cols; /* Number of columns */ + gchar **col_title;/* Column title */ gboolean **fmt_matx; /* Specifies which formats apply to a column */ gchar **col_data; /* Column data */ + gint *col_width; /* Column width */ } column_info; #define COL_MAX_LEN 256 @@ -84,6 +95,7 @@ typedef struct _packet_counts { gint tcp; gint udp; gint ospf; + gint gre; gint other; gint total; } packet_counts; @@ -99,9 +111,8 @@ typedef struct _frame_data { guint32 del_usecs; /* Delta microseconds */ long file_off; /* File offset */ column_info *cinfo; /* Column formatting information */ -#ifdef WITH_WIRETAP - int lnk_t; /* Per-packet encapsulation/data-link type */ -#endif + int lnk_t; /* Per-packet encapsulation/data-link type */ + gboolean passed_dfilter; /* TRUE = display, FALSE = no display */ } frame_data; typedef struct _packet_info { @@ -137,11 +148,14 @@ typedef struct tcp_extra_data { add_subtree() call. */ enum { + ETT_NONE, ETT_FRAME, ETT_IEEE8023, ETT_ETHER2, ETT_LLC, ETT_TOKEN_RING, + ETT_TOKEN_RING_AC, + ETT_TOKEN_RING_FC, ETT_TR_IERR_CNT, ETT_TR_NERR_CNT, ETT_TR_MAC, @@ -166,12 +180,17 @@ enum { ETT_IPX, ETT_SPX, ETT_NCP, + ETT_NCP_REQUEST_FIELDS, + ETT_NCP_REPLY_FIELDS, ETT_DNS, ETT_DNS_FLAGS, ETT_DNS_QRY, ETT_DNS_QD, ETT_DNS_ANS, ETT_DNS_RR, + ETT_ISAKMP, + ETT_ISAKMP_FLAGS, + ETT_ISAKMP_PAYLOAD, ETT_RIP, ETT_RIP_VEC, ETT_OSPF, @@ -223,15 +242,51 @@ enum { ETT_TELNET, ETT_TELNET_SUBOPT, ETT_NNTP, + ETT_SNMP, ETT_NBSS, ETT_NBSS_FLAGS, ETT_SMB, ETT_SMB_FLAGS, + ETT_SMB_FLAGS2, ETT_SMB_DIALECTS, ETT_SMB_MODE, - ETT_SMB_CAPS, + ETT_SMB_CAPABILITIES, ETT_SMB_RAWMODE, ETT_SMB_AFLAGS, + ETT_SMB_OPENFUNCTION, + ETT_PPTP, + ETT_GRE, + ETT_GRE_FLAGS, + ETT_PPPOED, + ETT_PPPOED_TAGS, + ETT_PPPOES, + ETT_LCP, + ETT_IPCP, + ETT_RSVP, + ETT_RSVP_UNKNOWN_CLASS, + ETT_RSVP_HDR, + ETT_RSVP_SESSION, + ETT_RSVP_SGROUP, + ETT_RSVP_HOP, + ETT_RSVP_INTEGRITY, + ETT_RSVP_TIME_VALUES, + ETT_RSVP_ERROR, + ETT_RSVP_SCOPE, + ETT_RSVP_STYLE, + ETT_RSVP_FLOWSPEC, + ETT_RSVP_FILTER_SPEC, + ETT_RSVP_SENDER_TEMPLATE, + ETT_RSVP_SENDER_TSPEC, + ETT_RSVP_ADSPEC, + ETT_RSVP_POLICY, + ETT_RSVP_CONFIRM, + ETT_RSVP_ADSPEC_SUBTREE1, + ETT_RSVP_ADSPEC_SUBTREE2, + ETT_RSVP_ADSPEC_SUBTREE3, + ETT_RTSP, + ETT_SDP, + ETT_RADIUS, + ETT_RADIUS_AVP, NUM_TREE_TYPES /* last item number plus one */ }; @@ -255,7 +310,9 @@ enum { /* Utility routines used by packet*.c */ gchar* ether_to_str(const guint8 *); gchar* ip_to_str(const guint8 *); +gchar* abs_time_to_str(struct timeval*); gchar* time_secs_to_str(guint32); +gchar* bytes_to_str(const guint8 *, int); const u_char *find_line_end(const u_char *data, const u_char *dataend, const u_char **eol); int get_token_len(const u_char *linep, const u_char *lineend, @@ -270,6 +327,7 @@ const char *decode_enumerated_bitfield(guint32 val, guint32 mask, int width, const char *decode_numeric_bitfield(guint32 val, guint32 mask, int width, const char *fmt); gint check_col(frame_data *, gint); +void col_add_cls_time(frame_data *); #if __GNUC__ == 2 void col_add_fstr(frame_data *, gint, gchar *, ...) __attribute__((format (printf, 3, 4))); @@ -279,30 +337,11 @@ void col_append_fstr(frame_data *, gint, gchar *, ...) void col_add_fstr(frame_data *, gint, gchar *, ...); void col_append_fstr(frame_data *, gint, gchar *, ...); #endif -void col_add_str(frame_data *, gint, gchar *); +void col_add_str(frame_data *, gint, const gchar *); void col_append_str(frame_data *, gint, gchar *); -/* Routines in packet.c */ - -typedef struct GtkWidget proto_tree; -typedef struct GtkWidget proto_item; - -struct GtkWidget; - -void proto_item_set_len(proto_item *ti, gint len); -proto_tree* proto_tree_new(void); -void proto_item_add_subtree(proto_item *ti, proto_tree *subtree, gint idx); - -#if __GNUC__ == 2 -proto_item* proto_tree_add_item(proto_tree *tree, gint start, gint len, - gchar *format, ...) - __attribute__((format (printf, 4, 5))); -#else -proto_item* proto_tree_add_item(proto_tree *tree, gint start, gint len, - gchar *format, ...); -#endif - void dissect_packet(const u_char *, frame_data *, proto_tree *); + /* * Routines in packet-*.c * Routines should take three args: packet data *, cap_len, packet_counts * @@ -361,17 +400,25 @@ void dissect_ipv6(const u_char *, int, frame_data *, proto_tree *); void dissect_ipx(const u_char *, int, frame_data *, proto_tree *); void dissect_llc(const u_char *, int, frame_data *, proto_tree *); void dissect_lpd(const u_char *, int, frame_data *, proto_tree *); -void dissect_nbdgm(const u_char *, int, frame_data *, proto_tree *); -void dissect_nbipx_ns(const u_char *, int, frame_data *, proto_tree *); +void dissect_nbdgm(const u_char *, int, frame_data *, proto_tree *, int); +void dissect_nbipx_ns(const u_char *, int, frame_data *, proto_tree *, int); void dissect_nbns(const u_char *, int, frame_data *, proto_tree *); -void dissect_ncp(const u_char *, int, frame_data *, proto_tree *); -void dissect_nwlink_dg(const u_char *, int, frame_data *, proto_tree *); +void dissect_ncp(const u_char *, int, frame_data *, proto_tree *, int); +void dissect_nwlink_dg(const u_char *, int, frame_data *, proto_tree *, int); void dissect_osi(const u_char *, int, frame_data *, proto_tree *); void dissect_ospf(const u_char *, int, frame_data *, proto_tree *); void dissect_ospf_hello(const u_char *, int, frame_data *, proto_tree *); +void dissect_pppoed(const u_char *, int, frame_data *, proto_tree *); +void dissect_pppoes(const u_char *, int, frame_data *, proto_tree *); +void dissect_isakmp(const u_char *, int, frame_data *, proto_tree *); +void dissect_radius(const u_char *, int, frame_data *, proto_tree *); void dissect_rip(const u_char *, int, frame_data *, proto_tree *); +void dissect_rsvp(const u_char *, int, frame_data *, proto_tree *); +void dissect_rtsp(const u_char *, int, frame_data *, proto_tree *); +void dissect_sdp(const u_char *, int, frame_data *, proto_tree *); +void dissect_snmp(const u_char *, int, frame_data *, proto_tree *); void dissect_tcp(const u_char *, int, frame_data *, proto_tree *); -void dissect_tftp(const u_char *, int, frame_data *, proto_tree *, int); +void dissect_tftp(const u_char *, int, frame_data *, proto_tree *); void dissect_trmac(const u_char *, int, frame_data *, proto_tree *); void dissect_udp(const u_char *, int, frame_data *, proto_tree *); void dissect_vines(const u_char *, int, frame_data *, proto_tree *); @@ -381,6 +428,7 @@ void dissect_vines_icp(const u_char *, int, frame_data *, proto_tree *); void dissect_vines_ipc(const u_char *, int, frame_data *, proto_tree *); void dissect_vines_rtp(const u_char *, int, frame_data *, proto_tree *); void dissect_vines_spp(const u_char *, int, frame_data *, proto_tree *); +void dissect_payload_ppp(const u_char *, int, frame_data *, proto_tree *); void dissect_ftp(const u_char *, int, frame_data *, proto_tree *, int); void dissect_ftpdata(const u_char *, int, frame_data *, proto_tree *, int); @@ -389,16 +437,18 @@ void dissect_nntp(const u_char *, int, frame_data *, proto_tree *, int); void dissect_pop(const u_char *, int, frame_data *, proto_tree *, int); void dissect_smb(const u_char *, int, frame_data *, proto_tree *, int); void dissect_telnet(const u_char *, int, frame_data *, proto_tree *, int); +void dissect_pptp(const u_char *, int, frame_data *, proto_tree *); +void dissect_gre(const u_char *, int, frame_data *, proto_tree *); void init_dissect_udp(void); /* These functions are in ethertype.c */ -gchar *ethertype_to_str(guint16 etype, const char *fmt); void capture_ethertype(guint16 etype, int offset, const u_char *pd, guint32 cap_len, packet_counts *ld); void ethertype(guint16 etype, int offset, const u_char *pd, frame_data *fd, proto_tree *tree, - proto_tree *fh_tree); + proto_tree *fh_tree, int item_id); +extern const value_string etype_vals[]; /* These functions are in packet-arp.c */ gchar *arphrdaddr_to_str(guint8 *ad, int ad_len, guint16 type); -- cgit v1.2.3