Browse code

- added struct msgid_var and get_msgid_val() macro - usefull to link some value to a msg id

Andrei Pelinescu-Onciul authored on 09/12/2005 18:29:38
Showing 1 changed files
... ...
@@ -37,6 +37,8 @@
37 37
  * 2003-03-30 str2int and str2float added (janakj)
38 38
  * 2003-04-26 ZSW (jiri)
39 39
  * 2004-03-08 updated int2str (64 bits, INT2STR_MAX_LEN used) (andrei)
40
+ * 2005-11-29 reverse_hex2int/int2reverse_hex switched to unsigned int (andrei)
41
+ * 2005-12-09 added msgid_var (andrei)
40 42
  */
41 43
 
42 44
 
... ...
@@ -56,7 +58,6 @@
56 58
 #include "str.h"
57 59
 
58 60
 
59
-struct sip_msg;
60 61
 
61 62
 /* zero-string wrapper */
62 63
 #define ZSW(_c) ((_c)?(_c):"")
... ...
@@ -92,6 +93,20 @@ struct sip_msg;
92 93
 		((_via)->hdr.s+(_via)->hdr.len)))
93 94
 
94 95
 
96
+/* links a value to a msgid */
97
+struct msgid_var{
98
+	union{
99
+		char char_val;
100
+		int int_val;
101
+		long long_val;
102
+	}u;
103
+	unsigned int msgid;
104
+};
105
+
106
+/* return the value or 0 if the msg_id doesn't match */
107
+#define get_msgid_val(var, id, type)\
108
+	(type)((type)((var).msgid!=(id))-1)&((var).u.type##_val)
109
+
95 110
 /* char to hex conversion table */
96 111
 static char fourbits2char[16] = { '0', '1', '2', '3', '4', '5',
97 112
 	'6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };