ソースを参照

core: added function to get the pv cache table

- pv cache struct moved to header file
Daniel-Constantin Mierla 12 年 前
コミット
69c409e14c
2 ファイル変更24 行追加9 行削除
  1. 8 9
      pvapi.c
  2. 16 0
      pvar.h

+ 8 - 9
pvapi.c

@@ -41,7 +41,6 @@
 #include "pvar.h"
 #include "pvar.h"
 
 
 #define PV_TABLE_SIZE	32  /*!< pseudo-variables table size */
 #define PV_TABLE_SIZE	32  /*!< pseudo-variables table size */
-#define PV_CACHE_SIZE	32  /*!< pseudo-variables table size */
 #define TR_TABLE_SIZE	16  /*!< transformations table size */
 #define TR_TABLE_SIZE	16  /*!< transformations table size */
 
 
 
 
@@ -58,14 +57,6 @@ typedef struct _pv_item
 static pv_item_t* _pv_table[PV_TABLE_SIZE];
 static pv_item_t* _pv_table[PV_TABLE_SIZE];
 static int _pv_table_set = 0;
 static int _pv_table_set = 0;
 
 
-typedef struct _pv_cache
-{
-	str pvname;
-	unsigned int pvid;
-	pv_spec_t spec;
-	struct _pv_cache *next;
-} pv_cache_t;
-
 static pv_cache_t* _pv_cache[PV_CACHE_SIZE];
 static pv_cache_t* _pv_cache[PV_CACHE_SIZE];
 static int _pv_cache_set = 0;
 static int _pv_cache_set = 0;
 
 
@@ -87,6 +78,14 @@ void pv_init_cache(void)
 	_pv_cache_set = 1;
 	_pv_cache_set = 1;
 }
 }
 
 
+/**
+ *
+ */
+pv_cache_t **pv_cache_get_table(void)
+{
+	if(_pv_cache_set==1) return _pv_cache;
+	return NULL;
+}
 
 
 /**
 /**
  * @brief Check if a char is valid according to the PV syntax
  * @brief Check if a char is valid according to the PV syntax

+ 16 - 0
pvar.h

@@ -225,6 +225,22 @@ int pv_get_strintval(struct sip_msg *msg, pv_param_t *param,
 int pv_get_intstrval(struct sip_msg *msg, pv_param_t *param,
 int pv_get_intstrval(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res, int ival, str *sval);
 		pv_value_t *res, int ival, str *sval);
 
 
+/**
+ * Core PV Cache
+ */
+typedef struct _pv_cache
+{
+	str pvname;
+	unsigned int pvid;
+	pv_spec_t spec;
+	struct _pv_cache *next;
+} pv_cache_t;
+
+#define PV_CACHE_SIZE	32  /*!< pseudo-variables cache table size */
+
+pv_cache_t **pv_cache_get_table(void);
+
+
 /**
 /**
  * Transformations
  * Transformations
  */
  */