* Routines for DCERPC over SMB packet disassembly
* Copyright 2001, Tim Potter <tpot@samba.org>
*
- * $Id: packet-dcerpc-nt.c,v 1.26 2002/04/17 07:52:26 tpot Exp $
+ * $Id: packet-dcerpc-nt.c,v 1.28 2002/04/22 09:43:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
} pol_hash_key;
typedef struct {
- int open_frame, close_frame; /* Frame numbers for open/close */
- char *name; /* Name of policy handle */
+ guint32 open_frame, close_frame; /* Frame numbers for open/close */
+ char *name; /* Name of policy handle */
} pol_hash_value;
#define POL_HASH_INIT_COUNT 100
/* Store a policy handle */
-void dcerpc_smb_store_pol(const guint8 *policy_hnd, char *name, int open_frame,
- int close_frame)
+void dcerpc_smb_store_pol(const guint8 *policy_hnd, char *name,
+ guint32 open_frame, guint32 close_frame)
{
pol_hash_key *key;
pol_hash_value *value;
/* Retrieve a policy handle */
gboolean dcerpc_smb_fetch_pol(const guint8 *policy_hnd, char **name,
- int *open_frame, int *close_frame)
+ guint32 *open_frame, guint32 *close_frame)
{
pol_hash_key key;
pol_hash_value *value;
* Initialise global DCERPC/SMB data structures
*/
-void dcerpc_smb_init(void)
+static void dcerpc_smb_init(void)
{
- static gboolean done_init;
+ /* Initialise policy handle hash */
+
+ init_pol_hash();
+}
+/*
+ * Register ett_ values, and register "dcerpc_smb_init()" as an
+ * initialisation routine.
+ */
+void proto_register_dcerpc_smb(void)
+{
static gint *ett[] = {
&ett_nt_unicode_string,
&ett_nt_policy_hnd,
};
- if (done_init)
- return;
-
- /* Initialise policy handle hash */
-
- init_pol_hash();
-
/* Register ett's */
proto_register_subtree_array(ett, array_length(ett));
- done_init = TRUE;
+ /* Register a routine to be called whenever initialisation
+ is done. */
+
+ register_init_routine(dcerpc_smb_init);
}
/* Check if there is unparsed data remaining in a frame and display an
proto_item *item;
proto_tree *subtree;
e_ctx_hnd hnd;
- int open_frame = 0, close_frame = 0;
+ guint32 open_frame = 0, close_frame = 0;
char *name;
/* Add to proto tree */
if (open_frame)
proto_tree_add_text(subtree, tvb, offset, 0,
- "Opened in frame %d", open_frame);
+ "Opened in frame %u", open_frame);
if (close_frame)
proto_tree_add_text(subtree, tvb, offset, 0,
- "Closed in frame %d", close_frame);
+ "Closed in frame %u", close_frame);
}
/* Store request/reply information */