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 56
 #include "str.h"
57 57
 
58 58
 
59
-struct sip_msg;
60 59
 
61 60
 /* zero-string wrapper */
62 61
 #define ZSW(_c) ((_c)?(_c):"")
... ...
@@ -92,6 +93,20 @@ struct sip_msg;
92 92
 		((_via)->hdr.s+(_via)->hdr.len)))
93 93
 
94 94
 
95
+/* links a value to a msgid */
96
+struct msgid_var{
97
+	union{
98
+		char char_val;
99
+		int int_val;
100
+		long long_val;
101
+	}u;
102
+	unsigned int msgid;
103
+};
104
+
105
+/* return the value or 0 if the msg_id doesn't match */
106
+#define get_msgid_val(var, id, type)\
107
+	(type)((type)((var).msgid!=(id))-1)&((var).u.type##_val)
108
+
95 109
 /* char to hex conversion table */
96 110
 static char fourbits2char[16] = { '0', '1', '2', '3', '4', '5',
97 111
 	'6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };