Move the declaration of routines exported from "packet-smb-browse.c"

into a "packet-smb-browse.h" header file, and have modules that import
those routines include "packet-smb-browse.h" rather than declaring the
routines themselves; do the same for routines exported from
"packet-smb-logon.c".

Make routines and arrays not exported static, and make routines that
return a true/false return value "gboolean" rather than "guint32".

svn path=/trunk/; revision=3147
This commit is contained in:
Guy Harris 2001-03-18 03:34:22 +00:00
parent b8289288e8
commit 7c8faf262f
6 changed files with 93 additions and 43 deletions

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
# $Id: Makefile.am,v 1.292 2001/03/18 03:23:30 guy Exp $
# $Id: Makefile.am,v 1.293 2001/03/18 03:34:22 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@ -292,7 +292,9 @@ noinst_HEADERS = \
packet-rx.h \
packet-sll.h \
packet-smb.h \
packet-smb-browse.h \
packet-smb-common.h \
packet-smb-logon.h \
packet-smb-mailslot.h \
packet-smb-pipe.h \
packet-sna.h \

View File

@ -1,8 +1,8 @@
/* packet-smb-browse.c
* Routines for smb packet dissection
* Routines for SMB Browser packet dissection
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
* $Id: packet-smb-browse.c,v 1.7 2001/01/03 06:55:32 guy Exp $
* $Id: packet-smb-browse.c,v 1.8 2001/03/18 03:34:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -48,6 +48,8 @@
#include "smb.h"
#include "alignment.h"
#include "packet-smb-browse.h"
static int proto_smb_browse = -1;
static gint ett_browse = -1;
@ -58,7 +60,7 @@ static gint ett_browse_election_desire = -1;
char *browse_commands[] =
static char *browse_commands[] =
{ "Error, No such command!", /* Value 0 */
"Host Announcement", /* Value 1 */
"Request Announcement", /* Value 2 */
@ -87,7 +89,7 @@ char *browse_commands[] =
#define MASTERANNOUNCEMENT 13
#define LOCALMASTERANNOUNC 15
char *svr_types[32] = {
static char *svr_types[32] = {
"Workstation",
"Server",
"SQL Server",
@ -122,8 +124,11 @@ char *svr_types[32] = {
"Domain Enum"
};
guint32
dissect_mailslot_browse(const u_char *pd, int offset, frame_data *fd, proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data, int SMB_offset, int errcode, int dirn, const u_char *command, int DataOffset, int DataCount)
gboolean
dissect_mailslot_browse(const u_char *pd, int offset, frame_data *fd,
proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
int SMB_offset, int errcode, int dirn, const u_char *command,
int DataOffset, int DataCount)
{
guint8 OpCode;
guint8 UpdateCount;
@ -151,7 +156,7 @@ dissect_mailslot_browse(const u_char *pd, int offset, frame_data *fd, proto_tree
int i;
if (!proto_is_protocol_enabled(proto_smb_browse))
return 0;
return FALSE;
if (check_col(fd, COL_PROTOCOL))
col_set_str(fd, COL_PROTOCOL, "BROWSER");
@ -562,7 +567,7 @@ dissect_mailslot_browse(const u_char *pd, int offset, frame_data *fd, proto_tree
break;
}
return 1; /* Success */
return TRUE; /* Success */
}

30
packet-smb-browse.h Normal file
View File

@ -0,0 +1,30 @@
/* packet-smb-browse.h
* Declaration of routines for SMB Browser packet dissection
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
*
* $Id: packet-smb-browse.h,v 1.1 2001/03/18 03:34:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
gboolean
dissect_mailslot_browse(const u_char *pd, int offset, frame_data *fd,
proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
int SMB_offset, int errcode, int dirn, const u_char *command,
int DataOffset, int DataCount);

View File

@ -1,8 +1,8 @@
/* packet-smb-logon.c
* Routines for smb net logon packet dissection
* Routines for SMB net logon packet dissection
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet-smb-logon.c,v 1.12 2001/01/11 19:40:35 guy Exp $
* $Id: packet-smb-logon.c,v 1.13 2001/03/18 03:34:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -26,6 +26,7 @@
*/
#include "packet-smb-common.h"
#include "packet-smb-logon.h"
static int proto_smb_logon = -1;
@ -178,7 +179,8 @@ void dissect_smb_logon_2(const u_char *pd, int offset, frame_data *fd,
void dissect_smb_logon_LM20_resp(const u_char *pd, int offset, frame_data *fd,
static void
dissect_smb_logon_LM20_resp(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree){
/*** 0x06 (LM2.0 LOGON Response) ***/
@ -221,7 +223,8 @@ dissect_smb_pdc_query(const u_char *pd, int offset, frame_data *fd,
void dissect_smb_pdc_startup(const u_char *pd, int offset, frame_data *fd,
static void
dissect_smb_pdc_startup(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree){
/*** 0x08 Announce startup of PDC ***/
@ -264,7 +267,8 @@ dissect_smb_pdc_failure( const u_char *pd, int offset, frame_data *fd,
}
void dissect_announce_change( const u_char *pd, int offset,
static void
dissect_announce_change( const u_char *pd, int offset,
frame_data *fd,proto_tree *tree) {
/*** 0x0A ( Announce change to UAS or SAM ) ***/
@ -428,7 +432,8 @@ dissect_smb_inter_resp( const u_char *pd, int offset, frame_data *fd,
}
void dissect_smb_sam_logon_resp(const u_char *pd, int offset, frame_data *fd,
static void
dissect_smb_sam_logon_resp(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree){
/* Netlogon command 0x13 - decode the SAM logon response from server */
@ -453,7 +458,7 @@ void dissect_smb_sam_logon_resp(const u_char *pd, int offset, frame_data *fd,
}
guint32
gboolean
dissect_smb_logon(const u_char *pd, int offset, frame_data *fd,
proto_tree *parent, proto_tree *tree, struct smb_info si,
int max_data, int SMB_offset, int errcode, int dirn,
@ -528,7 +533,7 @@ static void (*dissect_smb_logon_cmds[])(const u_char *, int, frame_data *,
if (!proto_is_protocol_enabled(proto_smb_logon))
return 0;
return FALSE;
/* get the Command field */
cmd = MIN( GBYTE(pd, offset), array_length(dissect_smb_logon_cmds)-1);
@ -553,7 +558,7 @@ static void (*dissect_smb_logon_cmds[])(const u_char *, int, frame_data *,
(dissect_smb_logon_cmds[ cmd]) (pd, offset, fd,smb_logon_tree);
}
return 1;
return TRUE;
}

30
packet-smb-logon.h Normal file
View File

@ -0,0 +1,30 @@
/* packet-smb-logon.h
* Declaration of outines for SMB net logon packet dissection
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet-smb-logon.h,v 1.1 2001/03/18 03:34:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
gboolean
dissect_smb_logon(const u_char *pd, int offset, frame_data *fd,
proto_tree *parent, proto_tree *tree, struct smb_info si,
int max_data, int SMB_offset, int errcode, int dirn,
const u_char *command, int DataOffset, int DataCount);

View File

@ -2,7 +2,7 @@
* Routines for SMB mailslot packet dissection
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
*
* $Id: packet-smb-mailslot.c,v 1.10 2001/03/18 03:23:30 guy Exp $
* $Id: packet-smb-mailslot.c,v 1.11 2001/03/18 03:34:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -28,36 +28,14 @@
#include "packet-smb-common.h"
#include "packet-smb-mailslot.h"
#include "packet-smb-browse.h"
#include "packet-smb-logon.h"
#include "packet-smb-pipe.h"
static int proto_smb_msp = -1;
static int ett_smb_msp = -1;
/*** External dissectors called from here */
extern guint32
dissect_mailslot_browse(const u_char *pd, int offset, frame_data *fd,
proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
int SMB_offset, int errcode, int dirn, const u_char *command,
int DataOffset, int DataCount);
extern guint32
dissect_smb_ntlogon(const u_char *pd, int offset, frame_data *fd,
proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
int SMB_offset, int errcode, int dirn, const u_char *command,
int DataOffset, int DataCount);
extern guint32
dissect_smb_logon(const u_char *pd, int offset, frame_data *fd,
proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
int SMB_offset, int errcode, int dirn, const u_char *command,
int DataOffset, int DataCount);
gboolean
dissect_mailslot_smb(const u_char *pd, int offset, frame_data *fd,
proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,