diff --git a/AUTHORS b/AUTHORS index 83d79b8ce6..e9cecb38ec 100644 --- a/AUTHORS +++ b/AUTHORS @@ -491,7 +491,8 @@ Kent Engstr Ronnie Sahlberg { NLM dissector enhancements Mount dissector enhancements - Support for status monitor protocol + Support for status monitor protocol and status monitor callback + protocol } Borosa Tomislav { diff --git a/Makefile.am b/Makefile.am index 4dd24e60df..84348520f8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.289 2001/03/15 09:11:00 guy Exp $ +# $Id: Makefile.am,v 1.290 2001/03/15 22:15:32 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs @@ -200,6 +200,7 @@ DISSECTOR_SOURCES = \ packet-srvloc.c \ packet-sscop.c \ packet-stat.c \ + packet-stat-notify.c \ packet-sual.c \ packet-syslog.c \ packet-tacacs.c \ @@ -295,6 +296,7 @@ noinst_HEADERS = \ packet-snmp.h \ packet-sscop.h \ packet-stat.h \ + packet-stat-notify.h \ packet-tcp.h \ packet-tns.h \ packet-tpkt.h \ diff --git a/Makefile.nmake b/Makefile.nmake index 1f95afce44..702b8297ba 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -1,7 +1,7 @@ ## Makefile for building ethereal.exe with Microsoft C and nmake ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake # -# $Id: Makefile.nmake,v 1.85 2001/03/15 09:11:00 guy Exp $ +# $Id: Makefile.nmake,v 1.86 2001/03/15 22:15:32 guy Exp $ include config.nmake @@ -150,6 +150,7 @@ DISSECTOR_SOURCES = \ packet-srvloc.c \ packet-sscop.c \ packet-stat.c \ + packet-stat-notify.c \ packet-sual.c \ packet-syslog.c \ packet-tacacs.c \ diff --git a/packet-stat-notify.c b/packet-stat-notify.c new file mode 100644 index 0000000000..ca135f1621 --- /dev/null +++ b/packet-stat-notify.c @@ -0,0 +1,103 @@ +/* packet-stat.c + * Routines for async NSM stat callback dissection + * 2001 Ronnie Sahlberg + * + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#include "packet-rpc.h" +#include "packet-stat-notify.h" + +static int proto_statnotify = -1; +static int hf_statnotify_name = -1; +static int hf_statnotify_state = -1; +static int hf_statnotify_priv = -1; + +static gint ett_statnotify = -1; + + +static int +dissect_statnotify_mon(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +{ + + offset = dissect_rpc_string_tvb(tvb,pinfo,tree,hf_statnotify_name,offset,NULL); + + offset = dissect_rpc_uint32_tvb(tvb,pinfo,tree,hf_statnotify_state,offset); + + proto_tree_add_item(tree,hf_statnotify_priv,tvb,offset,16,FALSE); + offset += 16; + + return offset; +} + +/* proc number, "proc name", dissect_request, dissect_reply */ +/* NULL as function pointer means: type of arguments is "void". */ + +static const vsff statnotify_proc[] = { + { 0, "NULL", NULL, NULL }, + { STATNOTIFYPROC_MON, "MON-CALLBACK", + dissect_statnotify_mon, NULL }, + { 0, NULL, NULL, NULL } +}; +/* end of stat-notify version 1 */ + + +void +proto_register_statnotify(void) +{ + static hf_register_info hf[] = { + { &hf_statnotify_name, { + "Name", "statnotify.name", FT_STRING, BASE_DEC, + NULL, 0, "Name of client that changed" }}, + { &hf_statnotify_state, { + "State", "statnotify.state", FT_UINT32, BASE_DEC, + NULL, 0, "New state of client that changed" }}, + { &hf_statnotify_priv, { + "Priv", "stat.priv", FT_BYTES, BASE_HEX, + NULL, 0, "Client supplied opaque data" }}, + }; + + static gint *ett[] = { + &ett_statnotify, + }; + + proto_statnotify = proto_register_protocol("Network Status Monitor CallBack Protocol", "STAT-CB", "stat-cb"); + proto_register_field_array(proto_statnotify, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); +} + +void +proto_reg_handoff_statnotify(void) +{ + /* Register the protocol as RPC */ + rpc_init_prog(proto_statnotify, STATNOTIFY_PROGRAM, ett_statnotify); + /* Register the procedure tables */ + rpc_init_proc_table(STATNOTIFY_PROGRAM, 1, statnotify_proc); +} diff --git a/packet-stat-notify.h b/packet-stat-notify.h new file mode 100644 index 0000000000..2ae1b70784 --- /dev/null +++ b/packet-stat-notify.h @@ -0,0 +1,34 @@ +/* packet-stat-notify.h + * Async callback to notify NSM servers of changes in client status + * 2001 Ronnie Sahlberg + * + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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. + */ + +#ifndef PACKET_STAT_NOTIFY_H +#define PACKET_STAT_NOTIFY_H + +#define STATNOTIFY_PROGRAM 200048 + +#define STATNOTIFYPROC_NULL 0 +#define STATNOTIFYPROC_MON 1 + +#endif