summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-06-05 19:07:27 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-06-05 19:07:27 +0000
commit9471b87d27bda1ec762c712f68489e88244b8fae (patch)
tree587127c83bf7f01e5c281920e0b216eec48c8344 /include
parent2347ebf43600d0fb6a0a5d5bfda326b890a8463f (diff)
Merge the adaptive realtime branch, which will make adding new required fields
to realtime less painful in the future. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@120789 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/config.h37
-rw-r--r--include/asterisk/res_odbc.h22
2 files changed, 59 insertions, 0 deletions
diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index 80f651d44..e1f983dc3 100644
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -46,6 +46,17 @@ enum {
#define CONFIG_STATUS_FILEUNCHANGED (void *)-1
+/*!
+ * \brief Types used in ast_realtime_require_field
+ */
+typedef enum {
+ RQ_INTEGER,
+ RQ_CHAR,
+ RQ_FLOAT,
+ RQ_DATE,
+ RQ_DATETIME,
+} require_type;
+
/*! \brief Structure for variables, used for configurations and for channel variables
*/
struct ast_variable {
@@ -70,6 +81,8 @@ typedef struct ast_config *realtime_multi_get(const char *database, const char *
typedef int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap);
typedef int realtime_store(const char *database, const char *table, va_list ap);
typedef int realtime_destroy(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap);
+typedef int realtime_require(const char *database, const char *table, va_list ap);
+typedef int realtime_unload(const char *database, const char *table);
/*! \brief Configuration engine structure, used to define realtime drivers */
struct ast_config_engine {
@@ -80,6 +93,8 @@ struct ast_config_engine {
realtime_update *update_func;
realtime_store *store_func;
realtime_destroy *destroy_func;
+ realtime_require *require_func;
+ realtime_unload *unload_func;
struct ast_config_engine *next;
};
@@ -185,6 +200,26 @@ int ast_category_exist(const struct ast_config *config, const char *category_nam
struct ast_variable *ast_load_realtime(const char *family, ...) attribute_sentinel;
struct ast_variable *ast_load_realtime_all(const char *family, ...) attribute_sentinel;
+/*!
+ * \brief Release any resources cached for a realtime family
+ * \param family which family/config to destroy
+ * Various backends may cache attributes about a realtime data storage
+ * facility; on reload, a front end resource may request to purge that cache.
+ */
+int ast_unload_realtime(const char *family);
+
+/*!
+ * \brief Inform realtime what fields that may be stored
+ * \param family which family/config is referenced
+ * This will inform builtin configuration backends that particular fields
+ * may be updated during the use of that configuration section. This is
+ * mainly to be used during startup routines, to ensure that various fields
+ * exist in the backend. The backends may take various actions, such as
+ * creating new fields in the data store or warning the administrator that
+ * new fields may need to be created, in order to ensure proper function.
+ */
+int ast_require_realtime_fields(const char *family, ...) attribute_sentinel;
+
/*!
* \brief Retrieve realtime configuration
* \param family which family/config to lookup
@@ -232,6 +267,8 @@ int ast_destroy_realtime(const char *family, const char *keyfield, const char *l
*/
int ast_check_realtime(const char *family);
+int ast_realtime_require_field(const char *family, ...) attribute_sentinel;
+
/*! \brief Check if there's any realtime engines loaded */
int ast_realtime_enabled(void);
diff --git a/include/asterisk/res_odbc.h b/include/asterisk/res_odbc.h
index 1defc816b..4fbc2dac5 100644
--- a/include/asterisk/res_odbc.h
+++ b/include/asterisk/res_odbc.h
@@ -30,6 +30,7 @@
#include <sql.h>
#include <sqlext.h>
#include <sqltypes.h>
+#include "asterisk/linkedlists.h"
typedef enum { ODBC_SUCCESS=0, ODBC_FAIL=-1} odbc_status;
@@ -44,6 +45,27 @@ struct odbc_obj {
AST_LIST_ENTRY(odbc_obj) list;
};
+/*!\brief These aren't used in any API calls, but they are kept in a common
+ * location, simply for convenience and to avoid duplication.
+ */
+struct odbc_cache_columns {
+ char *name;
+ SQLSMALLINT type;
+ SQLINTEGER size;
+ SQLSMALLINT decimals;
+ SQLSMALLINT radix;
+ SQLSMALLINT nullable;
+ SQLINTEGER octetlen;
+ AST_RWLIST_ENTRY(odbc_cache_columns) list;
+};
+
+struct odbc_cache_tables {
+ char *connection;
+ char *table;
+ AST_RWLIST_HEAD(_columns, odbc_cache_columns) columns;
+ AST_RWLIST_ENTRY(odbc_cache_tables) list;
+};
+
/* functions */
/*!