83    return (sscanf(
value, 
"%f %f", &lat, &lon) == 2);
 
 
   91    return (sscanf(
value, 
"%f %f %f", &lat, &lon, &alt) == 3);
 
 
   97    return (sscanf(
value, 
"%f", &
val) == 1);
 
 
  109    { 
"Circle", { {
"pos", 1, 1, 
pos_validator}, {
"radius", 1, 1, 
float_validator},{
NULL, -1, -1}}},
 
  117    { 
"Sphere", { {
"pos3d", 1, 1, 
pos3d_validator}, {
"radius", 1, 1, 
float_validator}, {
NULL, -1, -1} }},
 
  120        {
"orientation", 1, 1, 
float_validator}, {
"orientation_uom", 1, 1, 
uom_validator}, {
NULL, -1, -1} }},
 
  121    { 
"Prism", { {
"pos3d", 3, -1, 
pos_validator}, {
"height", 1, 1, 
float_validator}, {
NULL, -1, -1} }},
 
 
  146        int vname_index = -1;
 
  159        if (vname_index < 0) {
 
  163        if (!
gml_shape_defs[def_index].required_attributes[vname_index].validator(
var->value)) {
 
  180        if (count < 
gml_shape_defs[def_index].required_attributes[i].min_required) {
 
  184        if (
gml_shape_defs[def_index].required_attributes[i].max_allowed > 0 &&
 
  185            count > 
gml_shape_defs[def_index].required_attributes[i].max_allowed) {
 
 
  199        e->
command = 
"geoloc show gml_shape_defs";
 
  201            "Usage: geoloc show gml_shape_defs\n" 
  202            "       Show the GML Shape definitions.\n";
 
  208    ast_cli(
a->fd, 
"%-16s %-32s\n", 
"Shape", 
"Attributes name(min,max)");
 
  209    ast_cli(
a->fd, 
"================ ===============================\n");
 
 
  239    const char *ref_string)
 
  244    struct ast_xml_node *gml_node;
 
  245    struct ast_xml_node *child_node;
 
  250    if (!resolved_location) {
 
  293            angle = strtof(
a, &junk);
 
  303                    ref_string, 
var->name, 
var->value);
 
  314                        "Degrees can't be > 360.0\n",
 
  315                        ref_string, 
var->name, 
var->value);
 
  321                        "Radians can't be  > 100.0\n",
 
  322                        ref_string, 
var->name, 
var->value);
 
  327                    "The unit of measure must be 'deg[rees]' or 'rad[ians]'\n",
 
  328                    ref_string, 
var->name, 
var->value);
 
 
void ast_cli_unregister_multiple(void)
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
Standard Command Line Interface.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static int float_validator(const char *value)
static int pos3d_validator(const char *value)
static int pos_validator(const char *value)
static struct geoloc_gml_shape_def gml_shape_defs[8]
struct geoloc_gml_attr_def gml_attr_defs[]
static struct ast_cli_entry geoloc_gml_cli[]
static int uom_validator(const char *value)
int geoloc_gml_reload(void)
static char * handle_gml_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@ GEOLOC_SHAPE_ATTR_INNER_RADIUS
@ GEOLOC_SHAPE_ATTR_ANGLE_UOM
@ GEOLOC_SHAPE_ATTR_RADIUS
@ GEOLOC_SHAPE_ATTR_OPENING_ANGLE
@ GEOLOC_SHAPE_ATTR_STARTING_ANGLE
@ GEOLOC_SHAPE_ATTR_OUTER_RADIUS
@ GEOLOC_SHAPE_ATTR_ORIENTATION
@ GEOLOC_SHAPE_ATTR_ORIENTATION_UOM
@ GEOLOC_SHAPE_ATTR_HEIGHT
@ GEOLOC_SHAPE_ATTR_SEMI_MINOR_AXIS
@ GEOLOC_SHAPE_ATTR_SEMI_MAJOR_AXIS
@ GEOLOC_SHAPE_ATTR_VERTICAL_AXIS
@ GEOLOC_SHAPE_ATTR_POS3D
enum ast_geoloc_validate_result ast_geoloc_gml_validate_varlist(const struct ast_variable *varlist, const char **result)
Validate that the variables in the list represent a valid GML shape.
int geoloc_gml_unload(void)
struct ast_xml_node * geoloc_gml_list_to_xml(const struct ast_variable *resolved_location, const char *ref_string)
int geoloc_gml_load(void)
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
#define SCOPE_EXIT_LOG_RTN_VALUE(__value, __log_level,...)
#define SCOPE_ENTER(level,...)
Configuration File Parser.
const char * ast_variable_find_in_list(const struct ast_variable *list, const char *variable)
Gets the value of a variable from a variable list by name.
@ AST_MODULE_LOAD_SUCCESS
ast_geoloc_validate_result
@ AST_GEOLOC_VALIDATE_TOO_MANY_VARNAMES
@ AST_GEOLOC_VALIDATE_MISSING_SHAPE
@ AST_GEOLOC_VALIDATE_INVALID_VALUE
@ AST_GEOLOC_VALIDATE_SUCCESS
@ AST_GEOLOC_VALIDATE_NOT_ENOUGH_VARNAMES
@ AST_GEOLOC_VALIDATE_INVALID_SHAPE
@ AST_GEOLOC_VALIDATE_INVALID_VARNAME
int ast_strings_equal(const char *str1, const char *str2)
Compare strings for equality checking for NULL.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
static int force_inline attribute_pure ast_begins_with(const char *str, const char *prefix)
Checks whether a string begins with another.
descriptor for a cli entry.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
enum geoloc_shape_attrs attr
int(* validator)(const char *value)
int(* transformer)(struct ast_variable *value)
int(* validator)(const char *value)
struct geoloc_gml_attr required_attributes[8]
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
struct ast_xml_node * ast_xml_new_child(struct ast_xml_node *parent, const char *child_name)
Add a child node inside a passed parent node.
struct ast_xml_node * ast_xml_new_node(const char *name)
Create a XML node.
int ast_xml_set_attribute(struct ast_xml_node *node, const char *name, const char *value)
Set an attribute to a node.
void ast_xml_set_text(struct ast_xml_node *node, const char *content)
Set an element content string.
void ast_xml_free_node(struct ast_xml_node *node)
Free node.