[asterisk-commits] murf: trunk r61374 - in /trunk: include/asterisk/config.h main/config.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Apr 11 06:41:17 MST 2007


Author: murf
Date: Wed Apr 11 08:41:17 2007
New Revision: 61374

URL: http://svn.digium.com/view/asterisk?view=rev&rev=61374
Log:
via 8118, a RealTime upgrade to make RT a complete storage abstraction. The store/destroy mechanisms needed these missing peices.

Modified:
    trunk/include/asterisk/config.h
    trunk/main/config.c

Modified: trunk/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/config.h?view=diff&rev=61374&r1=61373&r2=61374
==============================================================================
--- trunk/include/asterisk/config.h (original)
+++ trunk/include/asterisk/config.h Wed Apr 11 08:41:17 2007
@@ -156,6 +156,23 @@
  */
 int ast_update_realtime(const char *family, const char *keyfield, const char *lookup, ...);
 
+/*! \brief Create realtime configuration 
+ * \param family which family/config to be created
+ * This function is used to create a parameter in realtime configuration space.
+ *
+ */
+int ast_store_realtime(const char *family, ...);
+
+/*! \brief Destroy realtime configuration 
+ * \param family which family/config to be destroyed
+ * \param keyfield which field to use as the key
+ * \param lookup which value to look for in the key field to match the entry.
+ * This function is used to destroy an entry in realtime configuration space.
+ * Additional params are used as keys.
+ *
+ */
+int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup, ...);
+
 /*! \brief Check if realtime engine is configured for family 
  * returns 1 if family is configured in realtime and engine exists
  * \param family which family/config to be checked

Modified: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=61374&r1=61373&r2=61374
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Wed Apr 11 08:41:17 2007
@@ -1426,6 +1426,38 @@
 	return res;
 }
 
+int ast_store_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->store_func) 
+		res = eng->store_func(db, table, ap);
+	va_end(ap);
+
+	return res;
+}
+
+int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup, ...) {
+	struct ast_config_engine *eng;
+	int res = -1;
+	char db[256]="";
+	char table[256]="";
+	va_list ap;
+
+	va_start(ap, lookup);
+	eng = find_engine(family, db, sizeof(db), table, sizeof(table));
+	if (eng && eng->destroy_func) 
+		res = eng->destroy_func(db, table, keyfield, lookup, ap);
+	va_end(ap);
+
+	return res;
+}
+
 static int config_command(int fd, int argc, char **argv) 
 {
 	struct ast_config_engine *eng;



More information about the asterisk-commits mailing list