Ethereal-dev: Re: [Ethereal-dev] Patches for packet-diameter.c

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

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Fri, 20 Oct 2000 20:33:34 -0700
On Fri, Oct 20, 2000 at 12:31:55PM -0500, David Frascone wrote:
> These patches changes the default TCP port, and brings the dissector up to
> spec with the most recent diameter-api document.

Checked in.

>  #undef SCTP_DISSECTORS_ENABLED

SCTP now lets you register dissectors; the attached patch compiles, at
least - should DIAMETER-atop-SCTP now be enabled?

Index: packet-diameter.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/packet-diameter.c,v
retrieving revision 1.6
diff -c -r1.6 packet-diameter.c
*** packet-diameter.c	2000/10/21 03:24:37	1.6
--- packet-diameter.c	2000/10/21 03:30:49
***************
*** 67,79 ****
  #define COMMAND_CODE_OFFSET 20
  #define  NTP_TIME_DIFF                   (2208988800UL)
  
- #undef SCTP_DISSECTORS_ENABLED
- 
  #define UDP_PORT_DIAMETER	2645
  #define TCP_PORT_DIAMETER	1812
- #ifdef SCTP_DISSECTORS_ENABLED
  #define SCTP_PORT_DIAMETER	1812
- #endif
  /* #define UDP_PORT_DIAMETER	1812  -- Compiling this in breaks RADIUS */
  
  static int proto_diameter = -1;
--- 67,75 ----
***************
*** 91,99 ****
  static char gbl_diameterString[200];
  static int gbl_diameterUdpPort=UDP_PORT_DIAMETER;
  static int gbl_diameterTcpPort=TCP_PORT_DIAMETER;
- #ifdef SCTP_DISSECTORS_ENABLED
  static int gbl_diameterSctpPort=SCTP_PORT_DIAMETER;
- #endif
  gboolean gbl_commandCodeInHeader = FALSE;
  
  typedef struct _e_diameterhdr {
--- 87,93 ----
***************
*** 711,723 ****
  				       "Set the TCP port for DIAMETER messages",
  				       10,
  				       &gbl_diameterTcpPort);
- #ifdef SCTP_DISSECTORS_ENABLED
  	prefs_register_uint_preference(diameter_module, "sctp.port",
  				       "DIAMETER SCTP Port",
  				       "Set the SCTP port for DIAMETER messages",
  				       10,
  				       &gbl_diameterSctpPort);
- #endif
  	prefs_register_bool_preference(diameter_module, "command_in_header",
  				       "Command code in header",
  				       "Whether the command code is in the header, or in the first AVP",
--- 705,715 ----
***************
*** 734,749 ****
  	static int Initialized=FALSE;
  	static int UdpPort=0;
  	static int TcpPort=0;
- #ifdef SCTP_DISSECTORS_ENABLED
  	static int SctpPort=0;
- #endif
  	if (Initialized) {
  		old_dissector_delete("udp.port", UdpPort, dissect_diameter);
  		old_dissector_delete("tcp.port", TcpPort, dissect_diameter);
! #ifdef SCTP_DISSECTORS_ENABLED
! 		old_dissector_delete("sctp.srcport", SctpPort, dissect_diameter);
! 		old_dissector_delete("sctp.destport", SctpPort, dissect_diameter);
! #endif
  	} else {
  		Initialized=TRUE;
  	}
--- 726,736 ----
  	static int Initialized=FALSE;
  	static int UdpPort=0;
  	static int TcpPort=0;
  	static int SctpPort=0;
  	if (Initialized) {
  		old_dissector_delete("udp.port", UdpPort, dissect_diameter);
  		old_dissector_delete("tcp.port", TcpPort, dissect_diameter);
! 		old_dissector_delete("sctp.port", SctpPort, dissect_diameter);
  	} else {
  		Initialized=TRUE;
  	}
***************
*** 751,759 ****
  	/* set port for future deletes */
  	UdpPort=gbl_diameterUdpPort;
  	TcpPort=gbl_diameterTcpPort;
- #ifdef SCTP_DISSECTORS_ENABLED
  	SctpPort=gbl_diameterSctpPort;
- #endif
  
  	strcpy(gbl_diameterString, "Diameter Protocol");
  
--- 738,744 ----
***************
*** 761,768 ****
  		gbl_diameterTcpPort); */
  	old_dissector_add("tcp.port", gbl_diameterTcpPort, dissect_diameter);
  	old_dissector_add("udp.port", gbl_diameterUdpPort, dissect_diameter);
! #ifdef SCTP_DISSECTORS_ENABLED
! 	old_dissector_add("sctp.srcport", gbl_diameterSctpPort, dissect_diameter);
! 	old_dissector_add("sctp.destport", gbl_diameterSctpPort, dissect_diameter);
! #endif
  }
--- 746,750 ----
  		gbl_diameterTcpPort); */
  	old_dissector_add("tcp.port", gbl_diameterTcpPort, dissect_diameter);
  	old_dissector_add("udp.port", gbl_diameterUdpPort, dissect_diameter);
! 	old_dissector_add("sctp.port", gbl_diameterSctpPort, dissect_diameter);
  }