aboutsummaryrefslogtreecommitdiffstats
path: root/packet-giop.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-05-05 09:32:36 +0000
committerGuy Harris <guy@alum.mit.edu>2000-05-05 09:32:36 +0000
commit6bbfd97bde03e01dbf64173b9fd4e85747fabf8e (patch)
tree950d9eb832f91889530022ffd446ddf3b4772801 /packet-giop.c
parentdedc615898ca05105579430990f44a441fa44009 (diff)
Add routines to:
register lists of "heuristic" dissectors, which are handed a frame that may or may contain a payload for the protocol they dissect, and that return FALSE if it's not or dissect the packet and return TRUE if it is; add a dissector to such a list; go through such a list, calling each dissector until either a dissector returns TRUE, in which case the routine returns TRUE, or it runs out of entries in the list, in which case the routine returns FALSE. Have lists of heuristic dissectors for TCP and for COTP when used with the Inactive Subset of CLNP, and add the GIOP and Yahoo Messenger dissectors to the first list and the Sinec H1 dissector to the second list. Make the dissector name argument to "dissector_add()" and "dissector_delete()" a "const char *" rarther than just a "char *". Add "heur_dissector_add()", the routine to add a heuristic dissector to a list of heuristic dissectors, to the set of routines we can export to plugins through a table on platforms where dynamically-loaded code can't call stuff in the main program, and initialize the element in the table in question for "dissector_add()" (which we'd forgotten to do). svn path=/trunk/; revision=1909
Diffstat (limited to 'packet-giop.c')
-rw-r--r--packet-giop.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/packet-giop.c b/packet-giop.c
index 8157864143..74328c1e87 100644
--- a/packet-giop.c
+++ b/packet-giop.c
@@ -3,7 +3,7 @@
*
* Laurent Deniel <deniel@worldnet.fr>
*
- * $Id: packet-giop.c,v 1.11 2000/03/12 04:47:38 gram Exp $
+ * $Id: packet-giop.c,v 1.12 2000/05/05 09:32:03 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -189,7 +189,8 @@ static u_char *print_object_key(int length, u_char *from)
/* main entry point */
-void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
+static gboolean
+dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
MessageHeader header;
@@ -216,8 +217,9 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
#define END_OF_GIOP_MESSAGE (offset - first_offset - GIOP_HEADER_SIZE)
if (!BYTES_ARE_IN_FRAME(offset, GIOP_HEADER_SIZE)) {
- dissect_data(pd, offset, fd, tree);
- return;
+ /* Not enough data, or not enough captured data; perhaps it was
+ a GIOP message, but we can't tell. */
+ return FALSE;
}
/* avoid alignment problem */
@@ -227,14 +229,18 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
/* check magic number and version */
if (memcmp(header.magic, GIOP_MAGIC, sizeof(header.magic)) != 0) {
- dissect_data(pd, offset, fd, tree);
- return;
+ /* Not a GIOP message. */
+ return FALSE;
}
if (header.GIOP_version.major != GIOP_MAJOR ||
((minor_version = header.GIOP_version.minor) > GIOP_MINOR)) {
+ /* Bad version number; should we note that and dissect the rest
+ as data, or should we return FALSE on the theory that it
+ might have been some other packet that happened to begin with
+ "GIOP"? */
dissect_data(pd, offset, fd, tree);
- return;
+ return TRUE;
}
switch(minor_version) {
@@ -315,7 +321,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
if (!BYTES_ARE_IN_FRAME(offset, message_size)) {
dissect_data(pd, offset, fd, tree);
- return;
+ return TRUE;
}
/* skip service_context in Request/Reply messages */
@@ -440,7 +446,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
if (sequence_length > message_size) {
dissect_data(pd, offset, fd, tree);
- return;
+ return TRUE;
}
if (tree) {
@@ -509,7 +515,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
if (sequence_length > message_size) {
dissect_data(pd, offset, fd, tree);
- return;
+ return TRUE;
}
if (tree) {
@@ -548,7 +554,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
if (sequence_length > message_size) {
dissect_data(pd, offset, fd, tree);
- return;
+ return TRUE;
}
if (tree) {
@@ -568,7 +574,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
if (sequence_length > message_size) {
dissect_data(pd, offset, fd, tree);
- return;
+ return TRUE;
}
if (tree && sequence_length) {
@@ -704,6 +710,7 @@ void dissect_giop(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
dissect_data(pd, offset, fd, tree);
}
+ return TRUE;
} /* dissect_giop */
void
@@ -725,3 +732,9 @@ proto_register_giop(void)
proto_register_field_array(proto_giop, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
+
+void
+proto_reg_handoff_giop(void)
+{
+ heur_dissector_add("tcp", dissect_giop);
+}