|
Asterisk - The Open Source Telephony Project GIT-master-80b953f
|
Private header for res_cdrel_custom. More...
#include <sqlite3.h>#include "asterisk.h"#include "asterisk/cdr.h"#include "asterisk/cel.h"#include "asterisk/event.h"#include "asterisk/lock.h"#include "asterisk/strings.h"#include "asterisk/vector.h"#include "asterisk/res_cdrel_custom.h"

Go to the source code of this file.
Data Structures | |
| struct | cdrel_config |
| struct | cdrel_field |
| struct | cdrel_value |
| struct | cdrel_values |
Macros | |
| #define | AST_EVENT_IE_CEL_EVENT_ENUM (AST_EVENT_IE_TOTAL + 2) |
| #define | AST_EVENT_IE_CEL_LITERAL (AST_EVENT_IE_TOTAL + 1) |
| #define | CDR_FIELD(__cdr, __offset) (((void *)__cdr) + __offset - CDR_OFFSET_SHIFT) |
| #define | CDR_OFFSET_SHIFT (LAST_CEL_ID + 1) |
| #define | CDR_OFFSETOF(_field) (offsetof(struct ast_cdr, _field) + CDR_OFFSET_SHIFT) |
| #define | CDREL_FIELD_FLAG_FORMAT_SPEC (5) |
| #define | CDREL_FIELD_FLAG_LAST (6) |
| #define | CDREL_FIELD_FLAG_LITERAL (4) |
| #define | CDREL_FIELD_FLAG_NOQUOTE (1) |
| #define | CDREL_FIELD_FLAG_QUOTE (0) |
| #define | CDREL_FIELD_FLAG_TYPE_FORCED (2) |
| #define | CDREL_FIELD_FLAG_USERVAR (3) |
| #define | DATA_TYPE_STR(_dt) (_dt < cdrel_data_type_end ? cdrel_data_type_map[_dt] : NULL) |
| #define | LAST_CEL_ID AST_EVENT_IE_CEL_EVENT_ENUM |
| #define | MODULE_TYPE_STR(_mt) (cdrel_module_type_map[_mt]) |
| #define | RECORD_TYPE_STR(_rt) (cdrel_record_type_map[_rt]) |
Typedefs | |
| typedef int(* | cdrel_backend_writer) (struct cdrel_config *config, struct cdrel_values *values) |
| typedef struct ast_channel *(* | cdrel_dummy_channel_alloc) (struct cdrel_config *config, void *record) |
| typedef int(* | cdrel_field_formatter) (struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *input_value, struct cdrel_value *output_value) |
| typedef int(* | cdrel_field_getter) (void *record, struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *value) |
Functions | |
| const char * | cdrel_basename (const char *path) |
| enum cdrel_data_type | cdrel_data_type_from_str (const char *str) |
| const char * | cdrel_get_field_flags (struct ast_flags *flags, struct ast_str **str) |
| const struct cdrel_field * | get_registered_field_by_name (enum cdrel_record_type record_type, const char *name) |
| int | load_cdr (void) |
| int | load_cel (void) |
| int | load_formatters (void) |
| int | load_writers (void) |
| int | write_record_to_database (struct cdrel_config *config, struct cdrel_values *values) |
| int | write_record_to_file (struct cdrel_config *config, struct ast_str *record) |
Private header for res_cdrel_custom.
Definition in file cdrel.h.
| #define AST_EVENT_IE_CEL_EVENT_ENUM (AST_EVENT_IE_TOTAL + 2) |
| #define AST_EVENT_IE_CEL_LITERAL (AST_EVENT_IE_TOTAL + 1) |
| #define CDR_FIELD | ( | __cdr, | |
| __offset | |||
| ) | (((void *)__cdr) + __offset - CDR_OFFSET_SHIFT) |
| #define CDR_OFFSET_SHIFT (LAST_CEL_ID + 1) |
While CEL event fields are published as a generic AST_EVENT with a field id assigned to each field, CDRs are published as a fixed ast_cdr structure. To make it easier to share lower level code, we assign pseudo-field-ids to each CDR field that are really the offset of the field in the structure. This allows us to generically get any field using its id just like we do for CEL.
To avoid conflicts with the existing CEL field ids, we'll start these after the last one.
| #define CDR_OFFSETOF | ( | _field | ) | (offsetof(struct ast_cdr, _field) + CDR_OFFSET_SHIFT) |
| #define DATA_TYPE_STR | ( | _dt | ) | (_dt < cdrel_data_type_end ? cdrel_data_type_map[_dt] : NULL) |
| #define LAST_CEL_ID AST_EVENT_IE_CEL_EVENT_ENUM |
| #define MODULE_TYPE_STR | ( | _mt | ) | (cdrel_module_type_map[_mt]) |
| #define RECORD_TYPE_STR | ( | _rt | ) | (cdrel_record_type_map[_rt]) |
| typedef int(* cdrel_backend_writer) (struct cdrel_config *config, struct cdrel_values *values) |
| typedef struct ast_channel *(* cdrel_dummy_channel_alloc) (struct cdrel_config *config, void *record) |
| typedef int(* cdrel_field_formatter) (struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *input_value, struct cdrel_value *output_value) |
| typedef int(* cdrel_field_getter) (void *record, struct cdrel_config *config, struct cdrel_field *field, struct cdrel_value *value) |
| enum cdr_field_id |
| enum cdrel_config_type |
| Enumerator | |
|---|---|
| cdrel_config_legacy | |
| cdrel_config_advanced | |
| cdrel_config_type_end | |
| enum cdrel_data_type |
| enum cdrel_field_flags |
| enum cdrel_quoting_method |
| Enumerator | |
|---|---|
| cdrel_quoting_method_none | |
| cdrel_quoting_method_all | |
| cdrel_quoting_method_minimal | |
| cdrel_quoting_method_non_numeric | |
| cdrel_quoting_method_end | |
| Enumerator | |
|---|---|
| cdrel_format_dsv | |
| cdrel_format_json | |
| cdrel_format_sql | |
| cdrel_format_type_end | |
| const char * cdrel_basename | ( | const char * | path | ) |
Definition at line 219 of file res_cdrel_custom.c.
References ast_strlen_zero().
Referenced by config_alloc(), field_alloc(), format_string(), load_database_columns(), load_database_config(), load_fields(), load_text_file_advanced_config(), load_text_file_legacy_config(), load_text_file_legacy_mappings(), open_database(), and parse_legacy_template().
| enum cdrel_data_type cdrel_data_type_from_str | ( | const char * | str | ) |
Definition at line 179 of file res_cdrel_custom.c.
References cdrel_data_type_end, cdrel_data_type_map, and str.
Referenced by field_alloc().
Definition at line 201 of file res_cdrel_custom.c.
References ast_str_append(), ast_str_buffer(), ast_test_flag, CDREL_FIELD_FLAG_LAST, cdrel_field_flags_map, and str.
Referenced by field_alloc(), and format_string().
| const struct cdrel_field * get_registered_field_by_name | ( | enum cdrel_record_type | record_type, |
| const char * | name | ||
| ) |
Definition at line 113 of file registry.c.
References ARRAY_LEN, cdrel_field_registry, name, NULL, cdrel_field::record_type, and type.
Referenced by field_alloc(), and parse_legacy_template().
| int load_cdr | ( | void | ) |
Definition at line 101 of file getters_cdr.c.
References ast_debug, cdr_get_literal(), cdr_get_string(), cdr_get_uservar(), cdrel_dummy_channel_allocators, cdrel_field_getters, cdrel_record_cdr, cdrel_type_double, cdrel_type_int32, cdrel_type_int64, cdrel_type_literal, cdrel_type_string, cdrel_type_timeval, cdrel_type_uint32, cdrel_type_uint64, cdrel_type_uservar, and dummy_chan_alloc_cdr().
Referenced by load_module().
| int load_cel | ( | void | ) |
Definition at line 104 of file getters_cel.c.
References ast_debug, cdrel_dummy_channel_allocators, cdrel_field_getters, cdrel_record_cel, cdrel_type_event_enum, cdrel_type_event_type, cdrel_type_literal, cdrel_type_string, cdrel_type_timeval, cdrel_type_uint32, cel_get_event_enum(), cel_get_event_type(), cel_get_literal(), cel_get_string(), cel_get_timeval(), cel_get_uint32(), and dummy_chan_alloc_cel().
Referenced by load_module().
| int load_formatters | ( | void | ) |
Definition at line 189 of file formatters.c.
References ast_debug, cdrel_field_formatters, cdrel_type_amaflags, cdrel_type_disposition, cdrel_type_double, cdrel_type_int32, cdrel_type_int64, cdrel_type_string, cdrel_type_timeval, cdrel_type_uint32, cdrel_type_uint64, format_amaflags(), format_disposition(), format_string(), and format_timeval().
Referenced by load_module().
| int load_writers | ( | void | ) |
Definition at line 221 of file writers.c.
References ast_debug, cdrel_backend_writers, cdrel_format_dsv, cdrel_format_json, cdrel_format_sql, database_writer(), dsv_writer(), and json_writer().
Referenced by load_module().
| int write_record_to_database | ( | struct cdrel_config * | config, |
| struct cdrel_values * | values | ||
| ) |
Definition at line 169 of file writers.c.
References ast_assert, ast_debug, ast_log, ast_mutex_lock, ast_mutex_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, cdrel_type_string, config, LOG_ERROR, RECORD_TYPE_STR, value, and cdrel_value::values.
Referenced by database_writer(), and log_legacy_database_record().
| int write_record_to_file | ( | struct cdrel_config * | config, |
| struct ast_str * | record | ||
| ) |
Definition at line 50 of file writers.c.
References ast_log, ast_mutex_lock, ast_mutex_unlock, ast_str_buffer(), config, errno, LOG_ERROR, out, and RECORD_TYPE_STR.
Referenced by dsv_writer(), json_writer(), and log_legacy_dsv_record().
|
extern |
Definition at line 137 of file res_cdrel_custom.c.
Referenced by load_writers(), and log_advanced_record().
|
extern |
Definition at line 160 of file res_cdrel_custom.c.
Referenced by cdrel_data_type_from_str().
|
extern |
Definition at line 142 of file res_cdrel_custom.c.
Referenced by config_alloc(), load_cdr(), and load_cel().
|
extern |
Definition at line 132 of file res_cdrel_custom.c.
Referenced by load_formatters(), and log_advanced_record().
|
extern |
Definition at line 127 of file res_cdrel_custom.c.
Referenced by load_cdr(), load_cel(), and log_advanced_record().
|
extern |
Definition at line 154 of file res_cdrel_custom.c.
|
extern |
Definition at line 148 of file res_cdrel_custom.c.