[Asterisk-cvs] asterisk/channels chan_sip.c,1.795,1.796

kpfleming at lists.digium.com kpfleming at lists.digium.com
Tue Jul 26 22:10:34 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv25650/channels

Modified Files:
	chan_sip.c 
Log Message:
and now we know why #define-ing constants and trying to keep them in sequence is a bad idea...


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.795
retrieving revision 1.796
diff -u -d -r1.795 -r1.796
--- chan_sip.c	27 Jul 2005 00:58:54 -0000	1.795
+++ chan_sip.c	27 Jul 2005 02:17:06 -0000	1.796
@@ -123,31 +123,42 @@
 static const char config[] = "sip.conf";
 static const char notify_config[] = "sip_notify.conf";
 
-#define SIP_RESPONSE	1
-#define SIP_REGISTER	2
-#define SIP_OPTIONS	3
-#define SIP_NOTIFY	4
-#define SIP_INVITE	5
-#define SIP_ACK		6
-#define SIP_PRACK	7
-#define SIP_BYE		8
-#define SIP_REFER	9
-#define SIP_SUBSCRIBE	10
-#define SIP_MESSAGE	11
-#define SIP_UPDATE	12
-#define SIP_INFO	13
-#define SIP_CANCEL	14
-#define SIP_PUBLISH	15
-
 #define RTP 	1
 #define NO_RTP	0
 
+/* Do _NOT_ make any changes to this enum, or the array following it;
+   if you think you are doing the right thing, you are probably
+   not doing the right thing. If you think there are changes
+   needed, get someone else to review them first _before_
+   submitting a patch. If these two lists do not match properly
+   bad things will happen.
+*/
+
+enum sipmethod {
+	SIP_UNKNOWN,
+	SIP_RESPONSE,
+	SIP_REGISTER,
+	SIP_OPTIONS,
+	SIP_NOTIFY,
+	SIP_INVITE,
+	SIP_ACK,
+	SIP_PRACK,
+	SIP_BYE,
+	SIP_REFER,
+	SIP_SUBSCRIBE,
+	SIP_MESSAGE,
+	SIP_UPDATE,
+	SIP_INFO,
+	SIP_CANCEL,
+	SIP_PUBLISH,
+} sip_method_list;
+
 static const struct  cfsip_methods { 
-	int id;
+	enum sipmethod id;
 	int need_rtp;		/* when this is the 'primary' use for a pvt structure, does it need RTP? */
 	char * const text;
 } sip_methods[] = {
-	{ 0,		 RTP,    "-UNKNOWN-" },
+	{ SIP_UNKNOWN,	 RTP,    "-UNKNOWN-" },
 	{ SIP_RESPONSE,	 NO_RTP, "SIP/2.0" },
 	{ SIP_REGISTER,	 NO_RTP, "REGISTER" },
  	{ SIP_OPTIONS,	 NO_RTP, "OPTIONS" },




More information about the svn-commits mailing list