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