Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
res_pjsip Scheduler More...
#include "asterisk.h"
#include "asterisk/res_pjsip.h"
#include "include/res_pjsip_private.h"
#include "asterisk/res_pjsip_cli.h"
#include "asterisk/taskprocessor.h"
#include <regex.h>
Go to the source code of this file.
Data Structures | |
struct | ast_sip_sched_task |
Macros | |
#define | ID_LEN 13 /* task_deadbeef */ |
#define | TASK_BUCKETS 53 |
#define | TIME_FORMAT "%a %T" |
Functions | |
AO2_STRING_FIELD_CMP_FN (ast_sip_sched_task, name) | |
AO2_STRING_FIELD_HASH_FN (ast_sip_sched_task, name) | |
AO2_STRING_FIELD_SORT_FN (ast_sip_sched_task, name) | |
int | ast_sip_destroy_scheduler (void) |
int | ast_sip_initialize_scheduler (void) |
Initialize scheduler. More... | |
int | ast_sip_sched_is_task_running (struct ast_sip_sched_task *schtd) |
Checks if the task is currently running. More... | |
int | ast_sip_sched_is_task_running_by_name (const char *name) |
Checks if the task is currently running. More... | |
int | ast_sip_sched_task_cancel (struct ast_sip_sched_task *schtd) |
Cancels the next invocation of a task. More... | |
int | ast_sip_sched_task_cancel_by_name (const char *name) |
Cancels the next invocation of a task by name. More... | |
int | ast_sip_sched_task_get_name (struct ast_sip_sched_task *schtd, char *name, size_t maxlen) |
Gets the task name. More... | |
int | ast_sip_sched_task_get_next_run (struct ast_sip_sched_task *schtd) |
Gets the number of milliseconds until the next invocation. More... | |
int | ast_sip_sched_task_get_next_run_by_name (const char *name) |
Gets the number of milliseconds until the next invocation. More... | |
int | ast_sip_sched_task_get_times (struct ast_sip_sched_task *schtd, struct timeval *queued, struct timeval *last_start, struct timeval *last_end) |
Gets the last start and end times of the task. More... | |
int | ast_sip_sched_task_get_times2 (struct ast_sip_sched_task *schtd, struct timeval *queued, struct timeval *last_start, struct timeval *last_end, int *interval, int *time_left, struct timeval *next_start) |
Gets the queued, last start, last_end, time left, interval, next run. More... | |
int | ast_sip_sched_task_get_times_by_name (const char *name, struct timeval *queued, struct timeval *last_start, struct timeval *last_end) |
Gets the last start and end times of the task by name. More... | |
int | ast_sip_sched_task_get_times_by_name2 (const char *name, struct timeval *queued, struct timeval *last_start, struct timeval *last_end, int *interval, int *time_left, struct timeval *next_start) |
Gets the queued, last start, last_end, time left, interval, next run by task name. More... | |
struct ast_sip_sched_task * | ast_sip_schedule_task (struct ast_taskprocessor *serializer, int interval, ast_sip_task sip_task, const char *name, void *task_data, enum ast_sip_scheduler_task_flags flags) |
Schedule a task to run in the res_pjsip thread pool. More... | |
static char * | cli_show_tasks (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | push_to_serializer (const void *data) |
static int | run_task (void *data) |
static void | schtd_dtor (void *data) |
Variables | |
static struct ast_cli_entry | cli_commands [] |
static struct ast_sched_context * | scheduler_context |
static int | task_count |
static struct ao2_container * | tasks |
res_pjsip Scheduler
Definition in file pjsip_scheduler.c.
#define ID_LEN 13 /* task_deadbeef */ |
#define TASK_BUCKETS 53 |
Definition at line 35 of file pjsip_scheduler.c.
#define TIME_FORMAT "%a %T" |
Definition at line 488 of file pjsip_scheduler.c.
AO2_STRING_FIELD_CMP_FN | ( | ast_sip_sched_task | , |
name | |||
) |
AO2_STRING_FIELD_HASH_FN | ( | ast_sip_sched_task | , |
name | |||
) |
AO2_STRING_FIELD_SORT_FN | ( | ast_sip_sched_task | , |
name | |||
) |
int ast_sip_destroy_scheduler | ( | void | ) |
Definition at line 642 of file pjsip_scheduler.c.
References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ARRAY_LEN, ast_cli_unregister_multiple(), ast_sched_context_destroy(), ast_sip_sched_task_cancel(), cli_commands, NULL, scheduler_context, and tasks.
Referenced by load_module(), and unload_module().
int ast_sip_initialize_scheduler | ( | void | ) |
Initialize scheduler.
-1 | failure |
0 | success |
Definition at line 614 of file pjsip_scheduler.c.
References AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_container_alloc_hash, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_sched_context_create(), ast_sched_context_destroy(), ast_sched_start_thread(), cli_commands, LOG_ERROR, scheduler_context, TASK_BUCKETS, and tasks.
Referenced by load_module().
|
static |
Definition at line 490 of file pjsip_scheduler.c.
References a, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_rbtree, ao2_container_count(), ao2_container_dup(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, AO2_ITERATOR_UNLINK, ao2_lock, ao2_ref, ao2_unlock, ast_cli(), ast_localtime(), ast_sip_sched_task_get_next_run(), AST_SIP_SCHED_TASK_ONESHOT, ast_strftime(), ast_tv(), ast_tvadd(), ast_tvnow(), ast_tvzero(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_sip_sched_task::flags, ast_sip_sched_task::interval, ast_sip_sched_task::is_running, ast_sip_sched_task::last_start, ast_sip_sched_task::name, NULL, regex(), ast_sip_sched_task::run_count, tasks, TIME_FORMAT, ast_cli_entry::usage, and ast_sip_sched_task::when_queued.
|
static |
Definition at line 157 of file pjsip_scheduler.c.
References ao2_lock, ao2_t_ref, ao2_unlink, ao2_unlock, ast_log, ast_sip_push_task(), AST_SIP_SCHED_TASK_TRACK, ast_sip_sched_task::current_scheduler_id, ast_sip_sched_task::flags, ast_sip_sched_task::interval, LOG_DEBUG, ast_sip_sched_task::name, run_task(), ast_sip_sched_task::serializer, and tasks.
Referenced by ast_sip_schedule_task(), and run_task().
|
static |
Definition at line 80 of file pjsip_scheduler.c.
References ao2_cleanup, ao2_lock, ao2_unlink, ao2_unlock, ast_log, ast_samp2tv(), ast_sched_add(), AST_SIP_SCHED_TASK_DELAY, AST_SIP_SCHED_TASK_ONESHOT, AST_SIP_SCHED_TASK_TRACK, AST_SIP_SCHED_TASK_VARIABLE, ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), LOG_DEBUG, LOG_ERROR, push_to_serializer(), RAII_VAR, scheduler_context, and tasks.
Referenced by push_to_serializer().
|
static |
Definition at line 399 of file pjsip_scheduler.c.
References ao2_ref, ast_free, ast_log, AST_SIP_SCHED_TASK_DATA_AO2, AST_SIP_SCHED_TASK_DATA_FREE, AST_SIP_SCHED_TASK_TRACK, ast_taskprocessor_unreference(), ast_sip_sched_task::flags, LOG_DEBUG, ast_sip_sched_task::name, ast_sip_sched_task::serializer, and ast_sip_sched_task::task_data.
Referenced by ast_sip_schedule_task().
|
static |
Definition at line 610 of file pjsip_scheduler.c.
Referenced by ast_sip_destroy_scheduler(), and ast_sip_initialize_scheduler().
|
static |
Definition at line 37 of file pjsip_scheduler.c.
Referenced by ast_sip_destroy_scheduler(), ast_sip_initialize_scheduler(), ast_sip_sched_task_cancel(), ast_sip_schedule_task(), and run_task().
|
static |
Definition at line 39 of file pjsip_scheduler.c.
Referenced by ast_sip_schedule_task().
|
static |
Definition at line 38 of file pjsip_scheduler.c.
Referenced by ast_sip_destroy_scheduler(), ast_sip_initialize_scheduler(), ast_sip_sched_is_task_running_by_name(), ast_sip_sched_task_cancel(), ast_sip_sched_task_cancel_by_name(), ast_sip_sched_task_get_next_run_by_name(), ast_sip_sched_task_get_times_by_name2(), ast_sip_schedule_task(), cli_show_tasks(), push_to_serializer(), and run_task().