51 }
else if (level->
id_pool >= (UINTMAX_MAX / 2)) {
63 return !strcmp(category->
name, name);
77 "Name already used for type.\n", name);
81 category =
ast_calloc(1,
sizeof(*category) + strlen(name) + 1);
89 strcpy(category->
name, name);
94 "Unable to append.\n", name);
115 return !strcasecmp(category->
name, name);
160 const char *
const *names,
size_t size,
int default_sublevel)
164 if (!names || !size) {
165 level->
state = default_sublevel;
168 level,
NULL, default_sublevel);
173 for (i = 0; i < size; ++i) {
175 int num = default_sublevel;
177 sublevel = strchr(names[i],
':');
179 size_t len = ++sublevel - names[i];
199 int wordlen = strlen(word);
213 if (!strncasecmp(word, category->
name, wordlen) && (++which > state)) {
215 for (j = 0; j < argc; ++j) {
216 if (!strncasecmp(category->
name, argv[j], strlen(category->
name))) {
244 if (ids & level->
state) {
295 size_t size,
int default_sublevel)
#define AST_VECTOR_RW_INIT(vec, size)
Initialize a vector with a read/write lock.
#define AST_VECTOR_GET_INDEX(vec, value, cmp)
Get the 1st index from a vector that matches the given comparison.
Asterisk main include file. File version handling, generic pbx functions.
static int casecmp_by_name(const struct category_t *category, const char *name)
#define AST_VECTOR_REMOVE_CMP_UNORDERED(vec, value, cmp, cleanup)
Remove an element from a vector that matches the given comparison.
static int category_is_allowed(int sublevel, struct categories_level_t *level, uintmax_t ids)
#define AST_VECTOR_RW_UNLOCK(vec)
Unlock vector.
static int cmp_by_name(const struct category_t *category, const char *name)
static int category_set_sublevels(struct categories_level_t *level, const char *const *names, size_t size, int default_sublevel)
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
#define AST_VECTOR_RW_RDLOCK(vec)
Obtain read lock on vector.
#define ast_strdup(str)
A wrapper for strdup()
struct categories_t categories
uintmax_t ast_debug_category_register(const char *name)
Register a debug level logger category.
#define AST_VECTOR_RW_FREE(vec)
Deallocates this locked vector.
AST_VECTOR_RW(categories_t, struct category_t *)
Conversion utility functions.
static struct categories_level_t debug_categories
int ast_str_to_int(const char *str, int *res)
Convert the given string to a signed integer.
int ast_logger_category_load(void)
Load/Initialize system wide logger category functionality.
struct association categories[]
#define AST_LOG_CATEGORY_DISABLED
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ast_debug_category_set_sublevels(const char *const *names, size_t size, int default_sublevel)
Set one or more debug category's sublevel.
#define AST_VECTOR_RW_WRLOCK(vec)
Obtain write lock on vector.
#define ast_calloc(num, len)
A wrapper for calloc()
Vector container support.
static int category_unregister(struct categories_level_t *level, const char *name)
#define AST_VECTOR_GET_CMP(vec, value, cmp)
Get an element from a vector that matches the given comparison.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
Standard Command Line Interface.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
int ast_logger_category_unload(void)
Unload system wide logger category functionality.
char * ast_debug_category_complete(const char *const *argv, int argc, const char *word, int state)
Add a unique (no duplicates) result to a request for completion for debug categories.
#define AST_LOG_CATEGORY_ENABLED
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
int ast_debug_category_set_sublevel(const char *name, int sublevel)
Set the debug category's sublevel.
static int category_set_sublevel(struct category_t *category, struct categories_level_t *level, const char *name, int sublevel)
static uintmax_t category_register(struct categories_level_t *level, const char *name)
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
int ast_debug_category_is_allowed(int sublevel, uintmax_t ids)
Check if a debug category is enabled, and allowed to output.
static uintmax_t get_next_id(struct categories_level_t *level)
Retrieve the next available id.
#define AST_VECTOR_CALLBACK_VOID(vec, callback,...)
Execute a callback on every element in a vector disregarding callback return.
int ast_debug_category_unregister(const char *name)
Un-register a debug level logger category.
static char * category_complete(struct categories_level_t *level, const char *const *argv, int argc, const char *word, int state)