summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-10-14 00:08:52 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-10-14 00:08:52 +0000
commitc1351ad2370f179e439adf9faf9c49cf34a9b4d6 (patch)
treedefa29805f9479efc7793b15f9e31a97dfe89603 /include
parentdb7299f4bc0dd35fb08038a368c6d8700a8ce4d4 (diff)
Merge realtime_update2 branch, which adds a new realtime API call named
'update2', which permits updates which match across multiple columns, instead of requiring all tables to have a single unique identifier. All of the other API calls with the exception of 'update' already had the ability to match on multiple fields, so it was a missing and very desireable feature that an API call implementing an update should have this, too. This does not change any outward performance of Asterisk, but it should make life easier for application developers who use the RealTime framework. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@148570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/config.h30
-rw-r--r--include/asterisk/strings.h4
2 files changed, 32 insertions, 2 deletions
diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index 8c9a1d3be..bd030a76e 100644
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -91,6 +91,7 @@ typedef struct ast_config *config_load_func(const char *database, const char *ta
typedef struct ast_variable *realtime_var_get(const char *database, const char *table, va_list ap);
typedef struct ast_config *realtime_multi_get(const char *database, const char *table, va_list ap);
typedef int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap);
+typedef int realtime_update2(const char *database, const char *table, 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);
@@ -103,6 +104,7 @@ struct ast_config_engine {
realtime_var_get *realtime_func;
realtime_multi_get *realtime_multi_func;
realtime_update *update_func;
+ realtime_update2 *update2_func;
realtime_store *store_func;
realtime_destroy *destroy_func;
realtime_require *require_func;
@@ -208,6 +210,9 @@ int ast_category_exist(const struct ast_config *config, const char *category_nam
* entity in realtime and return a variable list of its parameters. Note
* that unlike the variables in ast_config, the resulting list of variables
* MUST be freed with ast_variables_destroy() as there is no container.
+ *
+ * Note that you should use the constant SENTINEL to terminate arguments, in
+ * order to preserve cross-platform compatibility.
*/
struct ast_variable *ast_load_realtime(const char *family, ...) attribute_sentinel;
struct ast_variable *ast_load_realtime_all(const char *family, ...) attribute_sentinel;
@@ -243,6 +248,9 @@ int ast_unload_realtime(const char *family);
* a timeout value may reasonably be specified as an INTEGER2, with size 5.
* Even though values above 32767 seconds are possible, they are unlikely
* to be useful, and we should not complain about that size).
+ *
+ * Note that you should use the constant SENTINEL to terminate arguments, in
+ * order to preserve cross-platform compatibility.
*/
int ast_realtime_require_field(const char *family, ...) attribute_sentinel;
@@ -254,6 +262,9 @@ int ast_realtime_require_field(const char *family, ...) attribute_sentinel;
* the ast_load_realtime, this function can return more than one entry and
* is thus stored inside a taditional ast_config structure rather than
* just returning a linked list of variables.
+ *
+ * Note that you should use the constant SENTINEL to terminate arguments, in
+ * order to preserve cross-platform compatibility.
*/
struct ast_config *ast_load_realtime_multientry(const char *family, ...) attribute_sentinel;
@@ -264,14 +275,31 @@ struct ast_config *ast_load_realtime_multientry(const char *family, ...) attribu
* \param lookup which value to look for in the key field to match the entry.
* This function is used to update a parameter in realtime configuration space.
*
+ * Note that you should use the constant SENTINEL to terminate arguments, in
+ * order to preserve cross-platform compatibility.
*/
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...) attribute_sentinel;
/*!
+ * \brief Update realtime configuration
+ * \param family which family/config to be updated
+ * This function is used to update a parameter in realtime configuration space.
+ * It includes the ability to lookup a row based upon multiple key criteria.
+ * As a result, this function includes two sentinel values, one to terminate
+ * lookup values and the other to terminate the listing of fields to update.
+ *
+ * Note that you should use the constant SENTINEL to terminate arguments, in
+ * order to preserve cross-platform compatibility.
+ */
+int ast_update2_realtime(const char *family, ...) attribute_sentinel;
+
+/*!
* \brief Create realtime configuration
* \param family which family/config to be created
* This function is used to create a parameter in realtime configuration space.
*
+ * Note that you should use the constant SENTINEL to terminate arguments, in
+ * order to preserve cross-platform compatibility.
*/
int ast_store_realtime(const char *family, ...) attribute_sentinel;
@@ -283,6 +311,8 @@ int ast_store_realtime(const char *family, ...) attribute_sentinel;
* This function is used to destroy an entry in realtime configuration space.
* Additional params are used as keys.
*
+ * Note that you should use the constant SENTINEL to terminate arguments, in
+ * order to preserve cross-platform compatibility.
*/
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup, ...) attribute_sentinel;
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index 514b3af6a..682524248 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -421,8 +421,8 @@ int ast_str_make_space(struct ast_str **buf, size_t new_len),
_DB1(__ast_threadstorage_object_replace(old_buf, *buf, new_len + sizeof(struct ast_str));)
}
- (*buf)->len = new_len;
- return 0;
+ (*buf)->len = new_len;
+ return 0;
}
)