Ethereal-dev: Re: cvs diff output (for Diameter) was [ethereal-dev] CVS Access

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

From: David Frascone <dave@xxxxxxxxxxxx>
Date: Thu, 29 Jun 2000 11:57:20 -0500
Ok, big changes this time.  I've added a confFile.[ch] which allows disectors
to have run-time configuration parameters set.  I've also modified
packet-radius.c and my packet-diameter stuff to support it.

A default file (ethereal.conf) is installed to the data dir ($prefix/etc)
during make install.

I'm attaching a tar.gz file of all added files (to save bandwidth).  Attached
is a text version of the cvs diff output.


-------------cut here---------------

? packet-diameter.c
? packet-diameter.h
? diameter-dict2h.pl
? nohup.out
? confFile.h
? confFile.c
? ethereal.conf
Index: Makefile.am
===================================================================
RCS file: /cvsroot/ethereal/Makefile.am,v
retrieving revision 1.206
diff -u -r1.206 Makefile.am
--- Makefile.am	2000/06/22 06:37:59	1.206
+++ Makefile.am	2000/06/29 16:54:51
@@ -27,7 +27,7 @@
 
 man_MANS = ethereal.1 editcap.1 tethereal.1
 
-sysconf_DATA = manuf
+sysconf_DATA = manuf ethereal.conf
 
 # Any POSIX-compatible YACC should honor the -p flag
 YFLAGS=-d -p dfilter_
@@ -51,6 +51,7 @@
 	packet-cops.c  \
 	packet-data.c  \
 	packet-ddtp.c  \
+	packet-diameter.c \
 	packet-dns.c   \
 	packet-eigrp.c \
 	packet-esis.c  \
@@ -247,6 +248,8 @@
 	asn1.h         \
 	column.c       \
 	column.h       \
+	confFile.c     \
+	confFile.h     \
 	conversation.c \
 	conversation.h \
 	dfilter-int.h  \
Index: Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/Makefile.nmake,v
retrieving revision 1.45
diff -u -r1.45 Makefile.nmake
--- Makefile.nmake	2000/06/16 15:05:26	1.45
+++ Makefile.nmake	2000/06/29 16:54:51
@@ -37,6 +37,7 @@
 	packet-clnp.c  \
 	packet-cops.c  \
 	packet-data.c  \
+	packet-diameter.c \
 	packet-ddtp.c  \
 	packet-dns.c   \
 	packet-eigrp.c \
@@ -152,6 +153,7 @@
 ETHEREAL_COMMON_OBJECTS = \
 	asn1.obj         \
 	column.obj       \
+	confFile.obj     \
 	conversation.obj \
 	dfilter-grammar.obj \
 	dfilter-scanner.obj \
Index: packet-radius.c
===================================================================
RCS file: /cvsroot/ethereal/packet-radius.c,v
retrieving revision 1.13
diff -u -r1.13 packet-radius.c
--- packet-radius.c	2000/05/31 05:07:33	1.13
+++ packet-radius.c	2000/06/29 16:54:54
@@ -39,6 +39,7 @@
 #include <glib.h>
 #include "packet.h"
 #include "resolv.h"
+#include "confFile.h"
 
 static int proto_radius = -1;
 static int hf_radius_length = -1;
@@ -53,6 +54,13 @@
 #define UDP_PORT_RADACCT	1646
 #define UDP_PORT_RADACCT_NEW	1813
 
+static int gbl_radiusPort = UDP_PORT_RADIUS_NEW;
+static int gbl_radiusOldPort = UDP_PORT_RADIUS;
+static int gbl_radAcctPort = UDP_PORT_RADACCT_NEW;
+static int gbl_radAcctOldPort = UDP_PORT_RADACCT;
+static char gbl_confString[200];
+static char gbl_radiusString[200];
+
 typedef struct _e_radiushdr {
         guint8 rh_code;
         guint8 rh_ident;
@@ -742,6 +750,43 @@
         }
   }
 }
+void
+configRadius( void )
+{
+	int rc;
+	int port1, port2, port3, port4;
+
+	/* Set our defaults */
+	sprintf(gbl_radiusString, "Radius Protocol (ports %d, %d, %d, %d)",
+	    gbl_radiusPort, gbl_radiusOldPort, gbl_radAcctPort, gbl_radAcctOldPort);
+
+	/* Get our port number */
+	confGetConfiguration("packet-radius", gbl_confString,
+	    sizeof(gbl_confString)-1);
+	
+	if (gbl_confString[0] == 0)
+		return;
+
+	rc = sscanf(gbl_confString, " ports %d %d %d %d", &port1, &port2,
+	    &port3, &port4);
+	if (rc == 4) {
+		gbl_radiusPort = port1;
+		gbl_radiusOldPort = port2;
+		gbl_radAcctPort = port3;
+		gbl_radAcctOldPort = port4;
+	}
+
+#if 0
+	/* DEBUG: include conf line in diameter string */
+	sprintf(gbl_radiusString, "Radius Protocol (ports %d, %d, %d, %d) conf: %s",
+	    gbl_radiusPort, gbl_radiusOldPort, gbl_radAcctPort, gbl_radAcctOldPort,
+	    gbl_confString);
+#else
+	sprintf(gbl_radiusString, "Radius Protocol (ports %d, %d, %d, %d)",
+	    gbl_radiusPort, gbl_radiusOldPort, gbl_radAcctPort,
+	    gbl_radAcctOldPort);
+#endif
+}
 /* registration with the filtering engine */
 void
 proto_register_radius(void)
@@ -763,8 +808,10 @@
 		&ett_radius,
 		&ett_radius_avp,
 	};
+
+	configRadius();
 
-	proto_radius = proto_register_protocol ("Radius Protocol", "radius");
+	proto_radius = proto_register_protocol (gbl_radiusString, "radius");
 	proto_register_field_array(proto_radius, hf, array_length(hf));
 	proto_register_subtree_array(ett, array_length(ett));
 }
@@ -772,8 +819,8 @@
 void
 proto_reg_handoff_radius(void)
 {
-	dissector_add("udp.port", UDP_PORT_RADIUS, dissect_radius);
-	dissector_add("udp.port", UDP_PORT_RADIUS_NEW, dissect_radius);
-	dissector_add("udp.port", UDP_PORT_RADACCT, dissect_radius);
-	dissector_add("udp.port", UDP_PORT_RADACCT_NEW, dissect_radius);
+	dissector_add("udp.port", gbl_radiusPort, dissect_radius);
+	dissector_add("udp.port", gbl_radiusOldPort, dissect_radius);
+	dissector_add("udp.port", gbl_radAcctPort, dissect_radius);
+	dissector_add("udp.port", gbl_radAcctOldPort, dissect_radius);
 }

------------ cut here--------------

On Thu, Jun 29, 2000 at 11:20:39AM -0400, Gilbert Ramirez Jr. wrote:
> On Thu, Jun 29, 2000 at 07:40:42AM -0500, David Frascone wrote:
> > Thanks for all the responses (and sorry for the bitching)
> > 
> > Here is the output from cvs-diff . . not very interesting w/o the extra
> > packet files.
> 
> Why not send packet-diameter.[ch] and diameter-dict2h.pl to the list, too?
> 
> --gilbert

Attachment: diffs.tgz
Description: application/tar-gz