[svn-commits] tilghman: branch tilghman/realtime_for_voicemail_in_germany r167121 - in /tea...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Dec 31 18:26:08 CST 2008


Author: tilghman
Date: Wed Dec 31 18:26:07 2008
New Revision: 167121

URL: http://svn.digium.com/view/asterisk?view=rev&rev=167121
Log:
Add new APIs

Modified:
    team/tilghman/realtime_for_voicemail_in_germany/include/asterisk/config.h
    team/tilghman/realtime_for_voicemail_in_germany/main/config.c

Modified: team/tilghman/realtime_for_voicemail_in_germany/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/tilghman/realtime_for_voicemail_in_germany/include/asterisk/config.h?view=diff&rev=167121&r1=167120&r2=167121
==============================================================================
--- team/tilghman/realtime_for_voicemail_in_germany/include/asterisk/config.h (original)
+++ team/tilghman/realtime_for_voicemail_in_germany/include/asterisk/config.h Wed Dec 31 18:26:07 2008
@@ -92,6 +92,8 @@
 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_blobupdate(const char *database, const char *table, va_list ap);
+typedef int realtime_copy(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);
@@ -105,6 +107,8 @@
 	realtime_multi_get *realtime_multi_func;
 	realtime_update *update_func;
 	realtime_update2 *update2_func;
+	realtime_blobupdate *blobupdate_func;
+	realtime_copy *copy_func;
 	realtime_store *store_func;
 	realtime_destroy *destroy_func;
 	realtime_require *require_func;
@@ -292,6 +296,39 @@
  * order to preserve cross-platform compatibility.
  */
 int ast_update2_realtime(const char *family, ...) attribute_sentinel;
+
+/*!
+ * \brief Update a blob (Binary Large OBject) in a realtime configuration
+ * \param family which family/config to be updated
+ * This function is used to update a particular type of field in a realtime
+ * configuration space, one which may contain NULLs, which would otherwise
+ * terminate the field name.  Thus, the field requires the use of a length
+ * parameter to tell the storage system just how large the element is.
+ *
+ * The function uses 2 sentinels, similar to ast_update2_realtime.  The main
+ * difference is that the second set of fields are specified in a set of 3:
+ * fieldname, value, and valuelength.
+ */
+int ast_blobupdate_realtime(const char *family, ...) attribute_sentinel;
+
+/*!
+ * \brief Copy a set of data internally within the realtime configuration
+ * \param family which family/config to be updated
+ * \retval Number of records inserted, or -1 if not implemented on the realtime backend.
+ *
+ * This function copies a set of data from one record within the realtime
+ * configuration space to another.  Similar to the arguments of
+ * ast_update2_realtime, this API uses multiple sentinel values to separate
+ * groups of arguments.  Like the prior mentioned API, the first set of
+ * arguments are the criteria for selecting a row to be copied.  The second
+ * set of arguments is a list of fields to copy from the old record to the
+ * new record.  Finally, the third set of arguments are key-value pairs,
+ * specifying new values for named fields to be inserted into the new record.
+ *
+ * Note that specifying no fields for the second group causes this API to
+ * insert a completely new record, just like the ast_store_realtime() command.
+ */
+int ast_copy_realtime(const char *family, ...) attribute_sentinel;
 
 /*! 
  * \brief Create realtime configuration 

Modified: team/tilghman/realtime_for_voicemail_in_germany/main/config.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/realtime_for_voicemail_in_germany/main/config.c?view=diff&rev=167121&r1=167120&r2=167121
==============================================================================
--- team/tilghman/realtime_for_voicemail_in_germany/main/config.c (original)
+++ team/tilghman/realtime_for_voicemail_in_germany/main/config.c Wed Dec 31 18:26:07 2008
@@ -2233,6 +2233,40 @@
 	return res;
 }
 
+int ast_blobupdate_realtime(const char *family, ...)
+{
+	struct ast_config_engine *eng;
+	int res = -1;
+	char db[256];
+	char table[256];
+	va_list ap;
+
+	va_start(ap, family);
+	eng = find_engine(family, db, sizeof(db), table, sizeof(table));
+	if (eng && eng->blobupdate_func) 
+		res = eng->blobupdate_func(db, table, ap);
+	va_end(ap);
+
+	return res;
+}
+
+int ast_copy_realtime(const char *family, ...)
+{
+	struct ast_config_engine *eng;
+	int res = -1;
+	char db[256];
+	char table[256];
+	va_list ap;
+
+	va_start(ap, family);
+	eng = find_engine(family, db, sizeof(db), table, sizeof(table));
+	if (eng && eng->copy_func) 
+		res = eng->copy_func(db, table, ap);
+	va_end(ap);
+
+	return res;
+}
+
 int ast_store_realtime(const char *family, ...)
 {
 	struct ast_config_engine *eng;




More information about the svn-commits mailing list