<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14665] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14665">14665</a></dd>
<dt>Author</dt> <dd>rupa</dd>
<dt>Date</dt> <dd>2009-08-28 11:18:51 -0500 (Fri, 28 Aug 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>add memcache support (limit_memcache and friends)</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodapplicationsmod_limitmod_limitc">freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodapplicationsmod_limitmod_limitc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (14664 => 14665)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c        2009-08-28 14:31:26 UTC (rev 14664)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c        2009-08-28 16:18:51 UTC (rev 14665)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> * Ken Rice <krice at suspicious dot org
</span><span class="cx"> * Mathieu Rene <mathieu.rene@gmail.com>
</span><span class="cx"> * Bret McDanel <trixter AT 0xdecafbad.com>
</span><ins>+ * Rupa Schomaker <rupa@rupa.com>
</ins><span class="cx"> *
</span><span class="cx"> * mod_limit.c -- Resource Limit Module
</span><span class="cx"> *
</span><span class="lines">@@ -359,6 +360,55 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static switch_status_t memcache_state_handler(switch_core_session_t *session)
+{
+        switch_channel_t *channel = switch_core_session_get_channel(session);
+        switch_channel_state_t state = switch_channel_get_state(channel);
+        int argc = 0;
+        char *argv[32] = { 0 };
+        char *pvt = switch_channel_get_private(channel, "limit_keys");
+        char *mydata = NULL;
+        int i = 0;
+
+        char *hashkey = NULL;
+        uint32_t total_usage = 0;
+        char *cmd = NULL;
+        switch_stream_handle_t stream = { 0 };
+        SWITCH_STANDARD_STREAM(stream);
+        
+        switch_assert(pvt);
+        
+        /* The call is either hung up, or is going back into the dialplan, decrement appropriate couters */
+        if (state >= CS_HANGUP || state == CS_ROUTING) {        
+
+                /* Loop through the channel's keys which contains mapping to all the limits referenced by that channel */
+                mydata = switch_core_session_strdup(session, pvt);
+                argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
+                for (i = 0; i < argc; i++) {
+                        hashkey = argv[i];
+                        cmd = switch_core_session_sprintf(session, "decrement limit:%s_total 1", hashkey);
+                        switch_api_execute("memcache", cmd, session, &stream);
+                        if (strncmp("-ERR", stream.data, 4)) {
+                                total_usage = atoi(stream.data);
+                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)hashkey, total_usage);
+                        } else {
+                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
+                                goto end;
+                        }
+                        
+                        stream.end = stream.data;
+                }
+                        
+                /* Remove handler */
+                switch_core_event_hook_remove_state_change(session, memcache_state_handler);
+                switch_channel_set_private(channel, "limit_keys", NULL);
+        }
+        
+end:
+        switch_safe_free(stream.data);
+        return SWITCH_STATUS_SUCCESS;
+}
+
</ins><span class="cx"> struct callback {
</span><span class="cx">         char *buf;
</span><span class="cx">         size_t len;
</span><span class="lines">@@ -1152,6 +1202,350 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* \brief Enforces limit_memcache restrictions
+ * \param session current session
+ * \param realm limit realm
+ * \param id limit id
+ * \param max maximum count
+ * \param interval interval for rate limiting
+ * \return SWITCH_TRUE if the access is allowed, SWITCH_FALSE if it isnt
+ */
+static switch_bool_t do_limit_memcache(switch_core_session_t *session, const char *realm, const char *id, int max, int interval)
+{
+        switch_channel_t *channel = switch_core_session_get_channel(session);
+        char *hashkey = NULL;
+        switch_bool_t status = SWITCH_TRUE;
+        uint8_t increment = 1;
+        uint32_t total_usage = 0;
+        uint32_t rate_usage = 0;
+        char *cmd = NULL;
+        char *pvt = NULL;
+        int argc = 0;
+        int i = 0;
+        char *argv[32] = { 0 };
+        char *mydata = NULL;
+        
+        switch_stream_handle_t stream = { 0 };
+        
+        if (switch_loadable_module_exists("mod_memcache") != SWITCH_STATUS_SUCCESS) {
+                status = SWITCH_TRUE;
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "mod_memcache is not loaded.");
+                goto end;
+        }
+        
+        SWITCH_STANDARD_STREAM(stream);
+        hashkey = switch_core_session_sprintf(session, "%s_%s", realm, id);
+        
+        /* Did we already run on this channel before? */
+        if ((pvt = switch_channel_get_private(channel, "limit_keys")))
+        {
+                /* Yes, but check if we did that realm+id
+                 If we didnt, allow incrementing the counter.
+                 If we did, dont touch it but do the validation anyways
+                 */
+                mydata = switch_core_session_strdup(session, pvt);
+                argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
+                for (i = 0; i < argc; i++) {
+                        if (!strcmp(hashkey, argv[i])) {
+                                increment = 0;
+                                break;
+                        }
+                }
+        }
+        
+        cmd = switch_core_session_sprintf(session, "get limit:%s_total", hashkey);
+        switch_api_execute("memcache", cmd, session, &stream);
+        if (strncmp("-ERR", stream.data, 4)) {
+                total_usage = atoi(stream.data);
+        } else if (!strncmp("-ERR NOT FOUND", stream.data, 14)) {
+                total_usage = 0;
+        } else {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
+                status = SWITCH_TRUE;
+                goto end;
+        }
+        
+        stream.end = stream.data;
+
+        if (interval > 0) {
+                cmd = switch_core_session_sprintf(session, "increment limit:%s_rate 1 %d", hashkey, interval);
+                switch_api_execute("memcache", cmd, session, &stream);
+                if (strncmp("-ERR", stream.data, 4)) {
+                        rate_usage = atoi(stream.data);
+                } else {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
+                        status = SWITCH_TRUE;
+                        goto end;
+                }
+                if ((max >= 0) && (rate_usage > (uint32_t)max)) {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s exceeds maximum rate of %d/%ds, now at %d\n", hashkey, max, interval, rate_usage);
+                        status = SWITCH_FALSE;
+                        goto end;
+                }
+        } else if ((max >= 0) && (total_usage + increment > (uint32_t)max)) {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is already at max value (%d)\n", hashkey, total_usage);
+                status = SWITCH_FALSE;
+                goto end;
+        }
+        
+        stream.end = stream.data;
+
+        if (increment) {
+                cmd = switch_core_session_sprintf(session, "increment limit:%s_total 1", hashkey);
+                switch_api_execute("memcache", cmd, session, &stream);
+                if (strncmp("-ERR", stream.data, 4)) {
+                        total_usage = atoi(stream.data);
+                } else {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
+                        status = SWITCH_TRUE;
+                        goto end;
+                }
+                if (max == -1) {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", hashkey, total_usage);
+                } else if (interval == 0) {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d\n", hashkey, total_usage, max);        
+                } else {
+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey, rate_usage, max, interval);
+                }
+
+                limit_fire_event(realm, id, total_usage, rate_usage, max, max >=0 ? (uint32_t)max : 0);
+        }
+
+        /* Save current usage & rate into channel variables so it can be used later in the dialplan, or added to CDR records */
+        {
+                const char *susage = switch_core_session_sprintf(session, "%d", total_usage);
+                const char *srate = switch_core_session_sprintf(session, "%d", rate_usage);
+
+                switch_channel_set_variable(channel, "limit_usage", susage);
+                switch_channel_set_variable(channel, switch_core_session_sprintf(session, "limit_usage_%s", hashkey), susage);
+
+                switch_channel_set_variable(channel, "limit_rate", srate);
+                switch_channel_set_variable(channel, switch_core_session_sprintf(session, "limit_rate_%s", hashkey), srate);
+        }
+        
+        if (pvt && increment) {
+                pvt = switch_core_session_sprintf(session, "%s,%s", pvt, hashkey);
+        } else {
+                /* This is the first limit check on this channel, create a hashtable, set our prviate data and add a state handler */
+                pvt = (char *) hashkey;
+        }
+        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "hash_keys: %s\n", pvt);
+        switch_channel_set_private(channel, "limit_keys", pvt);
+
+        switch_core_event_hook_add_state_change(session, memcache_state_handler);
+
+end:        
+        switch_safe_free(stream.data);
+        return status;
+}
+
+/* !\brief Releases usage of a limit_hash-controlled ressource */
+static void limit_memcache_release(switch_core_session_t *session, const char *realm, const char *id)
+{
+        char *hashkey = NULL;
+        uint32_t total_usage = 0;
+        char *cmd = NULL;
+        switch_stream_handle_t stream = { 0 };
+        SWITCH_STANDARD_STREAM(stream);
+        
+        if (switch_loadable_module_exists("mod_memcache") != SWITCH_STATUS_SUCCESS) {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "mod_memcache is not loaded.");
+                goto end;
+        }
+
+        hashkey = switch_core_session_sprintf(session, "%s_%s", realm, id);
+        
+        cmd = switch_core_session_sprintf(session, "decrement limit:%s_total 1", hashkey);
+        switch_api_execute("memcache", cmd, session, &stream);
+        if (strncmp("-ERR", stream.data, 4)) {
+                total_usage = atoi(stream.data);
+        } else if (!strncmp("-ERR NOT FOUND", stream.data, 14)) {
+                total_usage = 0;
+        } else {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
+                goto end;
+        }
+
+        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)hashkey, total_usage);
+
+end:
+        switch_safe_free(stream.data);
+}
+
+#define LIMITMEMCACHE_USAGE "<realm> <id> [<max>[/interval]] [number [dialplan [context]]]"
+#define LIMITMEMCACHE_DESC "limit access to a resource and transfer to an extension if the limit is exceeded"
+SWITCH_STANDARD_APP(limit_memcache_function)
+{
+        int argc = 0;
+        char *argv[6] = { 0 };
+        char *mydata = NULL;
+        char *realm = NULL;
+        char *id = NULL;
+        char *xfer_exten = NULL;
+        int max = -1;
+        int interval = 0;
+        char *szinterval = NULL;
+        switch_channel_t *channel = switch_core_session_get_channel(session);
+
+        /* Parse application data */
+        if (!switch_strlen_zero(data)) {
+                mydata = switch_core_session_strdup(session, data);
+                argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+        }
+        
+        if (argc < 2) {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "USAGE: limit_memcache %s\n", LIMITMEMCACHE_USAGE);
+                return;
+        }
+        
+        realm = argv[0];
+        id = argv[1];
+        
+        /* If max is omitted, only act as a counter and skip maximum checks */
+        if (argc > 2) {
+                if ((szinterval = strchr(argv[2], '/')))
+                {
+                        *szinterval++ = '\0';
+                        interval = atoi(szinterval);
+                }
+                
+                max = atoi(argv[2]);
+                
+                if (max < 0) {
+                        max = 0;
+                }
+        }
+
+        if (argc > 3) {
+                xfer_exten = argv[3];
+        } else {
+                xfer_exten = limit_def_xfer_exten;
+        }
+        
+        if (!do_limit_memcache(session, realm, id, max, interval)) {
+                /* Limit exceeded */
+                if (*xfer_exten == '!') {
+                        switch_channel_hangup(channel, switch_channel_str2cause(xfer_exten+1));
+                } else {
+                        switch_ivr_session_transfer(session, xfer_exten, argv[4], argv[5]);
+                }
+        }
+}
+
+
+#define LIMITMEMCACHEEXECUTE_USAGE "<realm> <id> [<max>[/interval]] [application] [application arguments]"
+#define LIMITMEMCACHEEXECUTE_DESC "limit access to a resource. the specified application will only be executed if the resource is available"
+SWITCH_STANDARD_APP(limit_memcache_execute_function)
+{
+        int argc = 0;
+        char *argv[5] = { 0 };
+        char *mydata = NULL;
+        char *realm = NULL;
+        char *id = NULL;
+        char *app = NULL;
+        char *app_arg = NULL;
+        int max = -1;
+        int interval = 0;
+        char *szinterval = NULL;
+
+        /* Parse application data */
+        if (!switch_strlen_zero(data)) {
+                mydata = switch_core_session_strdup(session, data);
+                argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+        }
+        
+        if (argc < 2) {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "USAGE: limit_memcache_execute %s\n", LIMITMEMCACHEEXECUTE_USAGE);
+                return;
+        }
+        
+        realm = argv[0];
+        id = argv[1];
+        
+        /* If max is omitted, only act as a counter and skip maximum checks */
+        if (argc > 2) {
+                if ((szinterval = strchr(argv[2], '/')))
+                {
+                        *szinterval++ = '\0';
+                        interval = atoi(szinterval);
+                }
+                
+                max = atoi(argv[2]);
+                
+                if (max < 0) {
+                        max = 0;
+                }
+        }
+
+
+        app = argv[3];
+        app_arg = argv[4];
+
+        if (switch_strlen_zero(app)) {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing application\n");
+                return;
+        }
+
+        if (do_limit_memcache(session, realm, id, max, interval)) {
+                switch_core_session_execute_application(session, app, app_arg);
+                limit_memcache_release(session, realm, id);
+        }
+}
+
+
+#define LIMIT_MEMCACHE_USAGE_USAGE "<realm> <id>"
+SWITCH_STANDARD_API(limit_memcache_usage_function)
+{
+        int argc = 0;
+        char *argv[3] = { 0 };
+        char *mydata = NULL;
+        uint32_t count = 0;
+        char *apicmd = NULL;
+        switch_bool_t status = SWITCH_TRUE;
+        switch_stream_handle_t apistream = { 0 };
+
+        SWITCH_STANDARD_STREAM(apistream);
+        if (switch_loadable_module_exists("mod_memcache") != SWITCH_STATUS_SUCCESS) {
+                status = SWITCH_TRUE;
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "mod_memcache is not loaded.");
+                stream->write_function(stream, "-ERR mod_memcache not loaded");
+                goto end;
+        }
+
+        if (!switch_strlen_zero(cmd)) {
+                mydata = strdup(cmd);
+                switch_assert(mydata);
+                argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+        }
+        
+        if (argc < 2) {
+                stream->write_function(stream, "USAGE: limit_memcache_usage %s\n", LIMIT_MEMCACHE_USAGE_USAGE);
+                goto end;
+        }
+        
+        apicmd = switch_mprintf("get limit:%s_%s_total", argv[0], argv[1]);
+        switch_api_execute("memcache", apicmd, session, &apistream);
+        if (strncmp("-ERR", apistream.data, 4)) {
+                count = atoi(apistream.data);
+        } else if (!strncmp("-ERR NOT FOUND", apistream.data, 14)) {
+                count = 0;
+        } else {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) apistream.data);
+                status = SWITCH_TRUE;
+                goto end;
+        }
+        
+        stream->write_function(stream, "%d", count);
+        
+end:
+        switch_safe_free(mydata);
+        switch_safe_free(apistream.data);
+        switch_safe_free(apicmd);
+        
+        return SWITCH_STATUS_SUCCESS;
+}
+
+
</ins><span class="cx"> SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load)
</span><span class="cx"> {
</span><span class="cx">         switch_status_t status;
</span><span class="lines">@@ -1187,11 +1581,14 @@
</span><span class="cx">         SWITCH_ADD_APP(app_interface, "limit", "Limit", LIMIT_DESC, limit_function, LIMIT_USAGE, SAF_SUPPORT_NOMEDIA);
</span><span class="cx">         SWITCH_ADD_APP(app_interface, "limit_hash", "Limit (hash)", LIMITHASH_DESC, limit_hash_function, LIMITHASH_USAGE, SAF_SUPPORT_NOMEDIA);
</span><span class="cx">         SWITCH_ADD_APP(app_interface, "limit_hash_execute", "Limit (hash)", LIMITHASHEXECUTE_USAGE, limit_hash_execute_function, LIMITHASHEXECUTE_USAGE, SAF_SUPPORT_NOMEDIA);
</span><ins>+        SWITCH_ADD_APP(app_interface, "limit_memcache", "Limit (memcache)", LIMITMEMCACHE_DESC, limit_memcache_function, LIMITMEMCACHE_USAGE, SAF_SUPPORT_NOMEDIA);
+        SWITCH_ADD_APP(app_interface, "limit_memcache_execute", "Limit (memcache)", LIMITMEMCACHEEXECUTE_USAGE, limit_memcache_execute_function, LIMITMEMCACHEEXECUTE_USAGE, SAF_SUPPORT_NOMEDIA);
</ins><span class="cx">         SWITCH_ADD_APP(app_interface, "db", "Insert to the db", DB_DESC, db_function, DB_USAGE, SAF_SUPPORT_NOMEDIA);
</span><span class="cx">         SWITCH_ADD_APP(app_interface, "hash", "Insert into the hashtable", HASH_DESC, hash_function, HASH_USAGE, SAF_SUPPORT_NOMEDIA)
</span><span class="cx">         SWITCH_ADD_APP(app_interface, "group", "Manage a group", GROUP_DESC, group_function, GROUP_USAGE, SAF_SUPPORT_NOMEDIA);
</span><span class="cx">
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, "limit_hash_usage", "Gets the usage count of a limited resource", limit_hash_usage_function, LIMIT_HASH_USAGE_USAGE);
</span><ins>+        SWITCH_ADD_API(commands_api_interface, "limit_memcache_usage", "Gets the usage count of a limited resource", limit_memcache_usage_function, LIMIT_MEMCACHE_USAGE_USAGE);
</ins><span class="cx">         SWITCH_ADD_API(commands_api_interface, "limit_usage", "Gets the usage count of a limited resource", limit_usage_function, "<realm> <id>");
</span><span class="cx">         SWITCH_ADD_API(commands_api_interface, "db", "db get/set", db_api_function, "[insert|delete|select]/<realm>/<key>/<value>");
</span><span class="cx">         switch_console_set_complete("add db insert");
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>