83 if (
zstr(backendlist)) {
90 char *argv[6] = { 0 };
91 char *mydata = strdup(backendlist);
95 for (x = 0; x < argc; x++) {
125 realm, resource, max, interval);
131 if (!strstr(existing, backend)) {
156 status = limit->
release(session, realm, resource);
173 usage = limit->
usage(realm, resource, rcount);
190 status = limit->
reset();
switch_status_t switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt,...)
switch_channel_state_t switch_channel_get_state(switch_channel_t *channel)
Get the current state of a channel in the state engine.
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
static switch_bool_t switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
#define SWITCH_CHANNEL_SESSION_LOG(x)
Abstract interface to a limit module.
#define SWITCH_CHANNEL_LOG
#define LIMIT_EVENT_USAGE
switch_status_t(* reset)(void)
switch_status_t(* release)(switch_core_session_t *session, const char *realm, const char *resource)
switch_status_t switch_limit_interval_reset(const char *backend, const char *realm, const char *resource)
reset interval usage counter for a given resource
switch_memory_pool_t * pool
switch_status_t(* interval_reset)(const char *realm, const char *resource)
switch_status_t switch_event_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *fmt,...) PRINTF_FUNCTION(4
Add a header to an event.
Representation of an event.
char * switch_limit_status(const char *backend)
retrieve arbitrary status information
switch_status_t switch_limit_release(const char *backend, switch_core_session_t *session, const char *realm, const char *resource)
Release resource.
#define switch_event_create_subclass(_e, _eid, _sn)
switch_status_t switch_limit_reset(const char *backend)
reset all usage counters
switch_status_t switch_limit_incr(const char *backend, switch_core_session_t *session, const char *realm, const char *resource, const int max, const int interval)
Increment resource.
#define LIMIT_IGNORE_TRANSFER_VARIABLE
_Ret_ switch_channel_t * switch_core_session_get_channel(_In_ switch_core_session_t *session)
Retrieve a pointer to the channel object associated with a given session.
#define UNPROTECT_INTERFACE(_it)
static const char usage[]
unsigned int switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen)
Separate a string into an array based on a character delimiter.
void switch_limit_fire_event(const char *backend, const char *realm, const char *key, uint32_t usage, uint32_t rate, uint32_t max, uint32_t ratemax)
fire event for limit usage
#define switch_channel_get_variable(_c, _v)
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
static void release_backend(switch_limit_interface_t *limit)
void switch_limit_init(switch_memory_pool_t *pool)
Initilize the LIMIT Core System.
int(* usage)(const char *realm, const char *resource, uint32_t *rcount)
int switch_limit_usage(const char *backend, const char *realm, const char *resource, uint32_t *rcount)
get usage count for resource
switch_channel_state_t
Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are ...
switch_status_t
Common return values.
#define switch_goto_status(_status, _label)
#define switch_event_reserve_subclass(subclass_name)
Reserve a subclass assuming the owner string is the current filename.
Module Interface Definitions.
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
static switch_limit_interface_t * get_backend(const char *backend)
struct fspr_pool_t switch_memory_pool_t
switch_limit_interface_t * switch_loadable_module_get_limit_interface(const char *name)
Retrieve the limit interface by it's registered name.
#define LIMIT_BACKEND_VARIABLE
#define switch_channel_set_variable(_channel, _var, _val)
switch_status_t(* incr)(switch_core_session_t *session, const char *realm, const char *resource, const int max, const int interval)
static switch_status_t limit_state_handler(switch_core_session_t *session)