aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-08-06 19:05:14 +0000
committerGuy Harris <guy@alum.mit.edu>2001-08-06 19:05:14 +0000
commit57091e1abb817dc4c39c704723a0c66ee6389341 (patch)
treec8e00907bf192264de4c6cda8edafc71770d19d6
parentcf69e4c354b825b21d49e48828f28e8940dab82e (diff)
Update from Steve Dickson to add support for UDP encapsulation of PGM
packets. svn path=/trunk/; revision=3831
-rw-r--r--packet-pgm.c56
-rw-r--r--packet-pgm.h8
2 files changed, 60 insertions, 4 deletions
diff --git a/packet-pgm.c b/packet-pgm.c
index 6850d30170..fed0a975d0 100644
--- a/packet-pgm.c
+++ b/packet-pgm.c
@@ -1,7 +1,7 @@
/* packet-pgm.c
* Routines for pgm packet disassembly
*
- * $Id: packet-pgm.c,v 1.6 2001/08/02 17:05:00 guy Exp $
+ * $Id: packet-pgm.c,v 1.7 2001/08/06 19:05:14 guy Exp $
*
* Copyright (c) 2000 by Talarian Corp
*
@@ -52,12 +52,17 @@
#include "resolv.h"
#include "strutil.h"
#include "conversation.h"
+#include "prefs.h"
#include "proto.h"
void proto_reg_handoff_pgm(void);
-extern void decode_tcp_ports(tvbuff_t *, int , packet_info *,
- proto_tree *, int, int);
+void proto_rereg_pgm(void);
+
+static int udp_encap_ucast_port = 0;
+static int udp_encap_mcast_port = 0;
+static int old_encap_ucast_port = 0;
+static int old_encap_mcast_port = 0;
static int proto_pgm = -1;
static int ett_pgm = -1;
@@ -1064,6 +1069,7 @@ proto_register_pgm(void)
&ett_pgm_opts_naklist,
&ett_pgm_opts_ccdata,
};
+ module_t *pgm_module;
proto_pgm = proto_register_protocol("Pragmatic General Multicast",
"PGM", "pgm");
@@ -1075,12 +1081,56 @@ proto_register_pgm(void)
subdissector_table = register_dissector_table("pgm.port");
register_heur_dissector_list("pgm", &heur_subdissector_list);
+ /*
+ * Register configuration preferences for UDP encapsulation
+ * (Note: Initially the ports are set to zero so the
+ * dissecting of PGM encapsulated in UPD packets
+ * is off by default)
+ */
+ pgm_module = prefs_register_protocol(proto_pgm, proto_rereg_pgm);
+
+ prefs_register_uint_preference(pgm_module, "udp.encap_ucast_port",
+ "PGM Encap Unicast Port (Default 3055)",
+ "PGM Encap is PGM packets encapsulated in UDP packets"
+ " (Note: This is option is off by default",
+ 10, &udp_encap_ucast_port);
+ old_encap_ucast_port = udp_encap_ucast_port;
+
+ prefs_register_uint_preference(pgm_module, "udp.encap_mcast_port",
+ "PGM Encap Multicast Port (Default 3056)",
+ "PGM Encap is PGM packets encapsulated in UDP packets"
+ " (Note: This is option is off by default",
+ 10, &udp_encap_mcast_port);
+
+ old_encap_mcast_port = udp_encap_mcast_port;
}
/* The registration hand-off routine */
void
proto_reg_handoff_pgm(void)
{
+
+ /*
+ * Set up PGM Encap dissecting, which is off by default
+ */
+ dissector_add("udp.port", udp_encap_ucast_port, dissect_pgm, proto_pgm);
+ dissector_add("udp.port", udp_encap_mcast_port, dissect_pgm, proto_pgm);
+
dissector_add("ip.proto", IP_PROTO_PGM, dissect_pgm, proto_pgm);
}
+void
+proto_rereg_pgm(void)
+{
+ /*
+ * Remove the old ones
+ */
+ dissector_delete("udp.port", old_encap_ucast_port, dissect_pgm);
+ dissector_delete("udp.port", old_encap_mcast_port, dissect_pgm);
+
+ /*
+ * Set the new ones
+ */
+ dissector_add("udp.port", udp_encap_ucast_port, dissect_pgm, proto_pgm);
+ dissector_add("udp.port", udp_encap_mcast_port, dissect_pgm, proto_pgm);
+}
diff --git a/packet-pgm.h b/packet-pgm.h
index c06140d676..cfdad35b54 100644
--- a/packet-pgm.h
+++ b/packet-pgm.h
@@ -1,7 +1,7 @@
/* packet-pgm.h
* Declarations for pgm packet disassembly
*
- * $Id: packet-pgm.h,v 1.5 2001/08/02 17:05:00 guy Exp $
+ * $Id: packet-pgm.h,v 1.6 2001/08/06 19:05:14 guy Exp $
*
* Copyright (c) 2000 by Talarian Corp
*
@@ -240,4 +240,10 @@ typedef struct {
nlong_t acker;
} pgm_opt_pgmcc_feedback_t;
+/*
+ * Udp port for UDP encapsulation
+ */
+#define DEFAULT_UDP_ENCAP_UCAST_PORT 3055
+#define DEFAULT_UDP_ENCAP_MCAST_PORT 3056
+
#endif /* _PACKET_PGM_H */