Ethereal-dev: [ethereal-dev] Patch: gryphon.c & gryphon.h

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Steve Limkemann <stevelim@xxxxxxxxxx>
Date: Fri, 17 Dec 1999 17:25:28 -0500 (EST)
This patch adds the ability to decode Gryphon MISC and TEXT messages.

			Steve
 ______________________  _______________________________________________
/  Steve Limkemann     \/  A microsecond here and a microsecond there,  \
|  Westland, Michigan  ||    and before you know it, you're talking     |
|  USA, North America  ||                real-time.                     |
|  Earth, Solar System ||                                               |
|  Milky Way           ||      Smoking: Not just an addiction,          |
|    MGX467 271 48185  ||               but a way of death.             |
\ _____________________/\ ______________________________________________/

Index: plugins/gryphon/packet-gryphon.c
===================================================================
RCS file: /cvsroot/ethereal/plugins/gryphon/packet-gryphon.c,v
retrieving revision 1.1
diff -u -r1.1 packet-gryphon.c
--- packet-gryphon.c	1999/12/15 06:53:30	1.1
+++ packet-gryphon.c	1999/12/17 22:04:52
@@ -197,8 +197,10 @@
 	    	decode_event (src, &data, dataend, &offset, msglen, body_tree);
 	    	break;
 	    case GY_FT_MISC:
+	    	decode_misc (src, &data, dataend, &offset, msglen, body_tree);
 	    	break;
 	    case GY_FT_TEXT:
+	    	decode_text (src, &data, dataend, &offset, msglen, body_tree);
 	    	break;
 	    default:
 	    }
@@ -212,7 +214,6 @@
 		proto_tree_add_text(gryphon_tree, offset, i, "padding", NULL);
 		BUMP (offset, data, i);
 	    }
-/*	    data = dataend;*/
 	}
 
    }
@@ -598,6 +599,38 @@
     	proto_tree_add_text (pt, *offset, length, "Data (%d bytes)", length);
 	BUMP (*offset, *data, length);
     }
+    if (padding) {
+    	proto_tree_add_text (pt, *offset, padding, "padding", NULL);
+	BUMP (*offset, *data, padding);
+    }
+}
+
+void
+decode_misc (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt)
+{
+    int     	    padding;
+    const u_char    *msgend;
+
+    padding = 3 - (msglen + 3) % 4;
+    msgend = *data + msglen;
+    proto_tree_add_text(pt, *offset, msglen, "Data: %d bytes", msglen);
+    BUMP (*offset, *data, msglen);
+    if (padding) {
+    	proto_tree_add_text (pt, *offset, padding, "padding", NULL);
+	BUMP (*offset, *data, padding);
+    }
+}
+
+void
+decode_text (int src, const u_char **data, const u_char *dataend, int *offset, int msglen, proto_tree *pt)
+{
+    int     	    padding;
+    const u_char    *msgend;
+
+    padding = 3 - (msglen + 3) % 4;
+    msgend = *data + msglen;
+    proto_tree_add_text(pt, *offset, msglen, "Data: %d bytes", msglen);
+    BUMP (*offset, *data, msglen);
     if (padding) {
     	proto_tree_add_text (pt, *offset, padding, "padding", NULL);
 	BUMP (*offset, *data, padding);
Index: plugins/gryphon/packet-gryphon.h
===================================================================
RCS file: /cvsroot/ethereal/plugins/gryphon/packet-gryphon.h,v
retrieving revision 1.1
diff -u -r1.1 packet-gryphon.h
--- packet-gryphon.h	1999/12/15 06:53:36	1.1
+++ packet-gryphon.h	1999/12/17 22:04:55
@@ -360,6 +360,8 @@
 void decode_response (int, const u_char**, const u_char*, int*, int, proto_tree*);
 void decode_data (int, const u_char**, const u_char*, int*, int, proto_tree*);
 void decode_event (int, const u_char**, const u_char*, int*, int, proto_tree*);
+void decode_misc (int, const u_char**, const u_char*, int*, int, proto_tree*);
+void decode_text (int, const u_char**, const u_char*, int*, int, proto_tree*);
 void cmd_init (int, const u_char**, const u_char*, int*, int, proto_tree*);
 void resp_time (int, const u_char**, const u_char*, int*, int, proto_tree*);
 void cmd_setfilt (int, const u_char**, const u_char*, int*, int, proto_tree*);