Browse code

core: added function to get the pv cache table

- pv cache struct moved to header file

Daniel-Constantin Mierla authored on 16/06/2013 14:39:14
Showing 2 changed files
... ...
@@ -41,7 +41,6 @@
41 41
 #include "pvar.h"
42 42
 
43 43
 #define PV_TABLE_SIZE	32  /*!< pseudo-variables table size */
44
-#define PV_CACHE_SIZE	32  /*!< pseudo-variables table size */
45 44
 #define TR_TABLE_SIZE	16  /*!< transformations table size */
46 45
 
47 46
 
... ...
@@ -58,14 +57,6 @@ typedef struct _pv_item
58 57
 static pv_item_t* _pv_table[PV_TABLE_SIZE];
59 58
 static int _pv_table_set = 0;
60 59
 
61
-typedef struct _pv_cache
62
-{
63
-	str pvname;
64
-	unsigned int pvid;
65
-	pv_spec_t spec;
66
-	struct _pv_cache *next;
67
-} pv_cache_t;
68
-
69 60
 static pv_cache_t* _pv_cache[PV_CACHE_SIZE];
70 61
 static int _pv_cache_set = 0;
71 62
 
... ...
@@ -87,6 +78,14 @@ void pv_init_cache(void)
87 78
 	_pv_cache_set = 1;
88 79
 }
89 80
 
81
+/**
82
+ *
83
+ */
84
+pv_cache_t **pv_cache_get_table(void)
85
+{
86
+	if(_pv_cache_set==1) return _pv_cache;
87
+	return NULL;
88
+}
90 89
 
91 90
 /**
92 91
  * @brief Check if a char is valid according to the PV syntax
... ...
@@ -225,6 +225,22 @@ int pv_get_strintval(struct sip_msg *msg, pv_param_t *param,
225 225
 int pv_get_intstrval(struct sip_msg *msg, pv_param_t *param,
226 226
 		pv_value_t *res, int ival, str *sval);
227 227
 
228
+/**
229
+ * Core PV Cache
230
+ */
231
+typedef struct _pv_cache
232
+{
233
+	str pvname;
234
+	unsigned int pvid;
235
+	pv_spec_t spec;
236
+	struct _pv_cache *next;
237
+} pv_cache_t;
238
+
239
+#define PV_CACHE_SIZE	32  /*!< pseudo-variables cache table size */
240
+
241
+pv_cache_t **pv_cache_get_table(void);
242
+
243
+
228 244
 /**
229 245
  * Transformations
230 246
  */