]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
via 8118, a RealTime upgrade to make RT a complete storage abstraction. The store...
authorSteve Murphy <murf@digium.com>
Wed, 11 Apr 2007 13:41:17 +0000 (13:41 +0000)
committerSteve Murphy <murf@digium.com>
Wed, 11 Apr 2007 13:41:17 +0000 (13:41 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61374 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/config.h
main/config.c

index f7b14af1bd020c5811f55503c62a6e123d4b75dd..4ebf7b63ba6fd5db854fbced79692dd4828ddb48 100644 (file)
@@ -156,6 +156,23 @@ struct ast_config *ast_load_realtime_multientry(const char *family, ...);
  */
 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
index a3cf96c5079d54e4c9ae2695439743aa65e6582a..9bc97eac6482da99ed3f247c5c945b8af1729ffd 100644 (file)
@@ -1426,6 +1426,38 @@ int ast_update_realtime(const char *family, const char *keyfield, const char *lo
        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;