1 /* packet-smb-mailslot.c
2 * Routines for smb mailslot packet dissection
3 * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
5 * $Id: packet-smb-mailslot.c,v 1.3 2000/02/14 04:21:04 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@zing.org>
9 * Copyright 1998 Gerald Combs
11 * Copied from packet-pop.c
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include "packet-smb-common.h"
31 static int proto_smb_msp = -1;
33 static int ett_smb_msp = -1;
36 /*** External dissectors called from here */
39 dissect_mailslot_browse(const u_char *pd, int offset, frame_data *fd,
40 proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
41 int SMB_offset, int errcode, int dirn, const u_char *command,
42 int DataOffset, int DataCount);
45 dissect_pipe_lanman(const u_char *pd, int offset, frame_data *fd,
46 proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
47 int SMB_offset, int errcode, int dirn, const u_char *command,
48 int DataOffset, int DataCount, int ParameterOffset, int ParameterCount);
51 dissect_smb_ntlogon(const u_char *pd, int offset, frame_data *fd,
52 proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
53 int SMB_offset, int errcode, int dirn, const u_char *command,
54 int DataOffset, int DataCount);
58 dissect_smb_logon(const u_char *pd, int offset, frame_data *fd,
59 proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
60 int SMB_offset, int errcode, int dirn, const u_char *command,
61 int DataOffset, int DataCount);
66 dissect_mailslot_smb(const u_char *pd, int offset, frame_data *fd,
67 proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
68 int SMB_offset, int errcode, int dirn, const u_char *command,
69 int DataOffset, int DataCount, int ParameterOffset, int ParameterCount){
72 /* decode the SMB mail slot protocol */
75 proto_tree *smb_msp_tree = 0;
81 /* do the Op code field */
83 Temp16 = GSHORT(pd, offset); /* get Op code */
85 if (check_col(fd, COL_PROTOCOL))
86 col_add_str(fd, COL_PROTOCOL, "SMB Mailslot");
88 if (check_col(fd, COL_INFO))
89 col_add_fstr(fd, COL_INFO, "%s",
90 ( Temp16 == 1 ? "Write Mail slot" : "Unknown"));
94 ti = proto_tree_add_item( parent, proto_smb_msp, offset,
96 smb_msp_tree = proto_item_add_subtree(ti, ett_smb_msp);
98 proto_tree_add_text(smb_msp_tree, offset, 2, "Op code: %u (%s)",
99 Temp16, ( Temp16 == 1 ? "Write Mail slot" : "Unknown"));
103 /* do the Priority field */
104 Temp16 = GSHORT(pd, offset);
105 proto_tree_add_text(smb_msp_tree, offset, 2,
106 "Priority of transaction: %u", Temp16);
110 /* do the Class field */
111 Temp16 = GSHORT(pd, offset);
113 proto_tree_add_text(smb_msp_tree, offset, 2, "Class: %u (%s)",
114 Temp16, ( Temp16 == 1) ? "Reliable" : (( Temp16 == 2) ?
115 "Unreliable & Broadcast" : "Unknown"));
119 /* do the data size field */
120 Temp16 = GSHORT(pd, offset);
121 proto_tree_add_text(smb_msp_tree, offset, 2,
122 "Total size of mail data: %u", Temp16);
125 }else { /* no tree value adjust offset*/
129 /* Build display for: MailSlot Name */
131 StrPtr = &pd[offset]; /* load pointer to name */
134 proto_tree_add_text(smb_msp_tree, offset, strlen( StrPtr) + 1,
135 "Mailslot Name: %s", StrPtr);
138 offset += strlen( StrPtr) + 1;
140 /*** Decide what dissector to call based upon the command value ***/
142 if (strcmp(command, "BROWSE") == 0) { /* Decode a browse */
144 return dissect_mailslot_browse(pd, offset, fd, parent, tree,
145 si, max_data, SMB_offset, errcode, dirn, command,
146 DataOffset, DataCount);
149 else if (strcmp(command, "LANMAN") == 0) {
151 return dissect_pipe_lanman(pd, offset, fd, parent, tree, si,
152 max_data, SMB_offset, errcode, dirn, command,
153 DataOffset, DataCount, ParameterOffset, ParameterCount);
156 /* NOTE: use TEMP\\NETLOGON and MSSP because they seems very common, */
157 /* NOTE: may need a look up list to check for the mailslot names passed */
158 /* by the logon request packet */
160 else if ((strncmp(command, "NET", strlen("NET")) == 0)
161 || (strcmp(command, "TEMP\\NETLOGON") == 0)
162 || (strcmp(command, "MSSP") == 0)){
164 return dissect_smb_logon(pd, DataOffset, fd, parent, tree,
165 si, max_data, SMB_offset, errcode, dirn,
166 command, DataOffset, DataCount);
174 register_proto_smb_mailslot( void){
177 static gint *ett[] = {
181 proto_smb_msp = proto_register_protocol(
182 "SMB MailSlot Protocol", "mailslot");
184 proto_register_subtree_array(ett, array_length(ett));