FreeSWITCH API Documentation
1.7.0
|
Macros | |
#define | SWITCH_LIMIT_INCR(name) static switch_status_t name (switch_core_session_t *session, const char *realm, const char *resource, const int max, const int interval) |
#define | SWITCH_LIMIT_RELEASE(name) static switch_status_t name (switch_core_session_t *session, const char *realm, const char *resource) |
#define | SWITCH_LIMIT_USAGE(name) static int name (const char *realm, const char *resource, uint32_t *rcount) |
#define | SWITCH_LIMIT_RESET(name) static switch_status_t name (void) |
#define | SWITCH_LIMIT_INTERVAL_RESET(name) static switch_status_t name (const char *realm, const char *resource) |
#define | SWITCH_LIMIT_STATUS(name) static char * name (void) |
#define | LIMIT_IGNORE_TRANSFER_VARIABLE "limit_ignore_transfer" |
#define | LIMIT_BACKEND_VARIABLE "limit_backend" |
#define | LIMIT_EVENT_USAGE "limit::usage" |
#define | LIMIT_DEF_XFER_EXTEN "limit_exceeded" |
Functions | |
SWITCH_BEGIN_EXTERN_C void | switch_limit_init (switch_memory_pool_t *pool) |
Initilize the LIMIT Core System. More... | |
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. More... | |
switch_status_t | switch_limit_release (const char *backend, switch_core_session_t *session, const char *realm, const char *resource) |
Release resource. More... | |
int | switch_limit_usage (const char *backend, const char *realm, const char *resource, uint32_t *rcount) |
get usage count for resource More... | |
switch_status_t | switch_limit_interval_reset (const char *backend, const char *realm, const char *resource) |
reset interval usage counter for a given resource More... | |
switch_status_t | switch_limit_reset (const char *backend) |
reset all usage counters More... | |
void | switch_limit_fire_event (const char *backend, const char *realm, const char *resource, uint32_t usage, uint32_t rate, uint32_t max, uint32_t ratemax) |
fire event for limit usage More... | |
char * | switch_limit_status (const char *backend) |
retrieve arbitrary status information More... | |
#define LIMIT_BACKEND_VARIABLE "limit_backend" |
Definition at line 121 of file switch_limit.h.
Referenced by limit_state_handler(), and switch_limit_incr().
#define LIMIT_DEF_XFER_EXTEN "limit_exceeded" |
Definition at line 123 of file switch_limit.h.
#define LIMIT_EVENT_USAGE "limit::usage" |
Definition at line 122 of file switch_limit.h.
Referenced by switch_limit_fire_event(), and switch_limit_init().
#define LIMIT_IGNORE_TRANSFER_VARIABLE "limit_ignore_transfer" |
Definition at line 120 of file switch_limit.h.
Referenced by limit_state_handler().
#define SWITCH_LIMIT_INCR | ( | name | ) | static switch_status_t name (switch_core_session_t *session, const char *realm, const char *resource, const int max, const int interval) |
callback to init a backend
Definition at line 113 of file switch_limit.h.
#define SWITCH_LIMIT_INTERVAL_RESET | ( | name | ) | static switch_status_t name (const char *realm, const char *resource) |
Definition at line 117 of file switch_limit.h.
#define SWITCH_LIMIT_RELEASE | ( | name | ) | static switch_status_t name (switch_core_session_t *session, const char *realm, const char *resource) |
Definition at line 114 of file switch_limit.h.
#define SWITCH_LIMIT_RESET | ( | name | ) | static switch_status_t name (void) |
Definition at line 116 of file switch_limit.h.
#define SWITCH_LIMIT_STATUS | ( | name | ) | static char * name (void) |
Definition at line 118 of file switch_limit.h.
#define SWITCH_LIMIT_USAGE | ( | name | ) | static int name (const char *realm, const char *resource, uint32_t *rcount) |
Definition at line 115 of file switch_limit.h.
void switch_limit_fire_event | ( | const char * | backend, |
const char * | realm, | ||
const char * | resource, | ||
uint32_t | usage, | ||
uint32_t | rate, | ||
uint32_t | max, | ||
uint32_t | ratemax | ||
) |
fire event for limit usage
backend | to use |
realm | |
resource | |
usage | |
rate | |
max | |
ratemax |
Definition at line 62 of file switch_limit.c.
References LIMIT_EVENT_USAGE, switch_event_add_header(), switch_event_add_header_string(), switch_event_create_subclass, SWITCH_EVENT_CUSTOM, switch_event_fire, SWITCH_STACK_BOTTOM, and SWITCH_STATUS_SUCCESS.
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.
backend | to use |
realm | |
resource | |
max | - 0 means no limit, just count |
interval | - 0 means no interval |
Definition at line 111 of file switch_limit.c.
References get_backend(), switch_limit_interface::incr, LIMIT_BACKEND_VARIABLE, limit_state_handler(), release_backend(), switch_channel_get_variable, SWITCH_CHANNEL_SESSION_LOG, switch_channel_set_variable, switch_channel_set_variable_printf(), switch_core_session_get_channel(), switch_goto_status, SWITCH_LOG_DEBUG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_GENERR, and SWITCH_STATUS_SUCCESS.
SWITCH_BEGIN_EXTERN_C void switch_limit_init | ( | switch_memory_pool_t * | pool | ) |
Initilize the LIMIT Core System.
pool | the memory pool to use for long term allocations |
Definition at line 55 of file switch_limit.c.
References LIMIT_EVENT_USAGE, SWITCH_CHANNEL_LOG, switch_event_reserve_subclass, SWITCH_LOG_ERROR, switch_log_printf(), and SWITCH_STATUS_SUCCESS.
switch_status_t switch_limit_interval_reset | ( | const char * | backend, |
const char * | realm, | ||
const char * | resource | ||
) |
reset interval usage counter for a given resource
backend | |
realm | |
resource |
Definition at line 199 of file switch_limit.c.
References get_backend(), switch_limit_interface::interval_reset, release_backend(), SWITCH_CHANNEL_LOG, switch_goto_status, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_GENERR, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_limit_release | ( | const char * | backend, |
switch_core_session_t * | session, | ||
const char * | realm, | ||
const char * | resource | ||
) |
Release resource.
backend | to use |
realm | |
resource |
Definition at line 148 of file switch_limit.c.
References get_backend(), switch_limit_interface::release, release_backend(), SWITCH_CHANNEL_SESSION_LOG, switch_goto_status, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_GENERR, and SWITCH_STATUS_SUCCESS.
Referenced by limit_state_handler().
switch_status_t switch_limit_reset | ( | const char * | backend | ) |
reset all usage counters
backend | to use |
Definition at line 182 of file switch_limit.c.
References get_backend(), release_backend(), switch_limit_interface::reset, SWITCH_CHANNEL_LOG, switch_goto_status, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_GENERR, and SWITCH_STATUS_SUCCESS.
char* switch_limit_status | ( | const char * | backend | ) |
retrieve arbitrary status information
backend | to use |
Definition at line 221 of file switch_limit.c.
References get_backend(), release_backend(), switch_limit_interface::status, SWITCH_CHANNEL_LOG, switch_goto_status, SWITCH_LOG_ERROR, and switch_log_printf().
int switch_limit_usage | ( | const char * | backend, |
const char * | realm, | ||
const char * | resource, | ||
uint32_t * | rcount | ||
) |
get usage count for resource
backend | to use |
realm | |
resource | |
rcount | - output paramter, rate counter |
Definition at line 165 of file switch_limit.c.
References get_backend(), release_backend(), SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), usage, and switch_limit_interface::usage.